Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Dec 29, 2025

fixes #166173

Highlevel:

instead of clearing the entire geometry from the node that markSemanticsNeedsUpdate up to the first semantics boundary. and recalculate everything in between. This code now only clear the geometry for node that are markSemanticsNeedsUpdate. This requires us to keep a separate list for geomtry dirty node. Thus this change.

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-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 the framework flutter/packages/flutter repository. See also f: labels. label Dec 29, 2025
@chunhtai chunhtai force-pushed the issues/166173 branch 2 times, most recently from 1b7d1ca to fbd95d6 Compare January 8, 2026 21:34
@github-actions github-actions bot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: scrolling Viewports, list views, slivers, etc. labels Jan 13, 2026
@github-actions github-actions bot removed a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: scrolling Viewports, list views, slivers, etc. labels Jan 13, 2026
@chunhtai
Copy link
Contributor Author

chunhtai commented Jan 13, 2026

before
image

after
image

YEEEEEESSSSSSSS, cut half of total semantics calculation from the framework side

@chunhtai chunhtai changed the title [WIP]Adds geometry dirty nodes Adds geometry dirty nodes Jan 14, 2026
@chunhtai chunhtai marked this pull request as ready for review January 14, 2026 17:39
Copy link
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 more granular mechanism for tracking semantics geometry updates by adding a _nodesNeedingSemanticsGeometryUpdate set to PipelineOwner. This should improve performance by avoiding unnecessary geometry recalculations. The changes are well-contained and include necessary test updates. I have one suggestion to improve the readability of a complex loop.

@chunhtai chunhtai requested a review from justinmc January 14, 2026 18:13
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

Makes sense to me at a high level, but @LongCatIsLooong should definitely review and follow up on his old ideas (#166173 (comment)). Otherwise LGTM 👍

// Clear geometry for nodes that needs geometry update.
for (final node in nodesToProcessGeometry) {
if (node._semantics.shouldFormSemanticsNode && node._semantics.geometryDirty) {
// This is node is already dirty, skip it.
Copy link
Contributor

Choose a reason for hiding this comment

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

"This is node" => "This node"

// the geometry of the blocked branch half-heartly will cause a gap of render
// object with dirty geometry where the future update may never reach.
//
// Either we update entire tree regardless of been blocked or not, or we only update
Copy link
Contributor

Choose a reason for hiding this comment

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

"been blocked" => "whether it is blocked"

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

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[A11y] Further optimize geometry calculation in semantics

2 participants