Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / multicol / orphans-relayout.html
blob2e27dc6b4cd21b3eef3a1f1408031fc8dbf8cfd7
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style>
6 body.hide-containers .container {
7 display: none;
10 .container {
11 width: 600px;
12 height: 200px;
13 -webkit-columns: 3;
14 columns: 3;
15 column-fill: auto;
16 line-height: 20px; /* 10 lines per page */
17 font-size: 16px;
18 margin: 0 0 20px 0;
19 padding: 0;
20 overflow: hidden;
21 orphans: 2;
24 .block {
25 margin: 0 0 15px 0;
26 padding: 0;
29 .top {
30 color: red;
33 .bottom {
34 color: green;
36 </style>
37 <script>
39 description("Test if an element with orphans relayouts correctly. The red lines of text must be at the top of the blue rectangle. The green lines of text must be at the bottom of the blue rectangle.");
41 if (window.testRunner)
42 testRunner.dumpAsText();
44 function testIsFirstInColumn(containerId, blockNumber, lineNumber)
46 // Get the upper bounds of the container and line.
47 var topOfContainer = document.getElementById(containerId).getBoundingClientRect().top;
48 var topOfLine = document.getElementById(containerId + "-block-" + blockNumber + "-line-" + lineNumber).getBoundingClientRect().top;
50 if (Math.abs(topOfContainer - topOfLine) < 5) // Give 5 pixels to account for subpixel layout.
51 testPassed(containerId + " Block " + blockNumber + " Line " + lineNumber + " is correct.");
52 else
53 testFailed(containerId + " Block " + blockNumber + " Line " + lineNumber + " wasn't at the top of the region.");
56 function runTest()
58 var container = document.getElementById("test");
60 document.body.offsetTop;
62 container.style.border = "3px solid blue"; // Modify a property that triggers a layout.
64 testIsFirstInColumn("test", 1, 1);
65 testIsFirstInColumn("test", 2, 1);
67 if (window.testRunner) {
68 // Hide all the containers and leave just the test results for text output.
69 document.body.className = "hide-containers";
72 isSuccessfullyParsed();
75 window.addEventListener("load", runTest, false);
76 </script>
77 </head>
78 <body>
79 <div class="container" id="test">
80 <div class="block">
81 <span id="test-block-1-line-1" class="top">Block 1 Line 1</span><br>
82 <span id="test-block-1-line-2">Block 1 Line 2</span><br>
83 <span id="test-block-1-line-3">Block 1 Line 3</span><br>
84 <span id="test-block-1-line-4">Block 1 Line 4</span><br>
85 <span id="test-block-1-line-5">Block 1 Line 5</span><br>
86 <span id="test-block-1-line-6">Block 1 Line 6</span><br>
87 <span id="test-block-1-line-7">Block 1 Line 7</span><br>
88 <span id="test-block-1-line-8" class="bottom">Block 1 Line 8</span><br>
89 </div>
90 <div class="block">
91 <span id="test-block-2-line-1" class="top">Block 2 Line 1</span><br>
92 <span id="test-block-2-line-2">Block 2 Line 2</span><br>
93 <span id="test-block-2-line-3">Block 2 Line 3</span><br>
94 <span id="test-block-2-line-4">Block 2 Line 4</span><br>
95 <span id="test-block-2-line-5">Block 2 Line 5</span><br>
96 <span id="test-block-2-line-6">Block 2 Line 6</span><br>
97 </div>
98 </div>
99 </body>
100 </html>