fune/testing/web-platform/tests/css/css-overflow/scrollable-overflow-vertical-rl-dynamic.html
Kent Tamura 564e92daf3 Bug 1791117 [wpt PR 35923] - LayoutNG: Fix scroll offset clamping in vertical-rl and RTL, a=testonly
Automatic update from web-platform-tests
LayoutNG: Fix scroll offset clamping in vertical-rl and RTL

When a vertical scrollbar in vertical-rl writing-mode or RTL direction
disappeared by updating layout, scroll offset could be wrong by scroll
offset clamping.  This CL fixes it.

A LayoutNG block should delay ClampScrollOffsetAfterOverflowChange()
calls until it determines the final state of scrollbars existence. So
we add a DelayScrollOffsetClampScope to NGBlockNode::Layout().

We should not delay ClampScrollOffsetAfterOverflowChange() called
by functions other than PaintLayerScrollableArea::UpdateAfterLayout().
This CL removes the delay capability of ClampScrollOffsetAfterOverflowChange(), and UpdateAfterLayout() calls
another delay-capable version of ClampScrollOffsetAfterOverflowChange().

The new behavior is guarded by a runtime flag, and it works as a kill
switch just in case.

This CL fixes PrintBrowserTest.NoScrollingVerticalRl in browser_tests
with LayoutNGView and LayoutNGPrinting flags enabled.

Bug: 1294155, 1366268
Change-Id: I9bb8ba80d09adea11dd95c538233720dd06a05e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891818
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1049546}

--

wpt-commits: 8b4c96ce705b94499cb9b575bdee76abd5cd06fc
wpt-pr: 35923
2022-10-05 09:30:53 +00:00

18 lines
814 B
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-overflow/#scrollbar-layout">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="container" style="width:600px; height:400px; writing-mode:vertical-rl; overflow:auto;">
<div id="target" style="width:1000px; height:500px; background:lime;"></div>
</div>
<script>
promise_test(async () => {
await new Promise(resolve => requestAnimationFrame(resolve));
await new Promise(resolve => requestAnimationFrame(resolve));
// Remove the vertical scrollbar.
document.querySelector('#target').style.height = '200px';
assert_equals(document.querySelector('#container').scrollLeft, 0);
}, 'Removing the vertical scrollbar of a vertical-rl container should keep scrollLeft');
</script>