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-y:hidden;" onload=
"runTest();">
42 <div id=
"touchtarget">
43 <table border=
"0" cellspacing=
"0px" id=
"tablefoo">
45 <td><div id=
"redbox"></div></td>
46 <td><div id=
"greenbox"></div></td>
49 <td><div id=
"greenbox"></div></td>
50 <td><div id=
"greenbox"></div></td>
55 <table id=
"table_to_fill">
56 <tr><td><div id=
"greenbox"></div></td></tr>
57 <tr><td><div id=
"redbox"></div></td></tr>
60 <p id=
"description"></p>
61 <div id=
"console"></div>
62 <script type=
"text/javascript">
64 var expectedGesturesTotal
= 2;
65 var gesturesOccurred
= 0;
66 var scrollAmountX
= ['0', '0'];
67 var scrollAmountY
= ['0', '0'];
68 var wheelEventsOccurred
= 0;
69 var expectedWheelEventsOccurred
= ['0', '0'];
70 var scrollEventsOccurred
= 0;
71 var expectedScrollEventsOccurred
= '0';
72 var scrolledElement
= 'document.documentElement';
74 // Always construct a page larger than the vertical height of the window.
77 var table
= document
.getElementById('table_to_fill');
78 var targetHeight
= document
.body
.offsetHeight
;
79 var cellPairHeight
= table
.offsetHeight
;
80 var numberOfReps
= targetHeight
/ cellPairHeight
* 2;
82 for (i
= 0; i
< numberOfReps
; i
++) {
83 var p
= document
.createElement('tr');
84 p
.innerHTML
= '<td><div id="greenbox"></div></td>';
86 var p
= document
.createElement('tr');
87 p
.innerHTML
= '<td><div id="redbox"></div></td>';
91 window
.addEventListener("scroll", recordScroll
);
92 window
.addEventListener("mousewheel", recordWheel
);
95 function firstGestureScroll()
97 debug("first gesture");
98 eventSender
.gestureScrollBegin(95, 12);
99 eventSender
.gestureScrollUpdate(0, -100);
100 eventSender
.gestureScrollUpdate(0, -10);
101 eventSender
.gestureScrollEnd(0, 0);
107 function secondGestureScroll()
109 debug("second gesture");
110 eventSender
.gestureScrollBegin(12, 97);
111 eventSender
.gestureScrollUpdate(0, -95);
112 eventSender
.gestureScrollUpdate(0, -200);
113 eventSender
.gestureScrollEnd(0, 0);
118 // In this test we do not expect any scroll events to
119 // be received by the event listener, so we signal
120 // the end of the test by calling this function instead
121 // of relying on recordScroll() to do it.
125 window
.jsTestIsAsync
= true;
126 if (window
.testRunner
)
127 testRunner
.waitUntilDone();
132 if (window
.eventSender
) {
133 description('This tests that a page cannot be scrolled vertically with touch if its body has style overflow-y:hidden ' +
134 'and the scroll event is propogated from a scrollable child div.');
136 if (checkTestDependencies())
137 firstGestureScroll();
141 debug("This test requires DumpRenderTree. Touch scroll the red rect to log.");
145 function finishTest()
147 if (window
.eventSender
) {
148 if (gesturesOccurred
== expectedGesturesTotal
) {
149 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred
);
150 successfullyParsed
= true;