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

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

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review: Fix works with oopif webview but does not fix crbug.com/609903 Created 4 years, 7 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/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index 9977976aaba40eb87ec1c970367ba9b3f85a4053..6a601f07867dcbf7d034fd5d720f860a9162dc18 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -251,6 +251,15 @@ void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) {
if (node == GetFocusedFrame())
return;
+ if (node == nullptr) {
+ if (GetFocusedFrame()) {
lfg 2016/05/06 21:23:33 Nit: no need for {}.
avallee 2016/05/11 18:26:11 Done.
+ GetFocusedFrame()->current_frame_host()->UnsetFocusedFrame();
+ }
+ focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId;
+ // FIXME: Do we need to update the AX tree here?
lfg 2016/05/06 21:23:33 Check with dmazzoni@ if this is necessary.
dmazzoni 2016/05/09 17:07:20 Yes, it'd be good to add this line (just like is d
avallee 2016/05/11 18:26:11 Sent email.
avallee 2016/05/11 18:26:11 This doesn't seem to make the test pass. I've file
+ return;
+ }
+
std::set<SiteInstance*> frame_tree_site_instances =
CollectSiteInstances(this);
@@ -272,13 +281,15 @@ void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) {
DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
RenderFrameProxyHost* proxy =
node->render_manager()->GetRenderFrameProxyHost(instance);
- proxy->SetFocusedFrame();
+ if (proxy) {
lfg 2016/05/06 21:23:32 nit: {}
avallee 2016/05/11 18:26:11 Done.
+ proxy->SetFocusedFrame();
+ }
}
}
// If |node| was focused from a cross-process frame (i.e., via
// window.focus()), tell its RenderFrame that it should focus.
- if (current_instance != source)
+ if (current_instance && current_instance != source)
node->current_frame_host()->SetFocusedFrame();
focused_frame_tree_node_id_ = node->frame_tree_node_id();

Powered by Google App Engine
This is Rietveld 408576698