commit d57c8879128d3837d4271e02660422099c48e9ba
parent 809deced26bdf7864314601b2cf37d7362d3238b
Author: Glenn Watson <git@chillybin.org>
Date: Tue, 4 Nov 2025 20:02:31 +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:
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-977) 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