Skip to content

Commit

Permalink
[CSS-Sizing] Fix to respect block size with max-content and min-conte…
Browse files Browse the repository at this point in the history
…nt in a table

https://bugs.webkit.org/show_bug.cgi?id=261986

Reviewed by Antti Koivisto.

This patch aligns WebKit with Blink / Chromium and Gecko / Firefox.

Partial Merge (only RenderTable.cpp): https://chromium.googlesource.com/chromium/src.git/+/3a0c4adda19bade345ca115fdcfe825acf0b8869

The specification [1] says to treat the 'min-content', 'max-content' and 'fit-content' values
as the initial value of the property in question, if said property is a block length property.
In other words, these CSS values really only make a difference in the inline direction.

[1] https://www.w3.org/TR/css-sizing-3/#column-sizing

Additionally, it syncs latest test copies from WPT upstream:

Upstream Hash: 708e132acaee153316bf9356b0b2ba64c40a2965

* Source/WebCore/rendering/RenderTable.cpp:
(RenderTable::layout):
* LayoutTests/imported/w3c/resources/import-expectations.json:
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1a.html: Add Test Case
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1a-expected.html: Add Test Case Expectation
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1b.html: Add Test Case
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1b-expected.html: Add Test Case Expectation
* LayoutTests/fast/css-intrinsic-dimensions/height-tables-collapsed.html: Removed in favor of WPT test
* LayoutTests/fast/css-intrinsic-dimensions/height-tables-collapsed-expected.html: Removed Expectation
* LayoutTests/fast/css-intrinsic-dimensions/height-css-tables-collapsed.html: Removed in favor of WPT test
* LayoutTests/fast/css-intrinsic-dimensions/height-css-tables-collapsed-expected.html: Removed Expectation

Canonical link: https://commits.webkit.org/271054@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Nov 22, 2023
1 parent 018e5e8 commit e180ca7
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 153 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions LayoutTests/imported/w3c/resources/import-expectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"web-platform-tests/css/css-shadow-parts": "import",
"web-platform-tests/css/css-shapes": "import",
"web-platform-tests/css/css-sizing/aspect-ratio": "import",
"web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1a.html": "import",
"web-platform-tests/css/css-sizing/block-size-with-min-or-max-content-table-1b.html": "import",
"web-platform-tests/css/css-sizing/contain-intrinsic-size": "import",
"web-platform-tests/css/css-tables": "import",
"web-platform-tests/css/css-text": "import",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Reference Case: Block size with max-content and min-content in a table</title>
<meta charset="utf-8">
<link rel="author" title="Boris Chiou" href="mailto:boris.chiou@gmail.com">
<style>
html,body {
margin: 0;
}
table {
border: 2px solid black;
}

td {
border: 2px solid lime;
}

.item {
height: 50px;
width: 50px;
border: 1px solid blue;
}

.container {
writing-mode: vertical-lr;
}

.small { block-size: 1px; }
.big { block-size: 150px; }
</style>
</head>
<body>
<div class="container">
<table class="big"><td><div class="item"></div></td></table>
<table class="big"><td><div class="item"></div></td></table>

<table><td class="small"><div class="item"></div></td></table>
<table><td class="small"><div class="item"></div></td></table>
</div>

<table class="big"><td><div class="item"></div></td></table>
<table class="big"><td><div class="item"></div></td></table>

<table><td class="small"><div class="item"></div></td></table>
<table><td class="small"><div class="item"></div></td></table>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Test: Basic cases of width/height (block axis) with max-content and min-content in a table</title>
<meta charset="utf-8">
<link rel="author" title="Boris Chiou" href="mailto:boris.chiou@gmail.com">
<link rel="help" href="https://drafts.csswg.org/css-sizing/#sizing-values">
<link rel="match" href="block-size-with-min-or-max-content-table-1-ref.html">
<link rel="stylesheet" type="text/css" href="support/min-content-max-content.css">
<style>
html,body {
margin: 0;
}

table {
border: 2px solid black;
}

td {
border: 2px solid lime;
}

.item {
height: 50px;
width: 50px;
border: 1px solid blue;
}

.container {
writing-mode: vertical-lr;
}

.small-h { height: 1px; }
.big-h { height: 150px; }
.small-w { width: 1px; }
.big-w { width: 150px; }
</style>
</head>
<body>
<div class="container">
<table class="big-w max-width-min-content">
<td><div class="item"></div></td>
</table>
<table class="big-w max-width-max-content">
<td><div class="item"></div></td>
</table>

<table class="small-w min-width-min-content">
<td><div class="item"></div></td>
</table>
<table class="small-w min-width-max-content">
<td><div class="item"></div></td>
</table>
</div>

<table class="big-h max-height-min-content">
<td><div class="item"></div></td>
</table>
<table class="big-h max-height-max-content">
<td><div class="item"></div></td>
</table>

<table class="small-h min-height-min-content">
<td><div class="item"></div></td>
</table>
<table class="small-h min-height-max-content">
<td><div class="item"></div></td>
</table>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Reference Case: Block size with max-content and min-content in a table</title>
<meta charset="utf-8">
<link rel="author" title="Boris Chiou" href="mailto:boris.chiou@gmail.com">
<style>
html,body {
margin: 0;
}
table {
border: 2px solid black;
}

td {
border: 2px solid lime;
}

.item {
height: 50px;
width: 50px;
border: 1px solid blue;
}

.container {
writing-mode: vertical-lr;
}

.small { block-size: 1px; }
.big { block-size: 150px; }
</style>
</head>
<body>
<div class="container">
<table class="big"><td><div class="item"></div></td></table>
<table class="big"><td><div class="item"></div></td></table>

<table><td class="small"><div class="item"></div></td></table>
<table><td class="small"><div class="item"></div></td></table>
</div>

<table class="big"><td><div class="item"></div></td></table>
<table class="big"><td><div class="item"></div></td></table>

<table><td class="small"><div class="item"></div></td></table>
<table><td class="small"><div class="item"></div></td></table>
</body>
</html>
Loading

0 comments on commit e180ca7

Please sign in to comment.