Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: LayoutTests/fast/dom/Range/getClientRects-character.html

Issue 24023007: Fix wrong width of Range in vertical text (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove extra fprintf Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/Range/getClientRects-character.html
diff --git a/LayoutTests/fast/dom/Range/getClientRects-character.html b/LayoutTests/fast/dom/Range/getClientRects-character.html
new file mode 100644
index 0000000000000000000000000000000000000000..586aef4fc683b7add89fd5783c1b49d56569ca85
--- /dev/null
+++ b/LayoutTests/fast/dom/Range/getClientRects-character.html
@@ -0,0 +1,53 @@
+<script src="../../js/resources/js-test-pre.js"></script>
eae 2013/09/24 23:19:30 Please add a doctype declaration so that this runs
Xianzhu 2013/09/24 23:30:03 Done.
+<style>
+.box {
+ line-height: 30px;
+ font-family: monospace;
+ font-size: 20px;
+}
+
+.horizontal {
+ width: 400px;
+}
+
+.vertical {
+ height: 400px;
+ -webkit-writing-mode: vertical-rl;
+}
+
+#console {
+ position:absolute;
+ left: 500px;
+}
+</style>
+
+<div id="console"></div>
+<div class="box horizontal" id="test-horizontal">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ</div>
+<div class="box vertical" id="test-vertical">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ</div>
+
+<script>
+ if (window.testRunner)
eae 2013/09/24 23:19:30 This isn't needed as long as you import js-test-pr
Xianzhu 2013/09/24 23:30:03 Done.
+ testRunner.dumpAsText();
+
+ // Test 1
+ debug("Test horizontal");
+ var range = document.createRange();
+ var box = document.getElementById('test-horizontal');
+ range.setStart(box.firstChild, 20);
+ range.setEnd(box.firstChild, 21);
+ var rects = range.getClientRects();
+ shouldBe("1", "rects.length");
+ shouldBeGreaterThanOrEqual("box.offsetWidth / 26", "rects[0].width");
+ shouldBeGreaterThanOrEqual("box.offsetHeight / 2", "rects[0].height");
+
+ // Test 2
+ debug("Test vertical");
+ box = document.getElementById('test-vertical');
+ range.setStart(box.firstChild, 20);
+ range.setEnd(box.firstChild, 21);
+ rects = range.getClientRects();
+ shouldBe("1", "rects.length");
+ shouldBeGreaterThanOrEqual("box.offsetWidth / 2", "rects[0].width");
+ shouldBeGreaterThanOrEqual("box.offsetHeight / 26", "rects[0].height");
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
eae 2013/09/24 23:19:30 This really isn't needed anymore.
Xianzhu 2013/09/24 23:30:03 Tried to remove this, but the result will miss the
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Range/getClientRects-character-expected.txt » ('j') | Source/core/rendering/RenderText.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698