From 73eac2e9b99d5c4cd67168c8c0bcf126c2f835c1 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Mon, 4 Mar 2013 15:53:01 +0000 Subject: [PATCH] mac: Make services menu work after hitting "select all" The problem was that "select all" didn't go through RenderViewHostImpl::SelectAll(). That method has the effect of setting handling_select_range_ in RenderViewImpl::OnSelectAll(). Previously, this bool wasn't set, causing RenderViewImpl::didChangeSelection() to return early, which in turn meant that the browser process wasn't informed about the updated selection. BUG=114870 TEST=Focus a text box, enter some text, hit cmd-a. Check that text services are selectable in the services menu. Review URL: https://codereview.chromium.org/12398005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185904 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_host/render_widget_host_view_mac.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 25e41f51adf7ed..87f9f7c3e8d83e 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -3351,6 +3351,20 @@ - (void)pasteAndMatchStyle:(id)sender { } } +- (void)selectAll:(id)sender { + // editCommand_helper_ adds implementations for most NSResponder methods + // dynamically. But the renderer side only sends selection results back to + // the browser if they were triggered by a keyboard event or went through + // one of the Select methods on RWH. Since selectAll: is called from the + // menu handler, neither is true. + // Explicitly call SelectAll() here to make sure the renderer returns + // selection results. + if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { + static_cast( + renderWidgetHostView_->render_widget_host_)->SelectAll(); + } +} + - (void)startSpeaking:(id)sender { renderWidgetHostView_->SpeakSelection(); }