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

Unified Diff: chrome/renderer/spellchecker/spellcheck_provider.cc

Issue 866633002: partial PageClickTracker migration to RenderFrameObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make test happy Created 5 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: chrome/renderer/spellchecker/spellcheck_provider.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_provider.cc b/chrome/renderer/spellchecker/spellcheck_provider.cc
index 7389502c1bb88b77fb300fd9c91c5126c9de4bd0..840f3fb9508b9ed4b60ce2eaca1bebff3049ad34 100644
--- a/chrome/renderer/spellchecker/spellcheck_provider.cc
+++ b/chrome/renderer/spellchecker/spellcheck_provider.cc
@@ -13,6 +13,7 @@
#include "chrome/renderer/spellchecker/spellcheck.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/platform/WebVector.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebTextCheckingCompletion.h"
@@ -20,6 +21,7 @@
#include "third_party/WebKit/public/web/WebTextDecorationType.h"
#include "third_party/WebKit/public/web/WebView.h"
+using blink::WebElement;
using blink::WebFrame;
using blink::WebString;
using blink::WebTextCheckingCompletion;
@@ -109,17 +111,13 @@ bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) {
void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) {
#if defined(OS_MACOSX)
- bool enabled = false;
- blink::WebElement element = render_view()->GetFocusedElement();
- if (!element.isNull())
- enabled = render_view()->IsEditableNode(element);
-
- bool checked = false;
- if (enabled && render_view()->GetWebView()) {
- WebFrame* frame = render_view()->GetWebView()->focusedFrame();
- if (frame->isContinuousSpellCheckingEnabled())
- checked = true;
- }
+ WebFrame* frame = render_view()->GetWebView()->focusedFrame();
+ WebElement element = frame->document().isNull() ? WebElement() :
+ frame->document().focusedElement();
+ bool enabled = !element.isNull() && render_view()->IsEditableNode(element);
+
+ bool checked = enabled && render_view()->GetWebView() &&
+ frame->isContinuousSpellCheckingEnabled();
Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked));
#endif // OS_MACOSX
« no previous file with comments | « chrome/renderer/autofill/page_click_tracker_browsertest.cc ('k') | components/autofill/content/renderer/autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698