forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@container] Handle containers in the top layer with ::backdrop
Don't skip recalc for descendants of elements in the top layer which are containers. Otherwise the ::backdrop pseudo element box will be inserted before the top layer element currently being laid out and stay dirty. Also, avoid retrieving the next layout object pointer before laying out the previous one. For container queries and top layer, we may detach dialogs and their ::backdrops from the top layer during layout of the document tree which precedes them in the LayoutView. Removed the speculative CHECK introduced for issue 632848 as that was marked as fixed ages ago. Bug: 1259707 Change-Id: I126d012e5b31c9c599ddb0884c28a40347dbc57d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3237247 Reviewed-by: Morten Stenshorne <[email protected]> Commit-Queue: Rune Lillesveen <[email protected]> Cr-Commit-Position: refs/heads/main@{#935098}
- Loading branch information
Showing
6 changed files
with
117 additions
and
24 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
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
42 changes: 42 additions & 0 deletions
42
...rty/blink/web_tests/wpt_internal/css/css-conditional/container-queries/top-layer-001.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,42 @@ | ||
<!doctype html> | ||
<title>@container with modal dialog child</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#container { | ||
container-type: inline-size; | ||
} | ||
dialog { | ||
color: red; | ||
} | ||
@container (max-width: 200px) { | ||
dialog { color: green; } | ||
} | ||
@container (max-width: 100px) { | ||
dialog { color: lime; } | ||
} | ||
</style> | ||
<div id="container"> | ||
<dialog id="dialog"></dialog> | ||
</div> | ||
<script> | ||
test(() => { | ||
assert_equals(getComputedStyle(dialog).color, "rgb(255, 0, 0)"); | ||
}, "#container initially wider than 200px"); | ||
|
||
test(() => { | ||
container.style.width = "200px"; | ||
assert_equals(getComputedStyle(dialog).color, "rgb(0, 128, 0)"); | ||
}, "#container changed to 200px"); | ||
|
||
test(() => { | ||
dialog.showModal(); | ||
assert_equals(getComputedStyle(dialog).color, "rgb(0, 128, 0)"); | ||
}, "Modal dialog still has parent as query container while in top layer"); | ||
|
||
test(() => { | ||
container.style.width = "100px"; | ||
assert_equals(getComputedStyle(dialog).color, "rgb(0, 255, 0)"); | ||
}, "Container changes width while dialog is in top layer"); | ||
</script> |
30 changes: 30 additions & 0 deletions
30
...rty/blink/web_tests/wpt_internal/css/css-conditional/container-queries/top-layer-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,30 @@ | ||
<!doctype html> | ||
<title>Top layer element as a @container</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#parent { width: 100px; } | ||
#dialog { | ||
container-type: inline-size; | ||
width: auto; | ||
border: none; | ||
} | ||
#child { color: red; } | ||
@container (min-width: 200px) { | ||
#child { color: green; } | ||
} | ||
</style> | ||
<div id="parent"> | ||
<dialog id="dialog"><span id="child"></span></dialog> | ||
</div> | ||
<script> | ||
test(() => { | ||
assert_equals(getComputedStyle(child).color, "rgb(255, 0, 0)"); | ||
}, "#dialog initially sized by #containing-block"); | ||
|
||
test(() => { | ||
dialog.showModal(); | ||
assert_equals(getComputedStyle(child).color, "rgb(0, 128, 0)"); | ||
}, "#dialog sized by viewport"); | ||
</script> |
3 changes: 3 additions & 0 deletions
3
...blink/web_tests/wpt_internal/css/css-conditional/container-queries/top-layer-003-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,3 @@ | ||
<!doctype html> | ||
<html style="background:green"> | ||
<title>CSS Test Reference</title> |
20 changes: 20 additions & 0 deletions
20
...rty/blink/web_tests/wpt_internal/css/css-conditional/container-queries/top-layer-003.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,20 @@ | ||
<!doctype html> | ||
<title>::backdrop depending on @container</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> | ||
<link rel="match" href="top-layer-003-ref.html"> | ||
<style> | ||
html { background: green; } | ||
#container { container-type: inline-size; } | ||
@container (max-width: 200px) { | ||
::backdrop { display: none; } | ||
#dialog { visibility: hidden; } | ||
} | ||
</style> | ||
<div id="container"> | ||
<dialog id="dialog"></dialog> | ||
</div> | ||
<script> | ||
dialog.showModal(); | ||
dialog.offsetTop; | ||
container.style.width = "100px"; | ||
</script> |