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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1463153002: Don't route a non-frame widget's keyboard event to main frame widget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Charlie's comments Created 5 years, 1 month 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 | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index bfae0c2414406717893f98f7a8df07f750eac9a3..9c23bb86eae1a6a2f4e96b8355c01f1ff6311112 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1597,13 +1597,19 @@ void WebContentsImpl::ReplicatePageFocus(bool is_focused) {
frame_tree_.ReplicatePageFocus(is_focused);
}
-RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost() {
+RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
+ RenderWidgetHostImpl* receiving_widget) {
if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
- return GetMainFrame()->GetRenderWidgetHost();
+ return receiving_widget;
+
+ // Events for widgets other than the main frame (e.g., popup menus) should be
+ // forwarded directly to the widget they arrived on.
+ if (receiving_widget != GetMainFrame()->GetRenderWidgetHost())
+ return receiving_widget;
FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame();
if (!focused_frame)
- return GetMainFrame()->GetRenderWidgetHost();
+ return receiving_widget;
return RenderWidgetHostImpl::From(
focused_frame->current_frame_host()->GetView()->GetRenderWidgetHost());
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698