OLD | NEW |
---|---|
(Empty) | |
1 <script src="../../resources/js-test.js"></script> | |
esprehn
2016/05/02 19:02:12
Can you add a comment at the top like <!-- quirks
rune
2016/05/02 22:48:21
Done.
| |
2 <style> | |
3 :root, body { width: 100%; height: 100%; margin: 0 } | |
4 #container.wide { width: 5000px; height: 10px; } | |
5 #container.tall { height: 5000px; width: 10px; } | |
6 </style> | |
7 <div id="container"></div> | |
8 <script> | |
9 description("Style recalc when reading clientWidth/clientHeight of body in q uirks mode."); | |
10 | |
11 shouldBeDefined(window.internals); | |
12 | |
13 function runClientSizeTest(testClass, expectWidthChange, expectHeightChange, expectedRecalcCount) { | |
14 | |
15 var origWidth = document.body.clientWidth; | |
16 var origHeight = document.body.clientHeight; | |
17 internals.updateStyleAndReturnAffectedElementCount(); | |
18 | |
19 container.classList.add(testClass) | |
20 | |
21 var afterWidth = document.body.clientWidth; | |
22 var afterHeight = document.body.clientHeight; | |
23 | |
24 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", ""+expe ctedRecalcCount); | |
25 | |
26 if (expectWidthChange) | |
27 shouldBeGreaterThan(""+origWidth, ""+afterWidth); | |
28 else | |
29 shouldBe(""+origWidth, ""+afterWidth); | |
30 | |
31 if (expectHeightChange) | |
32 shouldBeGreaterThan(""+origHeight, ""+afterHeight); | |
33 else | |
34 shouldBe(""+origHeight, ""+afterHeight); | |
35 | |
36 container.classList.remove(testClass) | |
37 } | |
38 | |
39 var originalOverlayScrollbars = internals.runtimeFlags.overlayScrollbarsEnab led; | |
40 | |
41 internals.settings.setOverlayScrollbarsEnabled(true); | |
42 | |
43 runClientSizeTest("wide", false, false, 1); | |
44 runClientSizeTest("tall", false, false, 1); | |
45 | |
46 internals.settings.setOverlayScrollbarsEnabled(false); | |
47 | |
48 runClientSizeTest("wide", false, true, 0); | |
49 runClientSizeTest("tall", true, false, 0); | |
50 | |
51 internals.settings.setOverlayScrollbarsEnabled(originalOverlayScrollbars); | |
52 </script> | |
OLD | NEW |