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

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed)

Created:
9 years, 11 months ago by Robert Sesek
Modified:
9 years, 7 months ago
CC:
chromium-reviews, pam+watch_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org, brettw-cc_chromium.org, Nico, jam
Visibility:
Public.

Description

[Mac] Implement the system dictionary popup by implementing NSTextInput methods. This is a two-sided patch; the Chromium side is plumbing to marshall data from the renderer to the system APIs. Note that just hitting Cmd+Ctrl+D usually does not bring up the popup. I think this may be an Apple bug, but I have not yet found a work-around. BUG=17951, 37715, 47141 TEST=Hold Cmd+Ctrl+D on a web page and mouse around. The dictionary popup should follow the mouse and show the definition of the current word. TEST=In a text area, the dictionary popup should work only if the text area has focus. R=avi,suzhe,jam Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=83723

Patch Set 1 #

Total comments: 4

Patch Set 2 : Rename LookupInDictionary #

Patch Set 3 : Plumb selection rannge with ViewHostMsg_SelectionChanged #

Total comments: 18

Patch Set 4 : Split out IPC messages and handlers #

Patch Set 5 : Work on IME #

Total comments: 4

Patch Set 6 : Address comments #

Total comments: 13

Patch Set 7 : Update unit test #

Total comments: 6

Patch Set 8 : Address jam@ comments #

Total comments: 8

Patch Set 9 : Re-plumb with ui::Range #

Patch Set 10 : Create AttributedStringCoder #

Total comments: 8

Patch Set 11 : Address comments #

Patch Set 12 : Fix linux, checkdeps #

Patch Set 13 : Golden CL #

Patch Set 14 : Fix Clang #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1261 lines, -86 lines) Patch
M chrome/browser/chrome_content_browser_client.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_gtk.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_mac.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +5 lines, -13 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 9 chunks +50 lines, -39 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_views.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_views.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
A chrome/browser/renderer_host/text_input_client_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +86 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/text_input_client_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +122 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/text_input_client_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +160 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/text_input_client_message_filter.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +44 lines, -0 lines 0 comments Download
A chrome/browser/renderer_host/text_input_client_message_filter.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +63 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/chrome_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/chrome_renderer.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
A chrome/common/attributed_string_coder_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +118 lines, -0 lines 0 comments Download
A chrome/common/attributed_string_coder_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +165 lines, -0 lines 0 comments Download
A chrome/common/attributed_string_coder_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +105 lines, -0 lines 0 comments Download
A chrome/common/text_input_client_messages.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +55 lines, -0 lines 0 comments Download
A chrome/common/text_input_client_messages.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/renderer/chrome_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
A chrome/renderer/text_input_client_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +41 lines, -0 lines 0 comments Download
A chrome/renderer/text_input_client_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +70 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_message_filter.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_widget_host.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M content/common/common_param_traits.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +12 lines, -0 lines 0 comments Download
M content/common/common_param_traits.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +19 lines, -0 lines 0 comments Download
M content/common/font_descriptor_mac.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M content/common/font_descriptor_mac.mm View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -1 line 0 comments Download
M content/common/font_descriptor_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +4 lines, -4 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -2 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_view.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +14 lines, -12 lines 0 comments Download
M content/renderer/render_widget.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +44 lines, -1 line 0 comments Download
M content/renderer/render_widget_fullscreen_pepper.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -4 lines 0 comments Download
M ipc/ipc_message_utils.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 37 (0 generated)
Robert Sesek
+pinkerton: general thoughts +darin: plumbing & IPC; and if you wouldn't mind, take a look ...
9 years, 11 months ago (2011-01-19 16:38:42 UTC) #1
Avi (use Gerrit)
lookup_in_dictionary.[h|mm] seems to be an integral part of RWHVM's text input handling capabilities. It seems ...
9 years, 11 months ago (2011-01-19 17:26:04 UTC) #2
Robert Sesek
On 2011/01/19 17:26:04, Avi wrote: > lookup_in_dictionary.[h|mm] seems to be an integral part of RWHVM's ...
9 years, 11 months ago (2011-01-19 17:52:03 UTC) #3
James Su
Can we generalize the code of lookup_in_dictionary.* and WebTextHelper.*, so that other platforms can use ...
9 years, 11 months ago (2011-01-19 18:57:19 UTC) #4
Robert Sesek
On 2011/01/19 18:57:19, James Su wrote: > Can we generalize the code of lookup_in_dictionary.* and ...
9 years, 11 months ago (2011-01-19 19:52:24 UTC) #5
James Su
I'll give you detailed feedback after reviewing the CL thoroughly. Following are two quick points: ...
9 years, 11 months ago (2011-01-19 20:29:05 UTC) #6
Robert Sesek
On 2011/01/19 20:29:05, James Su wrote: > I'll give you detailed feedback after reviewing the ...
9 years, 11 months ago (2011-01-20 15:06:32 UTC) #7
James Su
On 2011/01/20 15:06:32, rsesek wrote: > On 2011/01/19 20:29:05, James Su wrote: > > I'll ...
9 years, 11 months ago (2011-01-20 17:50:13 UTC) #8
Robert Sesek
I've properly implemented |-selectedRange| by plumbing that info down with ViewHostMsg_SelectionChanged, so now it's async ...
9 years, 11 months ago (2011-01-20 19:17:40 UTC) #9
James Su
I tried to test this CL on my Mac, but the renderer crashed as soon ...
9 years, 11 months ago (2011-01-20 23:46:05 UTC) #10
James Su
Just figured out the reason of crash, and confirmed that we need to implement -markedRange ...
9 years, 11 months ago (2011-01-21 00:02:46 UTC) #11
jam
http://codereview.chromium.org/6289009/diff/40001/chrome/browser/renderer_host/render_message_filter.h File chrome/browser/renderer_host/render_message_filter.h (right): http://codereview.chromium.org/6289009/diff/40001/chrome/browser/renderer_host/render_message_filter.h#newcode203 chrome/browser/renderer_host/render_message_filter.h:203: void OnGotCharacterIndexForPoint(const uint index); nit: for input parameters in ...
9 years, 11 months ago (2011-01-21 18:51:07 UTC) #12
jam
also, perhaps these messages should go into their own X_messages.h files, so that we don't ...
9 years, 11 months ago (2011-01-21 19:01:28 UTC) #13
James Su
Some additional thoughts 1. Although we are currently using NSTextInput interface, we'll eventually migrate to ...
9 years, 11 months ago (2011-01-21 21:28:11 UTC) #14
Robert Sesek
I've addressed all of John's feedback and some of James' -- thank you! I'm still ...
9 years, 11 months ago (2011-01-21 23:40:06 UTC) #15
James Su
Hello, Sorry for late reply. I'm currently travelling in China. I'll review this CL again ...
9 years, 10 months ago (2011-02-11 03:33:06 UTC) #16
Robert Sesek
Sorry for the delay in getting back to this; I've been working on other things ...
9 years, 10 months ago (2011-02-16 21:31:00 UTC) #17
James Su
What issue did you encounter with input method? http://codereview.chromium.org/6289009/diff/70001/chrome/browser/renderer_host/render_widget_host_view_mac.mm File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/6289009/diff/70001/chrome/browser/renderer_host/render_widget_host_view_mac.mm#newcode836 chrome/browser/renderer_host/render_widget_host_view_mac.mm:836: [cocoa_view_ ...
9 years, 10 months ago (2011-02-17 02:03:00 UTC) #18
Robert Sesek
On 2011/02/17 02:03:00, James Su wrote: > What issue did you encounter with input method? ...
9 years, 10 months ago (2011-02-17 20:05:04 UTC) #19
James Su
LGTM, as long as you are going to replace it with a platform independent solution ...
9 years, 10 months ago (2011-02-21 02:03:14 UTC) #20
jeremy
http://codereview.chromium.org/6289009/diff/74001/chrome/browser/renderer_host/render_widget_host_view_mac.mm File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/6289009/diff/74001/chrome/browser/renderer_host/render_widget_host_view_mac.mm#newcode835 chrome/browser/renderer_host/render_widget_host_view_mac.mm:835: void RenderWidgetHostViewMac::ImeCompositionRangeChanged(int start, int end) { Why are start ...
9 years, 10 months ago (2011-02-21 09:19:46 UTC) #21
Robert Sesek
I've now split WebTextHelper out of this patch set and am going to upstream this ...
9 years, 10 months ago (2011-02-24 23:26:52 UTC) #22
jam
http://codereview.chromium.org/6289009/diff/78001/chrome/common/text_input_client_messages_internal.h File chrome/common/text_input_client_messages_internal.h (right): http://codereview.chromium.org/6289009/diff/78001/chrome/common/text_input_client_messages_internal.h#newcode1 chrome/common/text_input_client_messages_internal.h:1: // Copyright (c) 2011 The Chromium Authors. All rights ...
9 years, 10 months ago (2011-02-25 18:08:06 UTC) #23
jam
http://codereview.chromium.org/6289009/diff/78001/chrome/browser/renderer_host/text_input_client_message_filter.mm File chrome/browser/renderer_host/text_input_client_message_filter.mm (right): http://codereview.chromium.org/6289009/diff/78001/chrome/browser/renderer_host/text_input_client_message_filter.mm#newcode71 chrome/browser/renderer_host/text_input_client_message_filter.mm:71: RenderViewHost* rvh = RenderViewHost is not threadsafe. Your message ...
9 years, 10 months ago (2011-02-25 18:15:28 UTC) #24
Robert Sesek
Thanks for the feedback, John. All comments addressed. http://codereview.chromium.org/6289009/diff/78001/chrome/browser/renderer_host/text_input_client_message_filter.mm File chrome/browser/renderer_host/text_input_client_message_filter.mm (right): http://codereview.chromium.org/6289009/diff/78001/chrome/browser/renderer_host/text_input_client_message_filter.mm#newcode71 chrome/browser/renderer_host/text_input_client_message_filter.mm:71: RenderViewHost* ...
9 years, 10 months ago (2011-02-25 18:47:12 UTC) #25
jam
my nits lgtm with the one below http://codereview.chromium.org/6289009/diff/85001/chrome/browser/renderer_host/text_input_client_message_filter.mm File chrome/browser/renderer_host/text_input_client_message_filter.mm (right): http://codereview.chromium.org/6289009/diff/85001/chrome/browser/renderer_host/text_input_client_message_filter.mm#newcode51 chrome/browser/renderer_host/text_input_client_message_filter.mm:51: DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); please ...
9 years, 10 months ago (2011-02-25 19:15:15 UTC) #26
James Su
http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/text_input_client_observer.cc File chrome/renderer/text_input_client_observer.cc (right): http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/text_input_client_observer.cc#newcode44 chrome/renderer/text_input_client_observer.cc:44: uint index = webview()->mainFrame()->characterIndexForPoint(web_point); webview()->focusedFrame() is used in render_view.cc. ...
9 years, 9 months ago (2011-02-28 19:27:59 UTC) #27
James Su
http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/text_input_client_observer.cc File chrome/renderer/text_input_client_observer.cc (right): http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/text_input_client_observer.cc#newcode53 chrome/renderer/text_input_client_observer.cc:53: frame->firstRectForCharacterRange(location, length, web_rect); Do we need to call frame->view()->contentsToWindow(web_rect) ...
9 years, 9 months ago (2011-02-28 19:44:04 UTC) #28
James Su
http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/render_view.cc File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/6289009/diff/85001/chrome/renderer/render_view.cc#newcode2248 chrome/renderer/render_view.cc:2248: WebRange range = frame->selectionRange(); IMHO we should use the ...
9 years, 9 months ago (2011-03-03 04:10:31 UTC) #29
Robert Sesek
I re-plumbed a lot of the methods to use ui::Range. jam: I also added IPC ...
9 years, 9 months ago (2011-03-18 21:33:15 UTC) #30
Robert Sesek
Please take another look Jeremy, Avi, and/or John. I've added a new class AttributedStringCoder, which ...
9 years, 8 months ago (2011-04-11 20:15:26 UTC) #31
Avi (use Gerrit)
Attributed string LGTM http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.h File chrome/common/attributed_string_coder.h (right): http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.h#newcode61 chrome/common/attributed_string_coder.h:61: // A class that contains the ...
9 years, 8 months ago (2011-04-11 20:22:16 UTC) #32
jeremy
http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.mm File chrome/common/attributed_string_coder.mm (right): http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.mm#newcode76 chrome/common/attributed_string_coder.mm:76: font_name_ = base::SysNSStringToUTF8([font fontName]); Could you use a FontDescriptor ...
9 years, 8 months ago (2011-04-12 09:44:06 UTC) #33
Robert Sesek
http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.h File chrome/common/attributed_string_coder.h (right): http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_string_coder.h#newcode61 chrome/common/attributed_string_coder.h:61: // A class that contains the pertitent information from ...
9 years, 8 months ago (2011-04-25 20:58:18 UTC) #34
Robert Sesek
This CL is *finally* ready to land. On Monday I'll land what's posted here. If ...
9 years, 7 months ago (2011-04-29 21:18:37 UTC) #35
jeremy
I don't want to slow this down anymore, but I just want to double check ...
9 years, 7 months ago (2011-05-01 09:25:55 UTC) #36
Robert Sesek
9 years, 7 months ago (2011-05-02 15:43:31 UTC) #37
I added a unit test to verify we don't decode out-of-range attributes (which
would cause a crash via an NSException). ui::Range is hardened against integer
overflows, and your change to FontDescriptor ensures that is protected, too.

I think now everything's clear for landing.

http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_s...
File chrome/common/attributed_string_coder.mm (right):

http://codereview.chromium.org/6289009/diff/101001/chrome/common/attributed_s...
chrome/common/attributed_string_coder.mm:109: // IPC ParamTraits specialization
//////////////////////////////////////////////
On 2011/05/01 09:25:56, jeremy wrote:
> Is there any that verifies that the ui:Range's passed around are within the
> strings bounds?

Added a check that Range::GetMin() and GetMax() are both less than the string's
length.

Powered by Google App Engine
This is Rietveld 408576698