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

Unified Diff: LayoutTests/editing/spelling/resources/util.js

Issue 21024004: Add/remove spell checking markers in text inputs depending on focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clean up in the test & the new expected file. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/spelling/resources/util.js
diff --git a/LayoutTests/editing/spelling/resources/util.js b/LayoutTests/editing/spelling/resources/util.js
index 6bedc1a4b26849983822699732599a9cee5150df..59b5fcfd265471dfe5df74423af85b74d916ec3a 100644
--- a/LayoutTests/editing/spelling/resources/util.js
+++ b/LayoutTests/editing/spelling/resources/util.js
@@ -34,3 +34,35 @@ function initSpellTest(testElementId, testText, testFunction)
document.execCommand("InsertText", false, testText);
window.setTimeout(function() { verifySpellTest(10); }, 0);
}
+
+function findFirstTextNode(node)
+{
+ function iterToFindFirstTextNode(node)
+ {
+ if (node instanceof Text)
+ return node;
+
+ var childNodes = node.childNodes;
+ for (var i = 0; i < childNodes.length; ++i) {
+ var n = iterToFindFirstTextNode(childNodes[i]);
+ if (n)
+ return n;
+ }
+
+ return null;
+ }
+
+ if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
+ return iterToFindFirstTextNode(internals.shadowRoot(node));
+ } else {
+ return iterToFindFirstTextNode(node);
+ }
+}
+
+function typeText(elem, text)
+{
+ elem.focus();
+ for (var i = 0; i < text.length; ++i) {
+ typeCharacterCommand(text[i]);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698