Index: LayoutTests/fast/pagination/caret-range-outside-paged-y.html |
diff --git a/LayoutTests/fast/pagination/caret-range-outside-paged-y.html b/LayoutTests/fast/pagination/caret-range-outside-paged-y.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..359f9ed7e8a2f79fc5c5d8609937cc4210a8c18b |
--- /dev/null |
+++ b/LayoutTests/fast/pagination/caret-range-outside-paged-y.html |
@@ -0,0 +1,75 @@ |
+<!DOCTYPE html> |
+<style> |
+ body { |
+ margin:0; |
+ } |
+ |
+ #pagedContainer { |
+ overflow: -webkit-paged-y; |
+ -webkit-column-gap: 0; |
+ width: 200px; |
+ height: 120px; |
+ margin: 40px 100px; |
+ font: 40px/1 Ahem; |
+ } |
+ |
+ #log { |
+ position: absolute; |
+ top: 141px; |
+ } |
+</style> |
+<div id="log"> |
+ <p id="description"></p> |
+ <div id="console"></div> |
+</div> |
+<div id="pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+ description("Test that hitting areas outside a paged container takes us to the right text content on some page."); |
+ |
+ // FIXME: We should ideally test above and below every page, but we get bogus results, |
+ // thanks to crbug.com/466554 , so avoid testing in the problematic areas. |
+ |
+ debug("Above page 1:"); |
+ shouldBe("document.caretRangeFromPoint(50,0).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(150,0).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(300,0).startOffset", "0"); |
+ |
+ debug("To the left of page 1:"); |
+ shouldBe("document.caretRangeFromPoint(0,20).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(0,60).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(0,100).startOffset", "4"); |
+ shouldBe("document.caretRangeFromPoint(0,140).startOffset", "8"); |
+ |
+ debug("To the right of page 1:"); |
+ shouldBe("document.caretRangeFromPoint(400,20).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(400,60).startOffset", "3"); |
+ shouldBe("document.caretRangeFromPoint(400,100).startOffset", "7"); |
+ shouldBe("document.caretRangeFromPoint(400,140).startOffset", "11"); |
+ |
+ debug("Scroll to page 2"); |
+ document.getElementById("pagedContainer").scrollTop = 120; |
+ |
+ debug("To the left of page 2:"); |
+ shouldBe("document.caretRangeFromPoint(0,60).startOffset", "12"); |
+ shouldBe("document.caretRangeFromPoint(0,100).startOffset", "16"); |
+ shouldBe("document.caretRangeFromPoint(0,140).startOffset", "20"); |
+ |
+ debug("To the right of page 2:"); |
+ shouldBe("document.caretRangeFromPoint(400,60).startOffset", "15"); |
+ shouldBe("document.caretRangeFromPoint(400,100).startOffset", "19"); |
+ shouldBe("document.caretRangeFromPoint(400,140).startOffset", "23"); |
+ |
+ debug("Scroll to page 3"); |
+ document.getElementById("pagedContainer").scrollTop = 240; |
+ |
+ debug("To the left of page 3:"); |
+ shouldBe("document.caretRangeFromPoint(0,60).startOffset", "24"); |
+ shouldBe("document.caretRangeFromPoint(0,100).startOffset", "28"); |
+ shouldBe("document.caretRangeFromPoint(0,140).startOffset", "32"); |
+ |
+ debug("To the right of page 3:"); |
+ shouldBe("document.caretRangeFromPoint(400,60).startOffset", "27"); |
+ shouldBe("document.caretRangeFromPoint(400,100).startOffset", "31"); |
+ shouldBe("document.caretRangeFromPoint(400,140).startOffset", "35"); |
+</script> |