4 <script src=
"../../resources/js-test.js"></script>
6 body.hide-containers .container {
16 line-height:
20px; /*
10 lines per page */
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.");
53 testFailed(containerId
+ " Block " + blockNumber
+ " Line " + lineNumber
+ " wasn't at the top of the region.");
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);
79 <div class=
"container" id=
"test">
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>
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>