mrobinson · GitHub

@mrobinson

@mrobinson

@mrobinson

This avoids another entire fragment tree traversal when rebuilding
fragments. In the case that scrollable overflow-related properties
change or fragment tree reconstruction happens, a lazy (but constrained)
traversal happens at the moment the scrollable overflow is queried.
This is accomplished by clearing scrollable overflow during damage
propagation. When a fragment has its scrollable overflow cleared, it
will be recalculated the next time it is queried. This leads to a few
benefits:
1. We delay a recalculation of scrollable overflow until it is actually
   needed.
2. Scrollable overflow recalculation should only happen on the subtree
   that actually needs it, rather than unconditionally on the entire
   tree.
Minor change: Now the fragment tree is printed for debugging purposes
after every box/fragment tree layout, not every time that overflow is
updated.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

@mrobinson

@mrobinson

mrobinson marked this pull request as ready for review

May 13, 2026 09:13

Loirooriol

@mrobinson

Merged

@mrobinson

mrobinson deleted the integrate-scrollable-overflow-calculation-into-fragment-tree-construction branch

May 15, 2026 08:16

alice pushed a commit to alice/servo that referenced this pull request

May 15, 2026
This avoids another entire fragment tree traversal when rebuilding
fragments. In the case that scrollable overflow-related properties
change or fragment tree reconstruction happens, a lazy (but constrained)
traversal happens at the moment the scrollable overflow is queried.
This is accomplished by clearing scrollable overflow during damage
propagation. When a fragment has its scrollable overflow cleared, it
will be recalculated the next time it is queried. This leads to a few
benefits:
1. We delay a recalculation of scrollable overflow until it is actually
   needed.
2. Scrollable overflow recalculation should only happen on the subtree
   that actually needs it, rather than unconditionally on the entire
   tree.
Minor change: Now the fragment tree is printed for debugging purposes
after every box/fragment tree layout, not every time that overflow is
updated.
Testing: This should not change observable behavior, other than
doing less work during layout, so should be covered by existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>

Read the original on github.com ↗