mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
layout: Add a new FragmentTree
pass to calculate containing block rectangles (#36629)
When doing any kind of query, up until now, containing block rectangles were calculated by walking the `FragmentTree` until the node being queried was found. In order to make possible answering queries without walking the `FragmentTree`, `Fragment`s need to cache their cumulative containing block rectangles. This change adds a new `FragmentTree` pass (during construction) that takes care of calculating and caching these values. The new cached value is used during resolved style queries and also scrolling area queries (with the idea that all queries will eventually use them). In addition, extra `FragmentTree` walks used for cancelling animations for elements no longer in the `FragmentTree` are integrated into this new traversal. Testing: Covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
554fa26da2
commit
e9e103b46c
8 changed files with 206 additions and 207 deletions
|
@ -428,13 +428,14 @@ impl BoxTree {
|
|||
acc.union(&child_overflow)
|
||||
});
|
||||
|
||||
FragmentTree {
|
||||
FragmentTree::new(
|
||||
layout_context,
|
||||
root_fragments,
|
||||
scrollable_overflow,
|
||||
initial_containing_block: physical_containing_block,
|
||||
canvas_background: self.canvas_background.clone(),
|
||||
viewport_scroll_sensitivity: self.viewport_scroll_sensitivity,
|
||||
}
|
||||
physical_containing_block,
|
||||
self.canvas_background.clone(),
|
||||
self.viewport_scroll_sensitivity,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue