Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / pagination / caret-range-outside-paged-x.html
blob541ce4961579fa8da94cc801f6fbbea179851e48
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 width: 200px;
12 height: 150px;
13 margin: 40px 100px;
14 font: 40px/1 Ahem;
17 #log {
18 position: absolute;
19 top: 201px;
21 </style>
22 <div id="log">
23 <p id="description"></p>
24 <div id="console"></div>
25 </div>
26 <div id="pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div>
27 <script src="../../resources/js-test.js"></script>
28 <script>
29 onload = function() {
30 description("Test that hitting areas outside a paged container takes us to the right text content on some page.");
32 // FIXME: We should ideally test above and below every page, but we get bogus results,
33 // thanks to crbug.com/466554 , so avoid testing in the problematic areas.
35 debug("To the left of page 1:");
36 shouldBe("document.caretRangeFromPoint(0,20).startOffset", "0");
37 shouldBe("document.caretRangeFromPoint(0,60).startOffset", "0");
38 shouldBe("document.caretRangeFromPoint(0,100).startOffset", "4");
40 debug("Above page 1:");
41 shouldBe("document.caretRangeFromPoint(80,0).startOffset", "0");
42 shouldBe("document.caretRangeFromPoint(200,0).startOffset", "0");
43 shouldBe("document.caretRangeFromPoint(299,0).startOffset", "0");
45 debug("Below page 1:");
46 shouldBe("document.caretRangeFromPoint(80,200).startOffset", "12");
47 shouldBe("document.caretRangeFromPoint(200,200).startOffset", "12");
48 shouldBe("document.caretRangeFromPoint(299,200).startOffset", "12");
50 debug("Scroll to page 2");
51 document.getElementById("pagedContainer").scrollLeft = 200;
53 debug("Above page 2:");
54 shouldBe("document.caretRangeFromPoint(200,0).startOffset", "12");
55 shouldBe("document.caretRangeFromPoint(299,0).startOffset", "12");
57 debug("Below page 2:");
58 shouldBe("document.caretRangeFromPoint(200,200).startOffset", "24");
59 shouldBe("document.caretRangeFromPoint(299,200).startOffset", "24");
61 debug("Scroll to page 3");
62 document.getElementById("pagedContainer").scrollLeft = 400;
64 debug("Above page 3:");
65 shouldBe("document.caretRangeFromPoint(200,0).startOffset", "24");
66 shouldBe("document.caretRangeFromPoint(299,0).startOffset", "24");
68 debug("To the right of page 3:");
69 shouldBe("document.caretRangeFromPoint(400,20).startOffset", "24");
70 shouldBe("document.caretRangeFromPoint(400,60).startOffset", "27");
71 shouldBe("document.caretRangeFromPoint(400,100).startOffset", "31");
72 shouldBe("document.caretRangeFromPoint(400,140).startOffset", "35");
74 </script>