Files
tubestation/testing/web-platform/tests/layout-instability/pointerdown-becomes-scroll.html
Lan Wei 37e65057c2 Bug 1710777 [wpt PR 28968] - Revert "Count uncanceled pointermove as "input" for hadRecentIinput", a=testonly
Automatic update from web-platform-tests
Revert "Count uncanceled pointermove as "input" for hadRecentIinput"

This reverts commit 7adc232296397071ddfc56ee27176ccd2986a727.

Reason for revert:
LayoutShiftTracker is reporting the correct layout shift score for touch dragging/resizing.

Original change's description:
> Count uncanceled pointermove as "input" for hadRecentIinput
>
> We should not count the layout shift while doing touch dragging or
> resizing widgets. While doing touch dragging, we send out pointermove
> events, and we do not send pointercancel event. Touch scrolling sends out
> pointercancel event to cancel all the active touch pointers and does not
> send any more pointermove events when the scroll starts. Therefore, we
> add the uncanceled pointermove to the event list that trigger the
> exclusion window, which sets hadRecentInput to be true, then we do not
> compute the cumulative layout shift score for touch dragging actions.
>
> Bug: 1166952
> Change-Id: Ieaaf8a2f5549f078585b706dae34bfbbbd8c501c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2824368
> Reviewed-by: Steve Kobes <skobes@chromium.org>
> Commit-Queue: Lan Wei <lanwei@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#876440}

Bug: 1166952
Change-Id: Id2f3864976f96767ee459854a39afe50d5a46fa6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2890397
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#882060}

--

wpt-commits: f0e7dd723439b14794e299548ca6b86fea9d410c
wpt-pr: 28968
2021-05-14 04:50:38 +00:00

63 lines
1.8 KiB
HTML

<!DOCTYPE html>
<title>Layout Instability: shift in pointerdown becoming scroll</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" />
<style>
body { margin: 0; height: 2000px; }
#box {
left: 0px;
top: 0px;
width: 400px;
height: 500px;
background: yellow;
position: relative;
}
</style>
<div id="box"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/util.js"></script>
<script>
const box = document.querySelector("#box");
box.addEventListener("pointerdown", (e) => {
// Generate a layout shift before we know what type of input this pointer
// event sequence will become.
box.style.top = "100px";
e.preventDefault();
});
generateScrollSequence = () => new test_driver.Actions()
.addPointer("tp1", "touch")
.pointerMove(0, 100, {sourceName: "tp1"})
.pointerDown({sourceName: "tp1"})
.pointerMove(0, 0, {sourceName: "tp1"})
.pause(100)
.pointerUp({sourceName: "tp1"})
.pause(100);
promise_test(async () => {
const watcher = new ScoreWatcher;
// Wait for the initial render to complete.
await waitForAnimationFrames(2);
// Send pointer events for a touch scroll.
await generateScrollSequence().send();
// The box is 400 x 500 and moves by 100px.
const expectedScore = computeExpectedScore(400 * (500 + 100), 100);
// Both scores should increase (scroll doesn't count as input for the purpose
// of the LayoutShift.hadRecentInput bit).
assert_equals(watcher.score, expectedScore);
assert_equals(watcher.scoreWithInputExclusion, expectedScore);
}, "Shift in pointerdown reported when it becomes a scroll.");
</script>