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 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef AXObject_h | 30 #ifndef AXObject_h |
| 31 #define AXObject_h | 31 #define AXObject_h |
| 32 | 32 |
| 33 #include "core/InspectorTypeBuilder.h" | |
| 33 #include "core/editing/VisiblePosition.h" | 34 #include "core/editing/VisiblePosition.h" |
| 34 #include "modules/ModulesExport.h" | 35 #include "modules/ModulesExport.h" |
| 35 #include "platform/geometry/FloatQuad.h" | 36 #include "platform/geometry/FloatQuad.h" |
| 36 #include "platform/geometry/LayoutRect.h" | 37 #include "platform/geometry/LayoutRect.h" |
| 37 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 virtual bool isVisible() const { return true; } | 437 virtual bool isVisible() const { return true; } |
| 437 virtual bool isVisited() const { return false; } | 438 virtual bool isVisited() const { return false; } |
| 438 | 439 |
| 439 // Check whether certain properties can be modified. | 440 // Check whether certain properties can be modified. |
| 440 virtual bool canSetFocusAttribute() const { return false; } | 441 virtual bool canSetFocusAttribute() const { return false; } |
| 441 virtual bool canSetValueAttribute() const { return false; } | 442 virtual bool canSetValueAttribute() const { return false; } |
| 442 virtual bool canSetSelectedAttribute() const { return false; } | 443 virtual bool canSetSelectedAttribute() const { return false; } |
| 443 | 444 |
| 444 // Whether objects are ignored, i.e. not included in the tree. | 445 // Whether objects are ignored, i.e. not included in the tree. |
| 445 bool accessibilityIsIgnored() const; | 446 bool accessibilityIsIgnored() const; |
| 446 bool accessibilityIsIgnoredByDefault() const; | 447 virtual bool computeAccessibilityIsIgnored(PassRefPtr<TypeBuilder::Array<Typ eBuilder::Accessibility::AXProperty>> = PassRefPtr<TypeBuilder::Array<TypeBuilde r::Accessibility::AXProperty>>()) const { return true; } |
|
dmazzoni
2015/04/15 17:00:02
How about a typedef for PassRefPtr<TypeBuilder::Ar
aboxhall
2015/04/15 17:55:46
Done.
| |
| 448 bool accessibilityIsIgnoredByDefault(PassRefPtr<TypeBuilder::Array<TypeBuild er::Accessibility::AXProperty>> = PassRefPtr<TypeBuilder::Array<TypeBuilder::Acc essibility::AXProperty>>()) const; | |
|
dmazzoni
2015/04/15 17:00:02
accessibilityIsIgnoredByDefault hardly does anythi
aboxhall
2015/04/15 17:55:46
Ok, working on that now.
| |
| 447 AXObjectInclusion accessibilityPlatformIncludesObject() const; | 449 AXObjectInclusion accessibilityPlatformIncludesObject() const; |
| 448 virtual AXObjectInclusion defaultObjectInclusion() const; | 450 virtual AXObjectInclusion defaultObjectInclusion(PassRefPtr<TypeBuilder::Arr ay<TypeBuilder::Accessibility::AXProperty>> = PassRefPtr<TypeBuilder::Array<Type Builder::Accessibility::AXProperty>>()) const; |
| 449 bool isInertOrAriaHidden() const; | 451 bool isInertOrAriaHidden() const; |
| 450 const AXObject* ariaHiddenRoot() const; | 452 const AXObject* ariaHiddenRoot() const; |
| 451 bool computeIsInertOrAriaHidden() const; | 453 bool computeIsInertOrAriaHidden(PassRefPtr<TypeBuilder::Array<TypeBuilder::A ccessibility::AXProperty>> = PassRefPtr<TypeBuilder::Array<TypeBuilder::Accessib ility::AXProperty>>()) const; |
| 452 bool isDescendantOfBarrenParent() const; | 454 bool isDescendantOfLeafNode() const; |
|
dmazzoni
2015/04/15 17:00:02
This sounds great, but let's split the renames int
aboxhall
2015/04/15 17:55:46
I can do that, but note that it's a type change fo
| |
| 453 bool computeIsDescendantOfBarrenParent() const; | 455 AXObject* leafNodeAncestor() const; |
| 454 bool isDescendantOfDisabledNode() const; | 456 bool isDescendantOfDisabledNode() const; |
| 455 bool computeIsDescendantOfDisabledNode() const; | 457 const AXObject* disabledAncestor() const; |
| 456 bool lastKnownIsIgnoredValue(); | 458 bool lastKnownIsIgnoredValue(); |
| 457 void setLastKnownIsIgnoredValue(bool); | 459 void setLastKnownIsIgnoredValue(bool); |
| 458 | 460 |
| 459 // | 461 // |
| 460 // Deprecated text alternative calculation API. All of these will be replace d | 462 // Deprecated text alternative calculation API. All of these will be replace d |
| 461 // with the new API, below (under "New text alternative calculation API". | 463 // with the new API, below (under "New text alternative calculation API". |
| 462 // | 464 // |
| 463 | 465 |
| 464 virtual bool deprecatedExposesTitleUIElement() const { return true; } | 466 virtual bool deprecatedExposesTitleUIElement() const { return true; } |
| 465 virtual AXObject* deprecatedTitleUIElement() const { return 0; } | 467 virtual AXObject* deprecatedTitleUIElement() const { return 0; } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { } | 543 virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { } |
| 542 virtual void ariaControlsElements(AccessibilityChildrenVector&) const { } | 544 virtual void ariaControlsElements(AccessibilityChildrenVector&) const { } |
| 543 virtual void ariaOwnsElements(AccessibilityChildrenVector& owns) const { }; | 545 virtual void ariaOwnsElements(AccessibilityChildrenVector& owns) const { }; |
| 544 virtual bool ariaHasPopup() const { return false; } | 546 virtual bool ariaHasPopup() const { return false; } |
| 545 bool isMultiline() const; | 547 bool isMultiline() const; |
| 546 virtual String ariaLabeledByAttribute() const { return String(); } | 548 virtual String ariaLabeledByAttribute() const { return String(); } |
| 547 bool ariaPressedIsPresent() const; | 549 bool ariaPressedIsPresent() const; |
| 548 virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; } | 550 virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; } |
| 549 virtual bool ariaRoleHasPresentationalChildren() const { return false; } | 551 virtual bool ariaRoleHasPresentationalChildren() const { return false; } |
| 550 virtual AccessibilityOptionalBool isAriaGrabbed() const { return OptionalBoo lUndefined; } | 552 virtual AccessibilityOptionalBool isAriaGrabbed() const { return OptionalBoo lUndefined; } |
| 551 virtual bool isPresentationalChildOfAriaRole() const { return false; } | 553 virtual AXObject* ancestorForWhichThisIsAPresentationalChild() const { retur n 0; } |
| 552 virtual bool shouldFocusActiveDescendant() const { return false; } | 554 virtual bool shouldFocusActiveDescendant() const { return false; } |
| 553 bool supportsARIAAttributes() const; | 555 bool supportsARIAAttributes() const; |
| 554 virtual bool supportsARIADragging() const { return false; } | 556 virtual bool supportsARIADragging() const { return false; } |
| 555 virtual bool supportsARIADropping() const { return false; } | 557 virtual bool supportsARIADropping() const { return false; } |
| 556 virtual bool supportsARIAFlowTo() const { return false; } | 558 virtual bool supportsARIAFlowTo() const { return false; } |
| 557 virtual bool supportsARIAOwns() const { return false; } | 559 virtual bool supportsARIAOwns() const { return false; } |
| 558 bool supportsRangeValue() const; | 560 bool supportsRangeValue() const; |
| 559 virtual SortDirection sortDirection() const { return SortDirectionUndefined; } | 561 virtual SortDirection sortDirection() const { return SortDirectionUndefined; } |
| 560 | 562 |
| 561 // ARIA trees. | 563 // ARIA trees. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 bool hasInheritedPresentationalRole() const { return m_cachedHasInheritedPre sentationalRole; } | 676 bool hasInheritedPresentationalRole() const { return m_cachedHasInheritedPre sentationalRole; } |
| 675 | 677 |
| 676 protected: | 678 protected: |
| 677 AXID m_id; | 679 AXID m_id; |
| 678 AccessibilityChildrenVector m_children; | 680 AccessibilityChildrenVector m_children; |
| 679 mutable bool m_haveChildren; | 681 mutable bool m_haveChildren; |
| 680 AccessibilityRole m_role; | 682 AccessibilityRole m_role; |
| 681 AXObjectInclusion m_lastKnownIsIgnoredValue; | 683 AXObjectInclusion m_lastKnownIsIgnoredValue; |
| 682 LayoutRect m_explicitElementRect; | 684 LayoutRect m_explicitElementRect; |
| 683 | 685 |
| 684 virtual bool computeAccessibilityIsIgnored() const { return true; } | 686 virtual AXObject* inheritsPresentationalRoleFrom() const { return 0; } |
| 685 virtual bool computeHasInheritedPresentationalRole() const { return false; } | |
| 686 | 687 |
| 687 // If this object itself scrolls, return its ScrollableArea. | 688 // If this object itself scrolls, return its ScrollableArea. |
| 688 virtual ScrollableArea* getScrollableAreaIfScrollable() const { return 0; } | 689 virtual ScrollableArea* getScrollableAreaIfScrollable() const { return 0; } |
| 689 virtual void scrollTo(const IntPoint&) const { } | 690 virtual void scrollTo(const IntPoint&) const { } |
| 690 | 691 |
| 691 AccessibilityRole buttonRoleType() const; | 692 AccessibilityRole buttonRoleType() const; |
| 692 | 693 |
| 693 bool allowsTextRanges() const { return isTextControl(); } | 694 bool allowsTextRanges() const { return isTextControl(); } |
| 694 unsigned getLengthForTextRange() const { return text().length(); } | 695 unsigned getLengthForTextRange() const { return text().length(); } |
| 695 | 696 |
| 696 bool m_detached; | 697 bool m_detached; |
| 697 | 698 |
| 698 mutable AXObject* m_parent; | 699 mutable AXObject* m_parent; |
| 699 | 700 |
| 700 // The following cached attribute values (the ones starting with m_cached*) | 701 // The following cached attribute values (the ones starting with m_cached*) |
| 701 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount(). | 702 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount(). |
| 702 mutable int m_lastModificationCount; | 703 mutable int m_lastModificationCount; |
| 703 mutable bool m_cachedIsIgnored : 1; | 704 mutable bool m_cachedIsIgnored : 1; |
| 704 mutable bool m_cachedIsInertOrAriaHidden : 1; | 705 mutable bool m_cachedIsInertOrAriaHidden : 1; |
| 705 mutable bool m_cachedIsDescendantOfBarrenParent : 1; | 706 mutable bool m_cachedIsDescendantOfLeafNode : 1; |
| 706 mutable bool m_cachedIsDescendantOfDisabledNode : 1; | 707 mutable bool m_cachedIsDescendantOfDisabledNode : 1; |
| 707 mutable bool m_cachedHasInheritedPresentationalRole : 1; | 708 mutable bool m_cachedHasInheritedPresentationalRole : 1; |
| 708 mutable const AXObject* m_cachedLiveRegionRoot; | 709 mutable const AXObject* m_cachedLiveRegionRoot; |
| 709 | 710 |
| 710 AXObjectCacheImpl* m_axObjectCache; | 711 AXObjectCacheImpl* m_axObjectCache; |
| 711 | 712 |
| 712 // Updates the cached attribute values. This may be recursive, so to prevent deadlocks, | 713 // Updates the cached attribute values. This may be recursive, so to prevent deadlocks, |
| 713 // functions called here may only search up the tree (ancestors), not down. | 714 // functions called here may only search up the tree (ancestors), not down. |
| 714 void updateCachedAttributeValuesIfNeeded() const; | 715 void updateCachedAttributeValuesIfNeeded() const; |
| 715 | 716 |
| 716 private: | 717 private: |
| 717 static bool includesARIAWidgetRole(const String&); | 718 static bool includesARIAWidgetRole(const String&); |
| 718 static bool hasInteractiveARIAAttribute(const Element&); | 719 static bool hasInteractiveARIAAttribute(const Element&); |
| 719 }; | 720 }; |
| 720 | 721 |
| 721 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ | 722 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ |
| 722 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate) | 723 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate) |
| 723 | 724 |
| 724 } // namespace blink | 725 } // namespace blink |
| 725 | 726 |
| 726 #endif // AXObject_h | 727 #endif // AXObject_h |
| OLD | NEW |