Commit 7582a79f authored by Rahul Arakeri's avatar Rahul Arakeri Committed by Commit Bot

[CleanUp] for threaded-prefer-compositing.

Some tests in the virtual suite threaded-prefer-compositing will fail
when the feature is turned on by default since they run with smooth
scrolling enabled. The easy fix here would have been to simply add the
arg "--disable-smooth-scrolling" to the test suite but that will not
work since some tests under fast/scroll-behavior rely on smooth scroll
being enabled.
Additionally, disabling animated scrolling by using javascript only
works on the main thread (see bug for more info) so that isn't an
option either. This CL fixes the issue by allowing for adequate
time to finish animating by using waitForAnimationEndTimeBased.

Bug: 1038542
Change-Id: Ia5081a504cd99b3f10105f8ac20ad77ab966f063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986899
Commit-Queue: Rahul Arakeri <arakeri@microsoft.com>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742299}
parent db7b5eea
......@@ -53,13 +53,12 @@ window.onload = () => {
y: standardRectFast.top + BUTTON_WIDTH + 5
}
// TODO (arakeri): This test was moved to the top due to crbug.com/1017568. Delete the
// comment once the bug is fixed.
promise_test (async () => {
resetScrollOffset(standardDivFast);
// Click on the track part just above the down arrow.
await mouseClickOn(SCROLLBAR_BUTTON_FWD.x, SCROLLBAR_BUTTON_FWD.y - 10);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 74, "Pressing the down trackpart didn't scroll.");
}, "Test mouse click on non-custom composited div scrollbar empty trackparts.");
......@@ -78,6 +77,7 @@ window.onload = () => {
expected_offset = 46;
else
expected_offset = window.devicePixelRatio == 1 ? 71 : 73;
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, expected_offset, "Vertical thumb drag downwards did not scroll as expected.");
}, "Test mouse drags on non-custom composited div scrollbar thumb.");
......@@ -90,6 +90,7 @@ window.onload = () => {
// Click on the Down arrow for standardRectFast.
await mouseClickOn(SCROLLBAR_BUTTON_FWD.x, SCROLLBAR_BUTTON_FWD.y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 40, "Pressing the down arrow didn't scroll.");
}, "Test mouse click on non-custom composited div scrollbar arrows.");
......
......@@ -16,9 +16,6 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 2000px;
width: 2000px;
......@@ -26,8 +23,8 @@
</style>
<!-- Composited non-custom fast scroller -->
<div id="scroller" class="appearance location fast">
<!-- Composited non-custom scroller -->
<div id="scroller" class="appearance location">
<div id="divContent" class="space"></div>
</div>
......
......@@ -16,9 +16,6 @@
top: 250px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 1000px;
width: 1000px;
......@@ -42,8 +39,8 @@
}
</style>
<!-- Composited custom fast scroller -->
<div id="custom" class="appearance customLocation fast">
<!-- Composited custom scroller -->
<div id="custom" class="appearance customLocation">
<div class="space"></div>
</div>
......@@ -61,6 +58,7 @@ window.onload = () => {
await mouseMoveTo(x, y);
await mouseDownAt(x, y);
await mouseMoveTo(x, y);
await mouseUpAt(x, y);
// Testing the horizontal custom scrollbar click.
x = customRectFast.left + customRectFast.width / 2;
......@@ -69,6 +67,7 @@ window.onload = () => {
await mouseMoveTo(x, y);
await mouseDownAt(x, y);
await mouseMoveTo(x, y);
await mouseUpAt(x, y);
// Test passes if renderer did not crash.
......
......@@ -16,17 +16,14 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 150px;
width: 150px;
}
</style>
<!-- Composited non-custom fast scroller -->
<div id="standard" class="appearance standardLocation fast">
<!-- Composited non-custom scroller -->
<div id="standard" class="appearance standardLocation">
<div class="space"></div>
</div>
......@@ -58,6 +55,7 @@ window.onload = () => {
await mouseMoveTo(x, y);
assert_equals(standardDivFast.scrollTop, 0, "Vertical thumb drag beyond the track and back should not cause a scroll.");
await mouseUpAt(x, y);
}, "Test thumb drags beyond scrollbar track.");
}
</script>
......@@ -16,17 +16,14 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 1000px;
width: 1000px;
}
</style>
<!-- Composited non-custom fast scroller -->
<div id="standard" class="appearance standardLocation fast">
<!-- Composited non-custom scroller -->
<div id="standard" class="appearance standardLocation">
<div class="space"></div>
</div>
......
......@@ -16,17 +16,14 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 200px;
width: 200px;
}
</style>
<!-- Composited non-custom fast scroller -->
<div id="standard" class="appearance standardLocation fast">
<!-- Composited non-custom scroller -->
<div id="standard" class="appearance standardLocation">
<div class="space"></div>
</div>
......@@ -54,24 +51,28 @@ window.onload = () => {
let x = standardRectFast.right - BUTTON_WIDTH / 2;
let y = standardRectFast.bottom - SCROLL_CORNER - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 40, "Pressing the down arrow didn't scroll.");
// Click on the Up arrow for standardRectFast.
x = standardRectFast.right - BUTTON_WIDTH / 2;
y = standardRectFast.top + BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 0, "Pressing the up arrow didn't scroll.");
// Click on the Right arrow for standardRectFast.
x = standardRectFast.right - SCROLL_CORNER - BUTTON_WIDTH / 2;
y = standardRectFast.bottom - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollLeft;});
assert_equals(standardDivFast.scrollLeft, 40, "Pressing the right arrow didn't scroll.");
// Click on the Left arrow for standardRectFast.
x = standardRectFast.left + BUTTON_WIDTH / 2;
y = standardRectFast.bottom - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollLeft;});
assert_equals(standardDivFast.scrollLeft, 0, "Pressing the left arrow didn't scroll.");
}, "Test mouse click on non-custom composited div scrollbar arrows.");
......@@ -84,24 +85,28 @@ window.onload = () => {
let x = standardRectFast.right - BUTTON_WIDTH / 2;
let y = standardRectFast.bottom - SCROLL_CORNER - BUTTON_WIDTH - 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 74, "Pressing the down trackpart didn't scroll.");
// Click on the track part just below the up arrow.
x = standardRectFast.right - BUTTON_WIDTH / 2;
y = standardRectFast.top + BUTTON_WIDTH + 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollTop;});
assert_equals(standardDivFast.scrollTop, 0, "Pressing the up trackpart didn't scroll.");
// Click on the track part just to the left of the right arrow.
x = standardRectFast.right - SCROLL_CORNER - BUTTON_WIDTH - 2;
y = standardRectFast.bottom - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollLeft;});
assert_equals(standardDivFast.scrollLeft, 74, "Pressing the right trackpart didn't scroll.");
// Click on the track part just to the right of the left arrow.
x = standardRectFast.left + BUTTON_WIDTH + 2;
y = standardRectFast.bottom - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return standardDivFast.scrollLeft;});
assert_equals(standardDivFast.scrollLeft, 0, "Pressing the left trackpart didn't scroll.");
}, "Test mouse click on non-custom composited div scrollbar empty trackparts.");
}
......
......@@ -30,6 +30,7 @@ window.onload = () => {
await mouseMoveTo(x, y);
assert_equals(window.scrollY, 0, "Vertical thumb drag beyond the track and back should not cause a scroll.");
await mouseUpAt(x, y);
}, "Test thumb drags beyond scrollbar track.");
}
</script>
......
......@@ -13,14 +13,11 @@ window.onload = () => {
const TRACK_WIDTH = calculateScrollbarThickness();
const BUTTON_WIDTH = TRACK_WIDTH;
const SCROLL_CORNER = TRACK_WIDTH;
const SCROLL_DELTA = 100;
const onLinuxPlatform = navigator.userAgent.search(/\bLinux\b/) != -1;
const onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
promise_test (async (test) => {
// Scrollbars on Mac don't have arrows. This test is trrelevant.
if(onMacPlatform)
test.done();
// Scrollbars on Mac don't have arrows. This test is irrelevant.
if(navigator.userAgent.includes("Mac OS X"))
return;
await waitForCompositorCommit();
resetScrollOffset(document.scrollingElement);
......@@ -29,24 +26,28 @@ window.onload = () => {
let x = window.innerWidth - BUTTON_WIDTH / 2;
let y = window.innerHeight - SCROLL_CORNER - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollY;});
assert_equals(window.scrollY, 40, "Pressing the down arrow didn't scroll.");
// Click on the Up arrow of the viewport.
x = window.innerWidth - BUTTON_WIDTH / 2;
y = BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollY;});
assert_equals(window.scrollY, 0, "Pressing the up arrow didn't scroll.");
// Click on the Right arrow of the viewport.
x = window.innerWidth - SCROLL_CORNER - BUTTON_WIDTH / 2;
y = window.innerHeight - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollX;});
assert_equals(window.scrollX, 40, "Pressing the right arrow didn't scroll.");
// Click on the Left arrow of the viewport.
x = BUTTON_WIDTH / 2;
y = window.innerHeight - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollX;});
assert_equals(window.scrollX, 0, "Pressing the left arrow didn't scroll.");
}, "Test mouse click on non-custom composited root scrollbar arrows.");
......@@ -58,24 +59,28 @@ window.onload = () => {
let x = window.innerWidth - BUTTON_WIDTH / 2;
let y = window.innerHeight - SCROLL_CORNER - BUTTON_WIDTH - 2;
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollY;});
assert_equals(window.scrollY, 431, "Pressing the down trackpart didn't scroll.");
// Click on the track part just below the up arrow.
x = window.innerWidth - BUTTON_WIDTH / 2;
y = BUTTON_WIDTH + 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollY;});
assert_equals(window.scrollY, 0, "Pressing the up trackpart didn't scroll.");
// Click on the track part just to the left of the right arrow.
x = window.innerWidth - SCROLL_CORNER - BUTTON_WIDTH - 2;
y = window.innerHeight - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollX;});
assert_equals(window.scrollX, 223, "Pressing the right trackpart didn't scroll.");
// Click on the track part just to the right of the left arrow.
x = BUTTON_WIDTH + 2;
y = window.innerHeight - BUTTON_WIDTH / 2;
await mouseClickOn(x, y);
await mouseClickOn(x, y);
await waitForAnimationEndTimeBased(() => {return window.scrollX;});
assert_equals(window.scrollX, 0, "Pressing the left trackpart didn't scroll.");
}, "Test mouse click on non-custom composited root scrollbar empty trackparts.");
}
......
......@@ -16,9 +16,6 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 1000px;
width: 1000px;
......@@ -26,7 +23,7 @@
</style>
<div id="root" class="space"></div>
<div id="standard" class="appearance standardLocation fast">
<div id="standard" class="appearance standardLocation">
<div class="space"></div>
</div>
......
......@@ -31,9 +31,9 @@ promise_test(async (test) => {
// This specifically tests the impact of clicking the scrollbar button
// when scroller is at max offset. Since Mac scrollbars don't have any
// buttons, this test is irrelevant.
if(navigator.userAgent.search(/\bMac OS X\b/) != -1) {
test.done();
}
if(navigator.userAgent.search(/\bMac OS X\b/) != -1)
return;
// Scroll the subscroller to the end, on the y-axis
let subscroller = document.querySelector(".subscroller");
subscroller.scrollTo(0, 400);
......
......@@ -16,9 +16,6 @@
top: 100px;
left: 100px;
}
.fast {
will-change: transform;
}
.space {
height: 2000px;
width: 2000px;
......@@ -32,13 +29,13 @@
}
</style>
<!-- Composited non-custom fast scroller -->
<!-- Composited non-custom scroller -->
<div id="scroller" class="appearance location">
<div id="divContent" class="space"></div>
</div>
<!-- Add a div that partially occludes the composited scrollbar. -->
<div id="occlusion_div" class="occlude appearance fast">
<div id="occlusion_div" class="occlude appearance">
</div>
<script>
......@@ -51,7 +48,6 @@
const TRACK_WIDTH = calculateScrollbarThickness();
const BUTTON_WIDTH = TRACK_WIDTH;
const SCROLL_CORNER = TRACK_WIDTH;
const PRESS_DURATION = 500;
const onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
// This tests that interacting with a composited scrollbar that is
......@@ -62,7 +58,7 @@
// Click on the down arrow (which should now be occluded by the div).
const down_arrow_x = scrollerRect.right - BUTTON_WIDTH / 2;
const down_arrow_y = scrollerRect.bottom - SCROLL_CORNER - BUTTON_WIDTH / 2;
await mousePressOn(down_arrow_x, down_arrow_y, PRESS_DURATION);
await mouseClickOn(down_arrow_x, down_arrow_y);
// Expect that the scrolling doesn't happen.
assert_equals(scroller.scrollTop, 0, "Clicking on an occluded scrollbar shouldn't scroll");
......@@ -72,6 +68,7 @@
await mouseClickOn(down_arrow_x, down_arrow_y);
const expected = onMacPlatform ? 74 : 40;
const pressedPart = onMacPlatform ? "track" : "down arrow";
await waitForAnimationEndTimeBased(() => {return scroller.scrollTop;});
assert_equals(scroller.scrollTop, expected, "Pressing the " + pressedPart + " didn't scroll.");
},"Test hit-testing when scrollbar is occluded.");
</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