mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
layout: Use box tree Fragment
s for offset parent queries (#36681)
This change switches `offsetParent`, `offsetLeft`, etc queries to use the BoxTree fragments instead of walking the entire fragment tree. In addition, fragments are stored for columns and colgroups. In general, this greatly simplifies the flow of the query and prevents having to do expensive tree walks. Testing: This change is covered by newly passing WPT tests and three new failures: - /css/filter-effects/backdrop-filter-edge-clipping-2.html - /css/filter-effects/backdrop-filter-edge-mirror.html - /css/filter-effects/backdrop-filter-edge-pixels-2.html These failures are actually progressions, because now the references start to render properly whereas before they did not. Fixes: This is part of #36525 and #36665. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
69605d05cf
commit
a62f0eaf0a
15 changed files with 193 additions and 269 deletions
|
@ -20,12 +20,17 @@ pub(crate) struct PositioningFragment {
|
|||
pub base: BaseFragment,
|
||||
pub rect: PhysicalRect<Au>,
|
||||
pub children: Vec<Fragment>,
|
||||
|
||||
/// The scrollable overflow of this anonymous fragment's children.
|
||||
pub scrollable_overflow: PhysicalRect<Au>,
|
||||
|
||||
/// If this fragment was created with a style, the style of the fragment.
|
||||
#[conditional_malloc_size_of]
|
||||
pub style: Option<ServoArc<ComputedValues>>,
|
||||
|
||||
/// This [`PositioningFragment`]'s containing block rectangle in coordinates relative to
|
||||
/// the initial containing block, but not taking into account any transforms.
|
||||
pub cumulative_containing_block_rect: PhysicalRect<Au>,
|
||||
}
|
||||
|
||||
impl PositioningFragment {
|
||||
|
@ -61,9 +66,18 @@ impl PositioningFragment {
|
|||
rect,
|
||||
children,
|
||||
scrollable_overflow,
|
||||
cumulative_containing_block_rect: PhysicalRect::zero(),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn set_containing_block(&mut self, containing_block: &PhysicalRect<Au>) {
|
||||
self.cumulative_containing_block_rect = *containing_block;
|
||||
}
|
||||
|
||||
pub fn offset_by_containing_block(&self, rect: &PhysicalRect<Au>) -> PhysicalRect<Au> {
|
||||
rect.translate(self.cumulative_containing_block_rect.origin.to_vector())
|
||||
}
|
||||
|
||||
pub fn print(&self, tree: &mut PrintTree) {
|
||||
tree.new_level(format!(
|
||||
"PositioningFragment\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue