| Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js
|
| diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js
|
| index 67bb9c670145c080b9f113a3f0459ce422f7d6dd..197c23647238fc1814a2a4b452d59c97d20f41b4 100644
|
| --- a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js
|
| +++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js
|
| @@ -322,6 +322,16 @@ function verifyMarkers(
|
| }
|
| }
|
|
|
| +function focusNearestAncestorOfAnchor(selection) {
|
| + for (var anchor = selection.anchorNode; anchor; anchor = anchor.parentNode) {
|
| + if (anchor.nodeType != Node.ELEMENT_NODE)
|
| + continue;
|
| + anchor.focus();
|
| + if (anchor.ownerDocument.activeElement == anchor)
|
| + return;
|
| + }
|
| +}
|
| +
|
| // Spellchecker gets triggered not only by text and selection change, but also
|
| // by focus change. For example, misspelling markers in <INPUT> disappear when
|
| // the window loses focus, even though the selection does not change.
|
| @@ -349,6 +359,7 @@ function invokeSpellcheckTest(testObject, input, tester, expectedText) {
|
| /** @type {!Sample} */
|
| const sample = typeof(input) === 'string' ? new Sample(input) : input;
|
| testObject.sample = sample;
|
| + focusNearestAncestorOfAnchor(sample.selection);
|
|
|
| if (typeof(tester) === 'function') {
|
| tester.call(window, sample.document);
|
|
|