2 <script src=
"../../resources/ahem.js"></script>
9 overflow: -webkit-paged-y;
10 -webkit-column-gap:
0;
12 unicode-bidi: bidi-override;
25 <p id=
"description"></p>
26 <div id=
"console"></div>
28 <div id=
"pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx
</div>
29 <script src=
"../../resources/js-test.js"></script>
32 description("Test that hitting areas outside a paged container takes us to the right text content on some page.");
34 // FIXME: We should ideally test above and below every page, but we get bogus results,
35 // thanks to crbug.com/466554 , so avoid testing in the problematic areas.
37 debug("Above page 1:");
38 shouldBe("document.caretRangeFromPoint(50,0).startOffset", "0");
39 shouldBe("document.caretRangeFromPoint(150,0).startOffset", "0");
40 shouldBe("document.caretRangeFromPoint(300,0).startOffset", "0");
42 debug("To the right of page 1:");
43 shouldBe("document.caretRangeFromPoint(400,20).startOffset", "0");
44 shouldBe("document.caretRangeFromPoint(400,60).startOffset", "0");
45 shouldBe("document.caretRangeFromPoint(400,100).startOffset", "4");
46 shouldBe("document.caretRangeFromPoint(400,140).startOffset", "8");
48 debug("To the left of page 1:");
49 shouldBe("document.caretRangeFromPoint(0,20).startOffset", "0");
50 shouldBe("document.caretRangeFromPoint(0,60).startOffset", "3");
51 shouldBe("document.caretRangeFromPoint(0,100).startOffset", "7");
52 shouldBe("document.caretRangeFromPoint(0,140).startOffset", "11");
54 debug("Scroll to page 2");
55 document
.getElementById("pagedContainer").scrollTop
= 120;
57 debug("To the right of page 2:");
58 shouldBe("document.caretRangeFromPoint(400,60).startOffset", "12");
59 shouldBe("document.caretRangeFromPoint(400,100).startOffset", "16");
60 shouldBe("document.caretRangeFromPoint(400,140).startOffset", "20");
62 debug("To the left of page 2:");
63 shouldBe("document.caretRangeFromPoint(0,60).startOffset", "15");
64 shouldBe("document.caretRangeFromPoint(0,100).startOffset", "19");
65 shouldBe("document.caretRangeFromPoint(0,140).startOffset", "23");
67 debug("Scroll to page 3");
68 document
.getElementById("pagedContainer").scrollTop
= 240;
70 debug("To the right of page 3:");
71 shouldBe("document.caretRangeFromPoint(400,60).startOffset", "24");
72 shouldBe("document.caretRangeFromPoint(400,100).startOffset", "28");
73 shouldBe("document.caretRangeFromPoint(400,140).startOffset", "32");
75 debug("To the left of page 3:");
76 shouldBe("document.caretRangeFromPoint(0,60).startOffset", "27");
77 shouldBe("document.caretRangeFromPoint(0,100).startOffset", "31");
78 shouldBe("document.caretRangeFromPoint(0,140).startOffset", "35");