Add support for table fixups (#30868)

This adds support for fixing up tables so that internal table elements
that are not properly parented in the DOM have the correct box tree
structure according to the CSS Table specification [1]. Note that this
only comes into play when building the DOM via script, as HTML 5 has its
own table fixups that mean that the box tree construction fixups here
are not necessary.

There are no tests for this change. In general, it's hard to write tests
against the shape of the box tree, because it depends on the DOM. We
plan to test this via WPT tests once layout is complete.

1. https://drafts.csswg.org/css-tables/#table-internal-element

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2023-12-22 13:11:58 +01:00 committed by GitHub
parent 709d00583f
commit 81f5157522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 467 additions and 102 deletions

View file

@ -2379,14 +2379,14 @@ impl Legalizer {
FlowClass::TableRow => self.push_new_anonymous_flow::<E, _>(
context,
parent,
&[PseudoElement::ServoLegacyAnonymousTableCell],
&[PseudoElement::ServoAnonymousTableCell],
SpecificFragmentInfo::TableCell,
TableCellFlow::from_fragment,
),
FlowClass::Table | FlowClass::TableRowGroup => self.push_new_anonymous_flow::<E, _>(
context,
parent,
&[PseudoElement::ServoLegacyAnonymousTableRow],
&[PseudoElement::ServoAnonymousTableRow],
SpecificFragmentInfo::TableRow,
TableRowFlow::from_fragment,
),