fune/testing/web-platform/tests/css/css-anchor-position/position-visibility-no-overflow-scroll-ref.html
Xianzhu Wang 0c638eb152 Bug 1889248 [wpt PR 45478] - [css-anchor-position] Fix position fallback for scroll container of anchored, a=testonly
Automatic update from web-platform-tests
[css-anchor-position] Fix position fallback for scroll container of anchored

Scroll of the scroll container of an anchored element may affect
overflow status of the anchored element, though the scroll offset
doesn't contribute to the scroll adjustment. We need to invalidate
layout if such a scroll may affect the overflow status (which requires
NonOverflowingScrollRange to consider the scroll container), and
consider the scroll offset when calculating overflow of the anchored
element in TryCalculateOffset().

Bug: 331393773
Change-Id: I82f70b459f63d98a4b04899dee0c188bee2c8b46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5416013
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1282797}

--

wpt-commits: cb512d7a0baf0672324548042b6809e48a213745
wpt-pr: 45478
2024-04-10 09:26:44 +00:00

30 lines
621 B
HTML

<!DOCTYPE html>
<style>
#scroll-container {
overflow: hidden scroll;
width: 400px;
height: 150px;
}
.anchor {
width: 100px;
height: 100px;
background: orange;
display: inline-block;
}
.target {
width: 100px;
height: 100px;
}
</style>
<div id="scroll-container">
<div class="anchor">anchor1</div>
<div class="anchor" style="position: relative; top: 100px">anchor2</div>
<div id="target1" class="target" style="background: green">target1</div>
<div style="height: 200px"></div>
</div>
<script>
document.getElementById('scroll-container').scrollTop = 50;
</script>