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 ] ...@@ -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/dnd/dropEffect-for-link.html [ Slow ]
crbug.com/874695 fast/dom/HTMLLinkElement/link-preload-unused.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/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/frame-detached-in-mousedown.html [ Slow ]
crbug.com/874695 fast/events/popup-blocking-timers4.html [ Slow ] crbug.com/874695 fast/events/popup-blocking-timers4.html [ Slow ]
crbug.com/874695 fast/forms/color/* [ Slow ] crbug.com/874695 fast/forms/color/* [ Slow ]
...@@ -310,6 +309,7 @@ crbug.com/874695 fast/media/mq-color-gamut-picture.html [ 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/RTCPeerConnection-many.html [ Slow ]
crbug.com/874695 fast/peerconnection/RTCRtpSender-setParameters.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/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-crash3.html [ Slow ]
crbug.com/874695 fast/table/multiple-captions-crash4.html [ Slow ] crbug.com/874695 fast/table/multiple-captions-crash4.html [ Slow ]
crbug.com/874695 fast/webgl/canvas-toDataURL-crash.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. ...@@ -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 ] crbug.com/862589 virtual/threaded/fast/idle-callback/long_idle_periods.html [ Timeout Pass ]
# fast/events/middleClickAutoscroll-* are failing on Mac # 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-hyperlink.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-click.html [ Skip ] crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-click.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-drag.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 ...@@ -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/middleClickAutoscroll-nested-divs.html [ Skip ]
crbug.com/874162 [ Mac ] fast/events/selection-autoscroll-borderbelt.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 # Sheriff 2018-09-10
crbug.com/881207 fast/js/regress/splice-to-remove.html [ Timeout Pass ] crbug.com/881207 fast/js/regress/splice-to-remove.html [ Timeout Pass ]
......
<!DOCTYPE HTML> <!DOCTYPE HTML>
<script src="../../resources/gesture-util.js"></script>
<script src="../../resources/testharness.js"></script> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script> <script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script> <script src="../../resources/compositor-controls.js"></script>
...@@ -21,9 +22,8 @@ ...@@ -21,9 +22,8 @@
This test ensures that autoscrolling doesn't scroll an iframe that's marked 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 as unscrollable via `scrolling="no"`. To test manually, fully scroll the blue
inner scroller and use middle click autoscroll (Windows feature) from the inner scroller and use middle click autoscroll (Windows feature) from the
inner blue scroller to scroll downwards until the main window begins to inner blue scroller or the rest of the iframe to scroll downwards. This test
scroll. This test passes if the iframe that contains the blue scroller passes if the iframe that contains the blue scroller doesn't scroll.
doesn't scroll.
</p> </p>
<iframe id="scrollable" scrolling="no" srcdoc=" <iframe id="scrollable" scrolling="no" srcdoc="
<!DOCTYPE html> <!DOCTYPE html>
...@@ -67,41 +67,35 @@ function autoScroll(start_x, start_y, end_x, end_y) { ...@@ -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', () => { window.addEventListener('load', () => {
var inner_scroller = frames[0].document.getElementById('scroller'); var inner_scroller = frames[0].document.getElementById('scroller');
inner_scroller.scrollTop = 1000; inner_scroller.scrollTop = 1000;
promise_test(t => { promise_test(async t => {
const MIDDLE_CLICK_AUTOSCROLL_RADIUS = 15; // from blink::kNoMiddleClickAutoscrollRadius const MIDDLE_CLICK_AUTOSCROLL_RADIUS = 15; // from blink::kNoMiddleClickAutoscrollRadius
var rect = scrollable.getBoundingClientRect(); var rect = scrollable.getBoundingClientRect();
var startX = rect.left + 50; var startX = rect.left + 50;
var startY = rect.top + 50; var startY = rect.top + 50;
var endX = startX; var endX = startX;
var endY = startY + 5 * MIDDLE_CLICK_AUTOSCROLL_RADIUS; var endY = startY + 30 * MIDDLE_CLICK_AUTOSCROLL_RADIUS;
assert_equals(inner_scroller.scrollTop, assert_equals(inner_scroller.scrollTop,
inner_scroller.scrollHeight - inner_scroller.clientHeight, inner_scroller.scrollHeight - inner_scroller.clientHeight,
"Inner scroller starts fully scrolled."); "Inner scroller starts fully scrolled.");
assert_equals(window.scrollY, 0, "Main window starts unscrolled."); assert_equals(window.scrollY, 0, "Main window starts unscrolled.");
assert_equals(frames[0].window.scrollY, 0, "IFrame starts unscrolled."); assert_equals(frames[0].window.scrollY, 0, "IFrame starts unscrolled.");
return autoScroll(startX, startY, endX, endY) // Autoscroll over the inner scroller.
.then(waitForScrollAndCheck) await autoScroll(startX, startY, endX, endY);
.then(() => { await waitForAnimationEndTimeBased( () => { return window.scrollY; } );
assert_greater_than(window.scrollY, 0, "Main window must be scrolled."); assert_equals(window.scrollY, 0, "Main frame should not scroll");
assert_equals(frames[0].window.scrollY, 0, "IFrame must 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) { ...@@ -134,7 +134,7 @@ function waitForAnimationEndTimeBased(getValue) {
} }
if (cur_time - START_TIME > TIMEOUT_MS) { if (cur_time - START_TIME > TIMEOUT_MS) {
reject(); reject(new Error("Timeout waiting for animation to end"));
return; 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