layout: Support storing layout data for two-level nested pseudo-elements (#38678)

Add basic support for storing layout data for pseudo-elements nested to
up to two levels. This removes the last unstored layout result and fixes
a double-borrow issue. This change does not add properly parsing nor
styling of these element types, but does prepare for those changes which
must come from stylo.

Testing: This fixes a intermittent panic in
`tests/wpt/tests/css/css-lists/nested-marker-styling.html`
Fixes: #38177. 
Closes: #38183.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-14 15:41:34 +02:00 committed by GitHub
parent 43da933247
commit 99ce81cf64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 273 additions and 177 deletions

View file

@ -720,9 +720,9 @@ impl<'style, 'dom> TableBuilderTraversal<'style, 'dom> {
});
self.push_table_row(table_row.clone());
self.info
anonymous_info
.node
.pseudo_element_box_slot(PseudoElement::ServoAnonymousTableRow)
.box_slot()
.set(LayoutBox::TableLevelBox(TableLevelBox::Track(table_row)))
}
@ -989,9 +989,9 @@ impl<'style, 'builder, 'dom, 'a> TableRowBuilder<'style, 'builder, 'dom, 'a> {
.builder
.add_cell(new_table_cell.clone());
self.info
anonymous_info
.node
.pseudo_element_box_slot(PseudoElement::ServoAnonymousTableCell)
.box_slot()
.set(LayoutBox::TableLevelBox(TableLevelBox::Cell(
new_table_cell,
)));
@ -1027,7 +1027,7 @@ impl<'dom> TraversalHandler<'dom> for TableRowBuilder<'_, '_, 'dom, '_> {
let cell = old_cell.unwrap_or_else(|| {
// This value will already have filtered out rowspan=0
// in quirks mode, so we don't have to worry about that.
let (rowspan, colspan) = if info.pseudo_element().is_none() {
let (rowspan, colspan) = if info.pseudo_element_chain().is_empty() {
let rowspan = info.node.get_rowspan().unwrap_or(1) as usize;
let colspan = info.node.get_colspan().unwrap_or(1) as usize;
@ -1148,7 +1148,7 @@ fn add_column(
is_anonymous: bool,
old_column: Option<ArcRefCell<TableTrack>>,
) -> ArcRefCell<TableTrack> {
let span = if column_info.pseudo_element().is_none() {
let span = if column_info.pseudo_element_chain().is_empty() {
column_info.node.get_span().unwrap_or(1)
} else {
1