2 <body style=
"width:30000px;height:30000px" onload=
"runTest()">
5 <script src=
"../../resources/js-test.js"></script>
7 description("Verifies that document scrolling supports fractional offset.");
9 var floatPrecision
= 0.00001;
10 var useIntegerScrollOffset
= false;
11 function checkScrollOffset(offset_x
, offset_y
)
13 if (useIntegerScrollOffset
) {
14 offset_x
= Math
.floor(offset_x
);
15 offset_y
= Math
.floor(offset_y
);
17 shouldBeCloseTo('document.scrollingElement.scrollTop', offset_y
, floatPrecision
);
18 shouldBeCloseTo('document.scrollingElement.scrollLeft', offset_x
, floatPrecision
);
23 window
.scrollTo(0, 0);
24 eventSender
.gestureScrollBegin(100.1, 300.2);
25 checkScrollOffset(0, 0);
26 eventSender
.gestureScrollUpdate(-20.5, -10.2);
27 checkScrollOffset(20.5, 10.2);
28 eventSender
.gestureScrollUpdate(10.9, -20.9);
29 checkScrollOffset(9.6, 31.1);
30 eventSender
.gestureScrollUpdate(100.4, 220.9);
31 checkScrollOffset(0.0, 0.0);
32 eventSender
.gestureScrollEnd(0, 0);
37 if (window
.eventSender
) {
38 debug("set PreferCompositingToLCDTextEnabled true");
39 window
.internals
.settings
.setPreferCompositingToLCDTextEnabled(true);
42 debug("set PreferCompositingToLCDTextEnabled false");
43 window
.internals
.settings
.setPreferCompositingToLCDTextEnabled(false);
44 useIntegerScrollOffset
= true;