| Index: Source/web/EditorClientImpl.cpp
|
| diff --git a/Source/web/EditorClientImpl.cpp b/Source/web/EditorClientImpl.cpp
|
| index 7b1741f745c17796b0a3682855d928f09c418d0a..4685023b206dfc5fab166d1bc7c1e3d457d9c3f1 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
|
| + if (Page* page = m_webView->page()) {
|
| + for (Frame* frame = page->mainFrame(); frame && frame->document(); frame = frame->tree()->traverseNext()) {
|
| + frame->document()->markers()->removeMarkers(DocumentMarker::Spelling | DocumentMarker::Grammar);
|
| + }
|
| + }
|
| + } else {
|
| m_spellCheckThisFieldStatus = SpellCheckForcedOn;
|
| + if (Frame* frame = m_webView->focusedWebCoreFrame()) {
|
| + VisibleSelection frameSelection = frame->selection()->selection();
|
| + // If a selection is in an editable element spell check its content.
|
| + if (Element* rootEditableElement = frameSelection.rootEditableElement()) {
|
| + VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(rootEditableElement);
|
| + frame->editor()->markMisspellingsAndBadGrammar(selection);
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
| bool EditorClientImpl::isGrammarCheckingEnabled()
|
|
|