Skip to content

Commit

Permalink
layout: Add initial support for row height distribution
Browse files Browse the repository at this point in the history
This change adds a version of row height distribution that's a little
bit like the CSS Table 3 specification and a little bit like tables in
Blink's LayoutNG. This is just an intermediate step toward implementing
a distribution algorithm for both rows and columns more similar to
Layout NG. The CSS Table 3 specification is often wrong with regard to
web compatability, which is why we have abandoned it half-way through
this work. On the other hand, this change means that we are sizing rows
better than we were before, so is a good introductory change to a real
distribution algorithm.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
  • Loading branch information
mrobinson and Loirooriol committed Feb 23, 2024
1 parent e078a99 commit 0acbd7d
Show file tree
Hide file tree
Showing 43 changed files with 667 additions and 514 deletions.
20 changes: 13 additions & 7 deletions components/layout_2020/sizing.rs
Expand Up @@ -24,13 +24,6 @@ pub(crate) struct ContentSizes {

/// <https://drafts.csswg.org/css-sizing/#intrinsic-sizes>
impl ContentSizes {
pub fn zero() -> Self {
Self {
min_content: Au::zero(),
max_content: Au::zero(),
}
}

pub fn map(&self, f: impl Fn(Au) -> Au) -> Self {
Self {
min_content: f(self.min_content),
Expand All @@ -57,6 +50,19 @@ impl ContentSizes {
}
}

impl Zero for ContentSizes {
fn zero() -> Self {
Self {
min_content: Au::zero(),
max_content: Au::zero(),
}
}

fn is_zero(&self) -> bool {
self.min_content.is_zero() && self.max_content.is_zero()
}
}

impl Add for ContentSizes {
type Output = Self;

Expand Down
977 changes: 615 additions & 362 deletions components/layout_2020/table/layout.rs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/tables/height-table-cell-001.xht.ini

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/tables/row-visibility-002.xht.ini

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/tables/table-cell-001.xht.ini

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions tests/wpt/meta/css/css-tables/bounding-box-computation-1.html.ini

This file was deleted.

3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/chrome-rowspan-bug.html.ini

This file was deleted.

3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/colspan-001.html.ini
Expand Up @@ -4,6 +4,3 @@

[td 2]
expected: FAIL

[td 4]
expected: FAIL
3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/colspan-002.html.ini
Expand Up @@ -4,6 +4,3 @@

[td 2]
expected: FAIL

[td 4]
expected: FAIL
3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/colspan-003.html.ini
Expand Up @@ -4,6 +4,3 @@

[td 2]
expected: FAIL

[td 4]
expected: FAIL
2 changes: 0 additions & 2 deletions tests/wpt/meta/css/css-tables/colspan-004.html.ini

This file was deleted.

3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/column-track-merging.html.ini
Expand Up @@ -2,9 +2,6 @@
[main table 1]
expected: FAIL

[main table 2]
expected: FAIL

[main table 4]
expected: FAIL

Expand Down
6 changes: 6 additions & 0 deletions tests/wpt/meta/css/css-tables/fixed-layout-1.html.ini
@@ -1,3 +1,9 @@
[fixed-layout-1.html]
[Table-layout:fixed grows the table if needed for minimum-width]
expected: FAIL

[Table-layout:fixed distributes width equally to all auto-columns]
expected: FAIL

[Table-layout:fixed deals with columns generated by subsequent rows]
expected: FAIL

This file was deleted.

@@ -1,10 +1,4 @@
[computing-row-measure-0.html]
[Checking intermediate min-content height for span 1 (1)]
expected: FAIL

[Checking intermediate min-content height for span 1 (3)]
expected: FAIL

[Checking intermediate min-content height for span 1 (2)]
expected: FAIL

Expand Down
@@ -1,9 +1,3 @@
[computing-row-measure-1.html]
[Checking intermediate min-content width for span 2 (1)]
expected: FAIL

[Checking intermediate min-content width for span 2 (2)]
expected: FAIL

[Checking intermediate min-content width for span 2 (4)]
expected: FAIL
12 changes: 0 additions & 12 deletions tests/wpt/meta/css/css-tables/html5-table-formatting-2.html.ini
Expand Up @@ -11,26 +11,14 @@
[Border-spacing is added between any two unmerged columns (2)]
expected: FAIL

[Border-spacing is added between any two unmerged rows (2)]
expected: FAIL

[Border-spacing is added between any two unmerged columns (3)]
expected: FAIL

[Border-spacing is added between any two unmerged rows (3)]
expected: FAIL

[Border-spacing is added between any two unmerged columns (4)]
expected: FAIL

[Border-spacing is added between any two unmerged rows (4)]
expected: FAIL

[Border-spacing is added between any two unmerged columns (5)]
expected: FAIL

[Border-spacing is added between any two unmerged rows (5)]
expected: FAIL

[Explicitely defined rows are not merged]
expected: FAIL

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tests/wpt/meta/css/css-tables/table-model-fixup.html.ini
Expand Up @@ -2,9 +2,6 @@
[2.1. An anonymous table-row box must be generated around each sequence of consecutive children of a table-root box which are not proper table child boxes. (1/2)]
expected: FAIL

[2.1. An anonymous table-row box must be generated around each sequence of consecutive children of a table-root box which are not proper table child boxes. (2/2)]
expected: FAIL

[2.2. An anonymous table-row box must be generated around each sequence of consecutive children of a table-row-grouping box which are not table-row boxes. (1/3)]
expected: FAIL

Expand Down
9 changes: 0 additions & 9 deletions tests/wpt/meta/css/css-tables/tentative/baseline-td.html.ini
Expand Up @@ -2,14 +2,5 @@
[table, .display-table 1]
expected: FAIL

[table, .display-table 2]
expected: FAIL

[table, .display-table 3]
expected: FAIL

[table, .display-table 4]
expected: FAIL

[table, .display-table 5]
expected: FAIL
Expand Up @@ -14,9 +14,6 @@
[table 6]
expected: FAIL

[table 7]
expected: FAIL

[table 9]
expected: FAIL

Expand Down Expand Up @@ -85,3 +82,6 @@

[table 8]
expected: FAIL

[table 5]
expected: FAIL
Expand Up @@ -35,9 +35,6 @@
[table 18]
expected: FAIL

[table 19]
expected: FAIL

[table 21]
expected: FAIL

Expand All @@ -49,3 +46,21 @@

[table 20]
expected: FAIL

[table 10]
expected: FAIL

[table 11]
expected: FAIL

[table 12]
expected: FAIL

[table 13]
expected: FAIL

[table 16]
expected: FAIL

[table 24]
expected: FAIL
Expand Up @@ -56,9 +56,6 @@
[table 23]
expected: FAIL

[table 24]
expected: FAIL

[table 25]
expected: FAIL

Expand Down
Expand Up @@ -14,9 +14,6 @@
[table 6]
expected: FAIL

[table 7]
expected: FAIL

[table 9]
expected: FAIL

Expand All @@ -37,3 +34,6 @@

[table 15]
expected: FAIL

[table 8]
expected: FAIL
Expand Up @@ -26,9 +26,6 @@
[table 11]
expected: FAIL

[table 12]
expected: FAIL

[table 14]
expected: FAIL

Expand Down Expand Up @@ -58,3 +55,6 @@

[table 26]
expected: FAIL

[table 13]
expected: FAIL
Expand Up @@ -14,9 +14,6 @@
[table 5]
expected: FAIL

[table 6]
expected: FAIL

[table 7]
expected: FAIL

Expand Down
Expand Up @@ -11,9 +11,6 @@
[table 6]
expected: FAIL

[table 7]
expected: FAIL

[table 8]
expected: FAIL

Expand Down
Expand Up @@ -5,9 +5,6 @@
[table 9]
expected: FAIL

[table 11]
expected: FAIL

[table 5]
expected: FAIL

Expand Down
@@ -0,0 +1,6 @@
[visibility-collapse-row-005.html]
[collapsed row should not contribute to overflow]
expected: FAIL

[collapsed section should not contribute to overflow]
expected: FAIL
@@ -1,12 +1,6 @@
[computing-column-measure-1.html]
[Checking intermediate min-content height for span 2 (1)]
expected: FAIL

[Checking intermediate min-content height for span 2 (2)]
expected: FAIL

[Checking intermediate min-content height for span 2 (3)]
expected: FAIL

[Checking intermediate min-content height for span 2 (4)]
expected: FAIL

0 comments on commit 0acbd7d

Please sign in to comment.