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

Side by Side 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: Added test and addressed comments. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/frame_tree.h" 5 #include "content/browser/frame_host/frame_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 244 }
245 245
246 FrameTreeNode* FrameTree::GetFocusedFrame() { 246 FrameTreeNode* FrameTree::GetFocusedFrame() {
247 return FindByID(focused_frame_tree_node_id_); 247 return FindByID(focused_frame_tree_node_id_);
248 } 248 }
249 249
250 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) { 250 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) {
251 if (node == GetFocusedFrame()) 251 if (node == GetFocusedFrame())
252 return; 252 return;
253 253
254 if (!node) {
255 // TODO(avallee): https://crbug.com/614463 Notify proxies here once
256 // <webview> supports oopifs inside itself.
257 if (GetFocusedFrame())
258 GetFocusedFrame()->current_frame_host()->ClearFocusedFrame();
259 focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId;
260
261 // TODO(avallee): https://crbug.com/610795 This line is not sufficient to
262 // make the test pass. There seems to be no focus change events generated.
263 root()->current_frame_host()->UpdateAXTreeData();
264 return;
265 }
266
254 std::set<SiteInstance*> frame_tree_site_instances = 267 std::set<SiteInstance*> frame_tree_site_instances =
255 CollectSiteInstances(this); 268 CollectSiteInstances(this);
256 269
257 SiteInstance* current_instance = 270 SiteInstance* current_instance =
258 node->current_frame_host()->GetSiteInstance(); 271 node->current_frame_host()->GetSiteInstance();
259 272
260 // Update the focused frame in all other SiteInstances. If focus changes to 273 // Update the focused frame in all other SiteInstances. If focus changes to
261 // a cross-process frame, this allows the old focused frame's renderer 274 // a cross-process frame, this allows the old focused frame's renderer
262 // process to clear focus from that frame and fire blur events. It also 275 // process to clear focus from that frame and fire blur events. It also
263 // ensures that the latest focused frame is available in all renderers to 276 // ensures that the latest focused frame is available in all renderers to
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // This is only used to set page-level focus in cross-process subframes, and 439 // This is only used to set page-level focus in cross-process subframes, and
427 // requests to set focus in main frame's SiteInstance are ignored. 440 // requests to set focus in main frame's SiteInstance are ignored.
428 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { 441 if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
429 RenderFrameProxyHost* proxy = 442 RenderFrameProxyHost* proxy =
430 root_manager->GetRenderFrameProxyHost(instance); 443 root_manager->GetRenderFrameProxyHost(instance);
431 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); 444 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
432 } 445 }
433 } 446 }
434 447
435 } // namespace content 448 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698