Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / pagination / caret-range-outside-paged-x-rtl.html
blob29125fe9841ea8230b88c986b7c57b5930dc7522
1 <!DOCTYPE html>
2 <script src="../../resources/ahem.js"></script>
3 <style>
4 body {
5 margin:0;
8 #pagedContainer {
9 overflow: -webkit-paged-x;
10 -webkit-column-gap: 0;
11 direction: rtl;
12 unicode-bidi: bidi-override;
13 width: 200px;
14 height: 150px;
15 margin: 40px 100px;
16 font: 40px/1 Ahem;
19 #log {
20 position: absolute;
21 top: 201px;
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("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");
76 </script>