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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2208583005: Request to start/stop calculating composition info from RenderWidget when it is active/inactive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing creis@ comments Created 4 years, 4 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_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 3362aecf01defdbf2d288f7b99bfb11d20ade97f..2abd7c7776573ce9adf82fb58c5478c73dcde5d1 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -468,6 +468,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
set_focus_on_mouse_down_or_key_event_(false),
device_scale_factor_(0.0f),
disable_input_event_router_for_testing_(false),
+ last_active_widget_process_id_(-1),
+ last_active_widget_routing_id_(MSG_ROUTING_NONE),
weak_ptr_factory_(this) {
if (!is_guest_view_hack_)
host_->SetView(this);
@@ -2994,24 +2996,31 @@ void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
GetInputMethod()->OnTextInputTypeChanged(this);
const TextInputState* state = text_input_manager_->GetTextInputState();
-
if (state && state->show_ime_if_needed &&
state->type != ui::TEXT_INPUT_TYPE_NONE) {
GetInputMethod()->ShowImeIfNeeded();
-
// Start monitoring the composition information if the focused node is
// editable.
- host_->Send(new InputMsg_RequestCompositionUpdate(
- host_->GetRoutingID(),
- false /* immediate request */,
+ RenderWidgetHostImpl* last_active_widget =
+ text_input_manager_->GetActiveWidget();
+ last_active_widget_routing_id_ = last_active_widget->GetRoutingID();
+ last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID();
+ last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
+ last_active_widget->GetRoutingID(), false /* immediate request */,
true /* monitor request */));
} else {
// Stop monitoring the composition information if the focused node is not
// editable.
- host_->Send(new InputMsg_RequestCompositionUpdate(
- host_->GetRoutingID(),
- false /* immediate request */,
- false /* monitor request */));
+ if (last_active_widget_routing_id_ != MSG_ROUTING_NONE) {
+ RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID(
+ last_active_widget_process_id_, last_active_widget_routing_id_);
kenrb 2016/08/08 19:15:50 It feels weird to have this RenderWidgetHostView s
EhsanK 2016/08/09 16:42:29 How about adding a method to RWH? That will be mor
+ if (!last_active_widget)
+ return;
kenrb 2016/08/08 19:15:50 nit: It might be better to have if (last_active_wi
EhsanK 2016/08/09 16:42:29 Acknowledged.
+ last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
+ last_active_widget->GetRoutingID(), false /* immediate request */,
+ false /* monitor request */));
+ last_active_widget_process_id_ = MSG_ROUTING_NONE;
Charlie Reis 2016/08/08 17:12:01 You need to clear the routing ID as well, especial
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698