fune/testing/web-platform/tests/css/css-scroll-snap/snap-at-user-scroll-end-manual.html
Sandra Sun 5cbd571607 Bug 1475733 [wpt PR 11970] - Reland "Correctly initialize and test SnapContainerData in cc.", a=testonly
Automatic update from web-platform-testsReland "Correctly initialize and test SnapContainerData in cc."

This reverts commit 0fc70abb02f52598f0f98eafd7001490545bc0c9.

This patch increases the no-animation wait time to reduce
flakiness.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Correctly initialize and test SnapContainerData in cc."
>
> This reverts commit 37061f875b167ab82f1a0ddca84b510b7c6802dc.
>
> Reason for revert:
> The layout tests added by this CL is failing on the CL:
> https://ci.chromium.org/buildbot/chromium.webkit/WebKit%20Win10/37804
>
> Original change's description:
> > Correctly initialize and test SnapContainerData in cc.
> >
> > This patch initializes the rect_ field in SnapContainerData in copy
> > constructor and move constructor. Fixing a snapping issue in the
> > composited pages.
> >
> > We also adds external/wpt/css/css-scroll-snap/ to the virtual/threaded
> > test suite so that they are tested with the composited cases.
> >
> > snap-at-user-scroll-end-manual-automation.js calls
> > mouseClickInTarget() of pointerevent_common_input.js. That method
> > invokes programmatic scrolls. The test was written before programmatic
> > scroll snapping was implemented so it worked at that time. However,
> > with programmatic scroll snapping implemented, it will always snap
> > in mouseClickIntarget() and cannot test whether the user scroll snaps.
> > This patch adds a parameter shouldScrollToTarget to mouseClickInTarget
> > to avoid invoking programmatic scrolls in the test.
> >
> > This patch also checks nullptr for layout_box in
> > ScrollManager::SnapAtGestureScrollEnd() to fix a crash.
> >
> > Bug: 862406, 862571
> > Cq-Include-Trybots: luci.chromium.try :android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
> > Change-Id: I6a53818cf74421a4100ad6f908158abf302a5b8e
> > Reviewed-on: https://chromium-review.googlesource.com/1132386
> > Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
> > Reviewed-by: Majid Valipour <majidvp@chromium.org>
> > Reviewed-by: Robert Flack <flackr@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#574781}
>
> TBR=flackr@chromium.org,majidvp@chromium.org,sunyunjia@chromium.org
>
> Change-Id: I55c77c05c0381c8ac638bd106d2d18b1b4332745
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try : true
> Bug: 862406, 862571
> Cq-Include-Trybots: luci.chromium.try :android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
> Reviewed-on: https://chromium-review.googlesource.com/1136171
> Reviewed-by: Taiju Tsuiki <tzik@chromium.org>
> Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#574825}

TBR=flackr@chromium.org,majidvp@chromium.org,sunyunjia@chromium.org,tzik@chromium.org

Change-Id: I85550f6f01b2466d8ceb03e44c15253079a5059c
No-Presubmit: true
No-Tree-Checks: true
No-Try : true
Bug: 862406, 862571
Cq-Include-Trybots: luci.chromium.try :android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Reviewed-on: https://chromium-review.googlesource.com/1136613
Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
Reviewed-by: Sandra Sun <sunyunjia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574983}

--

wpt-commits: 8c497bd26ebfbd719dfcc580bc945e4e4cf6bce0
wpt-pr: 11970
MozReview-Commit-ID: XsdftlySZA
2018-07-29 18:45:57 +01:00

87 lines
2.3 KiB
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1" />
<title>Tests that window should snap at user scroll end.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
margin: 0px;
overflow: scroll;
scroll-snap-type: both mandatory;
}
#content {
width: 2000px;
height: 2000px;
padding: 0px;
margin: 0px;
}
#target {
position: relative;
left: 400px;
top: 400px;
width: 400px;
height: 400px;
background-color: lightblue;
scroll-snap-align: start;
}
#i1 {
color: red;
font-weight: bold;
}
</style>
<div id="content">
<div id="target">
<h1>CSSScrollSnap</h1>
<h4>Tests that the window can snap at user scroll end.</h4>
<ol>
<li id="i1" style="color: red">
Scroll the page vertically and horizontally.
Keep scrolling until background has turned yellow.</li>
<li id="i2"> Press the button "Done"</li>
</ol>
<input type="button" id="btn" value="DONE" style="width: 100px; height: 50px;"/>
</div>
</div>
<script>
var snap_test = async_test('Tests that window should snap at user scroll end.');
var body = document.body;
var button = document.getElementById("btn");
var target = document.getElementById("target");
var instruction1 = document.getElementById("i1");
var instruction2 = document.getElementById("i2");
var scrolled_x = false;
var scrolled_y = false;
var start_x = window.scrollX;
var start_y = window.scrollY;
window.onscroll = function() {
if (scrolled_x && scrolled_y) {
body.style.backgroundColor = "yellow";
instruction1.style.color = "black";
instruction1.style.fontWeight = "normal";
instruction2.style.color = "red";
instruction2.style.fontWeight = "bold";
return;
}
scrolled_x |= window.scrollX != start_x;
scrolled_y |= window.scrollY != start_y;
}
button.onclick = function() {
if (!scrolled_x || !scrolled_y)
return;
assert_equals(window.scrollX, target.offsetLeft,
"window.scrollX should be at snapped position.");
assert_equals(window.scrollY, target.offsetTop,
"window.scrollY should be at snapped position.");
// To make the test result visible.
var content = document.getElementById("content");
body.removeChild(content);
snap_test.done();
}
</script>