3 <script src=
"../../resources/js-test.js"></script>
5 description("This test ensures that document content width (height) as reported by scrollWidth (scrollHeight) is invariant to changes in page scale factor.");
8 window
.internals
.settings
.setMockScrollbarsEnabled(true);
10 var body
= document
.body
;
12 // According to CSSOM (http://dev.w3.org/csswg/cssom-view/#dom-element-scrollwidth)
13 // the scrollWidth of the body element (in Quirks mode) is defined as
14 // max(document content width, value of innerWidth).
15 // In this test, we want to measure the document content width (height),
16 // rather than innerWidth (innerHeight), so we make the body element
17 // larger than the innerWidth (innerHeight).
19 body
.style
["width"] = window
.innerWidth
+ 100 + "px";
20 body
.style
["height"] = window
.innerHeight
+ 100 + "px";
22 var originalScrollWidth
= body
.scrollWidth
;
23 var originalScrollHeight
= body
.scrollHeight
;
26 if (window
.eventSender
)
27 window
.internals
.setPageScaleFactor(scale
);
29 // As we have increased the scale factor, the innerWidth will be less
30 // as fewer CSS pixels will be rendered in the same viewport, so
31 // body.scrollWidth (scrollHeight) will still be measuring the document
32 // content width (height).
34 shouldBe("body.scrollWidth", "originalScrollWidth");
35 shouldBe("body.scrollHeight", "originalScrollHeight");