layout: Account for sticky nodes in ScrollTree transforms and cache transforms (#38391)

When calculating the node to world transform for use in bounding box
queries, cache the values of the transform. In addition, when scroll
offsets change, ensure that the cached values are invalided properly.
This change necessitated the storage of children for each node in the
tree, so that we can walk both up and down the tree. The purpose of this
part of the change is to increase performance when doing multiple
queries and prepare the tree for hit testing.

In addition, this change also tries to take into account sticky offsets,
using the algorithm from WebRender to calculate sticky offsets. This is
also going to be important for hit testing.

Testing: Newly passing tests:
 - /css/css-position/position-sticky-dynamic-ancestor-001.html
 - /css/css-tables/tentative/position-sticky-container.html

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-07-31 15:36:32 +02:00 committed by GitHub
parent fca94336d3
commit 5da55adfd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 261 additions and 65 deletions

View file

@ -65,7 +65,7 @@ fn root_transform_for_layout_node(
.spatial_tree_node
.borrow()
.expect("Should always have a scroll tree node when querying bounding box.");
Some(scroll_tree.cumulative_node_transform(&scroll_tree_node_id))
Some(scroll_tree.cumulative_node_to_root_transform(&scroll_tree_node_id))
}
pub(crate) fn process_content_box_request(