2 <script src=
"../../resources/ahem.js"></script>
9 overflow: -webkit-paged-x;
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("To the right of page 1:");
38 shouldBe("document.caretRangeFromPoint(400,20).startOffset", "0");
39 shouldBe("document.caretRangeFromPoint(400,60).startOffset", "0");
40 shouldBe("document.caretRangeFromPoint(400,100).startOffset", "4");
42 debug("Above page 1:");
43 shouldBe("document.caretRangeFromPoint(400,0).startOffset", "0");
44 shouldBe("document.caretRangeFromPoint(299,0).startOffset", "0");
45 shouldBe("document.caretRangeFromPoint(101,0).startOffset", "0");
47 debug("Below page 1:");
48 shouldBe("document.caretRangeFromPoint(400,200).startOffset", "12");
49 shouldBe("document.caretRangeFromPoint(299,200).startOffset", "12");
50 shouldBe("document.caretRangeFromPoint(101,200).startOffset", "12");
52 debug("Scroll to page 2");
53 document
.getElementById("pagedContainer").scrollLeft
= 200;
55 debug("Above page 2:");
56 shouldBe("document.caretRangeFromPoint(200,0).startOffset", "12");
57 shouldBe("document.caretRangeFromPoint(101,0).startOffset", "12");
59 debug("Below page 2:");
60 shouldBe("document.caretRangeFromPoint(200,200).startOffset", "24");
61 shouldBe("document.caretRangeFromPoint(101,200).startOffset", "24");
63 debug("Scroll to page 3");
64 document
.getElementById("pagedContainer").scrollLeft
= 0;
66 debug("Above page 3:");
67 shouldBe("document.caretRangeFromPoint(200,0).startOffset", "24");
68 shouldBe("document.caretRangeFromPoint(101,0).startOffset", "24");
70 debug("To the left of page 3:");
71 shouldBe("document.caretRangeFromPoint(0,20).startOffset", "24");
72 shouldBe("document.caretRangeFromPoint(0,60).startOffset", "27");
73 shouldBe("document.caretRangeFromPoint(0,100).startOffset", "31");
74 shouldBe("document.caretRangeFromPoint(0,140).startOffset", "35");