Skip to content

Conversation

@gspencergoog
Copy link
Contributor

Description

This prepares the framework for flutter/engine#36062 to roll into the framework, which will clamp rounded rect (RRect) corner radii to a min of zero when deflating, and assert that radii are not negative.

In order for that to roll in cleanly, we need to change the framework so that it does its own clamping when deflating rounded rects. Once the engine change rolls in, we can remove the extra clamping.

Related Issues

Tests

  • Updated tests to reflect changes in clamping.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Sep 13, 2022
@gspencergoog gspencergoog force-pushed the prepare_for_rrect_clamp branch from db04f9b to 4629129 Compare September 13, 2022 21:34
@gspencergoog gspencergoog changed the title Prepare the framework for having RRect clamp radii to zero Prepare the framework for having RRect assert on negative radii Sep 13, 2022
@gspencergoog gspencergoog force-pushed the prepare_for_rrect_clamp branch from cad7592 to 93b2ba0 Compare September 13, 2022 21:49
topRight: topRight,
bottomLeft: bottomLeft,
bottomRight: bottomRight,
topLeft: topLeft.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe create a RRect.clampCorners method? that applies one minimum/maximum radius to all four corners?

Copy link
Contributor Author

@gspencergoog gspencergoog Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I could, but really this won't be a problem once the RRect doesn't allow negative values anymore (which will happen shortly). I mean, sure, clamping to something other that zero might also be important, but it's not something that people have requested.

EDIT: Actually, these will remain in place. Can I maybe wait to add RRect.clampCorners? If it's not required, I won't need to make a round trip through the engine in order to land this PR.

@gspencergoog gspencergoog requested review from goderbauer and removed request for darrenaustin September 14, 2022 20:36
topLeft: topLeft.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
topRight: topRight.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomLeft: bottomLeft.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomRight: bottomRight.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these ignores temporary? If so, maybe add a TODO?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why are these ignores needed in the first place? You aren't even calling clamp on double here.

Is the ignore_clamp_double_lint triggering too broadly and needs some tightening?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wondered the same thing, but there are reasons why we can't narrow it.

See here.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with added doc comment

@gspencergoog gspencergoog added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 14, 2022
@auto-submit auto-submit bot merged commit 5f9ad01 into flutter:master Sep 14, 2022
@gspencergoog gspencergoog deleted the prepare_for_rrect_clamp branch September 14, 2022 23:21
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Sep 15, 2022
itsjustkevin added a commit that referenced this pull request Sep 21, 2022
* update engine version

* Prepare the framework for having RRect assert on negative radii (#111515)

* Remove no-longer-needed clamping of RRect radii (#111668)

Co-authored-by: Greg Spencer <[email protected]>
itsjustkevin added a commit that referenced this pull request Sep 22, 2022
* update engine version

* Prepare the framework for having RRect assert on negative radii (#111515)

* Remove no-longer-needed clamping of RRect radii (#111668)

* Revert "Use semantics label for backbutton and closebutton for Androi… (#111636)

* Roll Flutter Engine from 4096e133ef51 to 6610f3f2a9fb (11 revisions) (#111240)

* Revert Ballistic & Clamping simulation updates (#111201)

* Revert "Update `MaterialBanner` to support Material 3" (#111288)

* Revert "Use semantics label for backbutton and closebutton for Android" (#111305)

Co-authored-by: engine-flutter-autoroll <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Casey Hillers <[email protected]>
Co-authored-by: Xilai Zhang <[email protected]>

Co-authored-by: Greg Spencer <[email protected]>
Co-authored-by: godofredoc <[email protected]>
Co-authored-by: engine-flutter-autoroll <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Casey Hillers <[email protected]>
Co-authored-by: Xilai Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants