Latched scrolling tests are flakey on Mavericks
[WebKit-https.git] / LayoutTests / platform / mac-wk2 / tiled-drawing / fast-scroll-select-latched-select.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 .scrollable_region {
6     width: 680px;
7 }
8
9 .table td, .table th {
10     padding: 2px;
11 }
12
13 .table th {
14     height: 20px;
15     text-align: left;
16     font-weight: strong;
17 }
18
19 .table tr:nth-child(odd) {
20     background: #f3f3f3;
21 }
22
23 .scrollable_select option:nth-child(odd) {
24     background: #f3f3f3;
25 }
26
27 </style>
28 <script src="../../../resources/js-test-pre.js"></script>
29 <script>
30 function onLoad() {
31     setupTopLevel();
32 }
33 </script>
34 </head>
35 <body onload="onLoad();">
36 <script>
37
38 var selectTarget;
39 var pageScrollPositionBefore;
40 var selectScrollPositionBefore;
41 var continueCount = 5;
42
43 function checkForScroll() {
44
45     // The page should not have scrolled at all.
46     var pageScrollPositionAfter = document.body.scrollTop;
47     var selectScrollPositionAfter = selectTarget.scrollTop;
48
49     debug("Page before: " + pageScrollPositionBefore + ", select before: " + selectScrollPositionBefore);
50     debug("Page after:  " + pageScrollPositionAfter + ", select after: " + selectScrollPositionAfter);
51
52     if (pageScrollPositionBefore != pageScrollPositionAfter)
53         testFailed("Page received wheel events.");
54     else
55         testPassed("Page did not receive wheel events.");
56
57     if (window.internals) {
58         document.getElementById('layers').innerText = internals.layerTreeAsText(document,
59             internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
60     }
61
62     testRunner.notifyDone();
63 }
64
65 function scrollTest() {
66     pageScrollPositionBefore = document.body.scrollTop;
67
68     selectTarget = document.getElementById('target');
69     selectTarget.scrollTop = selectTarget.scrollHeight - selectTarget.clientHeight - 100;
70
71     selectScrollPositionBefore = selectTarget.scrollTop;
72
73     // Scroll the #source until we reach the #target.
74     var startPosX = Math.round(selectTarget.offsetLeft) + 20;
75     debug("div display height = " + Math.round(selectTarget.clientHeight));
76     var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42;
77     eventSender.mouseMoveTo(startPosX, startPosY);
78     debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
79     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
80     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
81     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
82     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none', true);
83     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin', true);
84     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
85     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
86     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
87     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
88     eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
89     setTimeout(checkForScroll, 100);
90 }
91
92 function setupTopLevel() {
93
94     if (window.eventSender) {
95         testRunner.dumpAsText();
96         testRunner.waitUntilDone();
97
98         setTimeout(scrollTest, 1000);
99     } else {
100         var messageLocation = document.getElementById('parent');
101         var message = document.createElement('div');
102         message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
103             + "inside the select box, and scroll near (but not AT) the bottom of the range. Use the mouse wheel or a two-finger<br/>"
104             + "swipe to scroll through the rest of the select options.<br/><br/>"
105             + "You should not see the page position change if this test is successful.</p>";
106         messageLocation.appendChild(message);
107     }
108 }
109
110 </script>
111 <div id="parent" style="height: 2000px; width: 2000px;">
112     <div id="source" style="height: 100px; width: 500px;">
113         Put mouse near the bottom of the select and scroll downwards.
114     </div>
115         <div class="scrollable_region">
116             <h3>Scrollable Select</h3>
117             <select id="target" class="scrollable_select" size="8">
118                 <option>content1</option>
119                 <option>content2</option>
120                 <option>content3</option>
121                 <option>content4</option>
122                 <option>content5</option>
123                 <option>content6</option>
124                 <option>content7</option>
125                 <option>content8</option>
126                 <option>content9</option>
127                 <option>content10</option>
128                 <option>content11</option>
129                 <option>content12</option>
130                 <option>content13</option>
131                 <option>content14</option>
132                 <option>content15</option>
133                 <option>content16</option>
134                 <option>content17</option>
135                 <option>content18</option>
136                 <option>content19</option>
137                 <option>content20</option>
138                 <option>content21</option>
139             </select>
140         </div>
141     </div>
142 </div>
143 <div id="console"></div>
144 <script>
145 description("Tests that a select doesn't pass wheel events to main frame when scrolling at bottom");
146 </script>
147 <pre id="layers">Layer tree goes here</p>
148 <script src="../../../resources/js-test-post.js"></script>
149 </body>
150 </html>