Index: Source/web/EditorClientImpl.cpp |
diff --git a/Source/web/EditorClientImpl.cpp b/Source/web/EditorClientImpl.cpp |
index 3f0ec5ee5f751dd484bbeb586ed9604344b572e7..b50b8f7d3c706bab796a978570030f33ab4b595e 100644 |
--- a/Source/web/EditorClientImpl.cpp |
+++ b/Source/web/EditorClientImpl.cpp |
@@ -46,6 +46,7 @@ |
#include "WebViewClient.h" |
#include "WebViewImpl.h" |
#include "core/dom/Document.h" |
+#include "core/dom/DocumentMarkerController.h" |
#include "core/dom/EventNames.h" |
#include "core/dom/KeyboardEvent.h" |
#include "core/editing/Editor.h" |
@@ -139,10 +140,24 @@ bool EditorClientImpl::isContinuousSpellCheckingEnabled() |
void EditorClientImpl::toggleContinuousSpellChecking() |
{ |
- if (isContinuousSpellCheckingEnabled()) |
+ if (isContinuousSpellCheckingEnabled()) { |
m_spellCheckThisFieldStatus = SpellCheckForcedOff; |
- else |
+ const Frame* frame = m_webView->focusedWebCoreFrame(); |
+ if (frame) |
abarth-chromium
2013/07/31 00:42:14
No need for "const". There's no meaningful sense
pstanek
2013/08/12 12:21:23
Won't this remove markers in one frame only (it sh
|
+ frame->document()->markers()->removeMarkers(DocumentMarker::Spelling | DocumentMarker::Grammar); |
+ } else { |
m_spellCheckThisFieldStatus = SpellCheckForcedOn; |
+ const Frame* frame = m_webView->focusedWebCoreFrame(); |
+ if (frame) { |
abarth-chromium
2013/07/31 00:42:14
ditto
|
+ VisibleSelection frameSelection = frame->selection()->selection(); |
+ Element* rootEditableElement = frameSelection.rootEditableElement(); |
+ // If a selection is in an editable element spell check its content. |
+ if (rootEditableElement) { |
abarth-chromium
2013/07/31 00:42:14
You can also combine this if statement with the pr
|
+ VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(rootEditableElement); |
+ frame->editor()->markMisspellingsAndBadGrammar(selection); |
+ } |
+ } |
+ } |
} |
bool EditorClientImpl::isGrammarCheckingEnabled() |