11 outline: 1px solid blue;
28 <div class="columns" style="height: 80px;">
29 one line two lines three lines
30 <div class="float" id="f1">
33 text runs here next to the float
35 <!-- In this case, the float fits, but then the main content causes the break
36 to occur earlier and the float gets split. -->
37 <div class="columns" style="height: 75px;">
38 one line two lines three lines
39 <div class="float" id="f2">
42 text runs here next to the float
44 <!-- In this case, the float paginates after its second line. -->
45 <div class="columns" style="height: 70px;">
46 one line two lines three lines
47 <div class="float" id="f3">
50 text runs here next to the float
52 <!-- In this case, the float paginates after its first line. -->
53 <div class="columns" style="height: 70px;">
54 one line two lines three lines and some more
55 <div class="float" id="f4">
58 text runs here next to the float
60 <!-- In this case, the float paginates after its third line. -->
61 <div class="columns" style="height: 45px;">
63 <div class="float" id="f5">
64 and one five line float
66 text runs here next to the float
69 <pre id="result"></pre>
71 function floatOffset(float)
73 var range = document.createRange();
74 range.setStart(float, 0);
75 range.setEnd(float, 0);
77 var rect = range.getBoundingClientRect();
78 var parentRect = float.parentNode.getBoundingClientRect();
79 return { width: rect.left - parentRect.left, height: rect.top - parentRect.top };
92 while (test = tests.shift()) {
93 var float = document.getElementById(test[0]);
94 var result = floatOffset(float);
95 var passed = result.width === test[1] && result.height === test[2]
96 float.style.color = passed ? "green" : "red";
101 if (window.testRunner) {
102 testRunner.dumpAsText();
103 document.getElementById("tests").style.display = "none";
106 document.getElementById("result").innerText = failures ? "FAIL: " + failures + " cases failed" : "PASS";