Index: Source/core/editing/Editor.cpp |
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp |
index ed04fdbd82b534fa325a303580e490b50fd336af..e193df2cb2559bc8c12910c198017996c4470d7f 100644 |
--- a/Source/core/editing/Editor.cpp |
+++ b/Source/core/editing/Editor.cpp |
@@ -1017,6 +1017,13 @@ bool Editor::isContinuousSpellCheckingEnabled() const |
void Editor::toggleContinuousSpellChecking() |
{ |
client().toggleContinuousSpellChecking(); |
+ if (isContinuousSpellCheckingEnabled()) |
+ return; |
+ for (Frame* frame = m_frame->page()->mainFrame(); frame && frame->document(); frame = frame->tree()->traverseNext()) { |
+ for (Node* node = frame->document()->rootNode(); node; node = NodeTraversal::next(node)) { |
+ node->setAlreadySpellChecked(false); |
+ } |
+ } |
} |
bool Editor::isGrammarCheckingEnabled() |
@@ -1059,8 +1066,35 @@ void Editor::redo() |
client().redo(); |
} |
-void Editor::didBeginEditing() |
+void Editor::elementDidBeginEditing(Element* element) |
+{ |
+ if (isContinuousSpellCheckingEnabled() && unifiedTextCheckerEnabled()) { |
+ bool isTextField = false; |
+ HTMLTextFormControlElement* enclosingHTMLTextFormControlElement = 0; |
+ if (!isHTMLTextFormControlElement(element)) |
+ enclosingHTMLTextFormControlElement = enclosingTextFormControl(firstPositionInNode(element)); |
+ element = enclosingHTMLTextFormControlElement ? enclosingHTMLTextFormControlElement : element; |
+ Element* parent = element; |
+ if (isHTMLTextFormControlElement(element)) { |
+ HTMLTextFormControlElement* textControl = toHTMLTextFormControlElement(element); |
+ parent = textControl; |
+ element = textControl->innerTextElement(); |
+ isTextField = textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField(); |
+ } |
+ |
+ if (isTextField || !parent->isAlreadySpellChecked()) { |
+ // We always recheck textfields because markers are removed from them on blur. |
+ VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(element); |
+ markMisspellingsAndBadGrammar(selection); |
+ if (!isTextField) |
+ parent->setAlreadySpellChecked(true); |
+ } |
+ } |
+} |
+ |
+void Editor::didBeginEditing(Element* rootEditableElement) |
{ |
+ elementDidBeginEditing(rootEditableElement); |
client().didBeginEditing(); |
} |
@@ -1867,14 +1901,9 @@ void Editor::computeAndSetTypingStyle(StylePropertySet* style, EditAction editin |
m_frame->selection()->setTypingStyle(typingStyle); |
} |
- |
-void Editor::textFieldDidBeginEditing(Element* e) |
+void Editor::textAreaOrTextFieldDidBeginEditing(Element* e) |
{ |
- if (isContinuousSpellCheckingEnabled()) { |
- Element* element = toHTMLTextFormControlElement(e)->innerTextElement(); |
- VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(element); |
- markMisspellingsAndBadGrammar(selection); |
- } |
+ elementDidBeginEditing(e); |
} |
void Editor::textFieldDidEndEditing(Element* e) |