tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d22f4c063732b2a848847832055322546d41c6f7
parent a57259e5dd631a9a5840f8f5a6ef05e046ec3926
Author: Glenn Watson <git@chillybin.org>
Date:   Mon,  3 Nov 2025 20:29:56 +0000

Bug 1997483 - Fix interning of primitives attached to a sticky positioning context r=gfx-reviewers,nical

We need to ensure the local space coordinates that are interned
for invalidation purposes don't include the sticky position offset
that was applied by the content process side.

Differential Revision: https://phabricator.services.mozilla.com/D270780

Diffstat:
Mgfx/wr/webrender/src/spatial_node.rs | 5++++-
Mgfx/wr/webrender/src/spatial_tree.rs | 7+++++--
Mlayout/reftests/position-sticky/reftest.list | 2+-
3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gfx/wr/webrender/src/spatial_node.rs b/gfx/wr/webrender/src/spatial_node.rs @@ -687,7 +687,10 @@ impl SpatialNode { info.previously_applied_offset.x, &info.horizontal_offset_bounds); - sticky_offset + // Reapply the content-process side sticky offset, which was removed + // from the primitive bounds attached to this node, so that interning + // sees stable values. + sticky_offset + info.previously_applied_offset } pub fn prepare_state_for_children(&self, state: &mut TransformUpdateState) { diff --git a/gfx/wr/webrender/src/spatial_tree.rs b/gfx/wr/webrender/src/spatial_tree.rs @@ -1379,8 +1379,11 @@ pub fn get_external_scroll_offset<S: SpatialNodeContainer>( SpatialNodeType::ScrollFrame(ref scrolling) => { offset += scrolling.external_scroll_offset; } - SpatialNodeType::StickyFrame(..) => { - // Doesn't provide any external scroll offset + SpatialNodeType::StickyFrame(ref sticky) => { + // Remove the sticky offset that was applied in the + // content process, so that primitive interning + // sees stable values, and doesn't invalidate unnecessarily. + offset -= sticky.previously_applied_offset; } SpatialNodeType::ReferenceFrame(..) => { // External scroll offsets are not propagated across diff --git a/layout/reftests/position-sticky/reftest.list b/layout/reftests/position-sticky/reftest.list @@ -40,7 +40,7 @@ fuzzy-if(Android,0-4,0-810) == containing-block-1.html containing-block-1-ref.ht == inline-1.html inline-1-ref.html == inline-2.html inline-2-ref.html fuzzy-if(cocoaWidget,0-99,0-210) == inline-3.html inline-3-ref.html -skip-if(useDrawSnapshot) fuzzy-if(swgl&&!Android,0-1,0-3) fails-if(useDrawSnapshot) == inline-4.html inline-4-ref.html +skip-if(useDrawSnapshot) fuzzy-if(swgl&&!Android,0-1,0-3) fuzzy-if(winWidget,255-255,976-976) fails-if(useDrawSnapshot) == inline-4.html inline-4-ref.html == column-contain-1a.html column-contain-1-ref.html == column-contain-1b.html column-contain-1-ref.html == column-contain-2.html column-contain-2-ref.html