Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility.cc |
| diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc |
| index fe71fef965aa95dfdd32a16d0c22d738e9430e99..710bd2faf2b4a317eef1e10b9e17ae437e3bea06 100644 |
| --- a/content/browser/accessibility/browser_accessibility.cc |
| +++ b/content/browser/accessibility/browser_accessibility.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "content/browser/accessibility/browser_accessibility_manager.h" |
| +#include "content/browser/accessibility/frame_tree_accessibility.h" |
| #include "content/common/accessibility_messages.h" |
| namespace content { |
| @@ -26,7 +27,8 @@ BrowserAccessibility* BrowserAccessibility::Create() { |
| BrowserAccessibility::BrowserAccessibility() |
| : manager_(NULL), |
| - node_(NULL) { |
| + node_(NULL), |
| + child_frame_id_(kNoFrameId) { |
| } |
| BrowserAccessibility::~BrowserAccessibility() { |
| @@ -63,7 +65,12 @@ bool BrowserAccessibility::PlatformIsLeaf() const { |
| } |
| uint32 BrowserAccessibility::PlatformChildCount() const { |
| - return PlatformIsLeaf() ? 0 : InternalChildCount(); |
| + if (child_frame_id_ != kNoFrameId) |
|
aboxhall
2014/05/06 15:41:27
Should this be == ?
|
| + return PlatformIsLeaf() ? 0 : InternalChildCount(); |
| + FrameTreeAccessibility* frames = FrameTreeAccessibility::GetInstance(); |
| + BrowserAccessibilityManager* child_manager = |
| + frames->FindAccessibilityManagerById(child_frame_id_); |
| + return child_manager ? 1 : 0; |
| } |
| bool BrowserAccessibility::IsNative() const { |
| @@ -83,6 +90,13 @@ bool BrowserAccessibility::IsDescendantOf( |
| BrowserAccessibility* BrowserAccessibility::PlatformGetChild( |
| uint32 child_index) const { |
| + if (child_index == 0 && child_frame_id_ != kNoFrameId) { |
|
aboxhall
2014/05/06 15:41:27
Perhaps the order of these two cases should be rev
|
| + FrameTreeAccessibility* frames = FrameTreeAccessibility::GetInstance(); |
| + BrowserAccessibilityManager* child_manager = |
| + frames->FindAccessibilityManagerById(child_frame_id_); |
| + return child_manager ? child_manager->GetRoot() : NULL; |
| + } |
| + |
| DCHECK(child_index < InternalChildCount()); |
| return InternalGetChild(child_index); |
| } |
| @@ -122,7 +136,9 @@ BrowserAccessibility* BrowserAccessibility::GetParent() const { |
| if (!node_ || !manager_) |
| return NULL; |
| ui::AXNode* parent = node_->parent(); |
| - return parent ? manager_->GetFromAXNode(parent) : NULL; |
| + if (parent) |
| + return manager_->GetFromAXNode(parent); |
| + return manager_->GetCrossFrameParent(); |
| } |
| int32 BrowserAccessibility::GetIndexInParent() const { |
| @@ -680,4 +696,9 @@ int BrowserAccessibility::GetStaticTextLenRecursive() const { |
| return len; |
| } |
| +void BrowserAccessibility::SetChildFrameId(uint32 child_frame_id) { |
| + child_frame_id_ = child_frame_id; |
| + manager_->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, this); |
| +} |
| + |
| } // namespace content |