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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <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.
2 <style>
3 .box {
4 line-height: 30px;
5 font-family: monospace;
6 font-size: 20px;
7 }
8
9 .horizontal {
10 width: 400px;
11 }
12
13 .vertical {
14 height: 400px;
15 -webkit-writing-mode: vertical-rl;
16 }
17
18 #console {
19 position:absolute;
20 left: 500px;
21 }
22 </style>
23
24 <div id="console"></div>
25 <div class="box horizontal" id="test-horizontal">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCD EFGHIJKLMNOPQRSTUVWXYZ</div>
26 <div class="box vertical" id="test-vertical">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGH IJKLMNOPQRSTUVWXYZ</div>
27
28 <script>
29 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.
30 testRunner.dumpAsText();
31
32 // Test 1
33 debug("Test horizontal");
34 var range = document.createRange();
35 var box = document.getElementById('test-horizontal');
36 range.setStart(box.firstChild, 20);
37 range.setEnd(box.firstChild, 21);
38 var rects = range.getClientRects();
39 shouldBe("1", "rects.length");
40 shouldBeGreaterThanOrEqual("box.offsetWidth / 26", "rects[0].width");
41 shouldBeGreaterThanOrEqual("box.offsetHeight / 2", "rects[0].height");
42
43 // Test 2
44 debug("Test vertical");
45 box = document.getElementById('test-vertical');
46 range.setStart(box.firstChild, 20);
47 range.setEnd(box.firstChild, 21);
48 rects = range.getClientRects();
49 shouldBe("1", "rects.length");
50 shouldBeGreaterThanOrEqual("box.offsetWidth / 2", "rects[0].width");
51 shouldBeGreaterThanOrEqual("box.offsetHeight / 26", "rects[0].height");
52 </script>
53 <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
OLDNEW
« 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