OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <body style="width:30000px;height:30000px" onload="runTest()"> | 2 <body style="width:30000px;height:30000px" onload="runTest()"> |
3 </body> | 3 </body> |
4 | 4 |
5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/js-test.js"></script> |
6 <script> | 6 <script> |
7 description("Verifies that document scrolling supports fractional offset."); | 7 description("Verifies that document scrolling supports fractional offset."); |
8 | 8 |
9 var floatPrecision = 0.00001; | 9 var floatPrecision = 0.00001; |
10 var useIntegerScrollOffset = false; | 10 var useIntegerScrollOffset = false; |
11 function checkScrollOffset(offset_x, offset_y) | 11 function checkScrollOffset(offset_x, offset_y) |
12 { | 12 { |
13 if (useIntegerScrollOffset) { | 13 if (useIntegerScrollOffset) { |
14 offset_x = Math.floor(offset_x); | 14 offset_x = Math.floor(offset_x); |
15 offset_y = Math.floor(offset_y); | 15 offset_y = Math.floor(offset_y); |
16 } | 16 } |
17 shouldBeCloseTo('document.documentElement.scrollTop', offset_y, floatPrecisi
on); | 17 shouldBeCloseTo('document.body.scrollTop', offset_y, floatPrecision); |
18 shouldBeCloseTo('document.documentElement.scrollLeft', offset_x, floatPrecis
ion); | 18 shouldBeCloseTo('document.body.scrollLeft', offset_x, floatPrecision); |
19 } | 19 } |
20 | 20 |
21 function scroll() | 21 function scroll() |
22 { | 22 { |
23 window.scrollTo(0, 0); | 23 window.scrollTo(0, 0); |
24 eventSender.gestureScrollBegin(100.1, 300.2); | 24 eventSender.gestureScrollBegin(100.1, 300.2); |
25 checkScrollOffset(0, 0); | 25 checkScrollOffset(0, 0); |
26 eventSender.gestureScrollUpdate(-20.5, -10.2); | 26 eventSender.gestureScrollUpdate(-20.5, -10.2); |
27 checkScrollOffset(20.5, 10.2); | 27 checkScrollOffset(20.5, 10.2); |
28 eventSender.gestureScrollUpdate(10.9, -20.9); | 28 eventSender.gestureScrollUpdate(10.9, -20.9); |
(...skipping 12 matching lines...) Expand all Loading... |
41 | 41 |
42 debug("set PreferCompositingToLCDTextEnabled false"); | 42 debug("set PreferCompositingToLCDTextEnabled false"); |
43 window.internals.settings.setPreferCompositingToLCDTextEnabled(false); | 43 window.internals.settings.setPreferCompositingToLCDTextEnabled(false); |
44 useIntegerScrollOffset = true; | 44 useIntegerScrollOffset = true; |
45 scroll(); | 45 scroll(); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 </script> | 49 </script> |
50 </html> | 50 </html> |
OLD | NEW |