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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/inline-spelling-markers-hidpi.html

Issue 2736823002: Move tests in editing/spelling for marker appearance to paint/spellmarkers (Closed)
Patch Set: Created 3 years, 9 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 body { overflow:hidden; }
6
7 .testDiv {
8 width: 200px;
9 height: 20px;
10 border: 1px solid black;
11 white-space: nowrap;
12 overflow: hidden;
13 }
14
15 .forcertl {
16 direction: rtl;
17 unicode-bidi: bidi-override;
18 }
19
20 .ellipses {
21 text-overflow:ellipsis;
22 }
23
24 </style>
25 </head>
26 <body>
27 <div id="warning">
28 This test requires window.internals. If you use content_shell,
29 "--expose-internals-for-testing" command flag enables it.
30 </div>
31
32 LTR
33 <div id="testLTR" class="testDiv" contenteditable="true">the the adlj adaasj sdk lj. there there</div>
34
35 RTL
36 <div id="testRTL" class="testDiv forcertl" contenteditable="true">the the adlj a daasj sdklj. there there</div>
37
38 LTR (text-overflow:ellipses)
39 <div id="testLTREllipses" class="testDiv ellipses" contenteditable="true">the th e adlj adaasj sdklj. there there</div>
40
41 RTL (text-overflow:ellipses)
42 <div id="testRTLEllipses" class="testDiv forcertl ellipses" contenteditable="tru e">the the adlj adaasj sdklj. there there</div>
43
44 <script>
45 if (window.internals)
46 document.getElementById('warning').style.display = 'none';
47 if (window.testRunner) {
48 testRunner.setBackingScaleFactor(
49 2,
50 () => setTimeout(() => testRunner.notifyDone(), 0));
51 }
52
53 // This tests the correct placement of inline spelling and grammar markers in
54 // text. Markers should line up exactly under misspelled words in all cases.
55
56 // 'adlj', adaasj', 'sdklj'.
57 const spellingMarkerRanges = [[8, 4], [13, 6], [20, 5]];
58
59 // 'the', 'there'.
60 const grammarMarkerRanges = [[4, 3], [33, 5]];
61
62 ['testLTR', 'testRTL', 'testLTREllipses', 'testRTLEllipses'].forEach(id => {
63 const div = document.getElementById(id);
64 const text = div.firstChild;
65
66 spellingMarkerRanges.forEach(markerRange => {
67 const range = document.createRange();
68 range.setStart(text, markerRange[0]);
69 range.setEnd(text, markerRange[0] + markerRange[1]);
70 if (window.internals)
71 internals.setMarker(document, range, 'spelling');
72 });
73
74 grammarMarkerRanges.forEach(markerRange => {
75 const range = document.createRange();
76 range.setStart(text, markerRange[0]);
77 range.setEnd(text, markerRange[0] + markerRange[1]);
78 if (window.internals)
79 internals.setMarker(document, range, 'grammar');
80 });
81 });
82 </script>
83 </body>
84 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698