Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / touch-gesture-scroll-iframe-not-propagated.html
blobddbdf1f00eb4c61098841709cf542d9429b0d964
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 <script src="resources/gesture-helpers.js"></script>
6 <style type="text/css">
8 ::-webkit-scrollbar {
9 width: 0px;
10 height: 0px;
13 #bluebox {
14 width: 100px;
15 height: 100px;
16 background: blue;
17 padding: 0px;
18 margin: 0px;
21 #outerdiv {
22 width: 200px;
23 height: 200px;
24 overflow-y: scroll;
25 overflow-x: scroll;
28 td {
29 padding: 0px;
32 </style>
33 </head>
34 <body style="margin:0" >
36 <div id="outerdiv">
37 <table border="0" cellspacing="0px" >
38 <tr><td>
39 <iframe frameBorder="0" style="display: block;" id="touchtargetiframe" src="resources/scroll-inside-editable-iframe.html"></iframe>
40 </td></tr>
41 <tr><td>
42 <div id="bluebox"></div>
43 </td></tr>
44 </table>
45 </div>
47 <p id="description"></p>
48 <div id="console"></div>
49 <script type="text/javascript">
51 var movedbox;
52 var touchtarget;
53 var iframe;
54 var iframeBody;
55 var iframeDocumentElement;
56 var expectedGesturesTotal = 1;
57 var gesturesOccurred = 0;
58 var scrollAmountX = ['0'];
59 var scrollAmountY = ['0'];
60 var wheelEventsOccurred = 0;
61 var expectedWheelEventsOccurred = ['0'];
62 var scrollEventsOccurred = 0;
63 var scrolledElement = 'movedbox';
64 var scrollEventsOccurred = 0;
65 var expectedScrollEventsOccurred = '1';
67 function firstGestureScroll()
69 iframe = touchtarget;
70 iframeScrollingElement = iframe.contentDocument.scrollingElement;
72 debug("first gesture");
73 eventSender.gestureScrollBegin(10, 72);
74 // Prevent scroll to propagate by passing true for third parameter
75 eventSender.gestureScrollUpdate(0, -700, true);
76 eventSender.gestureScrollUpdate(0, -100, true);
77 eventSender.gestureScrollUpdate(0, -70, true);
78 eventSender.gestureScrollUpdate(0, -10, true);
79 eventSender.gestureScrollEnd(0, 0);
81 // Make sure the actual iframe got fully scrolled
82 shouldBe('iframeScrollingElement.scrollHeight - iframeScrollingElement.scrollTop', 'iframe.clientHeight');
84 // Wait for layout.
85 checkScrollOffset();
88 if (window.testRunner)
89 testRunner.waitUntilDone();
91 function runTest()
93 movedbox = document.getElementById("outerdiv");
94 touchtarget = document.getElementById("touchtargetiframe");
95 touchtarget.contentDocument.addEventListener("scroll", recordScroll);
96 touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel);
98 if (window.eventSender) {
99 description('This tests that a gesture scroll is not propagated from an ' +
100 'iframe to an outer div when the iframe has no remaining ' +
101 'scroll offset when the preventPropagation flag is set for the gesture '+
102 'type GestureScrollUpdate.');
103 if (checkTestDependencies() && window.eventSender.gestureScrollUpdate)
104 firstGestureScroll();
105 else
106 exitIfNecessary();
107 } else {
108 debug("This test requires DumpRenderTree. Gesture-scroll the page to validate the implementation.");
111 </script>
115 </body>
116 </html>