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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 6020017: Mac: Enable "Check Spelling While Typing" in Edit menu... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 71193)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -1907,10 +1907,38 @@
action == @selector(copy:) ||
action == @selector(copyToFindPboard:) ||
action == @selector(paste:) ||
- action == @selector(pasteAsPlainText:)) {
+ action == @selector(pasteAsPlainText:) ||
+ action == @selector(checkSpelling:)) {
return renderWidgetHostView_->render_widget_host_->IsRenderView();
}
+ if (action == @selector(toggleContinuousSpellChecking:)) {
+ RenderViewHost::CommandState state;
+ state.is_enabled = false;
+ state.checked_state = RENDER_VIEW_COMMAND_CHECKED_STATE_UNCHECKED;
+ if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
+ state = static_cast<RenderViewHost*>(
+ renderWidgetHostView_->render_widget_host_)->
+ GetStateForCommand(RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK);
+ }
+ if ([(id)item respondsToSelector:@selector(setState:)]) {
+ NSCellStateValue checked_state;
+ switch (state.checked_state) {
+ case RENDER_VIEW_COMMAND_CHECKED_STATE_UNCHECKED:
+ checked_state = NSOffState;
+ break;
+ case RENDER_VIEW_COMMAND_CHECKED_STATE_CHECKED:
+ checked_state = NSOnState;
+ break;
+ case RENDER_VIEW_COMMAND_CHECKED_STATE_MIXED:
+ checked_state = NSMixedState;
+ break;
+ }
+ [(id)item setState:checked_state];
+ }
+ return state.is_enabled;
+ }
+
return editCommand_helper_->IsMenuItemEnabled(action, self);
}
@@ -2062,6 +2090,7 @@
// other spelling panel methods. This is probably because Apple assumes that the
// the spelling panel will be used with an NSText, which will automatically
// catch this and advance to the next word for you. Thanks Apple.
+// This is also called from the Edit -> Spelling -> Check Spelling menu item.
- (void)checkSpelling:(id)sender {
RenderWidgetHostViewMac* thisHostView = [self renderWidgetHostViewMac];
thisHostView->GetRenderWidgetHost()->AdvanceToNextMisspelling();
@@ -2084,6 +2113,13 @@
SpellCheckerPlatform::SpellingPanelVisible());
}
+- (void)toggleContinuousSpellChecking:(id)sender {
+ if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
+ static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)->
+ ToggleSpellCheck();
+ }
+}
+
// END Spellchecking methods
// Below is the nasty tooltip stuff -- copied from WebKit's WebHTMLView.mm
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698