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

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: fix test fail 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 let editor = document.getElementById('test1');
28 editor.focus();
29
30 assert_not_equals(window.internals, undefined, 'This test requires window.inte rnals');
31 let caretHeight1 = window.internals.absoluteCaretBounds().height;
32 let sel = window.getSelection();
33 sel.collapse(line2, 0);
34 let caretHeight2 = window.internals.absoluteCaretBounds().height;
35
36 assert_equals(caretHeight1, caretHeight2);
37 }, 'The caret height should be the same in every line');
38
39 test(function () {
40 let editor = document.getElementById('test2');
41 editor.focus();
42
43 assert_not_equals(window.internals, undefined, 'This test requires window.inte rnals');
44 let caretHeight1 = window.internals.absoluteCaretBounds().height;
45 let sel = window.getSelection();
46 sel.collapse(large_font, 0);
47 let caretHeight2 = window.internals.absoluteCaretBounds().height;
48
49 assert_equals(caretHeight1, caretHeight2);
50 }, 'The caret height at the front of word(150%) should be the same as the caret height in other words(100%).');
51
52 test(function () {
53 let editor = document.getElementById('test2');
54 editor.focus();
55
56 assert_not_equals(window.internals, undefined, 'This test requires window.inte rnals');
57 let sel = window.getSelection();
58 sel.collapse(large_font, 0);
59 sel.modify('move', 'right', 'character');
60 let caretHeight1 = window.internals.absoluteCaretBounds().height;
61 sel.collapse(large_font, 1);
62 let caretHeight2 = window.internals.absoluteCaretBounds().height;
63
64 assert_equals(caretHeight1, caretHeight2);
65 }, 'The caret height at the end of word should be the same as the caret height i n the word.');
66
67 test(function () {
68 let editor = document.getElementById('test3');
69 editor.focus();
70
71 assert_not_equals(window.internals, undefined, 'This test requires window.inte rnals');
72 let caretHeight1 = window.internals.absoluteCaretBounds().height;
73 let sel = window.getSelection();
74 sel.collapse(large_font_rtl, 0);
75 let caretHeight2 = window.internals.absoluteCaretBounds().height;
76
77 assert_equals(caretHeight1, caretHeight2);
78 }, '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%).');
79
80 test(function () {
81 let editor = document.getElementById('test3');
82 editor.focus();
83
84 assert_not_equals(window.internals, undefined, 'This test requires window.inte rnals');
85 let sel = window.getSelection();
86 sel.collapse(large_font_rtl, 0);
87 sel.modify('move', 'left', 'character');
88 let caretHeight1 = window.internals.absoluteCaretBounds().height;
89 sel.collapse(large_font_rtl, 1);
90 let caretHeight2 = window.internals.absoluteCaretBounds().height;
91
92 assert_equals(caretHeight1, caretHeight2);
93 }, 'In case of RTL, the caret height at the end of word should be the same as th e caret height in the word.');
94 </script>
95 </body>
96 </html>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698