diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 84654e2969..aa8ecc8cf3 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -210,7 +210,10 @@ static bool is_table_track(CSS::Display display) static bool is_table_track_group(CSS::Display display) { - return display == CSS::Display::TableRowGroup || display == CSS::Display::TableColumnGroup; + // Unless explicitly mentioned otherwise, mentions of table-row-groups in this spec also encompass the specialized + // table-header-groups and table-footer-groups. + return display == CSS::Display::TableRowGroup || display == CSS::Display::TableHeaderGroup || display == CSS::Display::TableFooterGroup + || display == CSS::Display::TableColumnGroup; } static bool is_not_proper_table_child(const Node& node) @@ -290,6 +293,18 @@ void TreeBuilder::generate_missing_child_wrappers(NodeWithStyle& root) wrap_in_anonymous(sequence, nearest_sibling); }); }); + // Unless explicitly mentioned otherwise, mentions of table-row-groups in this spec also encompass the specialized + // table-header-groups and table-footer-groups. + for_each_in_tree_with_display(root, [&](auto& parent) { + for_each_sequence_of_consecutive_children_matching(parent, is_not_table_row, [&](auto& sequence, auto nearest_sibling) { + wrap_in_anonymous(sequence, nearest_sibling); + }); + }); + for_each_in_tree_with_display(root, [&](auto& parent) { + for_each_sequence_of_consecutive_children_matching(parent, is_not_table_row, [&](auto& sequence, auto nearest_sibling) { + wrap_in_anonymous(sequence, nearest_sibling); + }); + }); // An anonymous table-cell box must be generated around each sequence of consecutive children of a table-row box which are not table-cell boxes. !Testcase for_each_in_tree_with_display(root, [&](auto& parent) {