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 664da652785132d4723d465ec769d1e66b5916de..49bf63f9f6e2a00eed3e81a687fcaf95115432c5 100644 |
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp |
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp |
@@ -802,10 +802,21 @@ void SpellChecker::didEndEditingOnTextField(Element* e) { |
m_spellCheckRequester->cancelCheck(); |
TextControlElement* textControlElement = toTextControlElement(e); |
HTMLElement* innerEditor = textControlElement->innerEditorElement(); |
+ removeSpellingAndGrammarMarkers(*innerEditor); |
+} |
+ |
+void SpellChecker::removeSpellingAndGrammarMarkers(const HTMLElement& element, |
+ ElementsType elementsType) { |
DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling); |
markerTypes.add(DocumentMarker::Grammar); |
- for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) |
- frame().document()->markers().removeMarkers(&node, markerTypes); |
+ for (Node& node : NodeTraversal::inclusiveDescendantsOf(element)) { |
+ // TODO(editing-dev): The use of |
+ // updateStyleAndLayoutIgnorePendingStylesheets |
+ // needs to be audited. See http://crbug.com/590369 for more details. |
+ frame().document()->updateStyleAndLayoutTreeForNode(&node); |
Xiaocheng
2017/02/01 05:20:28
This style and layout update should be placed out
Manuel Rego
2017/02/01 14:50:25
Done.
|
+ if (elementsType == All || !hasEditableStyle(node)) |
+ frame().document()->markers().removeMarkers(&node, markerTypes); |
+ } |
} |
void SpellChecker::replaceMisspelledRange(const String& text) { |