mirror of
https://github.com/servo/servo.git
synced 2025-07-17 20:33:40 +01:00
layout: Add incremental box tree construction for table caption (#37849)
This change extends incremental box tree updates to table captions. In addition, calls to `LayoutBox::invalidate_cached_fragment()` are moved to the damage calculation traversal. Testing: This should not change observable behavior and is thus 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
00472dec8e
commit
82f7f761d9
4 changed files with 37 additions and 14 deletions
|
@ -854,21 +854,37 @@ impl<'dom> TraversalHandler<'dom> for TableBuilderTraversal<'_, 'dom> {
|
|||
let Contents::NonReplaced(non_replaced_contents) = contents else {
|
||||
unreachable!("Replaced should not have a LayoutInternal display type.");
|
||||
};
|
||||
let contents =
|
||||
IndependentNonReplacedContents::Flow(BlockFormattingContext::construct(
|
||||
self.context,
|
||||
info,
|
||||
non_replaced_contents,
|
||||
self.current_propagated_data,
|
||||
false, /* is_list_item */
|
||||
));
|
||||
|
||||
let caption = ArcRefCell::new(TableCaption {
|
||||
context: IndependentFormattingContext {
|
||||
base: LayoutBoxBase::new(info.into(), info.style.clone()),
|
||||
contents: IndependentFormattingContextContents::NonReplaced(contents),
|
||||
},
|
||||
let old_caption = (!info.damage.has_box_damage())
|
||||
.then(|| match box_slot.take_layout_box() {
|
||||
Some(LayoutBox::TableLevelBox(TableLevelBox::Caption(caption))) => {
|
||||
Some(caption)
|
||||
},
|
||||
_ => None,
|
||||
})
|
||||
.flatten();
|
||||
|
||||
let caption = old_caption.unwrap_or_else(|| {
|
||||
let contents = IndependentNonReplacedContents::Flow(
|
||||
BlockFormattingContext::construct(
|
||||
self.context,
|
||||
info,
|
||||
non_replaced_contents,
|
||||
self.current_propagated_data,
|
||||
false, /* is_list_item */
|
||||
),
|
||||
);
|
||||
|
||||
ArcRefCell::new(TableCaption {
|
||||
context: IndependentFormattingContext {
|
||||
base: LayoutBoxBase::new(info.into(), info.style.clone()),
|
||||
contents: IndependentFormattingContextContents::NonReplaced(
|
||||
contents,
|
||||
),
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
self.builder.table.captions.push(caption.clone());
|
||||
box_slot.set(LayoutBox::TableLevelBox(TableLevelBox::Caption(caption)));
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue