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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // The potential native HTML-based text (name, description or placeholder) sourc
es for an element. | 330 // The potential native HTML-based text (name, description or placeholder) sourc
es for an element. |
331 // See http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessible-name-
and-description-calculation | 331 // See http://rawgit.com/w3c/aria/master/html-aam/html-aam.html#accessible-name-
and-description-calculation |
332 enum AXTextFromNativeHTML { | 332 enum AXTextFromNativeHTML { |
333 AXTextFromNativeHTMLUninitialized = -1, | 333 AXTextFromNativeHTMLUninitialized = -1, |
334 AXTextFromNativeHTMLFigcaption, | 334 AXTextFromNativeHTMLFigcaption, |
335 AXTextFromNativeHTMLLabel, | 335 AXTextFromNativeHTMLLabel, |
336 AXTextFromNativeHTMLLabelFor, | 336 AXTextFromNativeHTMLLabelFor, |
337 AXTextFromNativeHTMLLabelWrapped, | 337 AXTextFromNativeHTMLLabelWrapped, |
338 AXTextFromNativeHTMLLegend, | 338 AXTextFromNativeHTMLLegend, |
339 AXTextFromNativeHTMLTableCaption, | 339 AXTextFromNativeHTMLTableCaption, |
| 340 AXTextFromNativeHTMLTitleElement, |
340 }; | 341 }; |
341 | 342 |
342 // The source of the accessible description of an element. This is needed | 343 // The source of the accessible description of an element. This is needed |
343 // because on some platforms this determines how the accessible description | 344 // because on some platforms this determines how the accessible description |
344 // is exposed. | 345 // is exposed. |
345 enum AXDescriptionFrom { | 346 enum AXDescriptionFrom { |
346 AXDescriptionFromUninitialized = -1, | 347 AXDescriptionFromUninitialized = -1, |
347 AXDescriptionFromAttribute = 0, | 348 AXDescriptionFromAttribute = 0, |
348 AXDescriptionFromContents, | 349 AXDescriptionFromContents, |
349 AXDescriptionFromPlaceholder, | 350 AXDescriptionFromPlaceholder, |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 bool isDescendantOfLeafNode() const; | 662 bool isDescendantOfLeafNode() const; |
662 AXObject* leafNodeAncestor() const; | 663 AXObject* leafNodeAncestor() const; |
663 bool isDescendantOfDisabledNode() const; | 664 bool isDescendantOfDisabledNode() const; |
664 const AXObject* disabledAncestor() const; | 665 const AXObject* disabledAncestor() const; |
665 bool lastKnownIsIgnoredValue(); | 666 bool lastKnownIsIgnoredValue(); |
666 void setLastKnownIsIgnoredValue(bool); | 667 void setLastKnownIsIgnoredValue(bool); |
667 bool hasInheritedPresentationalRole() const; | 668 bool hasInheritedPresentationalRole() const; |
668 bool isPresentationalChild() const; | 669 bool isPresentationalChild() const; |
669 | 670 |
670 // | 671 // |
671 // Deprecated text alternative calculation API. All of these will be replace
d | 672 // Accessible name calculation |
672 // with the new API, below (under "New text alternative calculation API". | |
673 // | |
674 | |
675 virtual bool deprecatedExposesTitleUIElement() const { return true; } | |
676 virtual AXObject* deprecatedTitleUIElement() const { return 0; } | |
677 virtual String deprecatedPlaceholder() const { return String(); } | |
678 virtual void deprecatedAriaDescribedbyElements(AXObjectVector& describedby)
const { } | |
679 virtual void deprecatedAriaLabelledbyElements(AXObjectVector& labelledby) co
nst { } | |
680 virtual String deprecatedAccessibilityDescription() const { return String();
} | |
681 virtual String deprecatedTitle(TextUnderElementMode mode = TextUnderElementA
ll) const { return String(); } | |
682 virtual String deprecatedHelpText() const { return String(); } | |
683 virtual String deprecatedTextUnderElement(TextUnderElementMode mode = TextUn
derElementAll) const { return String(); } | |
684 | |
685 // | |
686 // New text alternative calculation API (under development). | |
687 // | 673 // |
688 | 674 |
689 // Retrieves the accessible name of the object, an enum indicating where the
name | 675 // Retrieves the accessible name of the object, an enum indicating where the
name |
690 // was derived from, and a list of objects that were used to derive the name
, if any. | 676 // was derived from, and a list of objects that were used to derive the name
, if any. |
691 virtual String name(AXNameFrom&, AXObjectVector* nameObjects) const; | 677 virtual String name(AXNameFrom&, AXObjectVector* nameObjects) const; |
692 | 678 |
693 typedef HeapVector<NameSource> NameSources; | 679 typedef HeapVector<NameSource> NameSources; |
694 // Retrieves the accessible name of the object and a list of all potential s
ources | 680 // Retrieves the accessible name of the object and a list of all potential s
ources |
695 // for the name, indicating which were used. | 681 // for the name, indicating which were used. |
696 virtual String name(NameSources*) const; | 682 virtual String name(NameSources*) const; |
697 | 683 |
698 typedef HeapVector<DescriptionSource> DescriptionSources; | 684 typedef HeapVector<DescriptionSource> DescriptionSources; |
699 // Takes the result of nameFrom from calling |name|, above, and retrieves th
e | 685 // Takes the result of nameFrom from calling |name|, above, and retrieves th
e |
700 // accessible description of the object, which is secondary to |name|, an en
um indicating | 686 // accessible description of the object, which is secondary to |name|, an en
um indicating |
701 // where the description was derived from, and a list of objects that were u
sed to | 687 // where the description was derived from, and a list of objects that were u
sed to |
702 // derive the description, if any. | 688 // derive the description, if any. |
703 virtual String description(AXNameFrom, AXDescriptionFrom&, AXObjectVector* d
escriptionObjects) const { return String(); } | 689 virtual String description(AXNameFrom, AXDescriptionFrom&, AXObjectVector* d
escriptionObjects) const { return String(); } |
704 | 690 |
705 // Same as above, but returns a list of all potential sources for the descri
ption, indicating which were used. | 691 // Same as above, but returns a list of all potential sources for the descri
ption, indicating which were used. |
706 virtual String description(AXNameFrom, AXDescriptionFrom&, DescriptionSource
s*, AXRelatedObjectVector*) const { return String(); } | 692 virtual String description(AXNameFrom, AXDescriptionFrom&, DescriptionSource
s*, AXRelatedObjectVector*) const { return String(); } |
707 | 693 |
708 // Takes the result of nameFrom and descriptionFrom from calling |name| and
|description|, | 694 // Takes the result of nameFrom and descriptionFrom from calling |name| and
|description|, |
709 // above, and retrieves the placeholder of the object, if present and if it
wasn't already | 695 // above, and retrieves the placeholder of the object, if present and if it
wasn't already |
710 // exposed by one of the two functions above. | 696 // exposed by one of the two functions above. |
711 virtual String placeholder(AXNameFrom, AXDescriptionFrom) { return String();
} | 697 virtual String placeholder(AXNameFrom, AXDescriptionFrom) const { return Str
ing(); } |
712 | 698 |
713 // Internal function used by name and description, above. | 699 // Internal function used by name and description, above. |
714 typedef HeapHashSet<Member<const AXObject>> AXObjectSet; | 700 typedef HeapHashSet<Member<const AXObject>> AXObjectSet; |
715 virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversa
l, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedObj
ects, NameSources* nameSources) const { return String(); } | 701 virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversa
l, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedObj
ects, NameSources* nameSources) const { return String(); } |
716 | 702 |
717 // Returns result of Accessible Name Calculation algorithm. | 703 // Returns result of Accessible Name Calculation algorithm. |
718 // This is a simpler high-level interface to |name| used by Inspector. | 704 // This is a simpler high-level interface to |name| used by Inspector. |
719 virtual String computedName() const { return String(); } | 705 String computedName() const; |
720 | 706 |
721 // | 707 // |
722 // Properties of static elements. | 708 // Properties of static elements. |
723 // | 709 // |
724 | 710 |
725 virtual const AtomicString& accessKey() const { return nullAtom; } | 711 virtual const AtomicString& accessKey() const { return nullAtom; } |
726 virtual RGBA32 backgroundColor() const { return Color::transparent; } | 712 virtual RGBA32 backgroundColor() const { return Color::transparent; } |
727 virtual RGBA32 color() const { return Color::black; } | 713 virtual RGBA32 color() const { return Color::black; } |
728 // Used by objects of role ColorWellRole. | 714 // Used by objects of role ColorWellRole. |
729 virtual RGBA32 colorValue() const { return Color::transparent; } | 715 virtual RGBA32 colorValue() const { return Color::transparent; } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 virtual float minValueForRange() const { return 0.0f; } | 753 virtual float minValueForRange() const { return 0.0f; } |
768 virtual String stringValue() const { return String(); } | 754 virtual String stringValue() const { return String(); } |
769 | 755 |
770 // ARIA attributes. | 756 // ARIA attributes. |
771 virtual AXObject* activeDescendant() const { return 0; } | 757 virtual AXObject* activeDescendant() const { return 0; } |
772 virtual String ariaAutoComplete() const { return String(); } | 758 virtual String ariaAutoComplete() const { return String(); } |
773 virtual String ariaDescribedByAttribute() const { return String(); } | 759 virtual String ariaDescribedByAttribute() const { return String(); } |
774 virtual void ariaFlowToElements(AXObjectVector&) const { } | 760 virtual void ariaFlowToElements(AXObjectVector&) const { } |
775 virtual void ariaControlsElements(AXObjectVector&) const { } | 761 virtual void ariaControlsElements(AXObjectVector&) const { } |
776 virtual void ariaOwnsElements(AXObjectVector& owns) const { } | 762 virtual void ariaOwnsElements(AXObjectVector& owns) const { } |
| 763 virtual void ariaDescribedbyElements(AXObjectVector&) const { } |
| 764 virtual void ariaLabelledbyElements(AXObjectVector&) const { } |
777 virtual bool ariaHasPopup() const { return false; } | 765 virtual bool ariaHasPopup() const { return false; } |
778 virtual bool isEditable() const { return false; } | 766 virtual bool isEditable() const { return false; } |
779 bool isMultiline() const; | 767 bool isMultiline() const; |
780 virtual bool isRichlyEditable() const { return false; } | 768 virtual bool isRichlyEditable() const { return false; } |
781 virtual String ariaLabelledbyAttribute() const { return String(); } | 769 virtual String ariaLabelledbyAttribute() const { return String(); } |
782 bool ariaPressedIsPresent() const; | 770 bool ariaPressedIsPresent() const; |
783 virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; } | 771 virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; } |
784 virtual bool ariaRoleHasPresentationalChildren() const { return false; } | 772 virtual bool ariaRoleHasPresentationalChildren() const { return false; } |
785 virtual AXObject* ancestorForWhichThisIsAPresentationalChild() const { retur
n 0; } | 773 virtual AXObject* ancestorForWhichThisIsAPresentationalChild() const { retur
n 0; } |
786 virtual bool shouldFocusActiveDescendant() const { return false; } | 774 virtual bool shouldFocusActiveDescendant() const { return false; } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 static bool isInsideFocusableElementOrARIAWidget(const Node&); | 918 static bool isInsideFocusableElementOrARIAWidget(const Node&); |
931 | 919 |
932 protected: | 920 protected: |
933 AXID m_id; | 921 AXID m_id; |
934 AXObjectVector m_children; | 922 AXObjectVector m_children; |
935 mutable bool m_haveChildren; | 923 mutable bool m_haveChildren; |
936 AccessibilityRole m_role; | 924 AccessibilityRole m_role; |
937 AXObjectInclusion m_lastKnownIsIgnoredValue; | 925 AXObjectInclusion m_lastKnownIsIgnoredValue; |
938 LayoutRect m_explicitElementRect; | 926 LayoutRect m_explicitElementRect; |
939 | 927 |
940 // Used only in recursive calls from textAlternative() | 928 // Used only inside textAlternative(): |
941 static String recursiveTextAlternative(const AXObject&, bool inAriaLabelledB
yTraversal, AXObjectSet& visited); | 929 static String recursiveTextAlternative(const AXObject&, bool inAriaLabelledB
yTraversal, AXObjectSet& visited); |
| 930 String ariaTextAlternative(bool recursive, bool inAriaLabelledByTraversal, A
XObjectSet& visited, AXNameFrom&, AXRelatedObjectVector*, NameSources*, bool* fo
undTextAlternative) const; |
| 931 String textFromElements(bool inAriaLabelledByTraversal, AXObjectSet& visited
, WillBeHeapVector<RawPtrWillBeMember<Element>>& elements, AXRelatedObjectVector
* relatedObjects) const; |
| 932 void tokenVectorFromAttribute(Vector<String>&, const QualifiedName&) const; |
| 933 void elementsFromAttribute(WillBeHeapVector<RawPtrWillBeMember<Element>>& el
ements, const QualifiedName&) const; |
| 934 void ariaLabelledbyElementVector(WillBeHeapVector<RawPtrWillBeMember<Element
>>& elements) const; |
| 935 String textFromAriaLabelledby(AXObjectSet& visited, AXRelatedObjectVector* r
elatedObjects) const; |
| 936 String textFromAriaDescribedby(AXRelatedObjectVector* relatedObjects) const; |
942 | 937 |
943 virtual const AXObject* inheritsPresentationalRoleFrom() const { return 0; } | 938 virtual const AXObject* inheritsPresentationalRoleFrom() const { return 0; } |
944 | 939 |
945 bool nameFromContents() const; | 940 virtual bool nameFromContents() const; |
946 | 941 |
947 AccessibilityRole buttonRoleType() const; | 942 AccessibilityRole buttonRoleType() const; |
948 | 943 |
949 unsigned getLengthForTextRange() const { return text().length(); } | 944 unsigned getLengthForTextRange() const { return text().length(); } |
950 | 945 |
951 bool m_detached; | 946 bool m_detached; |
952 | 947 |
953 mutable Member<AXObject> m_parent; | 948 mutable Member<AXObject> m_parent; |
954 | 949 |
955 // The following cached attribute values (the ones starting with m_cached*) | 950 // The following cached attribute values (the ones starting with m_cached*) |
(...skipping 23 matching lines...) Expand all Loading... |
979 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ | 974 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ |
980 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) | 975 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred
icate) |
981 | 976 |
982 } // namespace blink | 977 } // namespace blink |
983 | 978 |
984 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason); | 979 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::IgnoredReason); |
985 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource); | 980 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NameSource); |
986 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::DescriptionSource); | 981 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::DescriptionSource); |
987 | 982 |
988 #endif // AXObject_h | 983 #endif // AXObject_h |
OLD | NEW |