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

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

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Remove logging code. Created 3 years, 11 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/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 deee5480624927d91392edcc4f98dc3d9a510024..bd9e469964ba2480908b2c4acd3679f9ece85571 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4735,6 +4735,13 @@ void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() {
// and focus this contents to activate it.
if (old_contents)
old_contents->GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(false);
+
+ // Make sure the outer web contents knows our frame is focused. Otherwise, the
+ // outer renderer could have the element before or after the frame element
+ // focused which would return early without actually advancing focus.
+ if (GetRenderManager()->GetProxyToOuterDelegate())
+ GetRenderManager()->GetProxyToOuterDelegate()->SetFocusedFrame();
+
GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
GetOutermostWebContents()->node_->SetFocusedWebContents(this);
}

Powered by Google App Engine
This is Rietveld 408576698