Skip to content

iOS: Apply platform view mutators from FlutterPlatformViewLayer - #196753

Merged
cbracken merged 2 commits into
flutter:masterfrom
cbracken:pv-refactor-2
Nov 18, 2026
Merged

cbracken merged 2 commits into
flutter:masterfrom
cbracken:pv-refactor-2

Conversation

@cbracken

Copy link
Copy Markdown
Member

This moves platform view composition in the iOS embedder off the engine's internal C++ types and onto the Obj-C model added in #196498. Once the controller and the clipping mask view only operate on FlutterPlatformViewLayers, migrating to the embedder API will just involve changing the conversion function to work from FlutterLayer rather than EmbeddedViewParams.

FlutterPlatformViewsController applied clips, transforms, and backdrop filters to platform views by walking their flutter::MutatorsStack on the platform thread. FlutterClippingMaskView likewise took clips as DlRect, DlRoundRect, or DlPath, with DlMatrix transforms.

This changes applyMutators: to walk the mutators of FlutterPlatformViewLayers instead, and changes the mask view's clip methods to take CGRect, CGPathRef, and CATransform3D. compositeView:withParams: now converts its params to a layer and calls a new compositeLayer:, so its callers and the existing tests are unchanged.

This is a refactor with no changes to behaviour, covered by existing tests.

Issue: #112232

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@cbracken
cbracken requested a review from a team as a code owner November 17, 2026 03:07
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If both you and the PR author believe this PR qualifies for a test exemption, escalate to the tech lead for the changed area to review and apply the test-exempt label. All reviewers should feel empowered to ask for tests before escalating.

@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. team-ios Owned by iOS platform team labels Nov 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the iOS platform views clipping and transformation logic by replacing C++ types such as DlRect, DlMatrix, and MutatorsStack with native Objective-C types like CGRect, CATransform3D, and FlutterPlatformViewLayer. The feedback recommends adding defensive nil checks for touchInterceptor and embeddedView in FlutterPlatformViewsController.mm to prevent potential resource leaks from the mask view pool and ensure safer execution.

This moves platform view composition in the iOS embedder off the
engine's internal C++ types and onto the Obj-C model added in flutter#196498.
Once the controller and the clipping mask view only operate on
`FlutterPlatformViewLayers`, migrating to the embedder API will just
involve changing the conversion function to work from `FlutterLayer`
rather than `EmbeddedViewParams`.

`FlutterPlatformViewsController` applied clips, transforms, and backdrop
filters to platform views by walking their `flutter::MutatorsStack` on
the platform thread. `FlutterClippingMaskView` likewise took clips as
`DlRect`, `DlRoundRect`, or `DlPath`, with `DlMatrix` transforms.

This changes `applyMutators:` to walk the mutators of
`FlutterPlatformViewLayers` instead, and changes the mask view's clip
methods to take `CGRect`, `CGPathRef`, and `CATransform3D`.
`compositeView:withParams:` now converts its params to a layer and calls
a new `compositeLayer:`, so its callers and the existing tests are
unchanged.

This is a refactor with no changes to behaviour, covered by existing
tests.

Issue: flutter#112232
@cbracken

cbracken commented Nov 17, 2026 •

Copy link
Copy Markdown
Member Author

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

Done.

As mentioned in the comment, this is a refactor that is covered by existing tests but went looking for a place to add a test and turns out we weren't testing opacity, so added a test.

@jmagman jmagman added test-exempt Exempt from tests. Overrides `missing-tests` label and removed test-exempt Exempt from tests. Overrides `missing-tests` label labels Nov 17, 2026
@cbracken
cbracken added this pull request to the merge queue Nov 18, 2026
Merged via the queue into flutter:master with commit e736af5 Nov 18, 2026
23 checks passed
@cbracken
cbracken deleted the pv-refactor-2 branch November 18, 2026 02:22
LouiseHsu pushed a commit to flutter/packages that referenced this pull request Nov 18, 2026
flutter/flutter@2f09f96...06f32f8

2026-11-18 [email protected] Move macOS
desktop builds to ThinLTO (flutter/flutter#196804)
2026-11-18 [email protected] Roll Dart SDK from
5ed55b4b2ebc to 753488ede427 (2 revisions) (flutter/flutter#196893)
2026-11-18 [email protected] Roll Packages from
9af69be to dca2e58 (7 revisions) (flutter/flutter#196892)
2026-11-18 [email protected] Roll Skia from 503a380ebecc
to 81ee7327e81c (29 revisions) (flutter/flutter#196889)
2026-11-18 [email protected] Roll Dart SDK from
26e38955d9d4 to 5ed55b4b2ebc (4 revisions) (flutter/flutter#196843)
2026-11-18 [email protected] Fix permissions for action updates
(flutter/flutter#196791)
2026-11-18 [email protected] iOS: Apply platform view mutators from
FlutterPlatformViewLayer (flutter/flutter#196753)
2026-11-18 [email protected] [flutter_tools] Remove ambient Doctor,
FeatureFlags, and device getters (flutter/flutter#196572)
2026-11-18 [email protected] Fix
RelativeRect.lerp crash when b is null (flutter/flutter#196655)
2026-11-18 [email protected] [web] Harden
WebP and GIF header readers against truncated and malformed buffers
(flutter/flutter#196075)
2026-11-17 [email protected] Enable apps to
control focus behavior during app lifecycle changes via
`FocusLifecyclePolicy` (flutter/flutter#190570)
2026-11-17 [email protected] Don't re-run the code freeze check
on label changes (flutter/flutter#196745)
2026-11-17 [email protected] Android: Report
FlutterView as a text editor while a text input client is attached
(flutter/flutter#193074)
2026-11-17 [email protected] Roll Packages from
4c6a7d3 to 9af69be (5 revisions) (flutter/flutter#196812)
2026-11-17 [email protected] [flutter_tools] Handle target VM filesystem
errors in DevFS.create (flutter/flutter#196234)
2026-11-17 [email protected] [flutter_tools] Clarify analytics reporting
status when on a feature branch (flutter/flutter#194496)
2026-11-17 [email protected] [web] Recover
CanvasKit surfaces from WebGL failures without per-frame null crashes
(flutter/flutter#196257)
2026-11-17 [email protected] [devicelab] Trigger navigation tap via
Flutter Driver in service_extensions_test (flutter/flutter#194456)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to
ensure that a human
is aware of the problem.

To file a bug in Packages:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants