OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | 3 <style> |
4 ::-webkit-scrollbar { | 4 ::-webkit-scrollbar { |
5 width: 0px; | 5 width: 0px; |
6 height: 0px; | 6 height: 0px; |
7 } | 7 } |
8 </style> | 8 </style> |
9 <script> | 9 <script> |
10 window.enablePixelTesting = true; | 10 window.enablePixelTesting = true; |
11 | 11 |
12 function scrollViaJavascript() { | 12 function scrollViaJavascript() { |
13 var scaleFactor = 2.0; | 13 var scaleFactor = 2.0; |
14 if (window.eventSender) { | 14 if (window.eventSender) { |
15 window.eventSender.setPageScaleFactor(scaleFactor, 0, 0); | 15 window.eventSender.setPageScaleFactor(scaleFactor, 0, 0); |
16 } | 16 } |
17 | 17 |
18 // The page scale, as set by window.eventSender.setPageScaleFactor sho
uld not be apparent | 18 // The page scale, as set by window.eventSender.setPageScaleFactor sho
uld not be apparent |
19 // to javascript. So, we expect scrolling to (100,100) to be page coor
dinates, rather | 19 // to javascript. So, we expect scrolling to (100,100) to be page coor
dinates, rather |
20 // than device pixels. | 20 // than device pixels. |
21 document.body.scrollLeft = 100; | 21 document.scrollingElement.scrollLeft = 100; |
22 document.body.scrollTop = 100; | 22 document.scrollingElement.scrollTop = 100; |
23 | 23 |
24 shouldBe("window.document.body.scrollTop", "100"); | 24 shouldBe("window.document.scrollingElement.scrollTop", "100"); |
25 shouldBe("window.document.body.scrollLeft", "100"); | 25 shouldBe("window.document.scrollingElement.scrollLeft", "100"); |
26 shouldBe("window.scrollX", "100"); | 26 shouldBe("window.scrollX", "100"); |
27 shouldBe("window.scrollY", "100"); | 27 shouldBe("window.scrollY", "100"); |
28 } | 28 } |
29 | 29 |
30 function scrollViaSetScaleFactor() { | 30 function scrollViaSetScaleFactor() { |
31 if (window.eventSender) { | 31 if (window.eventSender) { |
32 // Test that the scroll offset changes even if scaleFactor remains | 32 // Test that the scroll offset changes even if scaleFactor remains |
33 // the same. | 33 // the same. |
34 window.eventSender.setPageScaleFactor(1, 30, 30); | 34 window.eventSender.setPageScaleFactor(1, 30, 30); |
35 shouldBe("window.document.body.scrollTop", "30"); | 35 shouldBe("window.document.scrollingElement.scrollTop", "30"); |
36 shouldBe("window.document.body.scrollLeft", "30"); | 36 shouldBe("window.document.scrollingElement.scrollLeft", "30"); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 function test() { | 40 function test() { |
41 scrollViaSetScaleFactor(); | 41 scrollViaSetScaleFactor(); |
42 scrollViaJavascript(); | 42 scrollViaJavascript(); |
43 } | 43 } |
44 </script> | 44 </script> |
45 <script src="../../resources/js-test.js"></script> | 45 <script src="../../resources/js-test.js"></script> |
46 </head> | 46 </head> |
47 <body style="width:2000px; height:2000px; margin:0px;" onload="test();"> | 47 <body style="width:2000px; height:2000px; margin:0px;" onload="test();"> |
48 <div style="left:0; top:0; width:100px; height:100px; position:absolute; bac
kground:yellow;"></div> | 48 <div style="left:0; top:0; width:100px; height:100px; position:absolute; bac
kground:yellow;"></div> |
49 <div style="left:100px; top:0; width:100px; height:100px; position:absolute;
background:green;"></div> | 49 <div style="left:100px; top:0; width:100px; height:100px; position:absolute;
background:green;"></div> |
50 <div style="left:200px; top:0; width:100px; height:100px; position:absolute;
background:blue;"></div> | 50 <div style="left:200px; top:0; width:100px; height:100px; position:absolute;
background:blue;"></div> |
51 | 51 |
52 <div style="left:0; top:100px; width:100px; height:100px; position:absolute;
background: green;"></div> | 52 <div style="left:0; top:100px; width:100px; height:100px; position:absolute;
background: green;"></div> |
53 <div style="left:100px; top:100px; width:100px; height:100px; position:absol
ute; background:blue;"></div> | 53 <div style="left:100px; top:100px; width:100px; height:100px; position:absol
ute; background:blue;"></div> |
54 <div style="left:200px; top:100px; width:100px; height:100px; position:absol
ute; background:yellow;"></div> | 54 <div style="left:200px; top:100px; width:100px; height:100px; position:absol
ute; background:yellow;"></div> |
55 | 55 |
56 <div id="console"></div> | 56 <div id="console"></div> |
57 </body> | 57 </body> |
58 </html> | 58 </html> |
OLD | NEW |