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

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

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Fix cases where focus does not actually advance focus Created 4 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
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 b22bfdaa29fea8982f715fce1d99644b77d2ee72..2ffba63b66a28db1fc297382c5319be99d307398 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4674,6 +4674,14 @@ 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()) {
alexmos 2016/11/28 23:52:24 nit: { not necessary
avallee 2016/12/09 21:16:51 Done.
+ GetRenderManager()->GetProxyToOuterDelegate()->SetFocusedFrame();
+ }
+
GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
GetOutermostWebContents()->node_->SetFocusedWebContents(this);
}

Powered by Google App Engine
This is Rietveld 408576698