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..a6a5591e206dcf48662abec1f1127fd710e0a462 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_(0) { |
|
David Tseng
2014/05/01 18:07:54
Maybe the id should be a uint32?
dmazzoni
2014/05/05 07:17:57
Done.
|
| } |
| BrowserAccessibility::~BrowserAccessibility() { |
| @@ -63,7 +65,12 @@ bool BrowserAccessibility::PlatformIsLeaf() const { |
| } |
| uint32 BrowserAccessibility::PlatformChildCount() const { |
| - return PlatformIsLeaf() ? 0 : InternalChildCount(); |
| + if (!child_frame_id_) |
|
David Tseng
2014/05/01 18:07:54
So, 0 means no iframe? Would it make sense to defi
dmazzoni
2014/05/05 07:17:57
Done.
|
| + 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_ != 0) { |
|
David Tseng
2014/05/01 18:07:54
A named constant would help the readability of thi
David Tseng
2014/05/01 18:07:54
Crazy question...but can an iframe element have ch
dmazzoni
2014/05/05 07:17:57
Done.
dmazzoni
2014/05/05 07:17:57
No - but even if that were the case that shouldn't
|
| + 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(int child_frame_id) { |
| + child_frame_id_ = child_frame_id; |
| + manager_->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, this); |
| +} |
| + |
| } // namespace content |