-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
touch-gesture-scroll-div-scaled.html
131 lines (115 loc) · 2.75 KB
/
touch-gesture-scroll-div-scaled.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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>