mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
layout: Improve sizing of tables in collapsed-borders mode (#34932)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
754ec455bc
commit
25a94efcdf
20 changed files with 44 additions and 42 deletions
|
@ -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,
|
||||
|
|
|
@ -1626,8 +1626,6 @@ impl<'a> TableLayout<'a> {
|
|||
containing_block_for_table: &ContainingBlock,
|
||||
) -> IndependentLayout {
|
||||
let table_writing_mode = containing_block_for_children.style.writing_mode;
|
||||
let grid_min_max = self.compute_grid_min_max(layout_context, table_writing_mode);
|
||||
let caption_minimum_inline_size = self.compute_caption_minimum_inline_size(layout_context);
|
||||
self.pbm = self
|
||||
.table
|
||||
.style
|
||||
|
@ -1635,6 +1633,8 @@ impl<'a> TableLayout<'a> {
|
|||
table_writing_mode,
|
||||
containing_block_for_table.size.inline,
|
||||
);
|
||||
let grid_min_max = self.compute_grid_min_max(layout_context, table_writing_mode);
|
||||
let caption_minimum_inline_size = self.compute_caption_minimum_inline_size(layout_context);
|
||||
self.compute_table_width(
|
||||
containing_block_for_children,
|
||||
grid_min_max,
|
||||
|
@ -2197,6 +2197,7 @@ impl<'a> TableLayout<'a> {
|
|||
};
|
||||
let all_rows = 0..self.table.size.height;
|
||||
let all_columns = 0..self.table.size.width;
|
||||
apply_border(&self.table.grid_style, &all_rows, &all_columns);
|
||||
for column_group in &self.table.column_groups {
|
||||
apply_border(&column_group.style, &all_rows, &column_group.track_range);
|
||||
}
|
||||
|
@ -2242,16 +2243,24 @@ impl<'a> TableLayout<'a> {
|
|||
block_end: collapsed_borders.block[end_y].width,
|
||||
};
|
||||
|
||||
if coordinates.x != 0 {
|
||||
if coordinates.x == 0 {
|
||||
result.inline_start -= self.pbm.border.inline_start;
|
||||
} else {
|
||||
result.inline_start /= 2;
|
||||
}
|
||||
if coordinates.y != 0 {
|
||||
if coordinates.y == 0 {
|
||||
result.block_start -= self.pbm.border.block_start;
|
||||
} else {
|
||||
result.block_start /= 2;
|
||||
}
|
||||
if end_x != self.table.size.width {
|
||||
if end_x == self.table.size.width {
|
||||
result.inline_end -= self.pbm.border.inline_end;
|
||||
} else {
|
||||
result.inline_end /= 2;
|
||||
}
|
||||
if end_y != self.table.size.height {
|
||||
if end_y == self.table.size.height {
|
||||
result.block_end -= self.pbm.border.block_end;
|
||||
} else {
|
||||
result.block_end /= 2;
|
||||
}
|
||||
|
||||
|
@ -2680,6 +2689,12 @@ impl ComputeInlineContentSizes for Table {
|
|||
) -> InlineContentSizesResult {
|
||||
let writing_mode = constraint_space.writing_mode;
|
||||
let mut layout = TableLayout::new(self);
|
||||
layout.pbm = self
|
||||
.style
|
||||
.padding_border_margin_with_writing_mode_and_containing_block_inline_size(
|
||||
writing_mode,
|
||||
Au::zero(),
|
||||
);
|
||||
let mut table_content_sizes = layout.compute_grid_min_max(layout_context, writing_mode);
|
||||
|
||||
let mut caption_minimum_inline_size =
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-cell-001.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-colgroup-001.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-column-001.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-row-001.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-rowgroup-001.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[table-backgrounds-bc-table-001.xht]
|
||||
expected: FAIL
|
2
tests/wpt/meta/css/css-tables/border-collapse-double-border.html.ini
vendored
Normal file
2
tests/wpt/meta/css/css-tables/border-collapse-double-border.html.ini
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[border-collapse-double-border.html]
|
||||
expected: FAIL
|
2
tests/wpt/meta/css/css-tables/border-collapse-dynamic-oof.html.ini
vendored
Normal file
2
tests/wpt/meta/css/css-tables/border-collapse-dynamic-oof.html.ini
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[border-collapse-dynamic-oof.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[row-group-margin-border-padding.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[row-margin-border-padding.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[subpixel-collapsed-borders-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[subpixel-collapsed-borders-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-image-column-collapsed.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-image-row-collapsed.html]
|
||||
expected: FAIL
|
|
@ -1,6 +0,0 @@
|
|||
[td-box-sizing-002.html]
|
||||
[.t 6]
|
||||
expected: FAIL
|
||||
|
||||
[.t 13]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[table-offset-props.html]
|
||||
[Table with collapsed border]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[table-scroll-props.html]
|
||||
[Table with collapsed border]
|
||||
expected: FAIL
|
2
tests/wpt/mozilla/meta/gfx-rs-gecko/356774-1.html.ini
vendored
Normal file
2
tests/wpt/mozilla/meta/gfx-rs-gecko/356774-1.html.ini
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[356774-1.html]
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue