Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / pagination / caret-range-outside-paged-y-rtl.html
blobc33b31a958551133ee5c1d611c867bab2e23838b
1 <!DOCTYPE html>
2 <script src="../../resources/ahem.js"></script>
3 <style>
4 body {
5 margin:0;
8 #pagedContainer {
9 overflow: -webkit-paged-y;
10 -webkit-column-gap: 0;
11 direction: rtl;
12 unicode-bidi: bidi-override;
13 width: 200px;
14 height: 120px;
15 margin: 40px 100px;
16 font: 40px/1 Ahem;
19 #log {
20 position: absolute;
21 top: 141px;
23 </style>
24 <div id="log">
25 <p id="description"></p>
26 <div id="console"></div>
27 </div>
28 <div id="pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div>
29 <script src="../../resources/js-test.js"></script>
30 <script>
31 onload = function() {
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");
80 </script>