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

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: Fixed test flakiness and comments in PS 7,8. 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 FrameTreeNode* FrameTree::GetFocusedFrame() { 247 FrameTreeNode* FrameTree::GetFocusedFrame() {
248 return FindByID(focused_frame_tree_node_id_); 248 return FindByID(focused_frame_tree_node_id_);
249 } 249 }
250 250
251 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) { 251 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) {
252 if (node == GetFocusedFrame()) 252 if (node == GetFocusedFrame())
253 return; 253 return;
254 254
255 if (!node) {
256 // TODO(avallee): https://crbug.com/614463 Notify proxies here once
257 // <webview> supports oopifs inside itself.
258 if (GetFocusedFrame())
259 GetFocusedFrame()->current_frame_host()->ClearFocusedFrame();
260 focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId;
261
262 // TODO(avallee): https://crbug.com/610795 This line is not sufficient to
263 // make the test pass. There seems to be no focus change events generated.
264 root()->current_frame_host()->UpdateAXTreeData();
265 return;
266 }
267
255 std::set<SiteInstance*> frame_tree_site_instances = 268 std::set<SiteInstance*> frame_tree_site_instances =
256 CollectSiteInstances(this); 269 CollectSiteInstances(this);
257 270
258 SiteInstance* current_instance = 271 SiteInstance* current_instance =
259 node->current_frame_host()->GetSiteInstance(); 272 node->current_frame_host()->GetSiteInstance();
260 273
261 // Update the focused frame in all other SiteInstances. If focus changes to 274 // Update the focused frame in all other SiteInstances. If focus changes to
262 // a cross-process frame, this allows the old focused frame's renderer 275 // a cross-process frame, this allows the old focused frame's renderer
263 // process to clear focus from that frame and fire blur events. It also 276 // process to clear focus from that frame and fire blur events. It also
264 // ensures that the latest focused frame is available in all renderers to 277 // ensures that the latest focused frame is available in all renderers to
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // This is only used to set page-level focus in cross-process subframes, and 440 // This is only used to set page-level focus in cross-process subframes, and
428 // requests to set focus in main frame's SiteInstance are ignored. 441 // requests to set focus in main frame's SiteInstance are ignored.
429 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { 442 if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
430 RenderFrameProxyHost* proxy = 443 RenderFrameProxyHost* proxy =
431 root_manager->GetRenderFrameProxyHost(instance); 444 root_manager->GetRenderFrameProxyHost(instance);
432 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); 445 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
433 } 446 }
434 } 447 }
435 448
436 } // namespace content 449 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698