On a paint-skip transaction, FrameMetrics::UpdatePendingScrollInfo mutates the ScrollMetadata retained from an earlier paint but left mVisualScrollUpdateType / mVisualDestination in place. AsyncPanZoomController::NotifyMainThreadTransaction then re-applied that already-consumed main-thread visual scroll update, clobbering the scroll offset the paint-skip had just applied (e.g. a scrollIntoView() followed by a deferred scrollBy() correction landing back at the anchor instead of below it). Clear the visual scroll update when applying the paint-skip scroll offset update, so the reused metadata no longer carries a stale destination. Differential Revision: https://phabricator.services.mozilla.com/D310979
36 lines
1.3 KiB
HTML
36 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
|
<title>CSSOM View - scrollIntoView() then a deferred scrollBy() correction</title>
|
|
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview">
|
|
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2053004">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/dom/events/scrolling/scroll_support.js"></script>
|
|
<div style="height: 200px;"></div>
|
|
<h1 id="a">A</h1>
|
|
<div style="height: 200vh;"></div>
|
|
|
|
<script>
|
|
const OFFSET = 80;
|
|
|
|
promise_test(async t => {
|
|
const target = document.getElementById("a");
|
|
|
|
await waitForCompositorReady();
|
|
await waitForCompositorCommit();
|
|
|
|
window.addEventListener("scroll", () => {
|
|
step_timeout(() => window.scrollBy(0, -OFFSET), 1);
|
|
}, { once: true });
|
|
|
|
target.scrollIntoView();
|
|
|
|
await waitForDelayWithoutScrollEvent(window);
|
|
await waitForCompositorCommit();
|
|
|
|
assert_equals(target.getBoundingClientRect().top, OFFSET,
|
|
"#a should rest OFFSET below the top after the deferred scrollBy()");
|
|
}, "scrollIntoView() followed by a deferred scrollBy() preserves the scroll correction");
|
|
</script>
|