OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 body { |
| 4 margin:0; |
| 5 } |
| 6 |
| 7 /* Need a wrapper to establish the writing mode, thanks to crbug.com/463462
*/ |
| 8 #wrapper { |
| 9 -webkit-writing-mode: vertical-rl; |
| 10 padding: 20px 100px; |
| 11 width: 400px; |
| 12 height: 350px; |
| 13 background: green; |
| 14 } |
| 15 |
| 16 #mc { |
| 17 -webkit-columns: 3; |
| 18 -webkit-column-gap: 20px; |
| 19 direction: rtl; |
| 20 unicode-bidi: bidi-override; |
| 21 height: 280px; |
| 22 font: 20px/1 Ahem; |
| 23 } |
| 24 |
| 25 #log { |
| 26 position: absolute; |
| 27 top: 400px; |
| 28 } |
| 29 </style> |
| 30 <div id="log"> |
| 31 <p id="description"></p> |
| 32 <div id="console"></div> |
| 33 </div> |
| 34 <div id="wrapper"> |
| 35 <div id="mc">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> |
| 36 </div> |
| 37 <script src="../../../resources/js-test.js"></script> |
| 38 <script> |
| 39 description("Test that hitting areas outside columns takes us to the right t
ext content inside columns."); |
| 40 |
| 41 // Note that this test is very limited (compared to the other caret-range- t
ests), |
| 42 // due to platform behavioral differences, and crbug.com/466974 |
| 43 |
| 44 debug("To the right of the first column:"); |
| 45 shouldBe("document.caretRangeFromPoint(550,340).startOffset", "0"); |
| 46 shouldBe("document.caretRangeFromPoint(550,270).startOffset", "0"); |
| 47 shouldBe("document.caretRangeFromPoint(550,211).startOffset", "0"); |
| 48 |
| 49 debug("Below first column:"); |
| 50 shouldBe("document.caretRangeFromPoint(550,350).startOffset", "0"); |
| 51 shouldBe("document.caretRangeFromPoint(490,350).startOffset", "0"); |
| 52 shouldBe("document.caretRangeFromPoint(470,350).startOffset", "4"); |
| 53 shouldBe("document.caretRangeFromPoint(450,350).startOffset", "8"); |
| 54 |
| 55 debug("Above third column:"); |
| 56 shouldBe("document.caretRangeFromPoint(490,0).startOffset", "27"); |
| 57 shouldBe("document.caretRangeFromPoint(470,0).startOffset", "31"); |
| 58 shouldBe("document.caretRangeFromPoint(450,0).startOffset", "35"); |
| 59 |
| 60 debug("In the gap between the first and second columns:"); |
| 61 shouldBe("document.caretRangeFromPoint(499,211).startOffset", "3"); |
| 62 shouldBe("document.caretRangeFromPoint(479,211).startOffset", "7"); |
| 63 shouldBe("document.caretRangeFromPoint(459,211).startOffset", "11"); |
| 64 shouldBe("document.caretRangeFromPoint(440,211).startOffset", "11"); |
| 65 shouldBe("document.caretRangeFromPoint(499,210).startOffset", "12"); |
| 66 shouldBe("document.caretRangeFromPoint(479,210).startOffset", "16"); |
| 67 shouldBe("document.caretRangeFromPoint(459,210).startOffset", "20"); |
| 68 shouldBe("document.caretRangeFromPoint(440,210).startOffset", "20"); |
| 69 |
| 70 debug("In the gap between the second and third columns:"); |
| 71 shouldBe("document.caretRangeFromPoint(499,111).startOffset", "15"); |
| 72 shouldBe("document.caretRangeFromPoint(479,111).startOffset", "19"); |
| 73 shouldBe("document.caretRangeFromPoint(459,111).startOffset", "23"); |
| 74 shouldBe("document.caretRangeFromPoint(440,111).startOffset", "23"); |
| 75 shouldBe("document.caretRangeFromPoint(499,110).startOffset", "24"); |
| 76 shouldBe("document.caretRangeFromPoint(479,110).startOffset", "28"); |
| 77 shouldBe("document.caretRangeFromPoint(459,110).startOffset", "32"); |
| 78 shouldBe("document.caretRangeFromPoint(440,110).startOffset", "32"); |
| 79 </script> |
OLD | NEW |