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

Unified Diff: Source/core/editing/SpellChecker.cpp

Issue 419563003: Adding a word to dictionary should remove spelling markers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed the removeSpellingMarkersUnderWords method from WebRemoteFrameImpl Created 6 years, 5 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: Source/core/editing/SpellChecker.cpp
diff --git a/Source/core/editing/SpellChecker.cpp b/Source/core/editing/SpellChecker.cpp
index fb57b8b84a4eb81d8e87258c962b7c053072a98d..c1180918d77fa3b534d11e9b172e59a655e66060 100644
--- a/Source/core/editing/SpellChecker.cpp
+++ b/Source/core/editing/SpellChecker.cpp
@@ -824,6 +824,27 @@ void SpellChecker::removeSpellingMarkers()
m_frame.document()->markers().removeMarkers(DocumentMarker::MisspellingMarkers());
}
+void SpellChecker::removeSpellingMarkersUnderWords(const Vector<String> &words)
+{
groby-ooo-7-16 2014/07/30 21:13:27 You might want to test this for large documents. I
Klemen Forstnerič 2014/07/31 17:14:00 Could you point out which piece of code was shown
groby-ooo-7-16 2014/08/01 00:13:22 The bottleneck for checking was the IPC traffic. Y
Klemen Forstnerič 2014/08/01 21:58:17 Seems to work fast enough. :-)
+ auto document = m_frame.document();
+ auto& markerController = document->markers();
+
+ auto markerNodePairs = markerController.markerNodePairs();
+ for (const auto &markerNodePair: markerNodePairs) {
+ auto node = const_cast<Node *>(markerNodePair.first.get());
+ auto marker = markerNodePair.second;
+
+ auto markerRange = Range::create(*document,
+ node, marker->startOffset(),
+ node, marker->endOffset());
+
+ if (words.contains(markerRange->text()))
+ markerController.removeMarkers(markerRange.get());
+ }
+
+ markerController.repaintMarkers();
+}
+
void SpellChecker::spellCheckAfterBlur()
{
if (!m_frame.selection().selection().isContentEditable())

Powered by Google App Engine
This is Rietveld 408576698