4 <script src=
"../../../../resources/js-test.js"></script>
5 <script src=
"resources/gesture-helpers.js"></script>
6 <style type=
"text/css">
40 <body style=
"margin:0; overflow:hidden;" onload=
"runTest();">
42 <table id=
"horizontal_table_to_fill">
44 <td><div id=
"redbox"></div></td>
45 <td><div id=
"greenbox"></div></td>
49 <table id=
"vertical_table_to_fill">
50 <tr><td><div id=
"greenbox"></div></td></tr>
51 <tr><td><div id=
"redbox"></div></td></tr>
54 <p id=
"description"></p>
55 <div id=
"console"></div>
56 <script type=
"text/javascript">
58 var expectedGesturesTotal
= 2;
59 var gesturesOccurred
= 0;
60 var scrollAmountX
= ['0', '0'];
61 var scrollAmountY
= ['0', '0'];
62 var wheelEventsOccurred
= 0;
63 var expectedWheelEventsOccurred
= ['0', '0'];
64 var scrollEventsOccurred
= 0;
65 var expectedScrollEventsOccurred
= '0';
66 var scrolledElement
= 'document.documentElement';
68 // Always construct a page larger than the vertical height of the window.
71 // build vertical table
72 var table
= document
.getElementById('vertical_table_to_fill');
73 var targetHeight
= document
.body
.offsetHeight
;
74 var cellPairHeight
= table
.offsetHeight
;
75 var numberOfReps
= targetHeight
/ cellPairHeight
* 2;
77 for (i
= 0; i
< numberOfReps
; i
++) {
78 var p
= document
.createElement('tr');
79 p
.innerHTML
= '<td><div id="greenbox"></div></td>';
81 var p
= document
.createElement('tr');
82 p
.innerHTML
= '<td><div id="redbox"></div></td>';
86 // build horizontal table
87 var horizontalTable
= document
.getElementById('horizontal_table_to_fill');
88 var tableRow
= document
.getElementById('firstrow');
89 var targetWidth
= document
.body
.offsetWidth
;
90 var cellPairWidth
= horizontalTable
.offsetWidth
;
91 numberOfReps
= targetWidth
/ cellPairWidth
* 2;
92 for (i
= 0; i
< numberOfReps
; i
++) {
93 var p
= document
.createElement('td');
94 p
.innerHTML
= '<div id="redbox"></div>';
95 tableRow
.appendChild(p
);
96 var p
= document
.createElement('td');
97 p
.innerHTML
= '<div id="greenbox"></div>';
98 tableRow
.appendChild(p
);
101 window
.addEventListener("scroll", recordScroll
);
102 window
.addEventListener("mousewheel", recordWheel
);
105 function firstGestureScroll()
107 debug("first gesture");
108 eventSender
.gestureScrollBegin(95, 12);
109 eventSender
.gestureScrollUpdate(-55, -110);
110 eventSender
.gestureScrollEnd(0, 0);
116 function secondGestureScroll()
118 debug("second gesture");
119 eventSender
.gestureScrollBegin(12, 97);
120 eventSender
.gestureScrollUpdate(-42, -95);
121 eventSender
.gestureScrollEnd(0, 0);
126 // In this test we do not expect any scroll events to
127 // be received by the event listener, so we signal
128 // the end of the test by calling this function instead
129 // of relying on recordScroll() to do it.
133 if (window
.testRunner
)
134 testRunner
.waitUntilDone();
139 if (window
.eventSender
) {
140 description('This tests that a page cannot be scrolled with touch if its body has style overflow:hidden.');
142 if (checkTestDependencies())
143 firstGestureScroll();
147 debug("This test requires DumpRenderTree. Touch scroll the red rect to log.");
151 function finishTest()
153 if (window
.eventSender
) {
154 if (gesturesOccurred
== expectedGesturesTotal
) {
155 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred
);
156 successfullyParsed
= true;
157 isSuccessfullyParsed();
158 if (window
.testRunner
)
159 testRunner
.notifyDone();