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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1406103005: Preserve page-level focus for subframe cross-process navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-page
Patch Set: Add comment 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/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index b43007f59010a209e0f3d84f22dc2f27e67b5a41..f6df60a22e696651294ee4c957537060ba2b09c3 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -2215,7 +2215,14 @@ void RenderFrameHostManager::CommitPending() {
if (will_focus_location_bar) {
delegate_->SetFocusToLocationBar(false);
} else if (focus_render_view && render_frame_host_->GetView()) {
- render_frame_host_->GetView()->Focus();
+ if (is_main_frame) {
+ render_frame_host_->GetView()->Focus();
+ } else {
+ // The main frame's view is already focused, but we need to set
+ // page-level focus in the subframe's renderer.
+ frame_tree_node_->frame_tree()->SetPageFocus(
+ render_frame_host_->GetSiteInstance(), true);
+ }
}
// Notify that we've swapped RenderFrameHosts. We do this before shutting down
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698