Commit ea5528d3 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Fix wheel-scroll-latching-on-scrollbar.html

This test wants to check scrolling over a scrollbar but was scrolling
over the scroll corner instead. The scroll corner is considered part of
the scroller when scrolling from the main thread but not when scrolling
from the compositor thread. This CL move the point to be over the
scrollbar so that the test has consistent behavior on main and
compositor threads. We also move it to fast/scrolling so it gets test
coverage on both threads.

Some cleanup has broken rename detection in Gerrit. See Base->PS1 for
rename and above change. PS1->PS2 makes the test more readable.

Bug: 915926,1090860
Change-Id: I25afd7c214505d38c08e456496d5bfa5a47ee74b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442353Reviewed-by: default avatarLiviu Tinta <liviutinta@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812674}
parent a0d469cd
<!DOCTYPE HTML> <!DOCTYPE HTML>
<script src='../../../resources/gesture-util.js'></script> <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>
<style> <style>
body { body {
...@@ -46,39 +46,14 @@ var parentDiv = document.getElementById('parentDiv'); ...@@ -46,39 +46,14 @@ var parentDiv = document.getElementById('parentDiv');
var rect = childDiv.getBoundingClientRect(); var rect = childDiv.getBoundingClientRect();
const GESTURE_SOURCE_TYPE = GestureSourceType.MOUSE_INPUT; const GESTURE_SOURCE_TYPE = GestureSourceType.MOUSE_INPUT;
const MAX_RAF = 1000; promise_test(async t => {
function waitForAnimationEnd() { await smoothScroll(1000, rect.right - 5, rect.bottom - 25, GESTURE_SOURCE_TYPE, 'down', 4000);
var last_child_scroll_offset = childDiv.scrollTop; await waitForAnimationEndTimeBased( () => { return childDiv.scrollTop; } );
var last_parent_scroll_offset = parentDiv.scrollTop; await waitForAnimationEndTimeBased( () => { return parentDiv.scrollTop; } );
var last_changed_count = 0;
return new Promise((resolve, reject) => {
function tick(raf_count) {
// We requestAnimationFrame either for 1000 frames or until 20 frames with
// no change have been observed.
if (raf_count >= MAX_RAF || raf_count - last_changed_count > 20) {
resolve();
} else {
if (childDiv.scrollTop != last_child_scroll_offset ||
parentDiv.scrollTop != last_parent_scroll_offset) {
last_changed_count = raf_count;
last_child_scroll_offset = childDiv.scrollTop;
last_parent_scroll_offset = parentDiv.scrollTop;
}
requestAnimationFrame(tick.bind(this, raf_count + 1));
}
}
tick(0);
});
}
promise_test(t => { assert_equals(childDiv.scrollTop, childDiv.scrollHeight - childDiv.clientHeight,
return smoothScroll(1000, rect.right - 5, rect.bottom - 5, GESTURE_SOURCE_TYPE, 'down', 4000) "childDiv must be fully scrolled");
.then(waitForAnimationEnd) assert_equals(parentDiv.scrollTop, 0, "parentDiv shouldn't scroll at all");
.then(() => {
assert_equals(childDiv.scrollTop, childDiv.scrollHeight - childDiv.clientHeight,
"childDiv must be fully scrolled");
assert_equals(parentDiv.scrollTop, 0, "parentDiv shouldn't scroll at all");
});
}, "Scrolling on scrollbar of the child div doesn't propagate to the parent."); }, "Scrolling on scrollbar of the child div doesn't propagate to the parent.");
</script> </script>
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