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

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

Issue 1405293002: OOPIF: Route keyboard events to focused frame in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-page
Patch Set: Add edit stack bug reference. Created 5 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
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 1de892f23ce5486e06b23ac18665b9dcaff90a5e..a66294ba56feeb65d4b310fae1c6f2bb6fb0e08c 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2731,6 +2731,17 @@ void RenderWidgetHostViewAura::DetachFromInputMethod() {
void RenderWidgetHostViewAura::ForwardKeyboardEvent(
const NativeWebKeyboardEvent& event) {
+ RenderWidgetHostImpl* target_host = host_;
+
+ // If there are multiple widgets on the page (such as when there are
+ // out-of-process iframes), pick the one that should process this event.
+ if (host_->delegate()) {
+ RenderWidgetHostImpl* focused_host =
+ host_->delegate()->GetFocusedRenderWidgetHost();
+ if (focused_host)
+ target_host = focused_host;
+ }
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate =
ui::GetTextEditKeyBindingsDelegate();
@@ -2746,16 +2757,19 @@ void RenderWidgetHostViewAura::ForwardKeyboardEvent(
edit_commands.push_back(EditCommand(it->GetCommandString(),
it->argument()));
}
- host_->Send(new InputMsg_SetEditCommandsForNextKeyEvent(
- host_->GetRoutingID(), edit_commands));
+ // TODO(alexmos): This needs to be refactored to work with subframe
+ // RenderWidgetHosts for OOPIF. See https://crbug.com/549334.
+ target_host->Send(new InputMsg_SetEditCommandsForNextKeyEvent(
+ target_host->GetRoutingID(), edit_commands));
+
NativeWebKeyboardEvent copy_event(event);
copy_event.match_edit_command = true;
- host_->ForwardKeyboardEvent(copy_event);
+ target_host->ForwardKeyboardEvent(event);
return;
}
#endif
- host_->ForwardKeyboardEvent(event);
+ target_host->ForwardKeyboardEvent(event);
}
void RenderWidgetHostViewAura::SelectionUpdated(bool is_editable,

Powered by Google App Engine
This is Rietveld 408576698