diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index 7395eff0d45..3cabdf7727d 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -1944,36 +1944,40 @@ impl TableAndTrackDimensions { let fallback_block_size = table_layout.final_table_height; let mut column_dimensions = Vec::new(); - let mut column_offset = if table_layout.table.size.width == 0 { - fallback_inline_size - } else { - border_spacing.inline - }; + let mut column_offset = Au::zero(); for column_index in 0..table_layout.table.size.width { if table_layout.is_column_collapsed(column_index) { column_dimensions.push((column_offset, column_offset)); continue; } - let column_size = table_layout.distributed_column_widths[column_index]; - column_dimensions.push((column_offset, column_offset + column_size)); - column_offset += column_size + border_spacing.inline; + let start_offset = column_offset + border_spacing.inline; + let end_offset = start_offset + table_layout.distributed_column_widths[column_index]; + column_dimensions.push((start_offset, end_offset)); + column_offset = end_offset; } + column_offset += if table_layout.table.size.width == 0 { + fallback_inline_size + } else { + border_spacing.inline + }; let mut row_dimensions = Vec::new(); - let mut row_offset = if table_layout.table.size.height == 0 { - fallback_block_size - } else { - border_spacing.block - }; + let mut row_offset = Au::zero(); for row_index in 0..table_layout.table.size.height { if table_layout.is_row_collapsed(row_index) { row_dimensions.push((row_offset, row_offset)); continue; } - let row_size = table_layout.row_sizes[row_index]; - row_dimensions.push((row_offset, row_offset + row_size)); - row_offset += row_size + border_spacing.block; + let start_offset = row_offset + border_spacing.block; + let end_offset = start_offset + table_layout.row_sizes[row_index]; + row_dimensions.push((start_offset, end_offset)); + row_offset = end_offset; } + row_offset += if table_layout.table.size.height == 0 { + fallback_block_size + } else { + border_spacing.block + }; let table_start_corner = LogicalVec2 { inline: column_dimensions.first().map_or_else(Au::zero, |v| v.0), diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 0ef1b7c42e1..81817bf2aba 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -236531,7 +236531,7 @@ {} ] ], - "visibility-collapse-border-spacing.html": [ + "visibility-collapse-border-spacing-001.html": [ "738cea16d5d0d41a2990fead77e8fd1c8bc246ec", [ null, @@ -236544,6 +236544,19 @@ {} ] ], + "visibility-collapse-border-spacing-002.html": [ + "95e2fb063594dee23cec40e6faab6388a35231bd", + [ + null, + [ + [ + "/css/reference/ref-filled-green-200px-square.html", + "==" + ] + ], + {} + ] + ], "visibility-collapse-colspan-003.html": [ "37092818f62c8beff7666f88910a5e803292bb47", [ diff --git a/tests/wpt/meta/css/css-tables/visibility-collapse-border-spacing-001.html.ini b/tests/wpt/meta/css/css-tables/visibility-collapse-border-spacing-001.html.ini new file mode 100644 index 00000000000..68f0fa04c80 --- /dev/null +++ b/tests/wpt/meta/css/css-tables/visibility-collapse-border-spacing-001.html.ini @@ -0,0 +1,2 @@ +[visibility-collapse-border-spacing-001.html] + expected: FAIL diff --git a/tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing.html b/tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing-001.html similarity index 100% rename from tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing.html rename to tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing-001.html diff --git a/tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing-002.html b/tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing-002.html new file mode 100644 index 00000000000..95e2fb06359 --- /dev/null +++ b/tests/wpt/tests/css/css-tables/visibility-collapse-border-spacing-002.html @@ -0,0 +1,32 @@ + + + + + + + + + +
Test passes if there is a filled green square and no red.
++ |