Automatic update from web-platform-tests Enforce scroll axis constraints in single-axis containers The SingleAxisScrollContainers feature allows containers to be configured to scroll along only one axis via CSS overflow properties. Previously, scroll APIs like scrollTo and scrollIntoView did not respect these constraints and would incorrectly apply offsets to both axes. This change updates PaintLayerScrollableArea to accurately reflect single-axis scrollability. The scrollable delta for the maximum scroll offset is now set to zero for non-scrollable axes. Adds tests to ensure scrollIntoView and style changes to single-axis scroll container work as expected. Fixed: 496515802 Change-Id: I7cfa72d64feceb0daf060dc77754acf1a0799ee0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7702333 Auto-Submit: Free Debreuil <freedebreuil@google.com> Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: Free Debreuil <freedebreuil@google.com> Cr-Commit-Position: refs/heads/main@{#1614582} -- wpt-commits: 2ae012c5ca1d0c85a886e0ff797d44193f78f8b0 wpt-pr: 58878
52 lines
1.5 KiB
HTML
52 lines
1.5 KiB
HTML
<!doctype html>
|
|
<meta charset="utf-8">
|
|
<title>Single-axis scroll containers clamp disabled axes on dynamic style changes</title>
|
|
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollto">
|
|
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth">
|
|
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollheight">
|
|
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5572">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
}
|
|
|
|
#scroller {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100px;
|
|
height: 100px;
|
|
overflow: hidden;
|
|
scrollbar-width: none;
|
|
}
|
|
|
|
#content {
|
|
width: 300px;
|
|
height: 300px;
|
|
}
|
|
</style>
|
|
<div id="log"></div>
|
|
<div id="scroller"><div id="content"></div></div>
|
|
<script>
|
|
test(() => {
|
|
const scroller = document.getElementById('scroller');
|
|
|
|
assert_equals(scroller.scrollWidth, 300);
|
|
assert_equals(scroller.scrollHeight, 300);
|
|
|
|
scroller.scrollTo(40, 50);
|
|
assert_equals(scroller.scrollLeft, 40);
|
|
assert_equals(scroller.scrollTop, 50);
|
|
|
|
scroller.style.overflowX = 'scroll';
|
|
scroller.style.overflowY = 'clip';
|
|
|
|
assert_equals(scroller.scrollLeft, 40);
|
|
assert_equals(scroller.scrollTop, 0);
|
|
assert_equals(scroller.scrollWidth, 300);
|
|
assert_equals(scroller.scrollHeight, 300);
|
|
}, 'changing from overflow: hidden to a single-axis scroller clamps the disabled axis and its scroll dimensions');
|
|
</script>
|