blob: 000edc5f2d86d1df8d4da5b9a45f941585c7427e [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/ahem.js"></script>
body {
/* Need a wrapper to establish the writing mode, thanks to */
#wrapper {
-webkit-writing-mode: vertical-rl;
padding: 50px;
width: 400px;
height: 250px;
#pagedContainer {
overflow: -webkit-paged-y;
-webkit-column-gap: 0;
direction: rtl;
unicode-bidi: bidi-override;
width: 150px;
height: 200px;
margin: 40px 100px;
font: 40px/1 Ahem;
#log {
position: absolute;
top: 350px;
<div id="log">
<p id="description"></p>
<div id="console"></div>
<div id="wrapper">
<div id="pagedContainer">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div>
<script src="../../resources/js-test.js"></script>
onload = function() {
description("Test that hitting areas outside a paged container takes us to the right text content on some page.");
// Note that this test is very limited (compared to the other caret-range- tests),
// due to platform behavioral differences, and
debug("To the right of page 1:");
shouldBe("document.caretRangeFromPoint(360,91).startOffset", "0");
shouldBe("document.caretRangeFromPoint(360,150).startOffset", "0");
shouldBe("document.caretRangeFromPoint(360,300).startOffset", "0");
debug("Below page 1:");
shouldBe("document.caretRangeFromPoint(400,320).startOffset", "0");
shouldBe("document.caretRangeFromPoint(330,320).startOffset", "0");
shouldBe("document.caretRangeFromPoint(290,320).startOffset", "4");
shouldBe("document.caretRangeFromPoint(250,320).startOffset", "8");
debug("Scroll to page 3");
document.getElementById("pagedContainer").scrollTop = 0;
debug("Above page 3:");
shouldBe("document.caretRangeFromPoint(330,0).startOffset", "27");
shouldBe("document.caretRangeFromPoint(290,0).startOffset", "31");
shouldBe("document.caretRangeFromPoint(250,0).startOffset", "35");