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

Unified Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2714263002: INPUT without focus should be considered as spellcheck disabled (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/no_marker_in_blurred_input.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
index 1e9624648685cc427e3049534186dbf33101a584..c0f3e0c6d2cd7a36900d216d5d35552d262fe1b4 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -76,12 +76,16 @@ bool isPositionInTextArea(const Position& position) {
static bool isSpellCheckingEnabledFor(const Position& position) {
if (position.isNull())
return false;
- // TODO(tkent): The following password type check should be done in
- // HTMLElement::spellcheck(). crbug.com/371567
if (TextControlElement* textControl = enclosingTextControl(position)) {
- if (isHTMLInputElement(textControl) &&
- toHTMLInputElement(textControl)->type() == InputTypeNames::password)
- return false;
+ if (isHTMLInputElement(textControl)) {
+ HTMLInputElement& input = toHTMLInputElement(*textControl);
+ // TODO(tkent): The following password type check should be done in
+ // HTMLElement::spellcheck(). crbug.com/371567
+ if (input.type() == InputTypeNames::password)
+ return false;
+ if (!input.isFocusedElementInDocument())
+ return false;
+ }
}
if (HTMLElement* element =
Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode())) {
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/no_marker_in_blurred_input.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698