Commit 7322431b authored by David Bokan's avatar David Bokan Committed by Commit Bot

[Scroll Unification] Convert set-root-scroller to gpuBenchmarking

Moves set-root-scroller away from using eventSender to gpuBenchmarking
so that scrolling is injected at the browser level.

Bug: 1047176
Change-Id: I573206a5cb23a5ad638661b400a6f946d11e29f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220625Reviewed-by: default avatarLan Wei <lanwei@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773587}
parent 79e3665f
......@@ -96,37 +96,41 @@
// Scroll the container <div> past the end. The scrolls should not chain
// past the rootScroller to the parentScroller element.
await setRootScrollerAndCheckEffective(container, container);
if (typeof eventSender !== 'undefined') {
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollUpdate(-300, -300);
assert_equals(container.scrollTop, 2000 - 600);
assert_equals(container.scrollLeft, 2000 - 800);
// The container is now fully scrolled. Normally, further scroll
// events would chain up to the parent element but, because the
// container is the root scroller, we shouldn't chain up past it.
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
assert_equals(container.scrollTop, 2000 - 600);
assert_equals(container.scrollLeft, 2000 - 800);
assert_equals(parentScroller.scrollTop, 0);
assert_equals(parentScroller.scrollLeft, 0);
}
// We need an additional wait here since the scrolls below might happen on
// the compositor thread so we need to ensure the root scroller change has
// propagated there.
await waitForCompositorCommit();
const delta = {
x: 1500,
y: 1500
};
const location = {
x: 500,
y: 500
};
await smoothScrollWithXY(delta.x, delta.y,
location.x, location.y,
GestureSourceType.TOUCHPAD_INPUT,
SPEED_INSTANT);
assert_equals(container.scrollTop, 2000 - 600);
assert_equals(container.scrollLeft, 2000 - 800);
// The container is now fully scrolled. Normally, further scroll
// events would chain up to the parent element but, because the
// container is the root scroller, we shouldn't chain up past it.
await smoothScrollWithXY(delta.x, delta.y,
location.x, location.y,
GestureSourceType.TOUCHPAD_INPUT,
SPEED_INSTANT);
assert_equals(container.scrollTop, 2000 - 600);
assert_equals(container.scrollLeft, 2000 - 800);
assert_equals(parentScroller.scrollTop, 0);
assert_equals(parentScroller.scrollLeft, 0);
}, "Scrolls don't chain past root scroller element");
promise_test(async function() {
......@@ -147,41 +151,56 @@
}, "document.scrollingElement and window scroll API reflect rootScroller offsets");
promise_test(async function() {
// Making the current rootScroller an invalid scroller (by making it not
// fill the viewport) should fallback to the default element, the
// documentElement, but the rootScroller property should remain the same.
await setRootScrollerAndCheckEffective(container, container);
container.style.width = "95%";
// We need a compositing update since root scroller selection happens as
// part of a full lifecycle update.
window.internals.forceCompositingUpdate(document);
assert_equals(window.internals.effectiveRootScroller(document), document,
"Effective root scroller should be reset after width is modified");
assert_equals(document.rootScroller, container);
// Making the current rootScroller an invalid scroller (by making it not
// fill the viewport) should fallback to the default element, the
// documentElement, but the rootScroller property should remain the same.
await setRootScrollerAndCheckEffective(container, container);
container.style.width = "95%";
// We need a compositing update since root scroller selection happens as
// part of a full lifecycle update.
window.internals.forceCompositingUpdate(document);
assert_equals(window.internals.effectiveRootScroller(document), document,
"Effective root scroller should be reset after width is modified");
assert_equals(document.rootScroller, container);
// We need an additional wait here since the scrolls below might happen on
// the compositor thread so we need to ensure the root scroller change has
// propagated there.
await waitForCompositorCommit();
// Reset parentScroller's offsets, make container fully scrolled.
parentScroller.scrollTop = 0;
parentScroller.scrollLeft = 0;
container.scrollTop = 10000;
container.scrollLeft = 10000;
// Now scrolling over the container should bubble the scroll up to the
// scrollingElement since the rootElement is invalid (doesn't fill the
// viewport).
if (typeof eventSender !== 'undefined') {
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
assert_equals(parentScroller.scrollTop, 900);
assert_equals(parentScroller.scrollLeft, 900);
}
}, "Setting an invalid rootScroller should reset to using the documentElement.");
// Reset parentScroller's offsets, make container fully scrolled.
parentScroller.scrollTop = 0;
parentScroller.scrollLeft = 0;
container.scrollTop = 10000;
container.scrollLeft = 10000;
// Now scrolling over the container should bubble the scroll up to the
// scrollingElement since the rootElement is invalid (doesn't fill the
// viewport).
const delta = {
x: 300,
y: 300
};
const location = {
x: 500,
y: 500
};
await smoothScrollWithXY(delta.x, delta.y,
location.x, location.y,
GestureSourceType.TOUCHPAD_INPUT,
SPEED_INSTANT);
await smoothScrollWithXY(delta.x, delta.y,
location.x, location.y,
GestureSourceType.TOUCHPAD_INPUT,
SPEED_INSTANT);
await smoothScrollWithXY(delta.x, delta.y,
location.x, location.y,
GestureSourceType.TOUCHPAD_INPUT,
SPEED_INSTANT);
assert_equals(parentScroller.scrollTop, 900);
assert_equals(parentScroller.scrollLeft, 900);
}, "Setting an invalid rootScroller should reset to using the documentElement.");
</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