Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / touch-gesture-fully-scrolled-iframe-propagates.html
bloba586ad12320fc42a7b4bc5505c6c2c316103ce2a
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 style="display: block;" frameBorder="0" 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 iframeScrollingElement;
55 var iframeDocumentElement;
56 var expectedGesturesTotal = 1;
57 var gesturesOccurred = 0;
58 var scrollAmountX = ['0'];
59 var scrollAmountY = ['50'];
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 var amountToScroll = iframeScrollingElement.scrollHeight - iframe.clientHeight;
74 iframeScrollingElement.scrollTop = amountToScroll;
76 // Sanity - make sure the iframe is actually fully scrolled
77 shouldBe('iframeScrollingElement.scrollHeight - iframeScrollingElement.scrollTop', 'iframe.clientHeight');
79 eventSender.gestureScrollBegin(10, 72);
80 // Prevent scroll to propagate by passing true for third parameter
81 eventSender.gestureScrollUpdate(0, -20, true);
82 eventSender.gestureScrollUpdate(0, -18, true);
83 eventSender.gestureScrollUpdate(0, -15, true);
84 eventSender.gestureScrollUpdate(0, -10, true);
85 eventSender.gestureScrollEnd(0, 0);
87 amountToScroll = movedbox.scrollHeight - movedbox.clientHeight;
88 scrollAmountY[0] = amountToScroll.toString();
90 // Wait for layout.
91 checkScrollOffset();
94 if (window.testRunner)
95 testRunner.waitUntilDone();
97 function runTest()
99 movedbox = document.getElementById("outerdiv");
100 touchtarget = document.getElementById("touchtargetiframe");
102 touchtarget.contentDocument.addEventListener("scroll", recordScroll);
103 touchtarget.contentDocument.documentElement.addEventListener("mousewheel", recordWheel);
105 if (window.eventSender) {
106 description('This tests that a fling gesture sent to an iframe with no remaining scroll offset ' +
107 'is correctly targeting the parent container.');
109 if (checkTestDependencies() && window.eventSender.gestureScrollUpdate)
110 firstGestureScroll();
111 else
112 exitIfNecessary();
113 } else {
114 debug("This test requires DumpRenderTree. Gesture-scroll the page to validate the implementation.");
117 </script>
121 </body>
122 </html>