Commit c1f9be74 authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Refactor BrowserAccessibility to prepare for AXNode (re-land)

The only purpose of this change is to rename some member
variables and accessors in BrowserAccessibility so that in the
subsequent change we can repurpose BrowserAccessibility to
make use of AXNode instead.

There should be no code logic changes here - just look at
browser_accessibility.h, everything else just follows from
that.

BUG=316726

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=262673

Review URL: https://codereview.chromium.org/224803005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262956 0039d316-1c4b-4281-b951-d872f2087c98
parent 507fd760
...@@ -68,7 +68,7 @@ void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree( ...@@ -68,7 +68,7 @@ void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree(
dict->Set(kChildrenDictAttr, children); dict->Set(kChildrenDictAttr, children);
for (size_t i = 0; i < node.PlatformChildCount(); ++i) { for (size_t i = 0; i < node.PlatformChildCount(); ++i) {
BrowserAccessibility* child_node = node.children()[i]; BrowserAccessibility* child_node = node.InternalGetChild(i);
base::DictionaryValue* child_dict = new base::DictionaryValue; base::DictionaryValue* child_dict = new base::DictionaryValue;
children->Append(child_dict); children->Append(child_dict);
RecursiveBuildAccessibilityTree(*child_node, child_dict); RecursiveBuildAccessibilityTree(*child_node, child_dict);
...@@ -96,7 +96,7 @@ void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree( ...@@ -96,7 +96,7 @@ void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree(
!defined(TOOLKIT_GTK)) !defined(TOOLKIT_GTK))
void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node, void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node,
base::DictionaryValue* dict) { base::DictionaryValue* dict) {
dict->SetInteger("id", node.renderer_id()); dict->SetInteger("id", node.GetId());
} }
base::string16 AccessibilityTreeFormatter::ToString( base::string16 AccessibilityTreeFormatter::ToString(
......
...@@ -34,7 +34,7 @@ void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node, ...@@ -34,7 +34,7 @@ void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node,
states->AppendString(atk_state_type_get_name(state_type)); states->AppendString(atk_state_type_get_name(state_type));
} }
dict->Set("states", states); dict->Set("states", states);
dict->SetInteger("id", node.renderer_id()); dict->SetInteger("id", node.GetId());
} }
base::string16 AccessibilityTreeFormatter::ToString( base::string16 AccessibilityTreeFormatter::ToString(
...@@ -43,8 +43,10 @@ base::string16 AccessibilityTreeFormatter::ToString( ...@@ -43,8 +43,10 @@ base::string16 AccessibilityTreeFormatter::ToString(
base::string16 line; base::string16 line;
std::string role_value; std::string role_value;
node.GetString("role", &role_value); node.GetString("role", &role_value);
if (!role_value.empty()) if (!role_value.empty()) {
WriteAttribute(true, base::StringPrintf("[%s]", role_value.c_str()), &line); WriteAttribute(true,
base::StringPrintf("[%s]", role_value.c_str()), &line);
}
std::string name_value; std::string name_value;
node.GetString("name", &name_value); node.GetString("name", &name_value);
......
...@@ -66,7 +66,7 @@ class CONTENT_EXPORT BrowserAccessibility { ...@@ -66,7 +66,7 @@ class CONTENT_EXPORT BrowserAccessibility {
void InitializeTreeStructure( void InitializeTreeStructure(
BrowserAccessibilityManager* manager, BrowserAccessibilityManager* manager,
BrowserAccessibility* parent, BrowserAccessibility* parent,
int32 renderer_id, int32 id,
int32 index_in_parent); int32 index_in_parent);
// Initialize this object's data. // Initialize this object's data.
...@@ -83,12 +83,6 @@ class CONTENT_EXPORT BrowserAccessibility { ...@@ -83,12 +83,6 @@ class CONTENT_EXPORT BrowserAccessibility {
// Return true if this object is equal to or a descendant of |ancestor|. // Return true if this object is equal to or a descendant of |ancestor|.
bool IsDescendantOf(BrowserAccessibility* ancestor); bool IsDescendantOf(BrowserAccessibility* ancestor);
// Returns the parent of this object, or NULL if it's the root.
BrowserAccessibility* parent() const { return parent_; }
// Returns the number of children of this object.
uint32 child_count() const { return children_.size(); }
// Returns true if this is a leaf node on this platform, meaning any // Returns true if this is a leaf node on this platform, meaning any
// children should not be exposed to this platform's native accessibility // children should not be exposed to this platform's native accessibility
// layer. Each platform subclass should implement this itself. // layer. Each platform subclass should implement this itself.
...@@ -154,26 +148,38 @@ class CONTENT_EXPORT BrowserAccessibility { ...@@ -154,26 +148,38 @@ class CONTENT_EXPORT BrowserAccessibility {
// Accessors // Accessors
// //
const std::vector<BrowserAccessibility*>& children() const {
return children_;
}
const std::vector<std::pair<std::string, std::string> >&
html_attributes() const {
return html_attributes_;
}
int32 index_in_parent() const { return index_in_parent_; }
gfx::Rect location() const { return location_; }
BrowserAccessibilityManager* manager() const { return manager_; } BrowserAccessibilityManager* manager() const { return manager_; }
bool instance_active() const { return instance_active_; }
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
const std::string& value() const { return value_; } const std::string& value() const { return value_; }
int32 renderer_id() const { return renderer_id_; }
int32 role() const { return role_; }
int32 state() const { return state_; }
bool instance_active() const { return instance_active_; }
void set_name(const std::string& name) { name_ = name; } void set_name(const std::string& name) { name_ = name; }
void set_value(const std::string& value) { value_ = value; } void set_value(const std::string& value) { value_ = value; }
std::vector<BrowserAccessibility*>& deprecated_children() {
return deprecated_children_;
}
// These access the internal accessibility tree, which doesn't necessarily
// reflect the accessibility tree that should be exposed on each platform.
// Use PlatformChildCount and PlatformGetChild to implement platform
// accessibility APIs.
uint32 InternalChildCount() const { return deprecated_children_.size(); }
BrowserAccessibility* InternalGetChild(uint32 child_index) const {
return deprecated_children_[child_index];
}
BrowserAccessibility* GetParent() const { return deprecated_parent_; }
int32 GetIndexInParent() const { return deprecated_index_in_parent_; }
int32 GetId() const { return data_.id; }
gfx::Rect GetLocation() const { return data_.location; }
int32 GetRole() const { return data_.role; }
int32 GetState() const { return data_.state; }
const std::vector<std::pair<std::string, std::string> >& GetHtmlAttributes()
const {
return data_.html_attributes;
}
#if defined(OS_MACOSX) && __OBJC__ #if defined(OS_MACOSX) && __OBJC__
BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa(); BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
#elif defined(OS_WIN) #elif defined(OS_WIN)
...@@ -273,7 +279,7 @@ class CONTENT_EXPORT BrowserAccessibility { ...@@ -273,7 +279,7 @@ class CONTENT_EXPORT BrowserAccessibility {
BrowserAccessibilityManager* manager_; BrowserAccessibilityManager* manager_;
// The parent of this object, may be NULL if we're the root object. // The parent of this object, may be NULL if we're the root object.
BrowserAccessibility* parent_; BrowserAccessibility* deprecated_parent_;
private: private:
// Return the sum of the lengths of all static text descendants, // Return the sum of the lengths of all static text descendants,
...@@ -281,32 +287,15 @@ class CONTENT_EXPORT BrowserAccessibility { ...@@ -281,32 +287,15 @@ class CONTENT_EXPORT BrowserAccessibility {
int GetStaticTextLenRecursive() const; int GetStaticTextLenRecursive() const;
// The index of this within its parent object. // The index of this within its parent object.
int32 index_in_parent_; int32 deprecated_index_in_parent_;
// The ID of this object in the renderer process.
int32 renderer_id_;
// The children of this object. // The children of this object.
std::vector<BrowserAccessibility*> children_; std::vector<BrowserAccessibility*> deprecated_children_;
// Accessibility metadata from the renderer // Accessibility metadata from the renderer
std::string name_; std::string name_;
std::string value_; std::string value_;
std::vector<std::pair< ui::AXNodeData data_;
ui::AXBoolAttribute, bool> > bool_attributes_;
std::vector<std::pair<
ui::AXFloatAttribute, float> > float_attributes_;
std::vector<std::pair<
ui::AXIntAttribute, int> > int_attributes_;
std::vector<std::pair<
ui::AXStringAttribute, std::string> > string_attributes_;
std::vector<std::pair<
ui::AXIntListAttribute, std::vector<int32> > >
intlist_attributes_;
std::vector<std::pair<std::string, std::string> > html_attributes_;
int32 role_;
int32 state_;
gfx::Rect location_;
// BrowserAccessibility objects are reference-counted on some platforms. // BrowserAccessibility objects are reference-counted on some platforms.
// When we're done with this object and it's removed from our accessibility // When we're done with this object and it's removed from our accessibility
......
...@@ -56,13 +56,13 @@ bool BrowserAccessibilityAndroid::IsNative() const { ...@@ -56,13 +56,13 @@ bool BrowserAccessibilityAndroid::IsNative() const {
} }
bool BrowserAccessibilityAndroid::PlatformIsLeaf() const { bool BrowserAccessibilityAndroid::PlatformIsLeaf() const {
if (child_count() == 0) if (InternalChildCount() == 0)
return true; return true;
// Iframes are always allowed to contain children. // Iframes are always allowed to contain children.
if (IsIframe() || if (IsIframe() ||
role() == ui::AX_ROLE_ROOT_WEB_AREA || GetRole() == ui::AX_ROLE_ROOT_WEB_AREA ||
role() == ui::AX_ROLE_WEB_AREA) { GetRole() == ui::AX_ROLE_WEB_AREA) {
return false; return false;
} }
...@@ -72,7 +72,7 @@ bool BrowserAccessibilityAndroid::PlatformIsLeaf() const { ...@@ -72,7 +72,7 @@ bool BrowserAccessibilityAndroid::PlatformIsLeaf() const {
// Headings with text can drop their children. // Headings with text can drop their children.
base::string16 name = GetText(); base::string16 name = GetText();
if (role() == ui::AX_ROLE_HEADING && !name.empty()) if (GetRole() == ui::AX_ROLE_HEADING && !name.empty())
return true; return true;
// Focusable nodes with text can drop their children. // Focusable nodes with text can drop their children.
...@@ -91,8 +91,8 @@ bool BrowserAccessibilityAndroid::IsCheckable() const { ...@@ -91,8 +91,8 @@ bool BrowserAccessibilityAndroid::IsCheckable() const {
bool is_aria_pressed_defined; bool is_aria_pressed_defined;
bool is_mixed; bool is_mixed;
GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed);
if (role() == ui::AX_ROLE_CHECK_BOX || if (GetRole() == ui::AX_ROLE_CHECK_BOX ||
role() == ui::AX_ROLE_RADIO_BUTTON || GetRole() == ui::AX_ROLE_RADIO_BUTTON ||
is_aria_pressed_defined) { is_aria_pressed_defined) {
checkable = true; checkable = true;
} }
...@@ -110,21 +110,21 @@ bool BrowserAccessibilityAndroid::IsClickable() const { ...@@ -110,21 +110,21 @@ bool BrowserAccessibilityAndroid::IsClickable() const {
} }
bool BrowserAccessibilityAndroid::IsCollection() const { bool BrowserAccessibilityAndroid::IsCollection() const {
return (role() == ui::AX_ROLE_GRID || return (GetRole() == ui::AX_ROLE_GRID ||
role() == ui::AX_ROLE_LIST || GetRole() == ui::AX_ROLE_LIST ||
role() == ui::AX_ROLE_LIST_BOX || GetRole() == ui::AX_ROLE_LIST_BOX ||
role() == ui::AX_ROLE_TABLE || GetRole() == ui::AX_ROLE_TABLE ||
role() == ui::AX_ROLE_TREE); GetRole() == ui::AX_ROLE_TREE);
} }
bool BrowserAccessibilityAndroid::IsCollectionItem() const { bool BrowserAccessibilityAndroid::IsCollectionItem() const {
return (role() == ui::AX_ROLE_CELL || return (GetRole() == ui::AX_ROLE_CELL ||
role() == ui::AX_ROLE_COLUMN_HEADER || GetRole() == ui::AX_ROLE_COLUMN_HEADER ||
role() == ui::AX_ROLE_DESCRIPTION_LIST_TERM || GetRole() == ui::AX_ROLE_DESCRIPTION_LIST_TERM ||
role() == ui::AX_ROLE_LIST_BOX_OPTION || GetRole() == ui::AX_ROLE_LIST_BOX_OPTION ||
role() == ui::AX_ROLE_LIST_ITEM || GetRole() == ui::AX_ROLE_LIST_ITEM ||
role() == ui::AX_ROLE_ROW_HEADER || GetRole() == ui::AX_ROLE_ROW_HEADER ||
role() == ui::AX_ROLE_TREE_ITEM); GetRole() == ui::AX_ROLE_TREE_ITEM);
} }
bool BrowserAccessibilityAndroid::IsContentInvalid() const { bool BrowserAccessibilityAndroid::IsContentInvalid() const {
...@@ -143,7 +143,7 @@ bool BrowserAccessibilityAndroid::IsEnabled() const { ...@@ -143,7 +143,7 @@ bool BrowserAccessibilityAndroid::IsEnabled() const {
bool BrowserAccessibilityAndroid::IsFocusable() const { bool BrowserAccessibilityAndroid::IsFocusable() const {
bool focusable = HasState(ui::AX_STATE_FOCUSABLE); bool focusable = HasState(ui::AX_STATE_FOCUSABLE);
if (IsIframe() || if (IsIframe() ||
role() == ui::AX_ROLE_WEB_AREA) { GetRole() == ui::AX_ROLE_WEB_AREA) {
focusable = false; focusable = false;
} }
return focusable; return focusable;
...@@ -154,22 +154,23 @@ bool BrowserAccessibilityAndroid::IsFocused() const { ...@@ -154,22 +154,23 @@ bool BrowserAccessibilityAndroid::IsFocused() const {
} }
bool BrowserAccessibilityAndroid::IsHeading() const { bool BrowserAccessibilityAndroid::IsHeading() const {
return (role() == ui::AX_ROLE_COLUMN_HEADER || return (GetRole() == ui::AX_ROLE_COLUMN_HEADER ||
role() == ui::AX_ROLE_HEADING || GetRole() == ui::AX_ROLE_HEADING ||
role() == ui::AX_ROLE_ROW_HEADER); GetRole() == ui::AX_ROLE_ROW_HEADER);
} }
bool BrowserAccessibilityAndroid::IsHierarchical() const { bool BrowserAccessibilityAndroid::IsHierarchical() const {
return (role() == ui::AX_ROLE_LIST || return (GetRole() == ui::AX_ROLE_LIST ||
role() == ui::AX_ROLE_TREE); GetRole() == ui::AX_ROLE_TREE);
} }
bool BrowserAccessibilityAndroid::IsLink() const { bool BrowserAccessibilityAndroid::IsLink() const {
return role() == ui::AX_ROLE_LINK || role() == ui::AX_ROLE_IMAGE_MAP_LINK; return GetRole() == ui::AX_ROLE_LINK ||
GetRole() == ui::AX_ROLE_IMAGE_MAP_LINK;
} }
bool BrowserAccessibilityAndroid::IsMultiLine() const { bool BrowserAccessibilityAndroid::IsMultiLine() const {
return role() == ui::AX_ROLE_TEXT_AREA; return GetRole() == ui::AX_ROLE_TEXT_AREA;
} }
bool BrowserAccessibilityAndroid::IsPassword() const { bool BrowserAccessibilityAndroid::IsPassword() const {
...@@ -177,9 +178,9 @@ bool BrowserAccessibilityAndroid::IsPassword() const { ...@@ -177,9 +178,9 @@ bool BrowserAccessibilityAndroid::IsPassword() const {
} }
bool BrowserAccessibilityAndroid::IsRangeType() const { bool BrowserAccessibilityAndroid::IsRangeType() const {
return (role() == ui::AX_ROLE_PROGRESS_INDICATOR || return (GetRole() == ui::AX_ROLE_PROGRESS_INDICATOR ||
role() == ui::AX_ROLE_SCROLL_BAR || GetRole() == ui::AX_ROLE_SCROLL_BAR ||
role() == ui::AX_ROLE_SLIDER); GetRole() == ui::AX_ROLE_SLIDER);
} }
bool BrowserAccessibilityAndroid::IsScrollable() const { bool BrowserAccessibilityAndroid::IsScrollable() const {
...@@ -202,7 +203,7 @@ bool BrowserAccessibilityAndroid::CanOpenPopup() const { ...@@ -202,7 +203,7 @@ bool BrowserAccessibilityAndroid::CanOpenPopup() const {
const char* BrowserAccessibilityAndroid::GetClassName() const { const char* BrowserAccessibilityAndroid::GetClassName() const {
const char* class_name = NULL; const char* class_name = NULL;
switch(role()) { switch(GetRole()) {
case ui::AX_ROLE_EDITABLE_TEXT: case ui::AX_ROLE_EDITABLE_TEXT:
case ui::AX_ROLE_SPIN_BUTTON: case ui::AX_ROLE_SPIN_BUTTON:
case ui::AX_ROLE_TEXT_AREA: case ui::AX_ROLE_TEXT_AREA:
...@@ -263,7 +264,7 @@ const char* BrowserAccessibilityAndroid::GetClassName() const { ...@@ -263,7 +264,7 @@ const char* BrowserAccessibilityAndroid::GetClassName() const {
base::string16 BrowserAccessibilityAndroid::GetText() const { base::string16 BrowserAccessibilityAndroid::GetText() const {
if (IsIframe() || if (IsIframe() ||
role() == ui::AX_ROLE_WEB_AREA) { GetRole() == ui::AX_ROLE_WEB_AREA) {
return base::string16(); return base::string16();
} }
...@@ -280,13 +281,13 @@ base::string16 BrowserAccessibilityAndroid::GetText() const { ...@@ -280,13 +281,13 @@ base::string16 BrowserAccessibilityAndroid::GetText() const {
// This is called from PlatformIsLeaf, so don't call PlatformChildCount // This is called from PlatformIsLeaf, so don't call PlatformChildCount
// from within this! // from within this!
if (text.empty() && HasOnlyStaticTextChildren()) { if (text.empty() && HasOnlyStaticTextChildren()) {
for (uint32 i = 0; i < child_count(); i++) { for (uint32 i = 0; i < InternalChildCount(); i++) {
BrowserAccessibility* child = children()[i]; BrowserAccessibility* child = InternalGetChild(i);
text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText();
} }
} }
switch(role()) { switch(GetRole()) {
case ui::AX_ROLE_HEADING: case ui::AX_ROLE_HEADING:
// Only append "heading" if this node already has text. // Only append "heading" if this node already has text.
if (!text.empty()) if (!text.empty())
...@@ -299,11 +300,11 @@ base::string16 BrowserAccessibilityAndroid::GetText() const { ...@@ -299,11 +300,11 @@ base::string16 BrowserAccessibilityAndroid::GetText() const {
int BrowserAccessibilityAndroid::GetItemIndex() const { int BrowserAccessibilityAndroid::GetItemIndex() const {
int index = 0; int index = 0;
switch(role()) { switch(GetRole()) {
case ui::AX_ROLE_LIST_ITEM: case ui::AX_ROLE_LIST_ITEM:
case ui::AX_ROLE_LIST_BOX_OPTION: case ui::AX_ROLE_LIST_BOX_OPTION:
case ui::AX_ROLE_TREE_ITEM: case ui::AX_ROLE_TREE_ITEM:
index = index_in_parent(); index = GetIndexInParent();
break; break;
case ui::AX_ROLE_SLIDER: case ui::AX_ROLE_SLIDER:
case ui::AX_ROLE_PROGRESS_INDICATOR: { case ui::AX_ROLE_PROGRESS_INDICATOR: {
...@@ -320,7 +321,7 @@ int BrowserAccessibilityAndroid::GetItemIndex() const { ...@@ -320,7 +321,7 @@ int BrowserAccessibilityAndroid::GetItemIndex() const {
int BrowserAccessibilityAndroid::GetItemCount() const { int BrowserAccessibilityAndroid::GetItemCount() const {
int count = 0; int count = 0;
switch(role()) { switch(GetRole()) {
case ui::AX_ROLE_LIST: case ui::AX_ROLE_LIST:
case ui::AX_ROLE_LIST_BOX: case ui::AX_ROLE_LIST_BOX:
count = PlatformChildCount(); count = PlatformChildCount();
...@@ -479,14 +480,14 @@ int BrowserAccessibilityAndroid::AndroidRangeType() const { ...@@ -479,14 +480,14 @@ int BrowserAccessibilityAndroid::AndroidRangeType() const {
} }
int BrowserAccessibilityAndroid::RowCount() const { int BrowserAccessibilityAndroid::RowCount() const {
if (role() == ui::AX_ROLE_GRID || if (GetRole() == ui::AX_ROLE_GRID ||
role() == ui::AX_ROLE_TABLE) { GetRole() == ui::AX_ROLE_TABLE) {
return CountChildrenWithRole(ui::AX_ROLE_ROW); return CountChildrenWithRole(ui::AX_ROLE_ROW);
} }
if (role() == ui::AX_ROLE_LIST || if (GetRole() == ui::AX_ROLE_LIST ||
role() == ui::AX_ROLE_LIST_BOX || GetRole() == ui::AX_ROLE_LIST_BOX ||
role() == ui::AX_ROLE_TREE) { GetRole() == ui::AX_ROLE_TREE) {
return PlatformChildCount(); return PlatformChildCount();
} }
...@@ -494,18 +495,18 @@ int BrowserAccessibilityAndroid::RowCount() const { ...@@ -494,18 +495,18 @@ int BrowserAccessibilityAndroid::RowCount() const {
} }
int BrowserAccessibilityAndroid::ColumnCount() const { int BrowserAccessibilityAndroid::ColumnCount() const {
if (role() == ui::AX_ROLE_GRID || if (GetRole() == ui::AX_ROLE_GRID ||
role() == ui::AX_ROLE_TABLE) { GetRole() == ui::AX_ROLE_TABLE) {
return CountChildrenWithRole(ui::AX_ROLE_COLUMN); return CountChildrenWithRole(ui::AX_ROLE_COLUMN);
} }
return 0; return 0;
} }
int BrowserAccessibilityAndroid::RowIndex() const { int BrowserAccessibilityAndroid::RowIndex() const {
if (role() == ui::AX_ROLE_LIST_ITEM || if (GetRole() == ui::AX_ROLE_LIST_ITEM ||
role() == ui::AX_ROLE_LIST_BOX_OPTION || GetRole() == ui::AX_ROLE_LIST_BOX_OPTION ||
role() == ui::AX_ROLE_TREE_ITEM) { GetRole() == ui::AX_ROLE_TREE_ITEM) {
return index_in_parent(); return GetIndexInParent();
} }
return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX); return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX);
...@@ -538,8 +539,8 @@ float BrowserAccessibilityAndroid::RangeCurrentValue() const { ...@@ -538,8 +539,8 @@ float BrowserAccessibilityAndroid::RangeCurrentValue() const {
bool BrowserAccessibilityAndroid::HasFocusableChild() const { bool BrowserAccessibilityAndroid::HasFocusableChild() const {
// This is called from PlatformIsLeaf, so don't call PlatformChildCount // This is called from PlatformIsLeaf, so don't call PlatformChildCount
// from within this! // from within this!
for (uint32 i = 0; i < child_count(); i++) { for (uint32 i = 0; i < InternalChildCount(); i++) {
BrowserAccessibility* child = children()[i]; BrowserAccessibility* child = InternalGetChild(i);
if (child->HasState(ui::AX_STATE_FOCUSABLE)) if (child->HasState(ui::AX_STATE_FOCUSABLE))
return true; return true;
if (static_cast<BrowserAccessibilityAndroid*>(child)->HasFocusableChild()) if (static_cast<BrowserAccessibilityAndroid*>(child)->HasFocusableChild())
...@@ -551,9 +552,9 @@ bool BrowserAccessibilityAndroid::HasFocusableChild() const { ...@@ -551,9 +552,9 @@ bool BrowserAccessibilityAndroid::HasFocusableChild() const {
bool BrowserAccessibilityAndroid::HasOnlyStaticTextChildren() const { bool BrowserAccessibilityAndroid::HasOnlyStaticTextChildren() const {
// This is called from PlatformIsLeaf, so don't call PlatformChildCount // This is called from PlatformIsLeaf, so don't call PlatformChildCount
// from within this! // from within this!
for (uint32 i = 0; i < child_count(); i++) { for (uint32 i = 0; i < InternalChildCount(); i++) {
BrowserAccessibility* child = children()[i]; BrowserAccessibility* child = InternalGetChild(i);
if (child->role() != ui::AX_ROLE_STATIC_TEXT) if (child->GetRole() != ui::AX_ROLE_STATIC_TEXT)
return false; return false;
} }
return true; return true;
...@@ -575,7 +576,7 @@ void BrowserAccessibilityAndroid::PostInitialize() { ...@@ -575,7 +576,7 @@ void BrowserAccessibilityAndroid::PostInitialize() {
} }
} }
if (role() == ui::AX_ROLE_ALERT && first_time_) if (GetRole() == ui::AX_ROLE_ALERT && first_time_)
manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this);
base::string16 live; base::string16 live;
...@@ -606,7 +607,7 @@ void BrowserAccessibilityAndroid::NotifyLiveRegionUpdate( ...@@ -606,7 +607,7 @@ void BrowserAccessibilityAndroid::NotifyLiveRegionUpdate(
int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
int count = 0; int count = 0;
for (uint32 i = 0; i < PlatformChildCount(); i++) { for (uint32 i = 0; i < PlatformChildCount(); i++) {
if (PlatformGetChild(i)->role() == role) if (PlatformGetChild(i)->GetRole() == role)
count++; count++;
} }
return count; return count;
......
...@@ -49,7 +49,7 @@ typedef std::map<ui::AXRole, NSString*> RoleMap; ...@@ -49,7 +49,7 @@ typedef std::map<ui::AXRole, NSString*> RoleMap;
// GetState checks the bitmask used in AXNodeData to check // GetState checks the bitmask used in AXNodeData to check
// if the given state was set on the accessibility object. // if the given state was set on the accessibility object.
bool GetState(BrowserAccessibility* accessibility, ui::AXState state) { bool GetState(BrowserAccessibility* accessibility, ui::AXState state) {
return ((accessibility->state() >> state) & 1); return ((accessibility->GetState() >> state) & 1);
} }
RoleMap BuildRoleMap() { RoleMap BuildRoleMap() {
...@@ -391,7 +391,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -391,7 +391,7 @@ NSDictionary* attributeToMethodNameMap = nil;
if (![self isIgnored]) { if (![self isIgnored]) {
children_.reset(); children_.reset();
} else { } else {
[browserAccessibility_->parent()->ToBrowserAccessibilityCocoa() [browserAccessibility_->GetParent()->ToBrowserAccessibilityCocoa()
childrenChanged]; childrenChanged];
} }
} }
...@@ -410,7 +410,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -410,7 +410,7 @@ NSDictionary* attributeToMethodNameMap = nil;
int id = uniqueCellIds[i]; int id = uniqueCellIds[i];
BrowserAccessibility* cell = BrowserAccessibility* cell =
browserAccessibility_->manager()->GetFromRendererID(id); browserAccessibility_->manager()->GetFromRendererID(id);
if (cell && cell->role() == ui::AX_ROLE_COLUMN_HEADER) if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER)
[ret addObject:cell->ToBrowserAccessibilityCocoa()]; [ret addObject:cell->ToBrowserAccessibilityCocoa()];
} }
return ret; return ret;
...@@ -651,9 +651,9 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -651,9 +651,9 @@ NSDictionary* attributeToMethodNameMap = nil;
- (id)parent { - (id)parent {
// A nil parent means we're the root. // A nil parent means we're the root.
if (browserAccessibility_->parent()) { if (browserAccessibility_->GetParent()) {
return NSAccessibilityUnignoredAncestor( return NSAccessibilityUnignoredAncestor(
browserAccessibility_->parent()->ToBrowserAccessibilityCocoa()); browserAccessibility_->GetParent()->ToBrowserAccessibilityCocoa());
} else { } else {
// Hook back up to RenderWidgetHostViewCocoa. // Hook back up to RenderWidgetHostViewCocoa.
BrowserAccessibilityManagerMac* manager = BrowserAccessibilityManagerMac* manager =
...@@ -678,7 +678,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -678,7 +678,7 @@ NSDictionary* attributeToMethodNameMap = nil;
// Returns an enum indicating the role from browserAccessibility_. // Returns an enum indicating the role from browserAccessibility_.
- (ui::AXRole)internalRole { - (ui::AXRole)internalRole {
return static_cast<ui::AXRole>(browserAccessibility_->role()); return static_cast<ui::AXRole>(browserAccessibility_->GetRole());
} }
// Returns a string indicating the NSAccessibility role of this object. // Returns a string indicating the NSAccessibility role of this object.
...@@ -771,7 +771,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -771,7 +771,7 @@ NSDictionary* attributeToMethodNameMap = nil;
int id = uniqueCellIds[i]; int id = uniqueCellIds[i];
BrowserAccessibility* cell = BrowserAccessibility* cell =
browserAccessibility_->manager()->GetFromRendererID(id); browserAccessibility_->manager()->GetFromRendererID(id);
if (cell && cell->role() == ui::AX_ROLE_ROW_HEADER) if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER)
[ret addObject:cell->ToBrowserAccessibilityCocoa()]; [ret addObject:cell->ToBrowserAccessibilityCocoa()];
} }
return ret; return ret;
...@@ -1115,7 +1115,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1115,7 +1115,7 @@ NSDictionary* attributeToMethodNameMap = nil;
i < browserAccessibility_->PlatformChildCount(); i < browserAccessibility_->PlatformChildCount();
++i) { ++i) {
BrowserAccessibility* child = browserAccessibility_->PlatformGetChild(i); BrowserAccessibility* child = browserAccessibility_->PlatformGetChild(i);
if (child->role() != ui::AX_ROLE_ROW) if (child->GetRole() != ui::AX_ROLE_ROW)
continue; continue;
int rowIndex; int rowIndex;
if (!child->GetIntAttribute( if (!child->GetIntAttribute(
...@@ -1130,7 +1130,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1130,7 +1130,7 @@ NSDictionary* attributeToMethodNameMap = nil;
j < child->PlatformChildCount(); j < child->PlatformChildCount();
++j) { ++j) {
BrowserAccessibility* cell = child->PlatformGetChild(j); BrowserAccessibility* cell = child->PlatformGetChild(j);
if (cell->role() != ui::AX_ROLE_CELL) if (cell->GetRole() != ui::AX_ROLE_CELL)
continue; continue;
int colIndex; int colIndex;
if (!cell->GetIntAttribute( if (!cell->GetIntAttribute(
...@@ -1354,9 +1354,9 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1354,9 +1354,9 @@ NSDictionary* attributeToMethodNameMap = nil;
NSAccessibilityDisclosedRowsAttribute, NSAccessibilityDisclosedRowsAttribute,
nil]]; nil]];
} else if ([role isEqualToString:NSAccessibilityRowRole]) { } else if ([role isEqualToString:NSAccessibilityRowRole]) {
if (browserAccessibility_->parent()) { if (browserAccessibility_->GetParent()) {
base::string16 parentRole; base::string16 parentRole;
browserAccessibility_->parent()->GetHtmlAttribute( browserAccessibility_->GetParent()->GetHtmlAttribute(
"role", &parentRole); "role", &parentRole);
const base::string16 treegridRole(base::ASCIIToUTF16("treegrid")); const base::string16 treegridRole(base::ASCIIToUTF16("treegrid"));
if (parentRole == treegridRole) { if (parentRole == treegridRole) {
...@@ -1457,7 +1457,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1457,7 +1457,7 @@ NSDictionary* attributeToMethodNameMap = nil;
// TODO(feldstein): Support more actions. // TODO(feldstein): Support more actions.
if ([action isEqualToString:NSAccessibilityPressAction]) if ([action isEqualToString:NSAccessibilityPressAction])
[delegate_ doDefaultAction:browserAccessibility_->renderer_id()]; [delegate_ doDefaultAction:browserAccessibility_->GetId()];
else if ([action isEqualToString:NSAccessibilityShowMenuAction]) else if ([action isEqualToString:NSAccessibilityShowMenuAction])
[delegate_ performShowMenuAction:self]; [delegate_ performShowMenuAction:self];
} }
...@@ -1486,12 +1486,12 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1486,12 +1486,12 @@ NSDictionary* attributeToMethodNameMap = nil;
NSNumber* focusedNumber = value; NSNumber* focusedNumber = value;
BOOL focused = [focusedNumber intValue]; BOOL focused = [focusedNumber intValue];
[delegate_ setAccessibilityFocus:focused [delegate_ setAccessibilityFocus:focused
accessibilityId:browserAccessibility_->renderer_id()]; accessibilityId:browserAccessibility_->GetId()];
} }
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
NSRange range = [(NSValue*)value rangeValue]; NSRange range = [(NSValue*)value rangeValue];
[delegate_ [delegate_
accessibilitySetTextSelection:browserAccessibility_->renderer_id() accessibilitySetTextSelection:browserAccessibility_->GetId()
startOffset:range.location startOffset:range.location
endOffset:range.location + range.length]; endOffset:range.location + range.length];
} }
...@@ -1536,7 +1536,7 @@ NSDictionary* attributeToMethodNameMap = nil; ...@@ -1536,7 +1536,7 @@ NSDictionary* attributeToMethodNameMap = nil;
// Potentially called during dealloc. // Potentially called during dealloc.
if (!browserAccessibility_) if (!browserAccessibility_)
return [super hash]; return [super hash];
return browserAccessibility_->renderer_id(); return browserAccessibility_->GetId();
} }
- (BOOL)accessibilityShouldUseUniqueId { - (BOOL)accessibilityShouldUseUniqueId {
......
...@@ -196,8 +196,8 @@ static AtkObject* browser_accessibility_get_parent(AtkObject* atk_object) { ...@@ -196,8 +196,8 @@ static AtkObject* browser_accessibility_get_parent(AtkObject* atk_object) {
BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object);
if (!obj) if (!obj)
return NULL; return NULL;
if (obj->parent()) if (obj->GetParent())
return obj->parent()->ToBrowserAccessibilityGtk()->GetAtkObject(); return obj->GetParent()->ToBrowserAccessibilityGtk()->GetAtkObject();
BrowserAccessibilityManagerGtk* manager = BrowserAccessibilityManagerGtk* manager =
static_cast<BrowserAccessibilityManagerGtk*>(obj->manager()); static_cast<BrowserAccessibilityManagerGtk*>(obj->manager());
...@@ -222,7 +222,7 @@ static AtkObject* browser_accessibility_ref_child( ...@@ -222,7 +222,7 @@ static AtkObject* browser_accessibility_ref_child(
return NULL; return NULL;
AtkObject* result = AtkObject* result =
obj->children()[index]->ToBrowserAccessibilityGtk()->GetAtkObject(); obj->InternalGetChild(index)->ToBrowserAccessibilityGtk()->GetAtkObject();
g_object_ref(result); g_object_ref(result);
return result; return result;
} }
...@@ -231,7 +231,7 @@ static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) { ...@@ -231,7 +231,7 @@ static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) {
BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object);
if (!obj) if (!obj)
return 0; return 0;
return obj->index_in_parent(); return obj->GetIndexInParent();
} }
static AtkAttributeSet* browser_accessibility_get_attributes( static AtkAttributeSet* browser_accessibility_get_attributes(
...@@ -253,7 +253,7 @@ static AtkStateSet* browser_accessibility_ref_state_set(AtkObject* atk_object) { ...@@ -253,7 +253,7 @@ static AtkStateSet* browser_accessibility_ref_state_set(AtkObject* atk_object) {
AtkStateSet* state_set = AtkStateSet* state_set =
ATK_OBJECT_CLASS(browser_accessibility_parent_class)-> ATK_OBJECT_CLASS(browser_accessibility_parent_class)->
ref_state_set(atk_object); ref_state_set(atk_object);
int32 state = obj->state(); int32 state = obj->GetState();
if (state & (1 << ui::AX_STATE_FOCUSABLE)) if (state & (1 << ui::AX_STATE_FOCUSABLE))
atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE); atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
...@@ -363,7 +363,7 @@ static int GetInterfaceMaskFromObject(BrowserAccessibilityGtk* obj) { ...@@ -363,7 +363,7 @@ static int GetInterfaceMaskFromObject(BrowserAccessibilityGtk* obj) {
// Component interface is always supported. // Component interface is always supported.
interface_mask |= 1 << ATK_COMPONENT_INTERFACE; interface_mask |= 1 << ATK_COMPONENT_INTERFACE;
int role = obj->role(); int role = obj->GetRole();
if (role == ui::AX_ROLE_PROGRESS_INDICATOR || if (role == ui::AX_ROLE_PROGRESS_INDICATOR ||
role == ui::AX_ROLE_SCROLL_BAR || role == ui::AX_ROLE_SCROLL_BAR ||
role == ui::AX_ROLE_SLIDER) { role == ui::AX_ROLE_SLIDER) {
...@@ -462,10 +462,10 @@ void BrowserAccessibilityGtk::PreInitialize() { ...@@ -462,10 +462,10 @@ void BrowserAccessibilityGtk::PreInitialize() {
if (!atk_object_) { if (!atk_object_) {
interface_mask_ = GetInterfaceMaskFromObject(this); interface_mask_ = GetInterfaceMaskFromObject(this);
atk_object_ = ATK_OBJECT(browser_accessibility_new(this)); atk_object_ = ATK_OBJECT(browser_accessibility_new(this));
if (this->parent()) { if (this->GetParent()) {
atk_object_set_parent( atk_object_set_parent(
atk_object_, atk_object_,
this->parent()->ToBrowserAccessibilityGtk()->GetAtkObject()); this->GetParent()->ToBrowserAccessibilityGtk()->GetAtkObject());
} }
} }
} }
...@@ -475,7 +475,7 @@ bool BrowserAccessibilityGtk::IsNative() const { ...@@ -475,7 +475,7 @@ bool BrowserAccessibilityGtk::IsNative() const {
} }
void BrowserAccessibilityGtk::InitRoleAndState() { void BrowserAccessibilityGtk::InitRoleAndState() {
switch(role()) { switch(GetRole()) {
case ui::AX_ROLE_DOCUMENT: case ui::AX_ROLE_DOCUMENT:
case ui::AX_ROLE_ROOT_WEB_AREA: case ui::AX_ROLE_ROOT_WEB_AREA:
case ui::AX_ROLE_WEB_AREA: case ui::AX_ROLE_WEB_AREA:
......
...@@ -116,7 +116,7 @@ bool BrowserAccessibilityManager::UseRootScrollOffsetsWhenComputingBounds() { ...@@ -116,7 +116,7 @@ bool BrowserAccessibilityManager::UseRootScrollOffsetsWhenComputingBounds() {
void BrowserAccessibilityManager::RemoveNode(BrowserAccessibility* node) { void BrowserAccessibilityManager::RemoveNode(BrowserAccessibility* node) {
if (node == focus_) if (node == focus_)
SetFocus(root_, false); SetFocus(root_, false);
int renderer_id = node->renderer_id(); int renderer_id = node->GetId();
renderer_id_map_.erase(renderer_id); renderer_id_map_.erase(renderer_id);
} }
...@@ -198,7 +198,7 @@ void BrowserAccessibilityManager::SetFocus( ...@@ -198,7 +198,7 @@ void BrowserAccessibilityManager::SetFocus(
focus_ = node; focus_ = node;
if (notify && node && delegate_) if (notify && node && delegate_)
delegate_->SetAccessibilityFocus(node->renderer_id()); delegate_->SetAccessibilityFocus(node->GetId());
} }
void BrowserAccessibilityManager::SetRoot(BrowserAccessibility* node) { void BrowserAccessibilityManager::SetRoot(BrowserAccessibility* node) {
...@@ -209,20 +209,20 @@ void BrowserAccessibilityManager::SetRoot(BrowserAccessibility* node) { ...@@ -209,20 +209,20 @@ void BrowserAccessibilityManager::SetRoot(BrowserAccessibility* node) {
void BrowserAccessibilityManager::DoDefaultAction( void BrowserAccessibilityManager::DoDefaultAction(
const BrowserAccessibility& node) { const BrowserAccessibility& node) {
if (delegate_) if (delegate_)
delegate_->AccessibilityDoDefaultAction(node.renderer_id()); delegate_->AccessibilityDoDefaultAction(node.GetId());
} }
void BrowserAccessibilityManager::ScrollToMakeVisible( void BrowserAccessibilityManager::ScrollToMakeVisible(
const BrowserAccessibility& node, gfx::Rect subfocus) { const BrowserAccessibility& node, gfx::Rect subfocus) {
if (delegate_) { if (delegate_) {
delegate_->AccessibilityScrollToMakeVisible(node.renderer_id(), subfocus); delegate_->AccessibilityScrollToMakeVisible(node.GetId(), subfocus);
} }
} }
void BrowserAccessibilityManager::ScrollToPoint( void BrowserAccessibilityManager::ScrollToPoint(
const BrowserAccessibility& node, gfx::Point point) { const BrowserAccessibility& node, gfx::Point point) {
if (delegate_) { if (delegate_) {
delegate_->AccessibilityScrollToPoint(node.renderer_id(), point); delegate_->AccessibilityScrollToPoint(node.GetId(), point);
} }
} }
...@@ -230,7 +230,7 @@ void BrowserAccessibilityManager::SetTextSelection( ...@@ -230,7 +230,7 @@ void BrowserAccessibilityManager::SetTextSelection(
const BrowserAccessibility& node, int start_offset, int end_offset) { const BrowserAccessibility& node, int start_offset, int end_offset) {
if (delegate_) { if (delegate_) {
delegate_->AccessibilitySetTextSelection( delegate_->AccessibilitySetTextSelection(
node.renderer_id(), start_offset, end_offset); node.GetId(), start_offset, end_offset);
} }
} }
...@@ -248,12 +248,12 @@ BrowserAccessibility* BrowserAccessibilityManager::NextInTreeOrder( ...@@ -248,12 +248,12 @@ BrowserAccessibility* BrowserAccessibilityManager::NextInTreeOrder(
if (node->PlatformChildCount() > 0) if (node->PlatformChildCount() > 0)
return node->PlatformGetChild(0); return node->PlatformGetChild(0);
while (node) { while (node) {
if (node->parent() && if (node->GetParent() &&
node->index_in_parent() < node->GetIndexInParent() <
static_cast<int>(node->parent()->PlatformChildCount()) - 1) { static_cast<int>(node->GetParent()->PlatformChildCount()) - 1) {
return node->parent()->PlatformGetChild(node->index_in_parent() + 1); return node->GetParent()->PlatformGetChild(node->GetIndexInParent() + 1);
} }
node = node->parent(); node = node->GetParent();
} }
return NULL; return NULL;
...@@ -264,14 +264,14 @@ BrowserAccessibility* BrowserAccessibilityManager::PreviousInTreeOrder( ...@@ -264,14 +264,14 @@ BrowserAccessibility* BrowserAccessibilityManager::PreviousInTreeOrder(
if (!node) if (!node)
return NULL; return NULL;
if (node->parent() && node->index_in_parent() > 0) { if (node->GetParent() && node->GetIndexInParent() > 0) {
node = node->parent()->PlatformGetChild(node->index_in_parent() - 1); node = node->GetParent()->PlatformGetChild(node->GetIndexInParent() - 1);
while (node->PlatformChildCount() > 0) while (node->PlatformChildCount() > 0)
node = node->PlatformGetChild(node->PlatformChildCount() - 1); node = node->PlatformGetChild(node->PlatformChildCount() - 1);
return node; return node;
} }
return node->parent(); return node->GetParent();
} }
void BrowserAccessibilityManager::UpdateNodesForTesting( void BrowserAccessibilityManager::UpdateNodesForTesting(
...@@ -363,7 +363,7 @@ BrowserAccessibility* BrowserAccessibilityManager::CreateNode( ...@@ -363,7 +363,7 @@ BrowserAccessibility* BrowserAccessibilityManager::CreateNode(
} }
void BrowserAccessibilityManager::AddNodeToMap(BrowserAccessibility* node) { void BrowserAccessibilityManager::AddNodeToMap(BrowserAccessibility* node) {
renderer_id_map_[node->renderer_id()] = node; renderer_id_map_[node->GetId()] = node;
} }
bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) { bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) {
...@@ -408,9 +408,10 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) { ...@@ -408,9 +408,10 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) {
// parent and new parent, which could lead to a double-free. // parent and new parent, which could lead to a double-free.
// If a node is reparented, the renderer will always send us a fresh // If a node is reparented, the renderer will always send us a fresh
// copy of the node. // copy of the node.
const std::vector<BrowserAccessibility*>& old_children = instance->children(); const std::vector<BrowserAccessibility*>& old_children =
instance->deprecated_children();
for (size_t i = 0; i < old_children.size(); ++i) { for (size_t i = 0; i < old_children.size(); ++i) {
int old_id = old_children[i]->renderer_id(); int old_id = old_children[i]->GetId();
if (new_child_ids.find(old_id) == new_child_ids.end()) if (new_child_ids.find(old_id) == new_child_ids.end())
old_children[i]->Destroy(); old_children[i]->Destroy();
} }
...@@ -424,7 +425,7 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) { ...@@ -424,7 +425,7 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) {
int32 index_in_parent = static_cast<int32>(i); int32 index_in_parent = static_cast<int32>(i);
BrowserAccessibility* child = GetFromRendererID(child_renderer_id); BrowserAccessibility* child = GetFromRendererID(child_renderer_id);
if (child) { if (child) {
if (child->parent() != instance) { if (child->GetParent() != instance) {
// This is a serious error - nodes should never be reparented. // This is a serious error - nodes should never be reparented.
// If this case occurs, continue so this node isn't left in an // If this case occurs, continue so this node isn't left in an
// inconsistent state, but return failure at the end. // inconsistent state, but return failure at the end.
...@@ -443,7 +444,7 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) { ...@@ -443,7 +444,7 @@ bool BrowserAccessibilityManager::UpdateNode(const ui::AXNodeData& src) {
// Handle the case where this node is the new root of the tree. // Handle the case where this node is the new root of the tree.
if (src.role == ui::AX_ROLE_ROOT_WEB_AREA && if (src.role == ui::AX_ROLE_ROOT_WEB_AREA &&
(!root_ || root_->renderer_id() != src.id)) { (!root_ || root_->GetId() != src.id)) {
if (root_) if (root_)
root_->Destroy(); root_->Destroy();
if (focus_ == root_) if (focus_ == root_)
......
...@@ -128,28 +128,28 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent( ...@@ -128,28 +128,28 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
// the Android system that the accessibility hierarchy rooted at this // the Android system that the accessibility hierarchy rooted at this
// node has changed. // node has changed.
Java_BrowserAccessibilityManager_handleContentChanged( Java_BrowserAccessibilityManager_handleContentChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
switch (event_type) { switch (event_type) {
case ui::AX_EVENT_LOAD_COMPLETE: case ui::AX_EVENT_LOAD_COMPLETE:
Java_BrowserAccessibilityManager_handlePageLoaded( Java_BrowserAccessibilityManager_handlePageLoaded(
env, obj.obj(), focus_->renderer_id()); env, obj.obj(), focus_->GetId());
break; break;
case ui::AX_EVENT_FOCUS: case ui::AX_EVENT_FOCUS:
Java_BrowserAccessibilityManager_handleFocusChanged( Java_BrowserAccessibilityManager_handleFocusChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
break; break;
case ui::AX_EVENT_CHECKED_STATE_CHANGED: case ui::AX_EVENT_CHECKED_STATE_CHANGED:
Java_BrowserAccessibilityManager_handleCheckStateChanged( Java_BrowserAccessibilityManager_handleCheckStateChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
break; break;
case ui::AX_EVENT_SCROLL_POSITION_CHANGED: case ui::AX_EVENT_SCROLL_POSITION_CHANGED:
Java_BrowserAccessibilityManager_handleScrollPositionChanged( Java_BrowserAccessibilityManager_handleScrollPositionChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
break; break;
case ui::AX_EVENT_SCROLLED_TO_ANCHOR: case ui::AX_EVENT_SCROLLED_TO_ANCHOR:
Java_BrowserAccessibilityManager_handleScrolledToAnchor( Java_BrowserAccessibilityManager_handleScrolledToAnchor(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
break; break;
case ui::AX_EVENT_ALERT: case ui::AX_EVENT_ALERT:
// An alert is a special case of live region. Fall through to the // An alert is a special case of live region. Fall through to the
...@@ -167,14 +167,14 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent( ...@@ -167,14 +167,14 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
} }
case ui::AX_EVENT_SELECTED_TEXT_CHANGED: case ui::AX_EVENT_SELECTED_TEXT_CHANGED:
Java_BrowserAccessibilityManager_handleTextSelectionChanged( Java_BrowserAccessibilityManager_handleTextSelectionChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
break; break;
case ui::AX_EVENT_CHILDREN_CHANGED: case ui::AX_EVENT_CHILDREN_CHANGED:
case ui::AX_EVENT_TEXT_CHANGED: case ui::AX_EVENT_TEXT_CHANGED:
case ui::AX_EVENT_VALUE_CHANGED: case ui::AX_EVENT_VALUE_CHANGED:
if (node->IsEditableText()) { if (node->IsEditableText()) {
Java_BrowserAccessibilityManager_handleEditableTextChanged( Java_BrowserAccessibilityManager_handleEditableTextChanged(
env, obj.obj(), node->renderer_id()); env, obj.obj(), node->GetId());
} }
break; break;
default: default:
...@@ -185,7 +185,7 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent( ...@@ -185,7 +185,7 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
} }
jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) { jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) {
return static_cast<jint>(root_->renderer_id()); return static_cast<jint>(root_->GetId());
} }
jboolean BrowserAccessibilityManagerAndroid::IsNodeValid( jboolean BrowserAccessibilityManagerAndroid::IsNodeValid(
...@@ -200,18 +200,18 @@ jint BrowserAccessibilityManagerAndroid::HitTest( ...@@ -200,18 +200,18 @@ jint BrowserAccessibilityManagerAndroid::HitTest(
root_->BrowserAccessibilityForPoint(gfx::Point(x, y))); root_->BrowserAccessibilityForPoint(gfx::Point(x, y)));
if (!result) if (!result)
return root_->renderer_id(); return root_->GetId();
if (result->IsFocusable()) if (result->IsFocusable())
return result->renderer_id(); return result->GetId();
// Examine the children of |result| to find the nearest accessibility focus // Examine the children of |result| to find the nearest accessibility focus
// candidate // candidate
BrowserAccessibility* nearest_node = FuzzyHitTest(x, y, result); BrowserAccessibility* nearest_node = FuzzyHitTest(x, y, result);
if (nearest_node) if (nearest_node)
return nearest_node->renderer_id(); return nearest_node->GetId();
return root_->renderer_id(); return root_->GetId();
} }
jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo(
...@@ -221,13 +221,13 @@ jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( ...@@ -221,13 +221,13 @@ jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo(
if (!node) if (!node)
return false; return false;
if (node->parent()) { if (node->GetParent()) {
Java_BrowserAccessibilityManager_setAccessibilityNodeInfoParent( Java_BrowserAccessibilityManager_setAccessibilityNodeInfoParent(
env, obj, info, node->parent()->renderer_id()); env, obj, info, node->GetParent()->GetId());
} }
for (unsigned i = 0; i < node->PlatformChildCount(); ++i) { for (unsigned i = 0; i < node->PlatformChildCount(); ++i) {
Java_BrowserAccessibilityManager_addAccessibilityNodeInfoChild( Java_BrowserAccessibilityManager_addAccessibilityNodeInfoChild(
env, obj, info, node->children()[i]->renderer_id()); env, obj, info, node->InternalGetChild(i)->GetId());
} }
Java_BrowserAccessibilityManager_setAccessibilityNodeInfoBooleanAttributes( Java_BrowserAccessibilityManager_setAccessibilityNodeInfoBooleanAttributes(
env, obj, info, env, obj, info,
...@@ -252,11 +252,11 @@ jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( ...@@ -252,11 +252,11 @@ jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo(
gfx::Rect absolute_rect = node->GetLocalBoundsRect(); gfx::Rect absolute_rect = node->GetLocalBoundsRect();
gfx::Rect parent_relative_rect = absolute_rect; gfx::Rect parent_relative_rect = absolute_rect;
if (node->parent()) { if (node->GetParent()) {
gfx::Rect parent_rect = node->parent()->GetLocalBoundsRect(); gfx::Rect parent_rect = node->GetParent()->GetLocalBoundsRect();
parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin());
} }
bool is_root = node->parent() == NULL; bool is_root = node->GetParent() == NULL;
Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation(
env, obj, info, env, obj, info,
absolute_rect.x(), absolute_rect.y(), absolute_rect.x(), absolute_rect.y(),
...@@ -410,7 +410,7 @@ void BrowserAccessibilityManagerAndroid::ScrollToMakeNodeVisible( ...@@ -410,7 +410,7 @@ void BrowserAccessibilityManagerAndroid::ScrollToMakeNodeVisible(
JNIEnv* env, jobject obj, jint id) { JNIEnv* env, jobject obj, jint id) {
BrowserAccessibility* node = GetFromRendererID(id); BrowserAccessibility* node = GetFromRendererID(id);
if (node) if (node)
ScrollToMakeVisible(*node, gfx::Rect(node->location().size())); ScrollToMakeVisible(*node, gfx::Rect(node->GetLocation().size()));
} }
BrowserAccessibility* BrowserAccessibilityManagerAndroid::FuzzyHitTest( BrowserAccessibility* BrowserAccessibilityManagerAndroid::FuzzyHitTest(
...@@ -478,30 +478,30 @@ jint BrowserAccessibilityManagerAndroid::FindElementType( ...@@ -478,30 +478,30 @@ jint BrowserAccessibilityManagerAndroid::FindElementType(
while (node) { while (node) {
switch(element_type) { switch(element_type) {
case HTML_ELEMENT_TYPE_SECTION: case HTML_ELEMENT_TYPE_SECTION:
if (node->role() == ui::AX_ROLE_ARTICLE || if (node->GetRole() == ui::AX_ROLE_ARTICLE ||
node->role() == ui::AX_ROLE_APPLICATION || node->GetRole() == ui::AX_ROLE_APPLICATION ||
node->role() == ui::AX_ROLE_BANNER || node->GetRole() == ui::AX_ROLE_BANNER ||
node->role() == ui::AX_ROLE_COMPLEMENTARY || node->GetRole() == ui::AX_ROLE_COMPLEMENTARY ||
node->role() == ui::AX_ROLE_CONTENT_INFO || node->GetRole() == ui::AX_ROLE_CONTENT_INFO ||
node->role() == ui::AX_ROLE_HEADING || node->GetRole() == ui::AX_ROLE_HEADING ||
node->role() == ui::AX_ROLE_MAIN || node->GetRole() == ui::AX_ROLE_MAIN ||
node->role() == ui::AX_ROLE_NAVIGATION || node->GetRole() == ui::AX_ROLE_NAVIGATION ||
node->role() == ui::AX_ROLE_SEARCH || node->GetRole() == ui::AX_ROLE_SEARCH ||
node->role() == ui::AX_ROLE_REGION) { node->GetRole() == ui::AX_ROLE_REGION) {
return node->renderer_id(); return node->GetId();
} }
break; break;
case HTML_ELEMENT_TYPE_LIST: case HTML_ELEMENT_TYPE_LIST:
if (node->role() == ui::AX_ROLE_LIST || if (node->GetRole() == ui::AX_ROLE_LIST ||
node->role() == ui::AX_ROLE_GRID || node->GetRole() == ui::AX_ROLE_GRID ||
node->role() == ui::AX_ROLE_TABLE || node->GetRole() == ui::AX_ROLE_TABLE ||
node->role() == ui::AX_ROLE_TREE) { node->GetRole() == ui::AX_ROLE_TREE) {
return node->renderer_id(); return node->GetId();
} }
break; break;
case HTML_ELEMENT_TYPE_CONTROL: case HTML_ELEMENT_TYPE_CONTROL:
if (static_cast<BrowserAccessibilityAndroid*>(node)->IsFocusable()) if (static_cast<BrowserAccessibilityAndroid*>(node)->IsFocusable())
return node->renderer_id(); return node->GetId();
break; break;
case HTML_ELEMENT_TYPE_ANY: case HTML_ELEMENT_TYPE_ANY:
// In theory, the API says that an accessibility service could // In theory, the API says that an accessibility service could
...@@ -511,7 +511,7 @@ jint BrowserAccessibilityManagerAndroid::FindElementType( ...@@ -511,7 +511,7 @@ jint BrowserAccessibilityManagerAndroid::FindElementType(
// just fall back on linear navigation when we don't recognize the // just fall back on linear navigation when we don't recognize the
// element type. // element type.
if (static_cast<BrowserAccessibilityAndroid*>(node)->IsClickable()) if (static_cast<BrowserAccessibilityAndroid*>(node)->IsClickable())
return node->renderer_id(); return node->GetId();
break; break;
} }
......
...@@ -68,9 +68,9 @@ void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( ...@@ -68,9 +68,9 @@ void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent(
void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged(
BrowserAccessibilityGtk* node) { BrowserAccessibilityGtk* node) {
AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject();
for (unsigned int i = 0; i < node->children().size(); ++i) { for (unsigned int i = 0; i < node->InternalChildCount(); ++i) {
BrowserAccessibilityGtk* child = BrowserAccessibilityGtk* child =
node->children()[i]->ToBrowserAccessibilityGtk(); node->InternalGetChild(i)->ToBrowserAccessibilityGtk();
g_signal_emit_by_name(atkObject, g_signal_emit_by_name(atkObject,
"children-changed::add", "children-changed::add",
i, i,
......
...@@ -47,7 +47,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( ...@@ -47,7 +47,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
NSString* event_id = @""; NSString* event_id = @"";
switch (event_type) { switch (event_type) {
case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED:
if (node->role() == ui::AX_ROLE_TREE) if (node->GetRole() == ui::AX_ROLE_TREE)
event_id = NSAccessibilitySelectedRowsChangedNotification; event_id = NSAccessibilitySelectedRowsChangedNotification;
else else
event_id = NSAccessibilityFocusedUIElementChangedNotification; event_id = NSAccessibilityFocusedUIElementChangedNotification;
......
...@@ -258,9 +258,9 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) { ...@@ -258,9 +258,9 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) {
child3_accessible->NativeAddReference(); child3_accessible->NativeAddReference();
// Check the index in parent. // Check the index in parent.
EXPECT_EQ(0, child1_accessible->index_in_parent()); EXPECT_EQ(0, child1_accessible->GetIndexInParent());
EXPECT_EQ(1, child2_accessible->index_in_parent()); EXPECT_EQ(1, child2_accessible->GetIndexInParent());
EXPECT_EQ(2, child3_accessible->index_in_parent()); EXPECT_EQ(2, child3_accessible->GetIndexInParent());
// Process a notification containing the changed subtree. // Process a notification containing the changed subtree.
std::vector<AccessibilityHostMsg_EventParams> params; std::vector<AccessibilityHostMsg_EventParams> params;
...@@ -284,8 +284,8 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) { ...@@ -284,8 +284,8 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) {
EXPECT_FALSE(child3_accessible->instance_active()); EXPECT_FALSE(child3_accessible->instance_active());
// Check that the index in parent has been updated. // Check that the index in parent has been updated.
EXPECT_EQ(1, child1_accessible->index_in_parent()); EXPECT_EQ(1, child1_accessible->GetIndexInParent());
EXPECT_EQ(2, child2_accessible->index_in_parent()); EXPECT_EQ(2, child2_accessible->GetIndexInParent());
// Release our references. The object count should only decrease by 1 // Release our references. The object count should only decrease by 1
// for child3. // for child3.
...@@ -435,8 +435,8 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) { ...@@ -435,8 +435,8 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) {
child3_accessible->NativeAddReference(); child3_accessible->NativeAddReference();
// Check the index in parent. // Check the index in parent.
EXPECT_EQ(1, child2_accessible->index_in_parent()); EXPECT_EQ(1, child2_accessible->GetIndexInParent());
EXPECT_EQ(2, child3_accessible->index_in_parent()); EXPECT_EQ(2, child3_accessible->GetIndexInParent());
// Process a notification containing the changed subtree rooted at // Process a notification containing the changed subtree rooted at
// the container. // the container.
...@@ -462,11 +462,11 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) { ...@@ -462,11 +462,11 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) {
EXPECT_FALSE(child3_accessible->instance_active()); EXPECT_FALSE(child3_accessible->instance_active());
// Ensure that we retain the parent of the detached subtree. // Ensure that we retain the parent of the detached subtree.
EXPECT_EQ(root_accessible, container_accessible->parent()); EXPECT_EQ(root_accessible, container_accessible->GetParent());
EXPECT_EQ(0, container_accessible->index_in_parent()); EXPECT_EQ(0, container_accessible->GetIndexInParent());
// Check that the index in parent has been updated. // Check that the index in parent has been updated.
EXPECT_EQ(2, child2_accessible->index_in_parent()); EXPECT_EQ(2, child2_accessible->GetIndexInParent());
// Release our references. The object count should only decrease by 1 // Release our references. The object count should only decrease by 1
// for child3. // for child3.
......
...@@ -84,7 +84,7 @@ void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, ...@@ -84,7 +84,7 @@ void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event,
void BrowserAccessibilityManagerWin::AddNodeToMap(BrowserAccessibility* node) { void BrowserAccessibilityManagerWin::AddNodeToMap(BrowserAccessibility* node) {
BrowserAccessibilityManager::AddNodeToMap(node); BrowserAccessibilityManager::AddNodeToMap(node);
LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win(); LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win();
unique_id_to_renderer_id_map_[unique_id_win] = node->renderer_id(); unique_id_to_renderer_id_map_[unique_id_win] = node->GetId();
} }
void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) { void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) {
...@@ -114,7 +114,7 @@ void BrowserAccessibilityManagerWin::OnWindowBlurred() { ...@@ -114,7 +114,7 @@ void BrowserAccessibilityManagerWin::OnWindowBlurred() {
void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
ui::AXEvent event_type, ui::AXEvent event_type,
BrowserAccessibility* node) { BrowserAccessibility* node) {
if (node->role() == ui::AX_ROLE_INLINE_TEXT_BOX) if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX)
return; return;
LONG event_id = EVENT_MIN; LONG event_id = EVENT_MIN;
......
...@@ -772,10 +772,6 @@ BrowserAccessibilityWin ...@@ -772,10 +772,6 @@ BrowserAccessibilityWin
return ia2_attributes_; return ia2_attributes_;
} }
// BrowserAccessibility::role is shadowed by IAccessible2::role, so
// we provide an alias for it.
int32 blink_role() const { return BrowserAccessibility::role(); }
private: private:
// Add one to the reference count and return the same object. Always // Add one to the reference count and return the same object. Always
// use this method when returning a BrowserAccessibilityWin object as // use this method when returning a BrowserAccessibilityWin object as
......
...@@ -618,9 +618,9 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { ...@@ -618,9 +618,9 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) {
// Verify the root is as we expect by default. // Verify the root is as we expect by default.
BrowserAccessibility* root = manager->GetRoot(); BrowserAccessibility* root = manager->GetRoot();
EXPECT_EQ(0, root->renderer_id()); EXPECT_EQ(0, root->GetId());
EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->role()); EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole());
EXPECT_EQ(busy_state | readonly_state | enabled_state, root->state()); EXPECT_EQ(busy_state | readonly_state | enabled_state, root->GetState());
// Tree with a child textfield. // Tree with a child textfield.
ui::AXNodeData tree1_1; ui::AXNodeData tree1_1;
...@@ -649,8 +649,8 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { ...@@ -649,8 +649,8 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) {
EXPECT_NE(root, manager->GetRoot()); EXPECT_NE(root, manager->GetRoot());
// And the proper child remains. // And the proper child remains.
EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, acc1_2->role()); EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, acc1_2->GetRole());
EXPECT_EQ(2, acc1_2->renderer_id()); EXPECT_EQ(2, acc1_2->GetId());
// Tree with a child button. // Tree with a child button.
ui::AXNodeData tree2_1; ui::AXNodeData tree2_1;
...@@ -676,8 +676,8 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { ...@@ -676,8 +676,8 @@ TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) {
EXPECT_NE(root, manager->GetRoot()); EXPECT_NE(root, manager->GetRoot());
// And the new child exists. // And the new child exists.
EXPECT_EQ(ui::AX_ROLE_BUTTON, acc2_2->role()); EXPECT_EQ(ui::AX_ROLE_BUTTON, acc2_2->GetRole());
EXPECT_EQ(3, acc2_2->renderer_id()); EXPECT_EQ(3, acc2_2->GetId());
// Ensure we properly cleaned up. // Ensure we properly cleaned up.
manager.reset(); manager.reset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment