Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Jan 18, 2023

Currently, the clipRRect's bounding rect is used to determine if the clipRRect operation is necessary on PlatformView. (See #37434) This causes a bug when the bounding rect is not clipping the PlatformView but the corner radii are.

This PR uses the whole rrect to determine if the clip operation is necessary.
To prevent similar regression, this PR also removed the similar buggy logic for clipPath. clipPath is not as trival, a TODO is added and I should cycle back to work on clipPath later.

fixes flutter/flutter#118550

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 and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@cyanglaz cyanglaz marked this pull request as draft January 18, 2023 04:22
fix

rename

unittest
@cyanglaz cyanglaz force-pushed the platform_view_cliprrect_fix branch from d8b5fe9 to bd92e72 Compare January 18, 2023 04:23
@cyanglaz cyanglaz marked this pull request as ready for review January 18, 2023 17:59
bounding_rect, transformMatrix)) {
break;
}
// TODO(cyanglaz): Find a way to pre-determine if path contains the PlatformView boudning
Copy link
Contributor

Choose a reason for hiding this comment

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

this is probably a hard geometry problem. but i bet most clipping actions are just simple shapes like RRect

{transformed_lower_right_x, transformed_lower_right_y},
{transformed_lower_left_x, transformed_lower_left_y}};
transformed_rrect.setRectRadii(transformed_clip_rect, corners);
return transformed_rrect.contains(platformview_boundingrect);
Copy link
Contributor

Choose a reason for hiding this comment

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

i assume this contains actually take its radii into consideration (rather than just checking rectangular bounds)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it does. the new scenario app test covers it. The new unit test also covered it. I had to use (-1, -1) as the origin for the clipRRect with a 1 radius to avoid clipping the PlatformView at (0, 0) origin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[platform-views][iOS] PlatformViews are not clipped when using ClipRRect

3 participants