10BC0 layout: Account for sticky nodes in ScrollTree transforms and cache transforms by mrobinson · Pull Request #38391 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

mrobinson
8000 Copy link
Member

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

Comment on lines 419 to 420
SpatialTreeNodeInfo::Scroll(info) if info.offset_changed.get() => {
info.offset_changed.set(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe simpler with take()

Suggested change
SpatialTreeNodeInfo::Scroll(info) if info.offset_changed.get() => {
info.offset_changed.set(false);
SpatialTreeNodeInfo::Scroll(info) if info.offset_changed.take() => {

…ransforms

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.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
@mrobinson mrobinson force-pushed the caching-transform-and-sticky branch from 3e5cd3a to b18f5a1 Compare July 31, 2025 13:01
@mrobinson mrobinson enabled auto-merge July 31, 2025 13:01
@mrobinson mrobinson added this pull request to the merge queue Jul 31, 2025
Merged via the queue into servo:main with commit 5da55ad Jul 31, 2025
21 checks passed
@mrobinson mrobinson deleted the caching-transform-and-sticky branch July 31, 2025 14:03
minghuaw pushed a commit to minghuaw/servo that referenced this pull request Aug 1, 2025
…ransforms (servo#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0