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

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

Issue 1423053002: Make document.activeElement work with OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-preserve-page-focus-on-subframe-navigations
Patch Set: Change plumbing a bit: use focusDocumentView on WebView and remove clearFocus from WebLocalFrame 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
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index cddea8333fd214ee43851fa0ee1f71b77b8d8bae..5c70f34f6c94c9394902b392238841d413a77b3a 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -271,12 +271,16 @@ void FrameTree::SetFocusedFrame(FrameTreeNode* node) {
// If the focused frame changed across processes, send a message to the old
// focused frame's renderer process to clear focus from that frame and fire
// blur events.
- FrameTreeNode* oldFocusedFrame = GetFocusedFrame();
- if (oldFocusedFrame &&
- oldFocusedFrame->current_frame_host()->GetSiteInstance() !=
- node->current_frame_host()->GetSiteInstance()) {
- DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
- oldFocusedFrame->current_frame_host()->ClearFocus();
+ FrameTreeNode* old_focused_frame = GetFocusedFrame();
+ if (old_focused_frame) {
+ SiteInstance* old_site_instance =
+ old_focused_frame->current_frame_host()->GetSiteInstance();
+ if (old_site_instance != node->current_frame_host()->GetSiteInstance()) {
+ DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
+ RenderFrameProxyHost* proxy =
+ node->render_manager()->GetRenderFrameProxyHost(old_site_instance);
+ proxy->SetFocusedFrame();
+ }
}
node->set_last_focus_time(base::TimeTicks::Now());

Powered by Google App Engine
This is Rietveld 408576698