Repository navigation
iOS: Add Obj-C model for platform view composition params - #196498
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces FlutterPlatformViewLayer and associated conversion utilities to represent platform view mutations and parameters using Core Graphics and Core Animation types on iOS, refactoring existing conversion logic out of FlutterPlatformViews and FlutterPlatformViewsController. It also adds corresponding unit tests. The review feedback suggests optimizing the isEqual: implementation in FlutterPlatformViewLayer by checking pointer equality for _mutators first, and improving the hash functions for both FlutterPlatformViewMutator and FlutterPlatformViewLayer to include more geometry properties to reduce potential hash collisions.
cbracken
force-pushed
the
pv-refactor-1
branch
from
November 13, 2026 04:55
3463cf3 to
aac68e6
Compare
LouiseHsu
previously approved these changes
Nov 14, 2026
cbracken
force-pushed
the
pv-refactor-1
branch
2 times, most recently
from
November 15, 2026 22:57
aa4dd4c to
e433d94
Compare
`FlutterPlatformViewsController` applies clips, transforms, and backdrop filters to platform views by walking a `flutter::MutatorsStack` on the platform thread. `MutatorsStack` is an internal C++ engine type though, so this creates an Obj-C equivalent against which the embedder can operate. When we migrate to the Embedder API it'll just be a matter of updating a translation/conversion function. This should be reusable across both iOS and macOS embedders eventually. This adds `FlutterPlatformViewMutator` and `FlutterPlatformViewLayer`, which hold the same information as `flutter::Mutator` and `flutter::EmbeddedViewParams`, but using Core Graphics and Core Animation types. These are modelled on `FlutterPlatformViewMutation` and `FlutterLayer` in the embedder API, with the addition of the mutations that iOS supports but which aren't yet exposed via the embedder API: clip path, clip rounded superellipse, backdrop filter, and the backdrop clips. Additionally, `FlutterPlatformViewLayer` holds the view's bounding rect, since the controller sets the clipping view's frame to it. This just adds the new types, but doesn't migrate the controller over to them. I'll do that in a followup to keep this small (it's already bigger than I'd like). Also consolidates a couple utility functions like `GetCATransform3DFromDlMatrix` and `GetCGRectFromDlRect` into the converter. This is a refactor with no changes to behaviour. Issue: flutter#112232
cbracken
force-pushed
the
pv-refactor-1
branch
from
November 15, 2026 22:58
e433d94 to
8d89695
Compare
LouiseHsu
self-requested a review
November 16, 2026 19:02
LouiseHsu
approved these changes
Nov 16, 2026
cbracken
added a commit
to cbracken/flutter
that referenced
this pull request
Nov 17, 2026
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
11 tasks done
cbracken
added a commit
to cbracken/flutter
that referenced
this pull request
Nov 17, 2026
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
This was referenced Nov 17, 2026
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Nov 17, 2026
flutter/flutter@d8bd864...2f09f96 2026-11-17 [email protected] Analyze every flutter create template, and fix the package_ffi lint (flutter/flutter#196165) 2026-11-17 [email protected] Roll Dart SDK from 50debf3c9757 to 26e38955d9d4 (3 revisions) (flutter/flutter#196772) 2026-11-17 [email protected] Manual roll ICU from b09986242cfb to d3c612f44146 (1 revision) (flutter/flutter#196713) 2026-11-17 [email protected] Roll Skia from 4f6b3a8d8565 to 503a380ebecc (19 revisions) (flutter/flutter#196768) 2026-11-17 [email protected] iOS: Don't mock UIView animations in keyboard spring animation test (flutter/flutter#196755) 2026-11-17 [email protected] [flutter_tools] Preserve index.html across --web-content-hash transitions (flutter/flutter#196491) 2026-11-17 [email protected] Fix TextStyle background color fade-out when lerping to null (flutter/flutter#196153) 2026-11-17 [email protected] Update desktop engine TESTOWNERS (flutter/flutter#196732) 2026-11-17 [email protected] [flutter_tools] Do not copy app-only build type properties onto library plugins (flutter/flutter#196692) 2026-11-17 [email protected] [flutter_tools] Remove service and runner ambient context getters (flutter/flutter#196571) 2026-11-17 [email protected] Bump customer tests (flutter/flutter#196740) 2026-11-17 [email protected] Take customer_testing_flame out of bringup (flutter/flutter#196570) 2026-11-17 [email protected] [devicelab] Read AssetManifest.bin from the APK in flavors_test (flutter/flutter#196736) 2026-11-17 [email protected] [flutter_tools] Fix flaky tool_tests_general by moving spawnUri tests to integration shard (flutter/flutter#195999) 2026-11-17 [email protected] Roll Dart SDK from 3e069c6fdbde to 50debf3c9757 (2 revisions) (flutter/flutter#196706) 2026-11-16 [email protected] [web] Record build finish synchronously in renderScene and fix dropped frame timings (flutter/flutter#195947) 2026-11-16 [email protected] Do not reveal obscured character when input is rejected by inputFormatters (flutter/flutter#195022) 2026-11-16 [email protected] Cla draft follow up: add waiting for response (flutter/flutter#196686) 2026-11-16 [email protected] Roll pub packages (flutter/flutter#196684) 2026-11-16 [email protected] Roll Packages from 015df97 to 4c6a7d3 (8 revisions) (flutter/flutter#196681) 2026-11-16 [email protected] Skip Vulkan impeller_unittests on macOS (flutter/flutter#196282) 2026-11-16 [email protected] Move the task runners out of Flutter Engine (flutter/flutter#196267) 2026-11-16 [email protected] [FGP] Add Flutter assets after AGP's asset merge so dotfiles are pack… (flutter/flutter#196465) 2026-11-16 [email protected] iOS: Add Obj-C model for platform view composition params (flutter/flutter#196498) 2026-11-16 [email protected] [Windows] Normalize Shift key messages with a non-standard scan code (flutter/flutter#193675) 2026-11-16 [email protected] Roll Skia from 118eaff3deb4 to 4f6b3a8d8565 (3 revisions) (flutter/flutter#196672) 2026-11-16 [email protected] Roll Dart SDK from c91e8b6674e2 to 3e069c6fdbde (4 revisions) (flutter/flutter#196669) 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
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-flutter__flutter
that referenced
this pull request
Nov 18, 2026
…ter#196753) 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 <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant in-code documentation (doc comments with `///`). - [X] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [X] All existing and new tests are passing. 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](https://developers.google.com/gemini-code-assist/docs/review-github-code). 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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [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 [flutter/website]: https://github.com/flutter/website [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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FlutterPlatformViewsControllerapplies clips, transforms, and backdrop filters to platform views by walking aflutter::MutatorsStackon the platform thread.MutatorsStackis an internal C++ engine type though, so this creates an Obj-C equivalent against which the embedder can operate. When we migrate to the Embedder API it'll just be a matter of updating a translation/conversion function. This should be reusable across both iOS and macOS embedders eventually.This adds
FlutterPlatformViewMutatorandFlutterPlatformViewLayer, which hold the same information asflutter::Mutatorandflutter::EmbeddedViewParams, but using Core Graphics and Core Animation types. These are modelled onFlutterPlatformViewMutationandFlutterLayerin the embedder API, with the addition of the mutations that iOS supports but which aren't yet exposed via the embedder API: clip path, clip rounded superellipse, backdrop filter, and the backdrop clips.Additionally,
FlutterPlatformViewLayerholds the view's bounding rect, since the controller sets the clipping view's frame to it.This just adds the new types, but doesn't migrate the controller over to them. I'll do that in a followup to keep this small (it's already bigger than I'd like).
Also consolidates a couple utility functions like
GetCATransform3DFromDlMatrixandGetCGRectFromDlRectinto the converter.This is a refactor with no changes to behaviour.
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-assistbot 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.