Commit 362ca055 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Improve autoscroll-iframe-no-scrolling.html

The behavior in this test differs based on main thread and compositor
thread scrolling. On the compositor thread, only the direct-most hit
scroller is targeted for autoscrolling but the main thread will bubble
up to the first scroller that can consume the scroll. See the
autoscroll-related comment in LayerTreeHostImpl::FindNodeToLatch.

The compositor behavior is the intended one, see
https://crrev.com/c/1743028 which implemented this behavior on both
threads and added a test that was unfortunately removed in
https://crrev.com/c/2111831. The test in this CL covers this case just
as well so we just move it to fast/scrolling to ensure it gets coverage
on both compositor and main threads.

Bug: 915926,1112183
Change-Id: I2dcc4e83d30dbc222cefc1781b5ecf46b20a3f85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441941Reviewed-by: default avatarRahul Arakeri <arakeri@microsoft.com>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812830}
parent 656e0e67
......@@ -299,7 +299,6 @@ crbug.com/874695 fast/css-grid-layout/crash-large-positions.html [ Slow ]
crbug.com/874695 fast/dnd/dropEffect-for-link.html [ Slow ]
crbug.com/874695 fast/dom/HTMLLinkElement/link-preload-unused.html [ Slow ]
crbug.com/874695 fast/dom/timer-throttling-hidden-page.html [ Slow ]
crbug.com/874695 fast/events/autoscroll-iframe-no-scrolling.html [ Slow ]
crbug.com/874695 fast/events/frame-detached-in-mousedown.html [ Slow ]
crbug.com/874695 fast/events/popup-blocking-timers4.html [ Slow ]
crbug.com/874695 fast/forms/color/* [ Slow ]
......@@ -310,6 +309,7 @@ crbug.com/874695 fast/media/mq-color-gamut-picture.html [ Slow ]
crbug.com/874695 fast/peerconnection/RTCPeerConnection-many.html [ Slow ]
crbug.com/874695 fast/peerconnection/RTCRtpSender-setParameters.html [ Slow ]
crbug.com/874695 fast/scroll-behavior/overscroll-behavior.html [ Slow ]
crbug.com/874695 fast/scrolling/autoscroll-iframe-no-scrolling.html [ Slow ]
crbug.com/874695 fast/table/multiple-captions-crash3.html [ Slow ]
crbug.com/874695 fast/table/multiple-captions-crash4.html [ Slow ]
crbug.com/874695 fast/webgl/canvas-toDataURL-crash.html [ Slow ]
......
......@@ -5315,7 +5315,6 @@ crbug.com/1044137 [ Mac ] fast/scrolling/no-hover-during-smooth-keyboard-scroll.
crbug.com/862589 virtual/threaded/fast/idle-callback/long_idle_periods.html [ Timeout Pass ]
# fast/events/middleClickAutoscroll-* are failing on Mac
crbug.com/874162 [ Mac ] fast/events/autoscroll-iframe-no-scrolling.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-click-hyperlink.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-click.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-drag.html [ Skip ]
......@@ -5328,6 +5327,9 @@ crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-nested-divs-forbidden
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-nested-divs.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/selection-autoscroll-borderbelt.html [ Skip ]
# Passes in threaded mode, fails without it. This is a real bug.
crbug.com/1112183 fast/scrolling/autoscroll-iframe-no-scrolling.html [ Failure ]
# Sheriff 2018-09-10
crbug.com/881207 fast/js/regress/splice-to-remove.html [ Timeout Pass ]
......
<!DOCTYPE HTML>
<script src="../../resources/gesture-util.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script>
......@@ -21,9 +22,8 @@
This test ensures that autoscrolling doesn't scroll an iframe that's marked
as unscrollable via `scrolling="no"`. To test manually, fully scroll the blue
inner scroller and use middle click autoscroll (Windows feature) from the
inner blue scroller to scroll downwards until the main window begins to
scroll. This test passes if the iframe that contains the blue scroller
doesn't scroll.
inner blue scroller or the rest of the iframe to scroll downwards. This test
passes if the iframe that contains the blue scroller doesn't scroll.
</p>
<iframe id="scrollable" scrolling="no" srcdoc="
<!DOCTYPE html>
......@@ -67,41 +67,35 @@ function autoScroll(start_x, start_y, end_x, end_y) {
});
}
function waitForScrollAndCheck() {
return new Promise((resolve, reject) => {
function tick(frames) {
// Wait until the scroll bubbles up to the main window or the iframe scrolls.
if (window.scrollY > 0 || scrollable.contentWindow.scrollY > 0)
resolve();
else
requestAnimationFrame(tick.bind(this, frames + 1));
}
tick(0);
});
}
window.addEventListener('load', () => {
var inner_scroller = frames[0].document.getElementById('scroller');
inner_scroller.scrollTop = 1000;
promise_test(t => {
promise_test(async t => {
const MIDDLE_CLICK_AUTOSCROLL_RADIUS = 15; // from blink::kNoMiddleClickAutoscrollRadius
var rect = scrollable.getBoundingClientRect();
var startX = rect.left + 50;
var startY = rect.top + 50;
var endX = startX;
var endY = startY + 5 * MIDDLE_CLICK_AUTOSCROLL_RADIUS;
var endY = startY + 30 * MIDDLE_CLICK_AUTOSCROLL_RADIUS;
assert_equals(inner_scroller.scrollTop,
inner_scroller.scrollHeight - inner_scroller.clientHeight,
"Inner scroller starts fully scrolled.");
assert_equals(window.scrollY, 0, "Main window starts unscrolled.");
assert_equals(frames[0].window.scrollY, 0, "IFrame starts unscrolled.");
return autoScroll(startX, startY, endX, endY)
.then(waitForScrollAndCheck)
.then(() => {
assert_greater_than(window.scrollY, 0, "Main window must be scrolled.");
assert_equals(frames[0].window.scrollY, 0, "IFrame must NOT scroll.");
});
// Autoscroll over the inner scroller.
await autoScroll(startX, startY, endX, endY);
await waitForAnimationEndTimeBased( () => { return window.scrollY; } );
assert_equals(window.scrollY, 0, "Main frame should not scroll");
// Autoscroll over the iframe.
startX = rect.right - 20;
endX = startX;
await autoScroll(startX, startY, endX, endY);
await waitForAnimationEndTimeBased( () => { return window.scrollY; } );
assert_equals(window.scrollY, 0, "Main frame should not scroll");
assert_equals(frames[0].window.scrollY, 0, "IFrame must NOT scroll.");
});
});
......
......@@ -134,7 +134,7 @@ function waitForAnimationEndTimeBased(getValue) {
}
if (cur_time - START_TIME > TIMEOUT_MS) {
reject();
reject(new Error("Timeout waiting for animation to end"));
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment