Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NG/DL: Implement size containment (and display lock) for NG fieldset …
…algo This patch adds size containment implementation for fieldsets in LayoutNG. Tested with LayoutNGFieldset feature flag. Along with the new tests, external/wpt/css/css-contain/contain-size-fieldset-001.html and external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-fieldset-001.html are also passing. R=chrishtr@chromium.org, ikilpatrick@chromium.org, mstensho@chromium.org Bug: 958975 Change-Id: I5e735adc65ed9450f84e4c1ab68cba69e3fd85ed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613844 Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Commit-Queue: vmpstr <vmpstr@chromium.org> Cr-Commit-Position: refs/heads/master@{#660866}
- Loading branch information
Showing
9 changed files
with
281 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
third_party/blink/web_tests/external/wpt/css/css-contain/contain-size-fieldset-002.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Containment Test: Size containment on fieldset</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size"> | ||
<link rel="match" href="reference/contain-size-fieldset-002-ref.html"> | ||
<meta name=assert content="Size containment does apply to fieldsets, thus their size is the same than if they don't have contents."> | ||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
fieldset { | ||
contain: size; | ||
visibility: hidden; | ||
height: 1px; | ||
} | ||
</style> | ||
|
||
<p>This test passes if it has the same output as the reference. You should see a black border box below.</p> | ||
<div id="border"> | ||
<fieldset> | ||
<legend>legend</legend> | ||
Fieldset contents are here. | ||
</fieldset> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
...blink/web_tests/external/wpt/css/css-contain/reference/contain-size-fieldset-002-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Containment Test: Reference file</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
fieldset { | ||
visibility: hidden; | ||
height: 1px; | ||
} | ||
</style> | ||
|
||
<p>This test passes if it has the same output as the reference. You should see a black border box below.</p> | ||
<div id="border"> | ||
<fieldset></fieldset> | ||
</div> |
38 changes: 38 additions & 0 deletions
38
third_party/blink/web_tests/wpt_internal/display-lock/sizing/contain-size-fieldset.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype HTML> | ||
<html class="reftest-wait"> | ||
<meta charset="utf8"> | ||
<title>Display Locking: fieldset with legend and size containment, sized by display lock</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
<link rel="match" href="fieldset-empty-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
#container { | ||
contain: style layout size; | ||
background: lightblue; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset id="container"> | ||
<legend>This is a legend</legend> | ||
This is some content. | ||
</fieldset> | ||
</div> | ||
|
||
<script> | ||
async function runTest() { | ||
const container = document.getElementById("container"); | ||
await container.displayLock.acquire({ timeout: Infinity, size: [123, 234] }); | ||
takeScreenshot(); | ||
} | ||
|
||
window.onload = runTest; | ||
</script> | ||
|
||
</html> |
21 changes: 21 additions & 0 deletions
21
third_party/blink/web_tests/wpt_internal/display-lock/sizing/fieldset-empty-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype HTML> | ||
<html> | ||
<meta charset="utf8"> | ||
<title>Display Locking: empty fieldset (reference)</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
fieldset { | ||
visibility: hidden; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset></fieldset> | ||
</div> | ||
</html> |
35 changes: 35 additions & 0 deletions
35
third_party/blink/web_tests/wpt_internal/display-lock/sizing/fieldset-empty.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype HTML> | ||
<html class="reftest-wait"> | ||
<meta charset="utf8"> | ||
<title>Display Locking: empty fieldset</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
<link rel="match" href="fieldset-empty-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
#container { | ||
contain: style layout; | ||
background: lightblue; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset id="container"></fieldset> | ||
</div> | ||
|
||
<script> | ||
async function runTest() { | ||
const container = document.getElementById("container"); | ||
await container.displayLock.acquire({ timeout: Infinity, size: [0, 0] }); | ||
takeScreenshot(); | ||
} | ||
|
||
window.onload = runTest; | ||
</script> | ||
|
||
</html> |
27 changes: 27 additions & 0 deletions
27
...arty/blink/web_tests/wpt_internal/display-lock/sizing/fieldset-with-legend-sized-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!doctype HTML> | ||
<html> | ||
<meta charset="utf8"> | ||
<title>Display Locking: fieldset with legend, sized by display lock (reference)</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
fieldset { | ||
visibility: hidden; | ||
} | ||
#child { | ||
width: 123px; | ||
height: 234px; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset> | ||
<div id="child"></div> | ||
</fieldset> | ||
</div> | ||
</html> |
38 changes: 38 additions & 0 deletions
38
third_party/blink/web_tests/wpt_internal/display-lock/sizing/fieldset-with-legend-sized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype HTML> | ||
<html class="reftest-wait"> | ||
<meta charset="utf8"> | ||
<title>Display Locking: fieldset with legend, sized by display lock</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
<link rel="match" href="fieldset-with-legend-sized-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
#container { | ||
contain: style layout; | ||
background: lightblue; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset id="container"> | ||
<legend>This is a legend</legend> | ||
This is some content. | ||
</fieldset> | ||
</div> | ||
|
||
<script> | ||
async function runTest() { | ||
const container = document.getElementById("container"); | ||
await container.displayLock.acquire({ timeout: Infinity, size: [123, 234] }); | ||
takeScreenshot(); | ||
} | ||
|
||
window.onload = runTest; | ||
</script> | ||
|
||
</html> |
38 changes: 38 additions & 0 deletions
38
third_party/blink/web_tests/wpt_internal/display-lock/sizing/fieldset-with-legend.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype HTML> | ||
<html class="reftest-wait"> | ||
<meta charset="utf8"> | ||
<title>Display Locking: fieldset with legend</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="help" href="https://github.com/WICG/display-locking"> | ||
<!-- The legend should be ignored when sizing, resulting in the same ref as empty --> | ||
<link rel="match" href="fieldset-empty-ref.html"> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<style> | ||
#border { | ||
border: 1px solid black; | ||
width: min-content; | ||
} | ||
#container { | ||
contain: style layout; | ||
background: lightblue; | ||
} | ||
</style> | ||
|
||
<div id="border"> | ||
<fieldset id="container"> | ||
<legend>This is a legend</legend> | ||
</fieldset> | ||
</div> | ||
|
||
<script> | ||
async function runTest() { | ||
const container = document.getElementById("container"); | ||
await container.displayLock.acquire({ timeout: Infinity, size: [0, 0] }); | ||
takeScreenshot(); | ||
} | ||
|
||
window.onload = runTest; | ||
</script> | ||
|
||
</html> |