|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=369950 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 369950</title> |
|
8 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=369950">Mozilla Bug 369950</a> |
|
15 <p id="display"> |
|
16 <iframe id="i" src="bug369950-subframe.xml" width="200" height="100"></iframe> |
|
17 </p> |
|
18 <div id="content" style="display: none"> |
|
19 |
|
20 </div> |
|
21 <pre id="test"> |
|
22 <script type="application/javascript"> |
|
23 |
|
24 /** Test for Bug 369950 **/ |
|
25 SimpleTest.waitForExplicitFinish(); |
|
26 |
|
27 addLoadEvent(function() { |
|
28 // Can't just run our code here, because we might not have painting |
|
29 // unsuppressed yet. Do it async. |
|
30 SimpleTest.executeSoon(doTheTest); |
|
31 }); |
|
32 |
|
33 function doTheTest() { |
|
34 // do a layout flush |
|
35 var rect = $("i").getBoundingClientRect(); |
|
36 var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
|
37 |
|
38 // And do the rest of it later |
|
39 SimpleTest.executeSoon(reallyDoTheTest); |
|
40 } |
|
41 |
|
42 function reallyDoTheTest() { |
|
43 var rect = $("i").getBoundingClientRect(); |
|
44 var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
|
45 |
|
46 // We want coords relative to the iframe, so subtract off rect2.left/top. |
|
47 // 7px is a guess to get us from the bottom of the iframe into the scrollbar |
|
48 // groove for the horizontal scrollbar on the bottom. |
|
49 synthesizeMouse($("i").contentDocument.documentElement, |
|
50 -rect2.left + rect.width / 2, rect.height - rect2.top - 7, |
|
51 {}, $("i").contentWindow); |
|
52 // Scroll is async, so give it time |
|
53 SimpleTest.executeSoon(checkScroll); |
|
54 }; |
|
55 |
|
56 function checkScroll() { |
|
57 // do a layout flush |
|
58 var rect = $("i").getBoundingClientRect(); |
|
59 // And do the rest of it later |
|
60 SimpleTest.executeSoon(reallyCheckScroll); |
|
61 } |
|
62 |
|
63 function reallyCheckScroll() { |
|
64 var rect = $("i").getBoundingClientRect(); |
|
65 var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
|
66 isnot($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll"); |
|
67 |
|
68 // Not doing things below here, since avoiding the scroll arrows |
|
69 // cross-platform is a huge pain. |
|
70 SimpleTest.finish(); |
|
71 return; |
|
72 |
|
73 // 8px horizontal offset is a guess to get us into the scr |
|
74 synthesizeMouse($("i").contentDocument.documentElement, -rect2.left + 8, |
|
75 rect.height - rect2.top - 7, {}, $("i").contentWindow); |
|
76 // Scroll is async, so give it time |
|
77 SimpleTest.executeSoon(finishUp); |
|
78 } |
|
79 |
|
80 function finishUp() { |
|
81 is($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll back"); |
|
82 SimpleTest.finish(); |
|
83 }; |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 </script> |
|
89 </pre> |
|
90 </body> |
|
91 </html> |