Fix rendering custom element size#184961
Conversation
- move limit to variable - add test
|
This is a minimal reproduction: https://github.com/holzgeist/flutter-custom-host-element-repro broken (on main) https://github.com/user-attachments/assets/70b0d616-b4d4-4b40-a1fb-d9d1ed704ba4 working (on this pr) https://github.com/user-attachments/assets/33bc17a5-c3e1-4a1c-8cd7-025a828e64d4 It's not a 100% reproduction, because in the original issue, rendering doesn't resume even when scaling down the window. If needed, please reopen the original issue as I lack the permissions to do so. Otherwise I'm happy to discuss this directly on the PR |
There was a problem hiding this comment.
Code Review
This pull request introduces a maximum size limit of 16384 for the canvas in CustomElementDimensionsProvider to prevent rendering issues, and adds a test case to verify this clamping behavior. Review feedback suggests adhering to the Dart style guide by using lowerCamelCase for the constant name and declaring it as static const instead of static final.
This PR limits the rendering size of custom host elements in multi view embedded flutter web apps.
The change fixes issue #182940 which is closed already due to lack of reproducibility. I still can't properly reproduce it, but this PR at least fixes the problems, which are best explained in this comment
I have no idea if that's the right place to fix this
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.