Fix bug in multisurfacerenderer where canvases do not have "position: absolute"#181053
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes a layout bug in MultiSurfaceRasterizer by correctly setting position: absolute on on-screen canvases. The change is simple and effective. A new test is added to verify the fix, which is great. I've also noticed a potential resource leak in the test cleanup logic within renderer.dart and have left a comment with a suggestion.
| for (final ViewRasterizer rasterizer in rasterizers.values) { | ||
| rasterizer.debugClear(); | ||
| } |
There was a problem hiding this comment.
To prevent resource leaks in tests, it's better to call dispose() on the ViewRasterizer instances instead of debugClear(), especially since the rasterizers map is cleared later in this method. The dispose() method is more thorough as it also handles DOM element removal.
Note that this change might require a corresponding change in MultiSurfaceRasterizer to clear its internal cache of ViewRasterizer instances, as it could otherwise return disposed objects. Consider adding a debugClear method to MultiSurfaceRasterizer to handle this.
| for (final ViewRasterizer rasterizer in rasterizers.values) { | |
| rasterizer.debugClear(); | |
| } | |
| for (final ViewRasterizer rasterizer in rasterizers.values) { | |
| rasterizer.dispose(); | |
| } |
|
I've verified that this fixed our issue, thank you for the incredibly quick turnaround! |
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
… absolute" (flutter#181053) When using MultiSurfaceRasterizer, the on-screen canvases did not have `position: absolute`, causing layout issues when platform views with overlaid content was rendered. Fixes internal bug b/475770800 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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 documentation (doc comments with `///`). - [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]. **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 [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
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…"position: absolute" (flutter/flutter#181053)
…ve "position: absolute" (#182299) This CP pull request was created manually. Cherry-pick of #181053 ### Issue Link: What is the link to the issue this cherry-pick is addressing? Closes #182292 ### Changelog Description: Fix bug in multisurfacerenderer where canvases do not have "position: absolute" ### Impact Description: Platform views not visible on Safari and Firefox. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Follow repro steps in #182292

When using MultiSurfaceRasterizer, the on-screen canvases did not have
position: absolute, causing layout issues when platform views with overlaid content was rendered.Fixes internal bug b/475770800
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
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.