Chromium Code Reviews| 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) { |