Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 | 711 |
| 712 bool AXObject::supportsRangeValue() const | 712 bool AXObject::supportsRangeValue() const |
| 713 { | 713 { |
| 714 return isProgressIndicator() | 714 return isProgressIndicator() |
| 715 || isMeter() | 715 || isMeter() |
| 716 || isSlider() | 716 || isSlider() |
| 717 || isScrollbar() | 717 || isScrollbar() |
| 718 || isSpinButton(); | 718 || isSpinButton(); |
| 719 } | 719 } |
| 720 | 720 |
| 721 bool AXObject::supportsSetSizeAndPosInSet() const | |
| 722 { | |
| 723 AXObject* parent = parentObject(); | |
| 724 if (!parent) | |
| 725 return false; | |
| 726 | |
| 727 int role = roleValue(); | |
| 728 int parentRole = parent->roleValue(); | |
| 729 | |
| 730 if ((role == ListBoxOptionRole && parentRole == ListBoxRole) | |
| 731 || (role == ListItemRole && parentRole == ListRole) | |
| 732 || (role == MenuItemRole && parentRole == MenuRole) | |
| 733 || (role == RadioButtonRole && parentRole == RadioGroupRole) | |
| 734 || (role == TabRole && parentRole == TabListRole) | |
| 735 || (role == TreeItemRole && parentRole == TreeRole)) | |
| 736 return true; | |
| 737 | |
| 738 return false; | |
| 739 } | |
| 740 | |
| 741 int AXObject::indexInParent() const | |
| 742 { | |
| 743 | |
| 744 const auto& siblings = parentObject()->children(); | |
|
dmazzoni
2015/04/16 17:19:48
You need to handle the case where parentObject() i
| |
| 745 int childCount = siblings.size(); | |
| 746 | |
| 747 for (int index = 0; index < childCount; ++index) { | |
| 748 if (siblings[index].get() == this) { | |
| 749 return index + 1; | |
|
dmazzoni
2015/04/16 17:19:48
It's very unusual to have 1-based indexes in code.
| |
| 750 } | |
| 751 } | |
| 752 return 0; | |
| 753 } | |
| 754 | |
| 721 void AXObject::ariaTreeRows(AccessibilityChildrenVector& result) | 755 void AXObject::ariaTreeRows(AccessibilityChildrenVector& result) |
| 722 { | 756 { |
| 723 for (const auto& child : children()) { | 757 for (const auto& child : children()) { |
| 724 // Add tree items as the rows. | 758 // Add tree items as the rows. |
| 725 if (child->roleValue() == TreeItemRole) | 759 if (child->roleValue() == TreeItemRole) |
| 726 result.append(child); | 760 result.append(child); |
| 727 | 761 |
| 728 // Now see if this item also has rows hiding inside of it. | 762 // Now see if this item also has rows hiding inside of it. |
| 729 child->ariaTreeRows(result); | 763 child->ariaTreeRows(result); |
| 730 } | 764 } |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1299 } | 1333 } |
| 1300 | 1334 |
| 1301 const AtomicString& AXObject::internalRoleName(AccessibilityRole role) | 1335 const AtomicString& AXObject::internalRoleName(AccessibilityRole role) |
| 1302 { | 1336 { |
| 1303 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector(); | 1337 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector(); |
| 1304 | 1338 |
| 1305 return internalRoleNameVector->at(role); | 1339 return internalRoleNameVector->at(role); |
| 1306 } | 1340 } |
| 1307 | 1341 |
| 1308 } // namespace blink | 1342 } // namespace blink |
| OLD | NEW |