forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@container] Add support for scroll-state(overflowing) axis
Add new values for matching axis instead of edge for overflowing: block, inline, x, y. These are convenience keywords. For instance: scroll-state(overflowing: x) is the same as: scroll-state((overflowing: left) or (overflowing: right)) Based on request in [1] [1] w3c/csswg-drafts#11183 Bug: 367764865 Change-Id: I125db5e5eced86da6404aa0bc5469830278d0ca9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6022915 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1386111}
- Loading branch information
1 parent
6b5196d
commit d486856
Showing
2 changed files
with
71 additions
and
0 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
67 changes: 67 additions & 0 deletions
67
css/css-conditional/container-queries/scroll-state/scroll-state-overflowing-axis.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,67 @@ | ||
<!DOCTYPE html> | ||
<title>@container: scroll-state(overflowing) axis matching</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#overflowing"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script> | ||
<script src="/css/css-transitions/support/helper.js"></script> | ||
<style> | ||
.scroller { | ||
writing-mode: vertical-lr; | ||
width: 200px; | ||
height: 200px; | ||
container-type: scroll-state; | ||
overflow: scroll; | ||
} | ||
.scroller.horizontal::after { | ||
content: " "; | ||
display: block; | ||
width: 10000px; | ||
height: 10px; | ||
} | ||
.scroller.vertical::after { | ||
content: " "; | ||
display: block; | ||
width: 10px; | ||
height: 10000px; | ||
} | ||
span { | ||
--inline: no; | ||
--block: no; | ||
--x: no; | ||
--y: no; | ||
} | ||
@container scroll-state(overflowing: inline) { | ||
span { --inline: yes; } | ||
} | ||
@container scroll-state(overflowing: block) { | ||
span { --block: yes; } | ||
} | ||
@container scroll-state(overflowing: x) { | ||
span { --x: yes; } | ||
} | ||
@container scroll-state(overflowing: y) { | ||
span { --y: yes; } | ||
} | ||
</style> | ||
<div class="horizontal scroller"><span id="t1"></span></div> | ||
<div class="vertical scroller"><span id="t2"></span></div> | ||
<script> | ||
setup(() => assert_implements_scroll_state_container_queries()); | ||
|
||
promise_test(async t => { | ||
await waitForAnimationFrames(2); | ||
assert_equals(getComputedStyle(t1).getPropertyValue("--x"), "yes", "x-axis"); | ||
assert_equals(getComputedStyle(t1).getPropertyValue("--y"), "no", "y-axis"); | ||
assert_equals(getComputedStyle(t1).getPropertyValue("--block"), "yes", "block-axis"); | ||
assert_equals(getComputedStyle(t1).getPropertyValue("--inline"), "no", "inline-axis"); | ||
}, "Horizontal scroller with orthogonal writing mode"); | ||
|
||
promise_test(async t => { | ||
assert_equals(getComputedStyle(t2).getPropertyValue("--x"), "no", "x-axis"); | ||
assert_equals(getComputedStyle(t2).getPropertyValue("--y"), "yes", "y-axis"); | ||
assert_equals(getComputedStyle(t2).getPropertyValue("--block"), "no", "block-axis"); | ||
assert_equals(getComputedStyle(t2).getPropertyValue("--inline"), "yes", "inline-axis"); | ||
}, "Vertical scroller with orthogonal writing mode"); | ||
|
||
</script> |