Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / partial-layout-block.html
blob34642ca1d6b38da21f4a199f2d900d43bfd16489
1 <!DOCTYPE HTML>
2 <html>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <link rel="stylesheet" href="../../resources/testharness.css">
6 <head>
7 <style>
8 html, body {
9 margin: 0;
10 padding: 0;
13 #measure {
14 margin: 10px;
15 padding: 10px;
18 #fixedsize {
19 width: 100px;
20 height: 100px;
22 </style>
23 </head>
24 <body>
25 <div id="measure"><div id="fixedsize"></div></div>
26 <script>
27 if (window.testRunner)
28 testRunner.dumpAsText();
30 if (window.internals)
31 window.internals.settings.setOverlayScrollbarsEnabled(true);
33 test(function() {
34 var measure = document.getElementById('measure');
36 // Record partial layout values for offset*.
37 var measureWidth = measure.offsetWidth;
38 var measureHeight = measure.offsetHeight;
39 var measureTop = measure.offsetTop;
40 var measureLeft = measure.offsetLeft;
42 // Invalidate measure and force a full layout.
43 var child = measure.firstChild;
44 measure.removeChild(child);
45 document.body.clientHeight;
46 measure.appendChild(child);
47 var forceLayout = document.body.clientHeight;
49 var childOffsetTop = child.offsetTop;
51 assert_equals(measureWidth, document.body.offsetWidth - 20);
52 assert_equals(measureHeight, measure.offsetHeight);
53 assert_equals(measureTop, childOffsetTop - 10);
54 assert_equals(measureLeft, measure.offsetLeft);
55 }, 'Test that partial layout works for offset{width, height, left, top} methods.');
56 </script>
57 </body>
58 </html>