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