Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| index 7b8dfade2ef72535611714f118146fd4c89262bb..04fbdcf39ac21d702777baabfc38bd45b1c8277f 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -1439,7 +1439,7 @@ void RenderWidgetHostViewAura::UnlockMouse() { |
| void RenderWidgetHostViewAura::SetCompositionText( |
| const ui::CompositionText& composition) { |
| // TODO(wjmaclean): can host_ ever be null? |
|
kenrb
2016/06/13 19:37:47
Nit: That comment can be removed.
EhsanK
2016/06/17 22:36:19
Acknowledged.
|
| - if (!host_) |
| + if (!text_input_manager_ || !text_input_manager_->GetActiveWidget()) |
| return; |
| // TODO(suzhe): convert both renderer_host and renderer to use |
| @@ -1459,27 +1459,28 @@ void RenderWidgetHostViewAura::SetCompositionText( |
| // TODO(suzhe): due to a bug of webkit, we can't use selection range with |
| // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 |
| - host_->ImeSetComposition(composition.text, underlines, |
| - gfx::Range::InvalidRange(), |
| - composition.selection.end(), |
| - composition.selection.end()); |
| + text_input_manager_->GetActiveWidget()->ImeSetComposition( |
|
kenrb
2016/06/13 19:37:47
I have a slight concern about nullptr derefs here.
EhsanK
2016/06/17 22:36:19
Agreed. I think it is safe to unregister here rath
kenrb
2016/06/20 16:04:06
You need to either address that problem before thi
EhsanK
2016/06/22 18:26:32
We already early return on top when GetActiveWidge
kenrb
2016/06/22 19:39:50
Okay, I had missed the line above. This seems fine
EhsanK
2016/06/22 20:56:43
Sorry for that confusing line. I was thinking of a
|
| + composition.text, underlines, gfx::Range::InvalidRange(), |
| + composition.selection.end(), composition.selection.end()); |
| has_composition_text_ = !composition.text.empty(); |
| } |
| void RenderWidgetHostViewAura::ConfirmCompositionText() { |
| // TODO(wjmaclean): can host_ ever be null? |
| - if (host_ && has_composition_text_) { |
| - host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(), |
| - false); |
| + if (text_input_manager_ && text_input_manager_->GetActiveWidget() && |
| + has_composition_text_) { |
| + text_input_manager_->GetActiveWidget()->ImeConfirmComposition( |
| + base::string16(), gfx::Range::InvalidRange(), false); |
| } |
| has_composition_text_ = false; |
| } |
| void RenderWidgetHostViewAura::ClearCompositionText() { |
| // TODO(wjmaclean): can host_ ever be null? |
| - if (host_ && has_composition_text_) |
| - host_->ImeCancelComposition(); |
| + if (text_input_manager_ && text_input_manager_->GetActiveWidget() && |
| + has_composition_text_) |
| + text_input_manager_->GetActiveWidget()->ImeCancelComposition(); |
| has_composition_text_ = false; |
| } |
| @@ -1487,8 +1488,9 @@ void RenderWidgetHostViewAura::InsertText(const base::string16& text) { |
| DCHECK_NE(GetTextInputType(), ui::TEXT_INPUT_TYPE_NONE); |
| // TODO(wjmaclean): can host_ ever be null? |
| - if (host_) |
| - host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); |
| + if (text_input_manager_ && text_input_manager_->GetActiveWidget()) |
| + text_input_manager_->GetActiveWidget()->ImeConfirmComposition( |
| + text, gfx::Range::InvalidRange(), false); |
| has_composition_text_ = false; |
| } |