From aef4718b39569939ec0052c44819cd01176234ca Mon Sep 17 00:00:00 2001 From: Tong Mu Date: Tue, 15 Apr 2025 23:57:20 -0700 Subject: [PATCH] [Web] Remove `webOnlyUniformRadii` from `RRect` (#167237) This variable was added in https://github.com/flutter/engine/pull/15970 (for the HTML renderer I guess?) and is apparently no long used anywhere. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --- .../src/flutter/lib/web_ui/lib/geometry.dart | 48 +---------- .../lib/web_ui/test/ui/rrect_test.dart | 83 ------------------- 2 files changed, 1 insertion(+), 130 deletions(-) diff --git a/engine/src/flutter/lib/web_ui/lib/geometry.dart b/engine/src/flutter/lib/web_ui/lib/geometry.dart index 2c01d61909f..6e366f08dc0 100644 --- a/engine/src/flutter/lib/web_ui/lib/geometry.dart +++ b/engine/src/flutter/lib/web_ui/lib/geometry.dart @@ -419,7 +419,6 @@ abstract class _RRectLike> { required this.brRadiusY, required this.blRadiusX, required this.blRadiusY, - required bool uniformRadii, }) : assert(tlRadiusX >= 0), assert(tlRadiusY >= 0), assert(trRadiusX >= 0), @@ -427,8 +426,7 @@ abstract class _RRectLike> { assert(brRadiusX >= 0), assert(brRadiusY >= 0), assert(blRadiusX >= 0), - assert(blRadiusY >= 0), - webOnlyUniformRadii = uniformRadii; + assert(blRadiusY >= 0); T _create({ required double left, @@ -460,8 +458,6 @@ abstract class _RRectLike> { Radius get brRadius => Radius.elliptical(brRadiusX, brRadiusY); final double blRadiusX; final double blRadiusY; - // webOnly - final bool webOnlyUniformRadii; Radius get blRadius => Radius.elliptical(blRadiusX, blRadiusY); T shift(Offset offset) { @@ -756,7 +752,6 @@ class RRect extends _RRectLike { blRadiusY: radiusY, brRadiusX: radiusX, brRadiusY: radiusY, - uniformRadii: radiusX == radiusY, ); RRect.fromLTRBR(double left, double top, double right, double bottom, Radius radius) @@ -773,7 +768,6 @@ class RRect extends _RRectLike { blRadiusY: radius.y, brRadiusX: radius.x, brRadiusY: radius.y, - uniformRadii: radius.x == radius.y, ); RRect.fromRectXY(Rect rect, double radiusX, double radiusY) @@ -790,7 +784,6 @@ class RRect extends _RRectLike { blRadiusY: radiusY, brRadiusX: radiusX, brRadiusY: radiusY, - uniformRadii: radiusX == radiusY, ); RRect.fromRectAndRadius(Rect rect, Radius radius) @@ -807,7 +800,6 @@ class RRect extends _RRectLike { blRadiusY: radius.y, brRadiusX: radius.x, brRadiusY: radius.y, - uniformRadii: radius.x == radius.y, ); RRect.fromLTRBAndCorners( @@ -832,14 +824,6 @@ class RRect extends _RRectLike { blRadiusY: bottomLeft.y, brRadiusX: bottomRight.x, brRadiusY: bottomRight.y, - uniformRadii: - topLeft.x == topLeft.y && - topLeft.x == topRight.x && - topLeft.x == topRight.y && - topLeft.x == bottomLeft.x && - topLeft.x == bottomLeft.y && - topLeft.x == bottomRight.x && - topLeft.x == bottomRight.y, ); RRect.fromRectAndCorners( @@ -861,14 +845,6 @@ class RRect extends _RRectLike { blRadiusY: bottomLeft.y, brRadiusX: bottomRight.x, brRadiusY: bottomRight.y, - uniformRadii: - topLeft.x == topLeft.y && - topLeft.x == topRight.x && - topLeft.x == topRight.y && - topLeft.x == bottomLeft.x && - topLeft.x == bottomLeft.y && - topLeft.x == bottomRight.x && - topLeft.x == bottomRight.y, ); const RRect._raw({ @@ -884,7 +860,6 @@ class RRect extends _RRectLike { super.brRadiusY = 0.0, super.blRadiusX = 0.0, super.blRadiusY = 0.0, - super.uniformRadii = false, }); @override @@ -1001,7 +976,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: radiusY, brRadiusX: radiusX, brRadiusY: radiusY, - uniformRadii: radiusX == radiusY, ); RSuperellipse.fromLTRBR(double left, double top, double right, double bottom, Radius radius) @@ -1018,7 +992,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: radius.y, brRadiusX: radius.x, brRadiusY: radius.y, - uniformRadii: radius.x == radius.y, ); RSuperellipse.fromRectXY(Rect rect, double radiusX, double radiusY) @@ -1035,7 +1008,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: radiusY, brRadiusX: radiusX, brRadiusY: radiusY, - uniformRadii: radiusX == radiusY, ); RSuperellipse.fromRectAndRadius(Rect rect, Radius radius) @@ -1052,7 +1024,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: radius.y, brRadiusX: radius.x, brRadiusY: radius.y, - uniformRadii: radius.x == radius.y, ); RSuperellipse.fromLTRBAndCorners( @@ -1077,14 +1048,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: bottomLeft.y, brRadiusX: bottomRight.x, brRadiusY: bottomRight.y, - uniformRadii: - topLeft.x == topLeft.y && - topLeft.x == topRight.x && - topLeft.x == topRight.y && - topLeft.x == bottomLeft.x && - topLeft.x == bottomLeft.y && - topLeft.x == bottomRight.x && - topLeft.x == bottomRight.y, ); RSuperellipse.fromRectAndCorners( @@ -1106,14 +1069,6 @@ class RSuperellipse extends _RRectLike { blRadiusY: bottomLeft.y, brRadiusX: bottomRight.x, brRadiusY: bottomRight.y, - uniformRadii: - topLeft.x == topLeft.y && - topLeft.x == topRight.x && - topLeft.x == topRight.y && - topLeft.x == bottomLeft.x && - topLeft.x == bottomLeft.y && - topLeft.x == bottomRight.x && - topLeft.x == bottomRight.y, ); const RSuperellipse._raw({ @@ -1129,7 +1084,6 @@ class RSuperellipse extends _RRectLike { super.brRadiusY = 0.0, super.blRadiusX = 0.0, super.blRadiusY = 0.0, - super.uniformRadii = false, }); @override diff --git a/engine/src/flutter/lib/web_ui/test/ui/rrect_test.dart b/engine/src/flutter/lib/web_ui/test/ui/rrect_test.dart index 172b4d3fa0d..b65fab106b8 100644 --- a/engine/src/flutter/lib/web_ui/test/ui/rrect_test.dart +++ b/engine/src/flutter/lib/web_ui/test/ui/rrect_test.dart @@ -49,87 +49,4 @@ Future testMain() async { expect(rrect.contains(const Offset(1.7, 1.97)), isTrue); expect(rrect.contains(const Offset(1.0, 1.99)), isTrue); }); - - test('RRect.webOnlyUniformRadii returns true when all corner radii are equal', () { - final RRect rect1 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect1.webOnlyUniformRadii, isTrue); - - final RRect rect2 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(1000, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect2.webOnlyUniformRadii, isFalse); - - final RRect rect3 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 1000), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect3.webOnlyUniformRadii, isFalse); - - final RRect rect4 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(1000, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect4.webOnlyUniformRadii, isFalse); - - final RRect rect5 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 1000), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect5.webOnlyUniformRadii, isFalse); - - final RRect rect6 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(1000, 5), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect6.webOnlyUniformRadii, isFalse); - - final RRect rect7 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 1000), - bottomRight: const Radius.elliptical(5, 5), - ); - expect(rect7.webOnlyUniformRadii, isFalse); - - final RRect rect8 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(1000, 5), - ); - expect(rect8.webOnlyUniformRadii, isFalse); - - final RRect rect9 = RRect.fromRectAndCorners( - const Rect.fromLTWH(1.0, 2.0, 3.0, 4.0), - topLeft: const Radius.elliptical(5, 5), - topRight: const Radius.elliptical(5, 5), - bottomLeft: const Radius.elliptical(5, 5), - bottomRight: const Radius.elliptical(5, 1000), - ); - expect(rect9.webOnlyUniformRadii, isFalse); - }); }