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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html

Issue 2517383002: Use the font height as caret height instead of the line height (Closed)
Patch Set: update comment Created 3 years, 11 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 div {
6 border: 2px solid red;
7 padding: 12px;
8 line-height: 1.66666667;
9 width: 140px;
10 }
11 </style>
12 <script src="../../resources/testharness.js"></script>
13 <script src="../../resources/testharnessreport.js"></script>
14 </head>
15 <body>
16 <div contenteditable id="test1">
17 The caret height
18 should <span id="line2">be the same for each line.</span>
19 </div>
20 <div contenteditable id="test2">
21 The <span id="large_font" style="font-size: 150%">caret</span> height should be obtained from a font of character before caret for LTR.
22 </div>
23 <div contenteditable id="test3" style="direction: RTL">גובה<span id="large_font _rtl" style="font-size: 150%">עבו</span> תו יש לקבל תו אחרי תו עבור RTL
24 </div>
25 <script>
26 test(function () {
27 var editor = document.getElementById('test1');
yosin_UTC9 2017/01/05 07:31:31 %s/var/const/ or using |let|
joone 2017/01/06 20:40:43 Acknowledged.
28 editor.focus();
29
30 var caretHeight1 = window.internals.absoluteCaretBounds().height;
yosin_UTC9 2017/01/05 07:31:31 Please add assertion for availability of window.in
joone 2017/01/06 20:40:43 Acknowledged.
31 var sel = window.getSelection();
32 sel.collapse(line2, 0);
33 var caretHeight2 = window.internals.absoluteCaretBounds().height;
34
35 assert_equals(caretHeight1, caretHeight2);
36 }, 'The caret height should be the same in every line');
37
38 test(function () {
39 var editor = document.getElementById('test2');
40 editor.focus();
41
42 var caretHeight1 = window.internals.absoluteCaretBounds().height;
43 var sel = window.getSelection();
44 sel.collapse(large_font, 0);
45 var caretHeight2 = window.internals.absoluteCaretBounds().height;
46
47 assert_equals(caretHeight1, caretHeight2);
48 }, 'The caret height at the front of word(150%) should be the same as the caret height in other words(100%).');
49
50 test(function () {
51 var editor = document.getElementById('test2');
52 editor.focus();
53
54 var sel = window.getSelection();
55 sel.collapse(large_font, 0);
56 sel.modify("move", "right", "character");
57 var caretHeight1 = window.internals.absoluteCaretBounds().height;
58 sel.collapse(large_font, 1);
59 var caretHeight2 = window.internals.absoluteCaretBounds().height;
60
61 assert_equals(caretHeight1, caretHeight2);
62 }, 'The caret height at the end of word should be the same as the caret height i n the word.');
63
64 test(function () {
65 var editor = document.getElementById('test3');
66 editor.focus();
67
68 var caretHeight1 = window.internals.absoluteCaretBounds().height;
69 var sel = window.getSelection();
70 sel.collapse(large_font_rtl, 0);
71 var caretHeight2 = window.internals.absoluteCaretBounds().height;
72
73 assert_equals(caretHeight1, caretHeight2);
74 }, 'In case of RTL, the caret height at the front of word(150%) should be the sa me as the caret height in other words(100%).');
75
76 test(function () {
77 var editor = document.getElementById('test3');
78 editor.focus();
79
80 var sel = window.getSelection();
81 sel.collapse(large_font_rtl, 0);
82 sel.modify("move", "left", "character");
yosin_UTC9 2017/01/05 07:31:31 Please use single-quote since other parts of scrip
joone 2017/01/06 20:40:43 Acknowledged.
83 var caretHeight1 = window.internals.absoluteCaretBounds().height;
84 sel.collapse(large_font_rtl, 1);
85 var caretHeight2 = window.internals.absoluteCaretBounds().height;
86
87 assert_equals(caretHeight1, caretHeight2);
88 }, 'In case of RTL, the caret height at the end of word should be the same as th e caret height in the word.');
89 </script>
90 </body>
91 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698