Skip to content

Fix rendering custom element size#184961

Open
holzgeist wants to merge 7 commits into
flutter:masterfrom
holzgeist:fix-rendering-custom-element-size
Open

Fix rendering custom element size#184961
holzgeist wants to merge 7 commits into
flutter:masterfrom
holzgeist:fix-rendering-custom-element-size

Conversation

@holzgeist
Copy link
Copy Markdown
Contributor

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-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.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Apr 13, 2026
@holzgeist
Copy link
Copy Markdown
Contributor Author

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

@holzgeist holzgeist marked this pull request as ready for review May 12, 2026 10:48
Copy link
Copy Markdown
Contributor

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

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 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.

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

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant