Skip to content

Commit

Permalink
Avoid overflowing snap areas in scrollTo wpt tests
Browse files Browse the repository at this point in the history
Some tests in scrollTo-scrollBy-snaps.html are failing on wpt dashboard.
This is caused by the uncertainty of the window size for testharness
tests. If the window size becomes small enough that the snap area covers
the snapport, the expected snap position is ignored because any scroll
position is considered a valid snap position. This patch changes the
landing position of scrollTo and scrollBy for failing cases so that the
snap area does not cover ths snapport regardless of the window size.

More specifically, the snap area's vertical and horizontal dimensions
are 600px each thus covering the [1000, 1600] range with expected snap
position at 1000. Previously if the test vertically scrolled to 1200 and
the window's size is smaller than 400, the snap area will cover the
window. Now the test scrolls to 900 (100px before the snap position),
ensuring that the target snap area won't cover the window regardless of
the size.

Bug: 876052
Change-Id: I448ecb1e3cc2cc458d467472ca38d49bf01d2901
Reviewed-on: https://chromium-review.googlesource.com/1182299
Commit-Queue: Sandra Sun <[email protected]>
Reviewed-by: Majid Valipour <[email protected]>
Cr-Commit-Position: refs/heads/master@{#585926}
  • Loading branch information
sunyunjia authored and chromium-wpt-export-bot committed Aug 24, 2018
1 parent 0ddf902 commit b146527
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions css/css-scroll-snap/scrollTo-scrollBy-snaps.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
var viewport = document.scrollingElement;
[
[{left: 800}, 1000, 0],
[{top: 1200}, 0, 1000],
[{left: 1200, top: 800}, 1000, 1000]
[{top: 900}, 0, 1000],
[{left: 900, top: 800}, 1000, 1000]
].forEach(([input, expectedX, expectedY]) => {
test(() => {
divScroller.scrollTo(0, 0);
Expand Down

0 comments on commit b146527

Please sign in to comment.