mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
layout: Store most anonymous pseudo-elements in box slots (#37941)
Previously, anonymous boxes, such for anonymous table parts were not associated with their non-pseudo ancestor DOM nodes. This presents a problem when it comes time to clear layout data during incremental layouts. This change reworks the way that pseudo-elements in general are stored in their non-pseudo ancestor DOM nodes, allowing for any number to be placed there. This trades a bit of performance for space, as just adding a vector to the node would add something like 24 bytes of storage to every node. This change should have a neutral runtime memory usage. Testing: This shouldn't change observable behavior and is thus covered by existing WPT tests. It will allow tests to pass in a subsequent PR. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
4054f9a5a0
commit
51367c22a6
7 changed files with 106 additions and 95 deletions
|
@ -299,9 +299,12 @@ impl<'dom, 'style> BlockContainerBuilder<'dom, 'style> {
|
|||
self.push_block_level_job_for_inline_formatting_context(inline_formatting_context);
|
||||
}
|
||||
|
||||
let box_slot = table_info
|
||||
.node
|
||||
.pseudo_element_box_slot(PseudoElement::ServoAnonymousTable);
|
||||
self.block_level_boxes.push(BlockLevelJob {
|
||||
info: table_info,
|
||||
box_slot: BoxSlot::dummy(),
|
||||
box_slot,
|
||||
kind: BlockLevelCreator::AnonymousTable { table_block },
|
||||
propagated_data: self.propagated_data,
|
||||
});
|
||||
|
@ -683,10 +686,13 @@ impl<'dom> BlockContainerBuilder<'dom, '_> {
|
|||
})
|
||||
.clone();
|
||||
|
||||
let box_slot = self
|
||||
.info
|
||||
.node
|
||||
.pseudo_element_box_slot(PseudoElement::ServoAnonymousBox);
|
||||
self.block_level_boxes.push(BlockLevelJob {
|
||||
info,
|
||||
// FIXME(nox): We should be storing this somewhere.
|
||||
box_slot: BoxSlot::dummy(),
|
||||
box_slot,
|
||||
kind: BlockLevelCreator::SameFormattingContextBlock(
|
||||
IntermediateBlockContainer::InlineFormattingContext(
|
||||
BlockContainer::InlineFormattingContext(inline_formatting_context),
|
||||
|
|
|
@ -302,10 +302,7 @@ impl<'dom> IncrementalBoxTreeUpdate<'dom> {
|
|||
}
|
||||
|
||||
let layout_data = NodeExt::layout_data(&potential_dirty_root_node)?;
|
||||
if layout_data.pseudo_before_box.borrow().is_some() {
|
||||
return None;
|
||||
}
|
||||
if layout_data.pseudo_after_box.borrow().is_some() {
|
||||
if !layout_data.pseudo_boxes.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue