Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Divide gesture scroll delta by scale factor
https://bugs.webkit.org/show_bug.cgi?id=106263 Reviewed by Adam Barth. Gesture scroll deltas were not being adjusted by the frame's scale factors, resulting in overly fast main-thread scrolling when zoomed in. New test: fast/events/touch/gesture/touch-gesture-scroll-div-scaled.html * page/EventHandler.cpp: (WebCore::EventHandler::handleGestureScrollCore): Canonical link: https://commits.webkit.org/124482@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
182 additions
and
1 deletion.
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
@@ -0,0 +1,10 @@ | ||
This tests gesture event scrolling of an overflow div with page scale. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
gesture events not implemented on this platform or gesture event scrolling of a document is broken | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
@@ -0,0 +1,131 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../../js/resources/js-test-pre.js"></script> | ||
<script src="resources/gesture-helpers.js"></script> | ||
<style type="text/css"> | ||
#touchtarget { | ||
width: 100px; | ||
height: 100px; | ||
position: relative; | ||
background: white; | ||
} | ||
|
||
::-webkit-scrollbar { | ||
width: 0px; | ||
height: 0px; | ||
} | ||
|
||
#movingbox { | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
word-wrap: break-word; | ||
overflow-y: scroll; | ||
overflow-x: scroll; | ||
display: block; | ||
} | ||
|
||
#greenbox { | ||
width: 100px; | ||
height: 100px; | ||
background: green; | ||
padding: 0px; | ||
margin: 0px; | ||
} | ||
|
||
#redbox { | ||
width: 100px; | ||
height: 100px; | ||
background: red; | ||
padding: 0px; | ||
margin: 0px; | ||
} | ||
|
||
td { | ||
padding: 0px; | ||
} | ||
</style> | ||
</head> | ||
<body style="margin:0" onload="runTest();"> | ||
<div id="touchtarget"> | ||
<div id="movingbox"> | ||
<table border="0" cellspacing="0px" id="tablefoo"> | ||
<tr> | ||
<td><div id="redbox"></div></td> | ||
<td><div id="greenbox"></div></td> | ||
</tr> | ||
<tr> | ||
<td><div id="greenbox"></div></td> | ||
<td><div id="greenbox"></div></td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script type="text/javascript"> | ||
|
||
var movingdiv; | ||
var expectedGesturesTotal = 2; | ||
var gesturesOccurred = 0; | ||
var scrollAmountX = ['45', '45']; | ||
var scrollAmountY = ['0', '48']; | ||
var wheelEventsOccurred = 0; | ||
var expectedWheelEventsOccurred = ['1', '1']; | ||
var scrollEventsOccurred = 0; | ||
var expectedScrollEventsOccurred = '1'; | ||
var scrolledElement = 'movingdiv' | ||
|
||
function firstGestureScroll() | ||
{ | ||
debug("first gesture"); | ||
eventSender.gestureScrollBegin(95, 12); | ||
eventSender.gestureScrollUpdate(-90, 0); | ||
eventSender.gestureScrollEnd(0, 0); | ||
|
||
// Wait for layout. | ||
checkScrollOffset(); | ||
} | ||
|
||
function secondGestureScroll() | ||
{ | ||
debug("second gesture"); | ||
eventSender.gestureScrollBegin(12, 97); | ||
eventSender.gestureScrollUpdate(0, -95); | ||
eventSender.gestureScrollEnd(0, 0); | ||
|
||
// Wait for layout. | ||
checkScrollOffset(); | ||
} | ||
|
||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
|
||
function runTest() | ||
{ | ||
var scaleFactor = 2.0; | ||
var scaleOffset = 0; | ||
if (window.internals) { | ||
window.internals.setPageScaleFactor(scaleFactor, scaleOffset, scaleOffset); | ||
} | ||
|
||
movingdiv = document.getElementById('movingbox'); | ||
movingdiv.addEventListener("scroll", recordScroll); | ||
window.addEventListener("mousewheel", recordWheel); | ||
|
||
if (window.eventSender) { | ||
description('This tests gesture event scrolling of an overflow div with page scale.'); | ||
|
||
if (checkTestDependencies()) | ||
firstGestureScroll(); | ||
else | ||
exitIfNecessary(); | ||
} else { | ||
debug("This test requires DumpRenderTree. Touch scroll the red rect to log."); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</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
@@ -0,0 +1,21 @@ | ||
This tests gesture event scrolling of an overflow div with page scale. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
first gesture | ||
wheel event 0+> [object HTMLDivElement] | ||
PASS movingdiv.scrollTop is 0 | ||
PASS movingdiv.scrollLeft is 45 | ||
PASS wheelEventsOccurred is 1 | ||
second gesture | ||
wheel event 0+> [object HTMLDivElement] | ||
PASS movingdiv.scrollTop is 48 | ||
PASS movingdiv.scrollLeft is 45 | ||
PASS wheelEventsOccurred is 1 | ||
scroll event 0+> [object HTMLDivElement] | ||
PASS scrollEventsOccurred is 1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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