mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
layout: Implement keyword sizes for block layout heuristics (#34695)
Block layout uses some heuristics to guess whether margins are separated by clearance and then don't collapse. These heuristics now take the min-content, max-content, fit-content and stretch sizing keywords into account. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
2ab66ce678
commit
6be0a64939
9 changed files with 212 additions and 63 deletions
52
tests/wpt/meta/MANIFEST.json
vendored
52
tests/wpt/meta/MANIFEST.json
vendored
|
@ -243091,6 +243091,58 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-001.html": [
|
||||
"d5e293f85e9cde73c1efa60d66ccdea4618512db",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-002.html": [
|
||||
"a9e0e95522403b396a86aac3a5400ef8693c56d4",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-003.html": [
|
||||
"0e27b9ef7d16c19c76fab7314e089a122b8b9123",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-004.html": [
|
||||
"6d08bd81a73703fd068849117c0e12210097adee",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"grid-item-image-percentage-min-height-computes-as-0.html": [
|
||||
"ef3da03100229a846ca77156bdf34e5e37c92508",
|
||||
[
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-003.html]
|
||||
expected: FAIL
|
|
@ -0,0 +1,2 @@
|
|||
[float-clearance-with-margin-collapse-and-fit-content-and-padding-percentage-004.html]
|
||||
expected: FAIL
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#fit-content-size">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#floats">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#clearance">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
<meta name="assert" content="
|
||||
The element with `width: fit-content` becomes 0px wide.
|
||||
Therefore, the padding percentage of its child resolves to 0px.
|
||||
Therefore, the 100px of margin collapse with the top margin of the element with `clear: both`.
|
||||
Therefore, the element with `clear: both` is already past the float and receives no clearance.
|
||||
">
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div style="display: inline-block; background: red">
|
||||
<div style="width: 100px; height: 100px; float: left; background: green"></div>
|
||||
<div style="clear: both">
|
||||
<div style="width: fit-content">
|
||||
<div style="padding-top: 100%; margin-bottom: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#fit-content-size">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#floats">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#clearance">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
<meta name="assert" content="
|
||||
The element with `width: fit-content` becomes 0px wide.
|
||||
Therefore, the padding percentage of its child resolves to 0px.
|
||||
Therefore, the 75px of margin collapse with the top margin of the element with `clear: both`.
|
||||
Therefore, the element with `clear: both` receives 25px of clearance.
|
||||
">
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div style="display: inline-block; background: red">
|
||||
<div style="width: 100px; height: 100px; float: left; background: green"></div>
|
||||
<div style="clear: both">
|
||||
<div style="width: fit-content">
|
||||
<div style="padding-top: 100%; margin-bottom: 75px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#fit-content-size">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#floats">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#clearance">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
<meta name="assert" content="
|
||||
The element with `width: fit-content` becomes 0px wide.
|
||||
Therefore, the padding percentage of its child resolves to 0px.
|
||||
Therefore, the 100px of margin collapse with the top margin of the element with `clear: both`.
|
||||
Therefore, the element with `clear: both` is already past the float and receives no clearance.
|
||||
">
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div style="display: inline-block; background: red">
|
||||
<div style="width: 100px; height: 100px; float: left; background: green"></div>
|
||||
<div style="clear: both; width: fit-content">
|
||||
<div style="padding-top: 100%; margin-bottom: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#fit-content-size">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#floats">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#clearance">
|
||||
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
<meta name="assert" content="
|
||||
The element with `width: fit-content` becomes 0px wide.
|
||||
Therefore, the padding percentage of its child resolves to 0px.
|
||||
Therefore, the 75px of margin collapse with the top margin of the element with `clear: both`.
|
||||
Therefore, the element with `clear: both` receives 25px of clearance.
|
||||
">
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div style="display: inline-block; background: red">
|
||||
<div style="width: 100px; height: 100px; float: left; background: green"></div>
|
||||
<div style="clear: both; width: fit-content">
|
||||
<div style="padding-top: 100%; margin-bottom: 75px;"></div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue