layout: Improve sizing of tables in collapsed-borders mode (#34932)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-01-10 15:22:32 -08:00 committed by GitHub
parent 754ec455bc
commit 25a94efcdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 44 additions and 42 deletions

View file

@ -616,6 +616,23 @@ impl ComputedValuesExt for ComputedValues {
fn border_width(&self, containing_block_writing_mode: WritingMode) -> LogicalSides<Au> {
let border = self.get_border();
if self.get_box().display.inside() == stylo::DisplayInside::Table &&
!matches!(self.pseudo(), Some(PseudoElement::ServoTableGrid)) &&
self.get_inherited_table().border_collapse == BorderCollapse::Collapse
{
// For tables in collapsed-borders mode we halve the border widths, because
// > in this model, the width of the table includes half the table border.
// https://www.w3.org/TR/CSS22/tables.html#collapsing-borders
return LogicalSides::from_physical(
&PhysicalSides::new(
border.border_top_width / 2,
border.border_right_width / 2,
border.border_bottom_width / 2,
border.border_left_width / 2,
),
containing_block_writing_mode,
);
}
LogicalSides::from_physical(
&PhysicalSides::new(
border.border_top_width,