OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/ahem.js"></script> | 2 <script src="../../resources/ahem.js"></script> |
3 <div id="target" style=" | 3 <div id="target" style=" |
4 outline: dashed lightblue; | 4 outline: dashed lightblue; |
5 width: 150px; | 5 height: 150px; |
6 padding: 25px; | 6 padding: 25px; |
7 font: 20px Ahem; | 7 font: 20px Ahem; |
8 -webkit-writing-mode: horizontal-bt; | 8 writing-mode: vertical-rl; |
9 ">Lorem ipsum dolor sit amet</div> | 9 ">Lorem ipsum dolor sit amet</div> |
10 <pre id="log"></pre> | 10 <pre id="log"></pre> |
11 <script> | 11 <script> |
12 if (window.testRunner && window.internals) { | 12 if (window.testRunner && window.internals) { |
13 testRunner.dumpAsText(); | 13 testRunner.dumpAsText(); |
14 internals.settings.setEditingBehavior("mac"); | 14 internals.settings.setEditingBehavior("mac"); |
15 } | 15 } |
16 | 16 |
17 function log(message) | 17 function log(message) |
18 { | 18 { |
19 document.getElementById("log").appendChild(document.createTextNode(messa
ge + "\n")); | 19 document.getElementById("log").appendChild(document.createTextNode(messa
ge + "\n")); |
20 } | 20 } |
21 | 21 |
22 function test(x, y, expectedOffset) | 22 function test(y, x, expectedOffset) |
23 { | 23 { |
24 var actualOffset = document.caretRangeFromPoint(8 + x, 8 + y).startOffse
t; | 24 var actualOffset = document.caretRangeFromPoint(8 + x, 8 + y).startOffse
t; |
25 if (actualOffset === expectedOffset) | 25 if (actualOffset === expectedOffset) |
26 log("PASS: offset at (" + x + "," + y + ") was " + actualOffset + ".
"); | 26 log("PASS: offset at (" + y + "," + x + ") was " + actualOffset + ".
"); |
27 else | 27 else |
28 log("FAIL: offset at (" + x + "," + y + ") was " + actualOffset + ".
Expected " + expectedOffset + "."); | 28 log("FAIL: offset at (" + y + "," + x + ") was " + actualOffset + ".
Expected " + expectedOffset + "."); |
29 } | 29 } |
30 | 30 |
31 test(100, 105, 4); | 31 test(100, 105, 4); |
32 test(160, 105, 5); | 32 test(160, 105, 5); |
33 test(100, 104, 10); | 33 test(100, 104, 10); |
34 test(160, 104, 11); | 34 test(160, 104, 11); |
35 test(60, 26, 24); | 35 test(60, 26, 24); |
36 test(160, 26, 26); | 36 test(160, 26, 26); |
37 test(60, 25, 24); | 37 test(60, 25, 24); |
38 test(160, 25, 26); | 38 test(160, 25, 26); |
39 test(60, 24, 26); | 39 test(60, 24, 24); |
40 test(160, 24, 26); | 40 test(160, 24, 26); |
41 </script> | 41 </script> |
OLD | NEW |