2 <script src=
"../../resources/ahem.js"></script>
8 /* Need a wrapper to establish the writing mode, thanks to crbug.com/
463462 */
10 -webkit-writing-mode: vertical-rl;
17 overflow: -webkit-paged-x;
18 -webkit-column-gap:
0;
30 <p id=
"description"></p>
31 <div id=
"console"></div>
34 <div id=
"pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx
</div>
36 <script src=
"../../resources/js-test.js"></script>
39 description("Test that hitting areas outside a paged container takes us to the right text content on some page.");
41 // FIXME: We should ideally test above and below every page, but we get bogus results,
42 // thanks to crbug.com/466554 , so avoid testing in the problematic areas.
44 debug("Above page 1:");
45 shouldBe("document.caretRangeFromPoint(499,0).startOffset", "0");
46 shouldBe("document.caretRangeFromPoint(430,0).startOffset", "0");
47 shouldBe("document.caretRangeFromPoint(390,0).startOffset", "4");
49 debug("Below page 1:");
50 shouldBe("document.caretRangeFromPoint(499,320).startOffset", "0");
51 shouldBe("document.caretRangeFromPoint(430,320).startOffset", "3");
52 shouldBe("document.caretRangeFromPoint(390,320).startOffset", "7");
54 debug("To the right of page 1:");
55 shouldBe("document.caretRangeFromPoint(499,320).startOffset", "0");
56 shouldBe("document.caretRangeFromPoint(499,250).startOffset", "0");
57 shouldBe("document.caretRangeFromPoint(499,0).startOffset", "0");
59 debug("Scroll to page 2");
60 document
.getElementById("pagedContainer").scrollLeft
= 120;
62 debug("Above page 2:");
63 shouldBe("document.caretRangeFromPoint(449,0).startOffset", "12");
64 shouldBe("document.caretRangeFromPoint(330,0).startOffset", "20");
66 debug("Below page 2:");
67 shouldBe("document.caretRangeFromPoint(449,320).startOffset", "15");
68 shouldBe("document.caretRangeFromPoint(330,320).startOffset", "23");
70 debug("Scroll to page 3");
71 document
.getElementById("pagedContainer").scrollLeft
= 0;
73 debug("Above page 3:");
74 shouldBe("document.caretRangeFromPoint(449,0).startOffset", "24");
75 shouldBe("document.caretRangeFromPoint(330,0).startOffset", "32");
77 debug("Below page 3:");
78 shouldBe("document.caretRangeFromPoint(449,320).startOffset", "27");
79 shouldBe("document.caretRangeFromPoint(330,320).startOffset", "35");