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