From 37d200e628716f62b846893ae015ff256cd11708 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 30 Dec 2016 15:45:17 -0800 Subject: [PATCH] Fix rowspan handling for rows that span to the end of the rowgroup --- components/layout/table_row.rs | 7 ++++- tests/wpt/mozilla/meta/MANIFEST.json | 26 ++++++++++++++----- .../tests/css/table_rowspan_rowgroup_a.html | 24 +++++++++++++++++ .../tests/css/table_rowspan_rowgroup_ref.html | 22 ++++++++++++++++ .../tests/css/table_rowspan_simple_ref.html | 1 - 5 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_a.html create mode 100644 tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_ref.html diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 45ac5fbdb3fd..d4dddb1a4030 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -752,6 +752,7 @@ pub fn propagate_column_inline_sizes_to_child( // FIXME(pcwalton): This seems inefficient. Reference count it instead? match child_flow.class() { FlowClass::TableRowGroup => { + incoming_rowspan.clear(); let child_table_rowgroup_flow = child_flow.as_mut_table_rowgroup(); child_table_rowgroup_flow.spacing = *border_spacing; for kid in child_table_rowgroup_flow.block_flow.base.child_iter_mut() { @@ -789,7 +790,11 @@ pub fn propagate_column_inline_sizes_to_child( if incoming_rowspan.len() < col + 1 { incoming_rowspan.resize(col + 1, 1); } - incoming_rowspan[col] = max(cell.row_span, incoming_rowspan[col]); + // HTML ยง 4.9.11: For rowspan, the value 0 means the cell is to span all + // the remaining rows in the rowgroup. + if cell.row_span > incoming_rowspan[col] || cell.row_span == 0 { + incoming_rowspan[col] = cell.row_span; + } } col += 1; } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index e5f7738ba93b..36abb2d5adb1 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5292,6 +5292,18 @@ "url": "/_mozilla/css/table_row_direction_a.html" } ], + "css/table_rowspan_rowgroup_a.html": [ + { + "path": "css/table_rowspan_rowgroup_a.html", + "references": [ + [ + "/_mozilla/css/table_rowspan_rowgroup_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/table_rowspan_rowgroup_a.html" + } + ], "css/table_rowspan_simple_a.html": [ { "path": "css/table_rowspan_simple_a.html", @@ -20550,28 +20562,28 @@ "url": "/_mozilla/css/table_row_direction_a.html" } ], - "css/table_rowspan_simple_a.html": [ + "css/table_rowspan_rowgroup_a.html": [ { - "path": "css/table_rowspan_simple_a.html", + "path": "css/table_rowspan_rowgroup_a.html", "references": [ [ - "/_mozilla/css/table_rowspan_simple_ref.html", + "/_mozilla/css/table_rowspan_rowgroup_ref.html", "==" ] ], - "url": "/_mozilla/css/table_rowspan_simple_a.html" + "url": "/_mozilla/css/table_rowspan_rowgroup_a.html" } ], - "css/table_rowspan_simple_ref.html": [ + "css/table_rowspan_simple_a.html": [ { - "path": "css/table_rowspan_simple_ref.html", + "path": "css/table_rowspan_simple_a.html", "references": [ [ "/_mozilla/css/table_rowspan_simple_ref.html", "==" ] ], - "url": "/_mozilla/css/table_rowspan_simple_ref.html" + "url": "/_mozilla/css/table_rowspan_simple_a.html" } ], "css/table_specified_width_a.html": [ diff --git a/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_a.html b/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_a.html new file mode 100644 index 000000000000..94f091ccf136 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_a.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + +
AB
C
D
EF
+ + + diff --git a/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_ref.html b/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_ref.html new file mode 100644 index 000000000000..0e4b668510a9 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/table_rowspan_rowgroup_ref.html @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + +
AB
C
D
EF
+ + + diff --git a/tests/wpt/mozilla/tests/css/table_rowspan_simple_ref.html b/tests/wpt/mozilla/tests/css/table_rowspan_simple_ref.html index 83580dd1d391..a9878865cd2e 100644 --- a/tests/wpt/mozilla/tests/css/table_rowspan_simple_ref.html +++ b/tests/wpt/mozilla/tests/css/table_rowspan_simple_ref.html @@ -1,7 +1,6 @@ -