Skip to content

Commit

Permalink
[@container] Add support for scroll-state(overflowing) axis
Browse files Browse the repository at this point in the history
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
lilles authored and chromium-wpt-export-bot committed Nov 21, 2024
1 parent 6b5196d commit d486856
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
test_cq_condition_known('scroll-state(overflowing: inline-end)');
test_cq_condition_known('scroll-state(overflowing: block-start)');
test_cq_condition_known('scroll-state(overflowing: block-end)');
test_cq_condition_known('scroll-state(overflowing: block)');
test_cq_condition_known('scroll-state(overflowing: x)');
test_cq_condition_known('scroll-state(overflowing: y)');
test_cq_condition_known('scroll-state(overflowing: inline)');
test_cq_condition_known('(scroll-state(overflowing: inline-end))');
test_cq_condition_known('scroll-state((overflowing: left))');
test_cq_condition_known('scroll-state(not ((overflowing: bottom) and (overflowing: right)))');
Expand Down
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>

0 comments on commit d486856

Please sign in to comment.