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

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

Issue 2650183002: Remove spelling markers when element is not editable (Closed)
Patch Set: Apply suggested changes 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..190323902fc8f46b43a8a79c97cf1a719659a221 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) {
+ // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ frame().document()->updateStyleAndLayoutTreeForNode(&element);
+
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)) {
+ if (elementsType == ElementsType::kAll || !hasEditableStyle(node))
+ frame().document()->markers().removeMarkers(&node, markerTypes);
+ }
}
void SpellChecker::replaceMisspelledRange(const String& text) {
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h ('k') | third_party/WebKit/Source/core/html/HTMLElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698