Chromium Code Reviews| Index: Source/modules/accessibility/AXObject.cpp |
| diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp |
| index e05a796356d47388e2b9ba1dfd4e4a83316fcee2..467ef3816cf13f14f27a45843baf5ab967c40156 100644 |
| --- a/Source/modules/accessibility/AXObject.cpp |
| +++ b/Source/modules/accessibility/AXObject.cpp |
| @@ -718,6 +718,40 @@ bool AXObject::supportsRangeValue() const |
| || isSpinButton(); |
| } |
| +bool AXObject::supportsSetSizeAndPosInSet() const |
| +{ |
| + AXObject* parent = parentObject(); |
| + if (!parent) |
| + return false; |
| + |
| + int role = roleValue(); |
| + int parentRole = parent->roleValue(); |
| + |
| + if ((role == ListBoxOptionRole && parentRole == ListBoxRole) |
| + || (role == ListItemRole && parentRole == ListRole) |
| + || (role == MenuItemRole && parentRole == MenuRole) |
| + || (role == RadioButtonRole && parentRole == RadioGroupRole) |
| + || (role == TabRole && parentRole == TabListRole) |
| + || (role == TreeItemRole && parentRole == TreeRole)) |
| + return true; |
| + |
| + return false; |
| +} |
| + |
| +int AXObject::indexInParent() const |
| +{ |
| + |
| + const auto& siblings = parentObject()->children(); |
|
dmazzoni
2015/04/16 17:19:48
You need to handle the case where parentObject() i
|
| + int childCount = siblings.size(); |
| + |
| + for (int index = 0; index < childCount; ++index) { |
| + if (siblings[index].get() == this) { |
| + return index + 1; |
|
dmazzoni
2015/04/16 17:19:48
It's very unusual to have 1-based indexes in code.
|
| + } |
| + } |
| + return 0; |
| +} |
| + |
| void AXObject::ariaTreeRows(AccessibilityChildrenVector& result) |
| { |
| for (const auto& child : children()) { |