forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After user clicking on the scrollbar's track or arrows, we should snap to the closest snap position of the container. This is done by simply moving SnapAfterScrollbarDragging() from ScrollableArea::MouseReleasedScrollbar() up to Scrollbar::MouseUp(). This patch also rewrites the previous snaps-after-scrollbar-dragging.html test using the gesture-util.js, and adds the new clicking tests to it as well. Bug: 860768 Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel Change-Id: I75267c3fc0917ecf5c14673a1eb480a047d03824 Reviewed-on: https://chromium-review.googlesource.com/1127153 Commit-Queue: Sandra Sun <[email protected]> Reviewed-by: David Bokan <[email protected]> Reviewed-by: Majid Valipour <[email protected]> Cr-Commit-Position: refs/heads/master@{#575191}
- Loading branch information
Showing
10 changed files
with
129 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 0 additions & 114 deletions
114
third_party/WebKit/LayoutTests/fast/scroll-behavior/snaps-after-scrollbar-dragging.html
This file was deleted.
Oops, something went wrong.
99 changes: 99 additions & 0 deletions
99
third_party/WebKit/LayoutTests/fast/scroll-snap/snaps-after-scrollbar-scrolling.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1" /> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../../resources/gesture-util.js"></script> | ||
<style> | ||
body { | ||
margin: 0px; | ||
} | ||
div { | ||
position: absolute; | ||
} | ||
#scroller { | ||
width: 400px; | ||
height: 400px; | ||
overflow: scroll; | ||
scroll-snap-type: both mandatory; | ||
padding: 0px; | ||
} | ||
.snap { | ||
width: 200px; | ||
height: 200px; | ||
background-color: blue; | ||
scroll-snap-align: start; | ||
} | ||
#space { | ||
width: 1000px; | ||
height: 1000px; | ||
} | ||
#left-top { | ||
left: 0px; | ||
top: 0px; | ||
} | ||
#right-top { | ||
left: 400px; | ||
top: 0px; | ||
} | ||
#left-bottom { | ||
left: 0px; | ||
top: 400px; | ||
} | ||
|
||
</style> | ||
|
||
<div id='scroller'> | ||
<div id="space"></div> | ||
<div class="snap" id="left-top"></div> | ||
<div class="snap" id="right-top"></div> | ||
<div class="snap" id="left-bottom"></div> | ||
</div> | ||
|
||
<script> | ||
var scroller = document.getElementById("scroller"); | ||
|
||
function scrollLeft() { | ||
return scroller.scrollLeft; | ||
} | ||
|
||
function scrollTop() { | ||
return scroller.scrollTop; | ||
} | ||
|
||
promise_test (async () => { | ||
scroller.scrollTo(0, 0); | ||
await mouseDragAndDrop(398, 20, 398, 120); | ||
await waitForAnimationEnd(scrollTop, 500, 5); | ||
await waitFor( () => { | ||
return scroller.scrollTop == 400; | ||
}); | ||
}, "Snaps after dragging the vertical scrollbar."); | ||
|
||
promise_test (async () => { | ||
scroller.scrollTo(0, 0); | ||
await mouseDragAndDrop(20, 398, 120, 398); | ||
await waitForAnimationEnd(scrollLeft, 500, 5); | ||
await waitFor( () => { | ||
return scroller.scrollLeft == 400; | ||
}); | ||
}, "Snaps after dragging the horizontal scrollbar."); | ||
|
||
promise_test (async () => { | ||
scroller.scrollTo(0, 0); | ||
await mousePressOn(398, 350, 1); | ||
await waitForAnimationEnd(scrollTop, 500, 5); | ||
await waitFor( () => { | ||
return scroller.scrollTop == 400; | ||
}); | ||
}, "Snaps after clicking the vertical scrollbar."); | ||
|
||
promise_test (async () => { | ||
scroller.scrollTo(0, 0); | ||
await mousePressOn(350, 398, 1); | ||
await waitForAnimationEnd(scrollLeft, 500, 5); | ||
await waitFor( () => { | ||
return scroller.scrollLeft == 400; | ||
}); | ||
}, "Snaps after clicking the horizontal scrollbar."); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters