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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.cc

Issue 849143003: Fix focus and bounds calculations for guest frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 5 years, 11 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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_cocoa.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/accessibility/browser_accessibility_manager.h" 5 #include "content/browser/accessibility/browser_accessibility_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/accessibility/browser_accessibility.h" 8 #include "content/browser/accessibility/browser_accessibility.h"
9 #include "content/common/accessibility_messages.h" 9 #include "content/common/accessibility_messages.h"
10 #include "ui/accessibility/ax_tree_serializer.h" 10 #include "ui/accessibility/ax_tree_serializer.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 BrowserAccessibility* active_descendant = 283 BrowserAccessibility* active_descendant =
284 node->manager()->GetFromID(active_descendant_id); 284 node->manager()->GetFromID(active_descendant_id);
285 if (active_descendant) 285 if (active_descendant)
286 return active_descendant; 286 return active_descendant;
287 } 287 }
288 return node; 288 return node;
289 } 289 }
290 290
291 BrowserAccessibility* BrowserAccessibilityManager::GetFocus( 291 BrowserAccessibility* BrowserAccessibilityManager::GetFocus(
292 BrowserAccessibility* root) { 292 BrowserAccessibility* root) {
293 if (focus_ && (!root || focus_->IsDescendantOf(root->node()))) 293 if (!focus_)
294 return GetFromAXNode(focus_); 294 return NULL;
295 295
296 return NULL; 296 if (root && !focus_->IsDescendantOf(root->node()))
297 return NULL;
298
299 if (!delegate())
300 return NULL;
301
302 BrowserAccessibility* obj = GetFromAXNode(focus_);
303 if (obj->HasBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST)) {
304 BrowserAccessibilityManager* child_manager =
305 delegate()->AccessibilityGetChildFrame(obj->GetId());
306 if (child_manager)
307 return child_manager->GetFocus(child_manager->GetRoot());
308 }
309
310 return obj;
297 } 311 }
298 312
299 void BrowserAccessibilityManager::SetFocus(ui::AXNode* node, bool notify) { 313 void BrowserAccessibilityManager::SetFocus(ui::AXNode* node, bool notify) {
300 if (focus_ != node) 314 if (focus_ != node)
301 focus_ = node; 315 focus_ = node;
302 316
303 if (notify && node && delegate_) 317 if (notify && node && delegate_)
304 delegate_->AccessibilitySetFocus(node->id()); 318 delegate_->AccessibilitySetFocus(node->id());
305 } 319 }
306 320
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 ui::AXTreeUpdate BrowserAccessibilityManager::SnapshotAXTreeForTesting() { 436 ui::AXTreeUpdate BrowserAccessibilityManager::SnapshotAXTreeForTesting() {
423 scoped_ptr<ui::AXTreeSource<const ui::AXNode*> > tree_source( 437 scoped_ptr<ui::AXTreeSource<const ui::AXNode*> > tree_source(
424 tree_->CreateTreeSource()); 438 tree_->CreateTreeSource());
425 ui::AXTreeSerializer<const ui::AXNode*> serializer(tree_source.get()); 439 ui::AXTreeSerializer<const ui::AXNode*> serializer(tree_source.get());
426 ui::AXTreeUpdate update; 440 ui::AXTreeUpdate update;
427 serializer.SerializeChanges(tree_->GetRoot(), &update); 441 serializer.SerializeChanges(tree_->GetRoot(), &update);
428 return update; 442 return update;
429 } 443 }
430 444
431 } // namespace content 445 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698