3 <script src=
"../../resources/js-test.js"></script>
4 <script src=
"../../editing/editing.js"></script>
6 body { overflow:hidden; }
11 border:
1px solid black;
18 unicode-bidi: bidi-override;
22 text-overflow:ellipsis;
30 description("This tests the correct placement of inline spelling and grammar "
31 + "markers in text. Spelling markers should line up exactly under misspelled "
32 + "words in all cases.");
36 if (window
.internals
) {
37 internals
.settings
.setUnifiedTextCheckerEnabled(true);
38 internals
.settings
.setAsynchronousSpellCheckingEnabled(true);
43 <div id=
"testLTR" class=
"testDiv" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
46 <div id=
"testRTL" class=
"testDiv forcertl" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
48 LTR (text-overflow:ellipses)
49 <div id=
"testLTREllipses" class=
"testDiv ellipses" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
51 RTL (text-overflow:ellipses)
52 <div id=
"testRTLEllipses" class=
"testDiv forcertl ellipses" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
55 function moveCursorOverAllWords(id
)
57 div
= document
.getElementById(id
);
61 // Move cursor over all words so inline spellchecking is activated for all.
62 for (var i
= 0; i
< div
.innerHTML
.length
; i
++)
63 moveSelectionForwardByWordCommand();
68 function verifyMarkers()
70 if (!window
.internals
)
73 // Take care of spelling markers first.
74 shouldBecomeEqual('internals.hasSpellingMarker(document, 8, 4)', 'true', function() { // Verifies 'adlj'.
75 shouldBecomeEqual('internals.hasSpellingMarker(document, 13, 6)', 'true', function() { // Verifies 'adaasj'.
76 shouldBecomeEqual('internals.hasSpellingMarker(document, 20, 5)', 'true', verifyGrammarMarkers
) // Verifies 'sdklj'.
80 function verifyGrammarMarkers() {
81 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', function() { // Verifies second 'the'.
82 shouldBecomeEqual('internals.hasGrammarMarker(document, 33, 5)', 'true', function() { // Verifies second 'there'.
83 // Markers of next element can not be found after modification selection without blur event.
91 var tests
= [ function() { moveCursorOverAllWords('testLTR'); },
92 function() { moveCursorOverAllWords('testRTL'); },
93 function() { moveCursorOverAllWords('testLTREllipses'); },
94 function() { moveCursorOverAllWords('testRTLEllipses'); } ];
98 var next
= tests
.shift();
100 return window
.setTimeout(next
, 0);
105 if (window
.testRunner
) {
106 testRunner
.dumpAsTextWithPixelResults();
107 testRunner
.setBackingScaleFactor(2, function () {