forked from crosswalk-project/chromium-crosswalk
-
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.
Fix premature termination of scroll animations while selecting text.
During text selection, AutoscrollController calls scrollIntoView continuously to make the scroll position follow the selection. This had the side effect of resetting ScrollAnimator before it could finish a main-thread smooth scroll. There are early returns for zero-delta scrolls in FrameView::setScrollPosition and RootFrameViewport::distributeScrollBetweenViewports, but scrollIntoView's conversion of fractional scroll offsets to LayoutUnits resulted in a very small (< 1px) non-zero scroll delta. We now avoid this by directly comparing the input and output of getRectToExpose and skipping the unneeded calls to setScrollPosition. BUG=591918 Review URL: https://codereview.chromium.org/1775213002 Cr-Commit-Position: refs/heads/master@{#380162}
- Loading branch information
1 parent
0a95746
commit 67a7b9d
Showing
4 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/scroll-during-selection-expected.txt
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,11 @@ | ||
TEXT | ||
This test verifies that text selection does not prevent smooth scrolls running on the main thread. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS scrollY became 40 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
39 changes: 39 additions & 0 deletions
39
..._party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/scroll-during-selection.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,39 @@ | ||
<!DOCTYPE html> | ||
<script src="../../../resources/js-test.js"></script> | ||
<style> | ||
body { | ||
height: 1000px; | ||
} | ||
#fixed { | ||
position:fixed; | ||
right: 20px; | ||
width: 100px; | ||
height: 40px; | ||
background-color: #ace; | ||
} | ||
#text { | ||
font: bold 18pt monospace; | ||
} | ||
</style> | ||
<div id="fixed"></div> | ||
<div id="text">TEXT</div> | ||
<div id="console"></div> | ||
<script> | ||
|
||
var jsTestIsAsync = true; | ||
|
||
description( | ||
"This test verifies that text selection does not prevent smooth " + | ||
"scrolls running on the main thread."); | ||
|
||
eventSender.dragMode = false; | ||
|
||
// Start a text selection. | ||
eventSender.mouseMoveTo(20, 20); | ||
eventSender.mouseDown(); | ||
eventSender.mouseMoveTo(40, 20); | ||
|
||
eventSender.mouseScrollBy(0, -1); | ||
shouldBecomeEqual("scrollY", "40", finishJSTest); | ||
|
||
</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