| Index: content/browser/accessibility/browser_accessibility.cc
|
| diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
|
| index 65d805bd3e2c2bf4d02b6eb75d0cdd417a985f3c..8cc30d138d8b6f2f423739449fbe833ea3b1a510 100644
|
| --- a/content/browser/accessibility/browser_accessibility.cc
|
| +++ b/content/browser/accessibility/browser_accessibility.cc
|
| @@ -36,6 +36,11 @@
|
| ui::AXNode* node) {
|
| manager_ = manager;
|
| node_ = node;
|
| +}
|
| +
|
| +void BrowserAccessibility::OnDataChanged() {
|
| + GetStringAttribute(ui::AX_ATTR_NAME, &name_);
|
| + GetStringAttribute(ui::AX_ATTR_VALUE, &value_);
|
| }
|
|
|
| bool BrowserAccessibility::PlatformIsLeaf() const {
|
| @@ -89,17 +94,6 @@
|
| }
|
|
|
| return result;
|
| -}
|
| -
|
| -bool BrowserAccessibility::PlatformIsChildOfLeaf() const {
|
| - BrowserAccessibility* ancestor = GetParent();
|
| - while (ancestor) {
|
| - if (ancestor->PlatformIsLeaf())
|
| - return true;
|
| - ancestor = ancestor->GetParent();
|
| - }
|
| -
|
| - return false;
|
| }
|
|
|
| BrowserAccessibility* BrowserAccessibility::GetPreviousSibling() {
|
| @@ -390,6 +384,9 @@
|
|
|
| void BrowserAccessibility::Destroy() {
|
| // Allow the object to fire a TextRemoved notification.
|
| + name_.clear();
|
| + value_.clear();
|
| +
|
| manager_->NotifyAccessibilityEvent(ui::AX_EVENT_HIDE, this);
|
| node_ = NULL;
|
| manager_ = NULL;
|
| @@ -560,6 +557,24 @@
|
| return true;
|
| }
|
|
|
| +void BrowserAccessibility::SetStringAttribute(
|
| + ui::AXStringAttribute attribute, const std::string& value) {
|
| + if (!node_)
|
| + return;
|
| + ui::AXNodeData data = GetData();
|
| + for (size_t i = 0; i < data.string_attributes.size(); ++i) {
|
| + if (data.string_attributes[i].first == attribute) {
|
| + data.string_attributes[i].second = value;
|
| + node_->SetData(data);
|
| + return;
|
| + }
|
| + }
|
| + if (!value.empty()) {
|
| + data.string_attributes.push_back(std::make_pair(attribute, value));
|
| + node_->SetData(data);
|
| + }
|
| +}
|
| +
|
| bool BrowserAccessibility::HasIntListAttribute(
|
| ui::AXIntListAttribute attribute) const {
|
| const ui::AXNodeData& data = GetData();
|
| @@ -687,6 +702,17 @@
|
| return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL;
|
| }
|
|
|
| +std::string BrowserAccessibility::GetTextRecursive() const {
|
| + if (!name_.empty()) {
|
| + return name_;
|
| + }
|
| +
|
| + std::string result;
|
| + for (uint32 i = 0; i < PlatformChildCount(); ++i)
|
| + result += PlatformGetChild(i)->GetTextRecursive();
|
| + return result;
|
| +}
|
| +
|
| int BrowserAccessibility::GetStaticTextLenRecursive() const {
|
| if (GetRole() == ui::AX_ROLE_STATIC_TEXT)
|
| return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size());
|
|
|