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

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

Issue 2373243005: Request composition info from the focused RenderWidget (Closed)
Patch Set: Added a unit test Created 4 years, 3 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: content/browser/renderer_host/render_widget_host_view_mac.mm
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 fa22008815a79b8747088da8dfaeb84b2c7bd229..a947b182a3fb7058125aee17dda09426a14ad435 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -885,13 +885,27 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
if (!did_update_state)
return;
+ // Only the widget with a focused text field should be computing composition
+ // info, i.e., if the current TextInputState is NONE, then the widget
+ // corresponding to |updated_view| should stop monitoring composition info. If
+ // state is anything other than NONE, the widget should start monitoring the
+ // composition info. TextInputManager guarantees that in two consecutive calls
+ // to this method, if |updated_view| are different, then the first call must
+ // have had a state->type of NONE and the second call must have had a
+ // none-NONE state, i.e., it is safe to set/unset monitoring based on current
+ // state and |updated_view|.
Charlie Reis 2016/09/30 22:39:16 How is this comment related to the null check belo
EhsanK 2016/10/05 16:39:02 A separate observation. I left a new comment for t
+ RenderWidgetHost* widgetHost = updated_view->GetRenderWidgetHost();
+ if (!widgetHost)
+ return;
+
// Set the monitor state based on the text input focus state.
const bool has_focus = HasFocus();
const TextInputState* state = text_input_manager->GetTextInputState();
bool need_monitor_composition =
has_focus && state && state->type != ui::TEXT_INPUT_TYPE_NONE;
- Send(new InputMsg_RequestCompositionUpdate(
- render_widget_host_->GetRoutingID(), false /* immediate request */,
+
+ widgetHost->Send(new InputMsg_RequestCompositionUpdate(
+ widgetHost->GetRoutingID(), false /* immediate request */,
need_monitor_composition));
if (has_focus) {

Powered by Google App Engine
This is Rietveld 408576698