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

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

Issue 2373243005: Request composition info from the focused RenderWidget (Closed)
Patch Set: Addressing creis@'s comments (the same as Patch Set 3) Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8afc7be80441585c875a36aa6c6424e60a2a43c2..b49a57b862e5babc6562c2739035daeb7e990f28 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -879,13 +879,25 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
if (!did_update_state)
return;
+ // |updated_view| is the last view to change its TextInputState which can be
+ // used to start/stop monitoring composition info when it has a focused
+ // editable text input field.
+ RenderWidgetHost* widgetHost = updated_view->GetRenderWidgetHost();
+
+ // We might end up here when |updated_view| has had active TextInputState and
+ // then got destroyed. In that case, |updated_view->GetRenderWidgetHost()|
+ // returns nullptr.
+ 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) {
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698