summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.cc
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 18:58:30 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 18:58:30 +0000
commit90f4fe96fa29377529a67f017dddba71748fd9f6 (patch)
tree93c4e4f6a38f0ee00f6ab4dc7fddf95cab1692de /chrome/renderer/render_view.cc
parentde41fbf33b50d8aabcfeafe61b748a9eba34c3e3 (diff)
downloadchromium_src-90f4fe96fa29377529a67f017dddba71748fd9f6.zip
chromium_src-90f4fe96fa29377529a67f017dddba71748fd9f6.tar.gz
chromium_src-90f4fe96fa29377529a67f017dddba71748fd9f6.tar.bz2
Revert 73641 - Mac: Enable "Check Spelling While Typing" in Edit menu
Currently the "Edit -> Spelling and Grammar -> Check Spelling While Typing" menu item is always disabled. The problem is that the logic to enable / disable this item lives in the render process and not in the UI. This patch implements a generic message that the render process can send to the browser to update the state of view commands. This is used to enable and disable the "Check Spelling While Typing" menu item. BUG=38440 TEST=Clicked in an edit box and verified that the "Check Spelling While Typing" menu item was enabled. Verified that changing the value from the context menu correctly updates the Edit menu as well. TBR=sail@chromium.org Review URL: http://codereview.chromium.org/6410062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r--chrome/renderer/render_view.cc59
1 files changed, 12 insertions, 47 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 9ea2b85..4de9a22 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -41,7 +41,6 @@
#include "chrome/common/pepper_messages.h"
#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/common/render_messages.h"
-#include "chrome/common/render_view_commands.h"
#include "chrome/common/renderer_preferences.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/url_constants.h"
@@ -1633,12 +1632,18 @@ void RenderView::OnSetInitialFocus(bool reverse) {
}
void RenderView::OnScrollFocusedEditableNodeIntoView() {
- WebKit::WebNode node = GetFocusedNode();
- if (!node.isNull()) {
- if (IsEditableNode(node))
- // TODO(varunjain): Change webkit API to scroll a particular node into
- // view and use that API here instead.
- webview()->scrollFocusedNodeIntoView();
+ if (!webview())
+ return;
+ WebFrame* focused_frame = webview()->focusedFrame();
+ if (focused_frame) {
+ WebDocument doc = focused_frame->document();
+ if (!doc.isNull()) {
+ WebNode node = doc.focusedNode();
+ if (IsEditableNode(node))
+ // TODO(varunjain): Change webkit API to scroll a particular node into
+ // view and use that API here instead.
+ webview()->scrollFocusedNodeIntoView();
+ }
}
}
@@ -2369,10 +2374,6 @@ void RenderView::updateSpellingUIWithMisspelledWord(const WebString& word) {
word));
}
-void RenderView::continuousSpellCheckingEnabledStateChanged() {
- UpdateToggleSpellCheckCommandState();
-}
-
bool RenderView::runFileChooser(
const WebKit::WebFileChooserParams& params,
WebFileChooserCompletion* chooser_completion) {
@@ -2499,27 +2500,6 @@ void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) {
}
}
-void RenderView::UpdateToggleSpellCheckCommandState() {
- bool is_enabled = false;
- WebKit::WebNode node = GetFocusedNode();
- if (!node.isNull())
- is_enabled = IsEditableNode(node);
-
- RenderViewCommandCheckedState checked_state =
- RENDER_VIEW_COMMAND_CHECKED_STATE_UNCHECKED;
- if (is_enabled && webview()) {
- WebFrame* frame = webview()->focusedFrame();
- if (frame->isContinuousSpellCheckingEnabled())
- checked_state = RENDER_VIEW_COMMAND_CHECKED_STATE_CHECKED;
- }
-
- Send(new ViewHostMsg_CommandStateChanged(
- routing_id_,
- RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK,
- is_enabled,
- checked_state));
-}
-
void RenderView::StartNavStateSyncTimerIfNecessary() {
int delay;
if (send_content_state_immediately_)
@@ -2596,8 +2576,6 @@ void RenderView::focusedNodeChanged(const WebNode& node) {
webview()->accessibilityObject(),
WebKit::WebAccessibilityNotificationFocusedUIElementChanged);
}
-
- UpdateToggleSpellCheckCommandState();
}
void RenderView::navigateBackForwardSoon(int offset) {
@@ -4538,19 +4516,6 @@ WebFrame* RenderView::GetChildFrame(const std::wstring& xpath) const {
return frame;
}
-WebNode RenderView::GetFocusedNode() const {
- if (!webview())
- return WebNode();
- WebFrame* focused_frame = webview()->focusedFrame();
- if (focused_frame) {
- WebDocument doc = focused_frame->document();
- if (!doc.isNull())
- return doc.focusedNode();
- }
-
- return WebNode();
-}
-
void RenderView::SetSuggestions(const std::vector<std::string>& suggestions) {
// Explicitly allow empty vector to be sent to the browser.
Send(new ViewHostMsg_SetSuggestions(routing_id_, page_id_, suggestions));