OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script> | 4 <script> |
5 description("This test ensures that document content width (height) as r eported by scrollWidth (scrollHeight) is invariant to changes in page scale fact or."); | 5 description("This test ensures that document content width (height) as r eported by scrollWidth (scrollHeight) is invariant to changes in page scale fact or."); |
6 | 6 |
7 if (window.internals) | 7 if (window.internals) |
8 window.internals.settings.setMockScrollbarsEnabled(true); | 8 window.internals.settings.setMockScrollbarsEnabled(true); |
9 | 9 |
10 var body = document.body; | 10 var body = document.body; |
11 | 11 |
12 // According to CSSOM (http://dev.w3.org/csswg/cssom-view/#dom-element-s crollwidth) | 12 // According to CSSOM (http://dev.w3.org/csswg/cssom-view/#dom-element-s crollwidth) |
13 // the scrollWidth of the body element (in Quirks mode) is defined as | 13 // the scrollWidth of the body element (in Quirks mode) is defined as |
14 // max(document content width, value of innerWidth). | 14 // max(document content width, value of innerWidth). |
15 // In this test, we want to measure the document content width (height), | 15 // In this test, we want to measure the document content width (height), |
16 // rather than innerWidth (innerHeight), so we make the body element | 16 // rather than innerWidth (innerHeight), so we make the body element |
17 // larger than the innerWidth (innerHeight). | 17 // larger than the innerWidth (innerHeight). |
18 | 18 |
19 body.style["width"] = window.innerWidth + 100 + "px"; | 19 body.style["width"] = window.innerWidth + 100 + "px"; |
20 body.style["height"] = window.innerHeight + 100 + "px"; | 20 body.style["height"] = window.innerHeight + 100 + "px"; |
tdresser
2015/05/19 13:53:11
Is this correct?
Should we be setting the size of
Rick Byers
2015/05/20 15:10:24
Either would work, but since this test is explicit
| |
21 | 21 |
22 var originalScrollWidth = body.scrollWidth; | 22 var originalScrollWidth = document.scrollingElement.scrollWidth; |
23 var originalScrollHeight = body.scrollHeight; | 23 var originalScrollHeight = document.scrollingElement.scrollHeight; |
24 | 24 |
25 var scale = 1.1; | 25 var scale = 1.1; |
26 if (window.eventSender) | 26 if (window.eventSender) |
27 window.eventSender.setPageScaleFactor(scale, 0, 0); | 27 window.eventSender.setPageScaleFactor(scale, 0, 0); |
28 | 28 |
29 // As we have increased the scale factor, the innerWidth will be less | 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 | 30 // as fewer CSS pixels will be rendered in the same viewport, so |
31 // body.scrollWidth (scrollHeight) will still be measuring the document | 31 // scrollingElement.scrollWidth (scrollHeight) will still be measuring t he document |
tdresser
2015/05/19 13:53:11
nit: scrollingElement->document.scrollingElement
| |
32 // content width (height). | 32 // content width (height). |
33 | 33 |
34 shouldBe("body.scrollWidth", "originalScrollWidth"); | 34 shouldBe("document.scrollingElement.scrollWidth", "originalScrollWidth") ; |
35 shouldBe("body.scrollHeight", "originalScrollHeight"); | 35 shouldBe("document.scrollingElement.scrollHeight", "originalScrollHeight "); |
36 </script> | 36 </script> |
37 </body> | 37 </body> |
38 </html> | 38 </html> |
OLD | NEW |