OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 body { |
| 4 margin:0; |
| 5 } |
| 6 |
| 7 #mc { |
| 8 -webkit-columns: 3; |
| 9 -webkit-column-gap: 20px; |
| 10 direction: rtl; |
| 11 unicode-bidi: bidi-override; |
| 12 width: 280px; |
| 13 margin:20px 100px; |
| 14 font: 20px/1 Ahem; |
| 15 } |
| 16 |
| 17 #log { |
| 18 position: absolute; |
| 19 top: 101px; |
| 20 } |
| 21 </style> |
| 22 <div id="log"> |
| 23 <p id="description"></p> |
| 24 <div id="console"></div> |
| 25 </div> |
| 26 <div id="mc">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> |
| 27 <script src="../../resources/js-test.js"></script> |
| 28 <script> |
| 29 description("Test that hitting areas outside columns takes us to the right t
ext content inside columns."); |
| 30 |
| 31 debug("Above first column:"); |
| 32 shouldBe("document.caretRangeFromPoint(450,0).startOffset", "0"); |
| 33 shouldBe("document.caretRangeFromPoint(350,0).startOffset", "0"); |
| 34 shouldBe("document.caretRangeFromPoint(291,0).startOffset", "0"); |
| 35 |
| 36 debug("Above second column:"); |
| 37 shouldBe("document.caretRangeFromPoint(290,0).startOffset", "12"); |
| 38 shouldBe("document.caretRangeFromPoint(250,0).startOffset", "12"); |
| 39 shouldBe("document.caretRangeFromPoint(191,0).startOffset", "12"); |
| 40 |
| 41 debug("Above third column:"); |
| 42 shouldBe("document.caretRangeFromPoint(190,0).startOffset", "24"); |
| 43 shouldBe("document.caretRangeFromPoint(150,0).startOffset", "24"); |
| 44 shouldBe("document.caretRangeFromPoint(50,0).startOffset", "24"); |
| 45 |
| 46 debug("Below first column:"); |
| 47 shouldBe("document.caretRangeFromPoint(450,100).startOffset", "12"); |
| 48 shouldBe("document.caretRangeFromPoint(350,100).startOffset", "12"); |
| 49 shouldBe("document.caretRangeFromPoint(291,100).startOffset", "12"); |
| 50 |
| 51 debug("Below second column:"); |
| 52 shouldBe("document.caretRangeFromPoint(290,100).startOffset", "24"); |
| 53 shouldBe("document.caretRangeFromPoint(250,100).startOffset", "24"); |
| 54 shouldBe("document.caretRangeFromPoint(191,100).startOffset", "24"); |
| 55 |
| 56 debug("To the right of the first column:"); |
| 57 shouldBe("document.caretRangeFromPoint(400,10).startOffset", "0"); |
| 58 shouldBe("document.caretRangeFromPoint(400,30).startOffset", "0"); |
| 59 shouldBe("document.caretRangeFromPoint(400,50).startOffset", "4"); |
| 60 shouldBe("document.caretRangeFromPoint(400,70).startOffset", "8"); |
| 61 shouldBe("document.caretRangeFromPoint(400,90).startOffset", "12"); |
| 62 |
| 63 debug("To the left of the third column:"); |
| 64 shouldBe("document.caretRangeFromPoint(0,10).startOffset", "24"); |
| 65 shouldBe("document.caretRangeFromPoint(0,30).startOffset", "27"); |
| 66 shouldBe("document.caretRangeFromPoint(0,50).startOffset", "31"); |
| 67 shouldBe("document.caretRangeFromPoint(0,70).startOffset", "35"); |
| 68 |
| 69 debug("In the gap between the first and second columns:"); |
| 70 shouldBe("document.caretRangeFromPoint(291,20).startOffset", "3"); |
| 71 shouldBe("document.caretRangeFromPoint(291,40).startOffset", "7"); |
| 72 shouldBe("document.caretRangeFromPoint(291,60).startOffset", "11"); |
| 73 shouldBe("document.caretRangeFromPoint(291,69).startOffset", "11"); |
| 74 shouldBe("document.caretRangeFromPoint(290,20).startOffset", "12"); |
| 75 shouldBe("document.caretRangeFromPoint(290,40).startOffset", "16"); |
| 76 shouldBe("document.caretRangeFromPoint(290,60).startOffset", "20"); |
| 77 shouldBe("document.caretRangeFromPoint(290,69).startOffset", "20"); |
| 78 |
| 79 debug("In the gap between the second and third columns:"); |
| 80 shouldBe("document.caretRangeFromPoint(191,20).startOffset", "15"); |
| 81 shouldBe("document.caretRangeFromPoint(191,40).startOffset", "19"); |
| 82 shouldBe("document.caretRangeFromPoint(191,60).startOffset", "23"); |
| 83 shouldBe("document.caretRangeFromPoint(191,69).startOffset", "23"); |
| 84 shouldBe("document.caretRangeFromPoint(190,20).startOffset", "24"); |
| 85 shouldBe("document.caretRangeFromPoint(190,40).startOffset", "28"); |
| 86 shouldBe("document.caretRangeFromPoint(190,60).startOffset", "32"); |
| 87 shouldBe("document.caretRangeFromPoint(190,69).startOffset", "32"); |
| 88 </script> |
OLD | NEW |