layout: Don't let table grid boxes inherit display: inline-table (#35264)

The outer display type of a table element applies to the table wrapper
box. The table grid box needs to be block-level as defined in
https://drafts.csswg.org/css-tables/#table-grid-box

Therefore this sets `display: table` on table grid boxes, and then when
painting collapsed table borders we can use the usual logic to compute
the StackingContextSection.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-02-03 18:11:49 +01:00 committed by GitHub
parent 7301af8468
commit 27c40fcd29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -1216,7 +1216,8 @@ impl BoxFragment {
}); });
}; };
add_fragment(self.get_stacking_context_section()); let section = self.get_stacking_context_section();
add_fragment(section);
if !self.style.get_outline().outline_width.is_zero() { if !self.style.get_outline().outline_width.is_zero() {
add_fragment(StackingContextSection::Outline); add_fragment(StackingContextSection::Outline);
} }
@ -1239,7 +1240,7 @@ impl BoxFragment {
scroll_node_id: new_scroll_node_id, scroll_node_id: new_scroll_node_id,
reference_frame_scroll_node_id: reference_frame_scroll_node_id_for_fragments, reference_frame_scroll_node_id: reference_frame_scroll_node_id_for_fragments,
clip_chain_id: new_clip_chain_id, clip_chain_id: new_clip_chain_id,
section: self.get_stacking_context_section(), section,
containing_block: containing_block.rect, containing_block: containing_block.rect,
fragment: fragment.clone(), fragment: fragment.clone(),
is_hit_test_for_scrollable_overflow: true, is_hit_test_for_scrollable_overflow: true,
@ -1303,8 +1304,7 @@ impl BoxFragment {
scroll_node_id: new_scroll_node_id, scroll_node_id: new_scroll_node_id,
reference_frame_scroll_node_id: reference_frame_scroll_node_id_for_fragments, reference_frame_scroll_node_id: reference_frame_scroll_node_id_for_fragments,
clip_chain_id: new_clip_chain_id, clip_chain_id: new_clip_chain_id,
// TODO: should this use `self.get_stacking_context_section()`? section,
section: StackingContextSection::DescendantBackgroundsAndBorders,
containing_block: containing_block.rect, containing_block: containing_block.rect,
fragment: fragment.clone(), fragment: fragment.clone(),
is_hit_test_for_scrollable_overflow: false, is_hit_test_for_scrollable_overflow: false,

View file

@ -269,6 +269,9 @@ svg > * {
contain: unset; contain: unset;
container: unset; container: unset;
scroll-margin: unset; scroll-margin: unset;
/* The grid needs to be block-level, so avoid inheriting `display: inline-table`. */
display: table;
} }
*|*::-servo-legacy-anonymous-block { *|*::-servo-legacy-anonymous-block {