Index: LayoutTests/fast/pagination/caret-range-outside-paged-x.html |
diff --git a/LayoutTests/fast/pagination/caret-range-outside-paged-x.html b/LayoutTests/fast/pagination/caret-range-outside-paged-x.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..245ba6a5dcb6bad7053189d12143123c9e011ab8 |
--- /dev/null |
+++ b/LayoutTests/fast/pagination/caret-range-outside-paged-x.html |
@@ -0,0 +1,71 @@ |
+<!DOCTYPE html> |
+<style> |
+ body { |
+ margin:0; |
+ } |
+ |
+ #pagedContainer { |
+ overflow: -webkit-paged-x; |
+ -webkit-column-gap: 0; |
+ width: 200px; |
+ height: 150px; |
+ margin: 40px 100px; |
+ font: 40px/1 Ahem; |
+ } |
+ |
+ #log { |
+ position: absolute; |
+ top: 201px; |
+ } |
+</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("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"); |
+ |
+ debug("Above page 1:"); |
+ shouldBe("document.caretRangeFromPoint(80,0).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(200,0).startOffset", "0"); |
+ shouldBe("document.caretRangeFromPoint(299,0).startOffset", "0"); |
+ |
+ debug("Below page 1:"); |
+ shouldBe("document.caretRangeFromPoint(80,200).startOffset", "12"); |
+ shouldBe("document.caretRangeFromPoint(200,200).startOffset", "12"); |
+ shouldBe("document.caretRangeFromPoint(299,200).startOffset", "12"); |
+ |
+ debug("Scroll to page 2"); |
+ document.getElementById("pagedContainer").scrollLeft = 200; |
+ |
+ debug("Above page 2:"); |
+ shouldBe("document.caretRangeFromPoint(200,0).startOffset", "12"); |
+ shouldBe("document.caretRangeFromPoint(299,0).startOffset", "12"); |
+ |
+ debug("Below page 2:"); |
+ shouldBe("document.caretRangeFromPoint(200,200).startOffset", "24"); |
+ shouldBe("document.caretRangeFromPoint(299,200).startOffset", "24"); |
+ |
+ debug("Scroll to page 3"); |
+ document.getElementById("pagedContainer").scrollLeft = 400; |
+ |
+ debug("Above page 3:"); |
+ shouldBe("document.caretRangeFromPoint(200,0).startOffset", "24"); |
+ shouldBe("document.caretRangeFromPoint(299,0).startOffset", "24"); |
+ |
+ debug("To the right of page 3:"); |
+ shouldBe("document.caretRangeFromPoint(400,20).startOffset", "24"); |
+ shouldBe("document.caretRangeFromPoint(400,60).startOffset", "27"); |
+ shouldBe("document.caretRangeFromPoint(400,100).startOffset", "31"); |
+ shouldBe("document.caretRangeFromPoint(400,140).startOffset", "35"); |
+</script> |