OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="stylesheet" href="../../../js/resources/js-test-style.css"> | 4 <link rel="stylesheet" href="../../../js/resources/js-test-style.css"> |
5 <script src="../../../js/resources/js-test-pre.js"></script> | 5 <script src="../../../js/resources/js-test-pre.js"></script> |
6 <script src="resources/gesture-helpers.js"></script> | 6 <script src="resources/gesture-helpers.js"></script> |
7 <style type="text/css"> | 7 <style type="text/css"> |
8 | 8 |
9 ::-webkit-scrollbar { | 9 ::-webkit-scrollbar { |
10 width: 0px; | 10 width: 0px; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 </div> | 46 </div> |
47 | 47 |
48 <p id="description"></p> | 48 <p id="description"></p> |
49 <div id="console"></div> | 49 <div id="console"></div> |
50 <script type="text/javascript"> | 50 <script type="text/javascript"> |
51 | 51 |
52 var movedbox; | 52 var movedbox; |
53 var touchtarget; | 53 var touchtarget; |
54 var iframe; | 54 var iframe; |
55 var iframeBody; | 55 var iframeBody; |
56 var iframeDocumentElement; | |
57 var expectedGesturesTotal = 1; | 56 var expectedGesturesTotal = 1; |
58 var gesturesOccurred = 0; | 57 var gesturesOccurred = 0; |
59 var scrollAmountX = ['0']; | 58 var scrollAmountX = ['0']; |
60 var scrollAmountY = ['50']; | 59 var scrollAmountY = ['50']; |
61 var wheelEventsOccurred = 0; | 60 var wheelEventsOccurred = 0; |
62 var expectedWheelEventsOccurred = ['0']; | 61 var expectedWheelEventsOccurred = ['0']; |
63 var scrollEventsOccurred = 0; | 62 var scrollEventsOccurred = 0; |
64 var scrolledElement = 'movedbox' | 63 var scrolledElement = 'movedbox' |
65 var scrollEventsOccurred = 0; | 64 var scrollEventsOccurred = 0; |
66 var expectedScrollEventsOccurred = '1'; | 65 var expectedScrollEventsOccurred = '1'; |
67 | 66 |
68 function firstGestureScroll() | 67 function firstGestureScroll() |
69 { | 68 { |
70 iframe = touchtarget; | 69 iframe = touchtarget; |
71 iframeBody = iframe.contentDocument.body; | 70 iframeBody = iframe.contentDocument.body; |
72 iframeDocumentElement = touchtarget.contentDocument.documentElement; | |
73 | 71 |
74 var amountToScroll = iframeBody.scrollHeight - iframe.clientHeight; | 72 var amountToScroll = iframeBody.scrollHeight - iframe.clientHeight; |
75 | 73 |
76 iframeBody.scrollTop = amountToScroll; | 74 touchtarget.contentDocument.body.scrollTop = amountToScroll; |
77 | 75 |
78 // Sanity - make sure the iframe is actually fully scrolled scrolled | 76 // Sanity - make sure the iframe is actually fully scrolled scrolled |
79 shouldBe('iframeBody.scrollHeight - iframeDocumentElement.scrollTop', 'ifram
e.clientHeight'); | 77 shouldBe('iframeBody.scrollHeight - iframeBody.scrollTop', 'iframe.clientHei
ght'); |
80 | 78 |
81 eventSender.gestureScrollBegin(10, 72); | 79 eventSender.gestureScrollBegin(10, 72); |
82 eventSender.gestureScrollUpdateWithoutPropagation(0, -20); | 80 eventSender.gestureScrollUpdateWithoutPropagation(0, -20); |
83 eventSender.gestureScrollUpdateWithoutPropagation(0, -18); | 81 eventSender.gestureScrollUpdateWithoutPropagation(0, -18); |
84 eventSender.gestureScrollUpdateWithoutPropagation(0, -15); | 82 eventSender.gestureScrollUpdateWithoutPropagation(0, -15); |
85 eventSender.gestureScrollUpdateWithoutPropagation(0, -10); | 83 eventSender.gestureScrollUpdateWithoutPropagation(0, -10); |
86 eventSender.gestureScrollEnd(0, 0); | 84 eventSender.gestureScrollEnd(0, 0); |
87 | 85 |
88 amountToScroll = movedbox.scrollHeight - movedbox.clientHeight; | 86 amountToScroll = movedbox.scrollHeight - movedbox.clientHeight; |
89 scrollAmountY[0] = amountToScroll.toString(); | 87 scrollAmountY[0] = amountToScroll.toString(); |
90 | 88 |
91 // Wait for layout. | 89 // Wait for layout. |
92 checkScrollOffset(); | 90 checkScrollOffset(); |
93 } | 91 } |
94 | 92 |
95 if (window.testRunner) | 93 if (window.testRunner) |
96 testRunner.waitUntilDone(); | 94 testRunner.waitUntilDone(); |
97 | 95 |
98 function runTest() | 96 function runTest() |
99 { | 97 { |
100 movedbox = document.getElementById("outerdiv"); | 98 movedbox = document.getElementById("outerdiv"); |
101 touchtarget = document.getElementById("touchtargetiframe"); | 99 touchtarget = document.getElementById("touchtargetiframe"); |
102 | 100 |
103 touchtarget.contentDocument.addEventListener("scroll", recordScroll); | 101 touchtarget.contentDocument.addEventListener("scroll", recordScroll); |
104 touchtarget.contentDocument.documentElement.addEventListener("mousewheel", r
ecordWheel); | 102 touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel)
; |
105 | 103 |
106 if (window.eventSender) { | 104 if (window.eventSender) { |
107 description('This tests that a fling gesture sent to an iframe with no r
emaining scroll offset ' + | 105 description('This tests that a fling gesture sent to an iframe with no r
emaining scroll offset ' + |
108 'is correctly targeting the parent container.'); | 106 'is correctly targeting the parent container.'); |
109 | 107 |
110 if (checkTestDependencies() && window.eventSender.gestureScrollUpdateWit
houtPropagation) | 108 if (checkTestDependencies() && window.eventSender.gestureScrollUpdateWit
houtPropagation) |
111 firstGestureScroll(); | 109 firstGestureScroll(); |
112 else | 110 else |
113 exitIfNecessary(); | 111 exitIfNecessary(); |
114 } else { | 112 } else { |
115 debug("This test requires DumpRenderTree. Gesture-scroll the page to va
lidate the implementation."); | 113 debug("This test requires DumpRenderTree. Gesture-scroll the page to va
lidate the implementation."); |
116 } | 114 } |
117 } | 115 } |
118 </script> | 116 </script> |
119 | 117 |
120 | 118 |
121 | 119 |
122 </body> | 120 </body> |
123 </html> | 121 </html> |
OLD | NEW |