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-lr; |
| 10 padding: 20px 100px; |
| 11 width: 400px; |
| 12 height: 350px; |
| 13 } |
| 14 |
| 15 #mc { |
| 16 -webkit-columns: 3; |
| 17 -webkit-column-gap: 20px; |
| 18 height: 280px; |
| 19 font: 20px/1 Ahem; |
| 20 } |
| 21 |
| 22 #log { |
| 23 position: absolute; |
| 24 top: 400px; |
| 25 } |
| 26 </style> |
| 27 <div id="log"> |
| 28 <p id="description"></p> |
| 29 <div id="console"></div> |
| 30 </div> |
| 31 <div id="wrapper"> |
| 32 <div id="mc">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> |
| 33 </div> |
| 34 <script src="../../../resources/js-test.js"></script> |
| 35 <script> |
| 36 description("Test that hitting areas outside columns takes us to the right t
ext content inside columns."); |
| 37 |
| 38 debug("To the left of the first column:"); |
| 39 shouldBe("document.caretRangeFromPoint(0,10).startOffset", "0"); |
| 40 shouldBe("document.caretRangeFromPoint(0,70).startOffset", "0"); |
| 41 shouldBe("document.caretRangeFromPoint(0,109).startOffset", "0"); |
| 42 |
| 43 debug("To the left of the second column:"); |
| 44 shouldBe("document.caretRangeFromPoint(0,110).startOffset", "12"); |
| 45 shouldBe("document.caretRangeFromPoint(0,170).startOffset", "12"); |
| 46 shouldBe("document.caretRangeFromPoint(0,209).startOffset", "12"); |
| 47 |
| 48 debug("To the left of the third column:"); |
| 49 shouldBe("document.caretRangeFromPoint(0,210).startOffset", "24"); |
| 50 shouldBe("document.caretRangeFromPoint(0,270).startOffset", "24"); |
| 51 shouldBe("document.caretRangeFromPoint(0,309).startOffset", "24"); |
| 52 |
| 53 debug("To the right of the first column:"); |
| 54 shouldBe("document.caretRangeFromPoint(400,10).startOffset", "12"); |
| 55 shouldBe("document.caretRangeFromPoint(400,70).startOffset", "12"); |
| 56 shouldBe("document.caretRangeFromPoint(400,109).startOffset", "12"); |
| 57 |
| 58 debug("To the right of the second column:"); |
| 59 shouldBe("document.caretRangeFromPoint(400,110).startOffset", "24"); |
| 60 shouldBe("document.caretRangeFromPoint(400,170).startOffset", "24"); |
| 61 shouldBe("document.caretRangeFromPoint(400,209).startOffset", "24"); |
| 62 |
| 63 debug("Above first column:"); |
| 64 shouldBe("document.caretRangeFromPoint(90,0).startOffset", "0"); |
| 65 shouldBe("document.caretRangeFromPoint(110,0).startOffset", "0"); |
| 66 shouldBe("document.caretRangeFromPoint(130,0).startOffset", "4"); |
| 67 shouldBe("document.caretRangeFromPoint(150,0).startOffset", "8"); |
| 68 shouldBe("document.caretRangeFromPoint(170,0).startOffset", "12"); |
| 69 |
| 70 debug("Below third column:"); |
| 71 shouldBe("document.caretRangeFromPoint(90,350).startOffset", "24"); |
| 72 shouldBe("document.caretRangeFromPoint(110,350).startOffset", "27"); |
| 73 shouldBe("document.caretRangeFromPoint(130,350).startOffset", "31"); |
| 74 shouldBe("document.caretRangeFromPoint(150,350).startOffset", "35"); |
| 75 |
| 76 debug("In the gap between the first and second columns:"); |
| 77 shouldBe("document.caretRangeFromPoint(100,109).startOffset", "3"); |
| 78 shouldBe("document.caretRangeFromPoint(120,109).startOffset", "7"); |
| 79 shouldBe("document.caretRangeFromPoint(140,109).startOffset", "11"); |
| 80 shouldBe("document.caretRangeFromPoint(159,109).startOffset", "11"); |
| 81 shouldBe("document.caretRangeFromPoint(100,110).startOffset", "12"); |
| 82 shouldBe("document.caretRangeFromPoint(120,110).startOffset", "16"); |
| 83 shouldBe("document.caretRangeFromPoint(140,110).startOffset", "20"); |
| 84 shouldBe("document.caretRangeFromPoint(159,110).startOffset", "20"); |
| 85 |
| 86 debug("In the gap between the second and third columns:"); |
| 87 shouldBe("document.caretRangeFromPoint(100,209).startOffset", "15"); |
| 88 shouldBe("document.caretRangeFromPoint(120,209).startOffset", "19"); |
| 89 shouldBe("document.caretRangeFromPoint(140,209).startOffset", "23"); |
| 90 shouldBe("document.caretRangeFromPoint(159,209).startOffset", "23"); |
| 91 shouldBe("document.caretRangeFromPoint(100,210).startOffset", "24"); |
| 92 shouldBe("document.caretRangeFromPoint(120,210).startOffset", "28"); |
| 93 shouldBe("document.caretRangeFromPoint(140,210).startOffset", "32"); |
| 94 shouldBe("document.caretRangeFromPoint(159,210).startOffset", "32"); |
| 95 </script> |
OLD | NEW |