OLD | NEW |
1 <html style="-webkit-writing-mode:vertical-lr"> | 1 <html style="-webkit-writing-mode:vertical-lr"> |
2 <style> | 2 <style> |
3 div.columns { | 3 div.columns { |
4 -webkit-columns: 2; | 4 -webkit-columns: 2; |
5 -webkit-column-gap: 0; | 5 -webkit-column-gap: 0; |
6 columns: 2; | 6 columns: 2; |
7 column-gap: 0; | 7 column-gap: 0; |
8 column-fill: auto; | 8 column-fill: auto; |
9 height: 200px; | 9 height: 200px; |
10 outline: 1px solid blue; | 10 outline: 1px solid blue; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 <div class="float" id="f5"> | 62 <div class="float" id="f5"> |
63 and one five line float | 63 and one five line float |
64 </div> | 64 </div> |
65 text runs here next to the float | 65 text runs here next to the float |
66 </div> | 66 </div> |
67 </div> | 67 </div> |
68 <pre id="result"></pre> | 68 <pre id="result"></pre> |
69 <script> | 69 <script> |
70 function floatOffset(float) | 70 function floatOffset(float) |
71 { | 71 { |
72 var range = document.createRange(); | 72 var selection = getSelection(); |
73 range.setStart(float, 0); | 73 selection.collapse(float, 0); |
74 range.setEnd(float, 0); | 74 selection.modify("extend", "forward", "word"); |
75 range.expand("word"); | 75 var rect = selection.getRangeAt(0).getBoundingClientRect(); |
76 var rect = range.getBoundingClientRect(); | |
77 var parentRect = float.parentNode.getBoundingClientRect(); | 76 var parentRect = float.parentNode.getBoundingClientRect(); |
78 return { width: rect.left - parentRect.left, height: rect.top - parentRe
ct.top }; | 77 return { width: rect.left - parentRect.left, height: rect.top - parentRe
ct.top }; |
79 } | 78 } |
80 | 79 |
81 var tests = [ | 80 var tests = [ |
82 ["f1", 45, 0], | 81 ["f1", 45, 0], |
83 ["f2", 45, 0], | 82 ["f2", 45, 0], |
84 ["f3", 45, 0], | 83 ["f3", 45, 0], |
85 ["f4", 55, 0], | 84 ["f4", 55, 0], |
86 ["f5", 15, 0] | 85 ["f5", 15, 0] |
(...skipping 12 matching lines...) Expand all Loading... |
99 } | 98 } |
100 } | 99 } |
101 | 100 |
102 if (window.testRunner) { | 101 if (window.testRunner) { |
103 testRunner.dumpAsText(); | 102 testRunner.dumpAsText(); |
104 document.getElementById("tests").style.display = "none"; | 103 document.getElementById("tests").style.display = "none"; |
105 } | 104 } |
106 | 105 |
107 document.getElementById("result").innerText = failures ? "FAIL: " + failures
+ " cases failed" : "PASS"; | 106 document.getElementById("result").innerText = failures ? "FAIL: " + failures
+ " cases failed" : "PASS"; |
108 </script> | 107 </script> |
OLD | NEW |