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

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

Issue 2650183002: Remove spelling markers when element is not editable (Closed)
Patch Set: Add missing comment Created 3 years, 11 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: 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) {

Powered by Google App Engine
This is Rietveld 408576698