diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp b/chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp index 0d1246eee6c..76965d29364 100644 --- a/chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp @@ -25,18 +25,18 @@ */ #include "config.h" -#include "SpellCheckerClientImpl.h" +#include "web/SpellCheckerClientImpl.h" -#include "WebSpellCheckClient.h" -#include "WebTextCheckingCompletionImpl.h" -#include "WebTextCheckingResult.h" -#include "WebViewImpl.h" #include "core/dom/DocumentMarkerController.h" #include "core/editing/Editor.h" #include "core/editing/SpellChecker.h" -#include "core/frame/Frame.h" -#include "core/page/Page.h" +#include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" +#include "core/page/Page.h" +#include "public/web/WebSpellCheckClient.h" +#include "public/web/WebTextCheckingResult.h" +#include "web/WebTextCheckingCompletionImpl.h" +#include "web/WebViewImpl.h" using namespace WebCore; @@ -56,7 +56,9 @@ bool SpellCheckerClientImpl::shouldSpellcheckByDefault() { // Spellcheck should be enabled for all editable areas (such as textareas, // contentEditable regions, designMode docs and inputs). - const Frame* frame = m_webView->focusedWebCoreFrame(); + if (!m_webView->focusedWebCoreFrame()->isLocalFrame()) + return false; + const LocalFrame* frame = toLocalFrame(m_webView->focusedWebCoreFrame()); if (!frame) return false; if (frame->spellChecker().isSpellCheckingEnabledInFocusedNode()) @@ -68,9 +70,9 @@ bool SpellCheckerClientImpl::shouldSpellcheckByDefault() // If |element| is null, we default to allowing spellchecking. This is done // in order to mitigate the issue when the user clicks outside the textbox, // as a result of which |element| becomes null, resulting in all the spell - // check markers being deleted. Also, the Frame will decide not to do + // check markers being deleted. Also, the LocalFrame will decide not to do // spellchecking if the user can't edit - so returning true here will not - // cause any problems to the Frame's behavior. + // cause any problems to the LocalFrame's behavior. if (!element) return true; const RenderObject* renderer = element->renderer(); @@ -94,17 +96,21 @@ void SpellCheckerClientImpl::toggleContinuousSpellChecking() if (isContinuousSpellCheckingEnabled()) { m_spellCheckThisFieldStatus = SpellCheckForcedOff; if (Page* page = m_webView->page()) { - for (Frame* frame = page->mainFrame(); frame && frame->document(); frame = frame->tree().traverseNext()) { - frame->document()->markers()->removeMarkers(DocumentMarker::MisspellingMarkers()); + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) { + if (!frame->isLocalFrame()) + continue; + toLocalFrame(frame)->document()->markers().removeMarkers(DocumentMarker::MisspellingMarkers()); } } } 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()) { - frame->spellChecker().didBeginEditing(rootEditableElement); + if (m_webView->focusedWebCoreFrame()->isLocalFrame()) { + if (LocalFrame* frame = toLocalFrame(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()) { + frame->spellChecker().didBeginEditing(rootEditableElement); + } } } } @@ -112,7 +118,7 @@ void SpellCheckerClientImpl::toggleContinuousSpellChecking() bool SpellCheckerClientImpl::isGrammarCheckingEnabled() { - const Frame* frame = m_webView->focusedWebCoreFrame(); + const LocalFrame* frame = toLocalFrame(m_webView->focusedWebCoreFrame()); return frame && frame->settings() && (frame->settings()->asynchronousSpellCheckingEnabled() || frame->settings()->unifiedTextCheckerEnabled()); } |