| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google 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 12 matching lines...) Expand all Loading... |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef AXNodeObject_h | 29 #ifndef AXNodeObject_h |
| 30 #define AXNodeObject_h | 30 #define AXNodeObject_h |
| 31 | 31 |
| 32 #include "modules/ModulesExport.h" | 32 #include "modules/ModulesExport.h" |
| 33 #include "modules/accessibility/AXObject.h" | 33 #include "modules/accessibility/AXObjectImpl.h" |
| 34 #include "platform/wtf/Forward.h" | 34 #include "platform/wtf/Forward.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class AXObjectCacheImpl; | 38 class AXObjectCacheImpl; |
| 39 class Element; | 39 class Element; |
| 40 class HTMLLabelElement; | 40 class HTMLLabelElement; |
| 41 class Node; | 41 class Node; |
| 42 | 42 |
| 43 class MODULES_EXPORT AXNodeObject : public AXObject { | 43 class MODULES_EXPORT AXNodeObject : public AXObjectImpl { |
| 44 WTF_MAKE_NONCOPYABLE(AXNodeObject); | 44 WTF_MAKE_NONCOPYABLE(AXNodeObject); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 AXNodeObject(Node*, AXObjectCacheImpl&); | 47 AXNodeObject(Node*, AXObjectCacheImpl&); |
| 48 | 48 |
| 49 public: | 49 public: |
| 50 static AXNodeObject* Create(Node*, AXObjectCacheImpl&); | 50 static AXNodeObject* Create(Node*, AXObjectCacheImpl&); |
| 51 ~AXNodeObject() override; | 51 ~AXNodeObject() override; |
| 52 DECLARE_VIRTUAL_TRACE(); | 52 DECLARE_VIRTUAL_TRACE(); |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 // Protected data. | 55 // Protected data. |
| 56 AccessibilityRole aria_role_; | 56 AccessibilityRole aria_role_; |
| 57 bool children_dirty_; | 57 bool children_dirty_; |
| 58 #if DCHECK_IS_ON() | 58 #if DCHECK_IS_ON() |
| 59 bool initialized_ = false; | 59 bool initialized_ = false; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const override; | 62 bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const override; |
| 63 const AXObject* InheritsPresentationalRoleFrom() const override; | 63 const AXObjectImpl* InheritsPresentationalRoleFrom() const override; |
| 64 virtual AccessibilityRole DetermineAccessibilityRole(); | 64 virtual AccessibilityRole DetermineAccessibilityRole(); |
| 65 virtual AccessibilityRole NativeAccessibilityRoleIgnoringAria() const; | 65 virtual AccessibilityRole NativeAccessibilityRoleIgnoringAria() const; |
| 66 String AccessibilityDescriptionForElements( | 66 String AccessibilityDescriptionForElements( |
| 67 HeapVector<Member<Element>>& elements) const; | 67 HeapVector<Member<Element>>& elements) const; |
| 68 void AlterSliderValue(bool increase); | 68 void AlterSliderValue(bool increase); |
| 69 AXObject* ActiveDescendant() override; | 69 AXObjectImpl* ActiveDescendant() override; |
| 70 String AriaAccessibilityDescription() const; | 70 String AriaAccessibilityDescription() const; |
| 71 String AriaAutoComplete() const; | 71 String AriaAutoComplete() const; |
| 72 AccessibilityRole DetermineAriaRoleAttribute() const; | 72 AccessibilityRole DetermineAriaRoleAttribute() const; |
| 73 void AccessibilityChildrenFromAttribute(QualifiedName attr, | 73 void AccessibilityChildrenFromAttribute(QualifiedName attr, |
| 74 AXObject::AXObjectVector&) const; | 74 AXObjectImpl::AXObjectVector&) const; |
| 75 | 75 |
| 76 bool HasContentEditableAttributeSet() const; | 76 bool HasContentEditableAttributeSet() const; |
| 77 bool IsTextControl() const override; | 77 bool IsTextControl() const override; |
| 78 // This returns true if it's focusable but it's not content editable and it's | 78 // This returns true if it's focusable but it's not content editable and it's |
| 79 // not a control or ARIA control. | 79 // not a control or ARIA control. |
| 80 bool IsGenericFocusableElement() const; | 80 bool IsGenericFocusableElement() const; |
| 81 AXObject* MenuButtonForMenu() const; | 81 AXObjectImpl* MenuButtonForMenu() const; |
| 82 Element* MenuItemElementForMenu() const; | 82 Element* MenuItemElementForMenu() const; |
| 83 Element* MouseButtonListener() const; | 83 Element* MouseButtonListener() const; |
| 84 AccessibilityRole RemapAriaRoleDueToParent(AccessibilityRole) const; | 84 AccessibilityRole RemapAriaRoleDueToParent(AccessibilityRole) const; |
| 85 bool IsNativeCheckboxOrRadio() const; | 85 bool IsNativeCheckboxOrRadio() const; |
| 86 void SetNode(Node*); | 86 void SetNode(Node*); |
| 87 AXObject* CorrespondingControlForLabelElement() const; | 87 AXObjectImpl* CorrespondingControlForLabelElement() const; |
| 88 HTMLLabelElement* LabelElementContainer() const; | 88 HTMLLabelElement* LabelElementContainer() const; |
| 89 | 89 |
| 90 // | 90 // |
| 91 // Overridden from AXObject. | 91 // Overridden from AXObjectImpl. |
| 92 // | 92 // |
| 93 | 93 |
| 94 void Init() override; | 94 void Init() override; |
| 95 void Detach() override; | 95 void Detach() override; |
| 96 bool IsDetached() const override { return !node_; } | 96 bool IsDetached() const override { return !node_; } |
| 97 bool IsAXNodeObject() const final { return true; } | 97 bool IsAXNodeObject() const final { return true; } |
| 98 | 98 |
| 99 void GetSparseAXAttributes(AXSparseAttributeClient&) const override; | 99 void GetSparseAXAttributes(AXSparseAttributeClient&) const override; |
| 100 | 100 |
| 101 // Check object role or purpose. | 101 // Check object role or purpose. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 bool CanSetValueAttribute() const override; | 139 bool CanSetValueAttribute() const override; |
| 140 bool CanSetSelectedAttribute() const override; | 140 bool CanSetSelectedAttribute() const override; |
| 141 | 141 |
| 142 // Properties of static elements. | 142 // Properties of static elements. |
| 143 RGBA32 ColorValue() const final; | 143 RGBA32 ColorValue() const final; |
| 144 bool CanvasHasFallbackContent() const final; | 144 bool CanvasHasFallbackContent() const final; |
| 145 int HeadingLevel() const final; | 145 int HeadingLevel() const final; |
| 146 unsigned HierarchicalLevel() const final; | 146 unsigned HierarchicalLevel() const final; |
| 147 void Markers(Vector<DocumentMarker::MarkerType>&, | 147 void Markers(Vector<DocumentMarker::MarkerType>&, |
| 148 Vector<AXRange>&) const override; | 148 Vector<AXRange>&) const override; |
| 149 AXObject* InPageLinkTarget() const override; | 149 AXObjectImpl* InPageLinkTarget() const override; |
| 150 AccessibilityOrientation Orientation() const override; | 150 AccessibilityOrientation Orientation() const override; |
| 151 AXObjectVector RadioButtonsInGroup() const override; | 151 AXObjectVector RadioButtonsInGroup() const override; |
| 152 static HeapVector<Member<HTMLInputElement>> FindAllRadioButtonsWithSameName( | 152 static HeapVector<Member<HTMLInputElement>> FindAllRadioButtonsWithSameName( |
| 153 HTMLInputElement* radio_button); | 153 HTMLInputElement* radio_button); |
| 154 String GetText() const override; | 154 String GetText() const override; |
| 155 | 155 |
| 156 // Properties of interactive elements. | 156 // Properties of interactive elements. |
| 157 AriaCurrentState GetAriaCurrentState() const final; | 157 AriaCurrentState GetAriaCurrentState() const final; |
| 158 InvalidState GetInvalidState() const final; | 158 InvalidState GetInvalidState() const final; |
| 159 // Only used when invalidState() returns InvalidStateOther. | 159 // Only used when invalidState() returns InvalidStateOther. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 179 AXObjectVector* description_objects) const override; | 179 AXObjectVector* description_objects) const override; |
| 180 String Description(AXNameFrom, | 180 String Description(AXNameFrom, |
| 181 AXDescriptionFrom&, | 181 AXDescriptionFrom&, |
| 182 DescriptionSources*, | 182 DescriptionSources*, |
| 183 AXRelatedObjectVector*) const override; | 183 AXRelatedObjectVector*) const override; |
| 184 String Placeholder(AXNameFrom) const override; | 184 String Placeholder(AXNameFrom) const override; |
| 185 bool NameFromLabelElement() const override; | 185 bool NameFromLabelElement() const override; |
| 186 bool NameFromContents() const override; | 186 bool NameFromContents() const override; |
| 187 | 187 |
| 188 // Location | 188 // Location |
| 189 void GetRelativeBounds(AXObject** out_container, | 189 void GetRelativeBounds(AXObjectImpl** out_container, |
| 190 FloatRect& out_bounds_in_container, | 190 FloatRect& out_bounds_in_container, |
| 191 SkMatrix44& out_container_transform) const override; | 191 SkMatrix44& out_container_transform) const override; |
| 192 | 192 |
| 193 // High-level accessibility tree access. | 193 // High-level accessibility tree access. |
| 194 AXObject* ComputeParent() const override; | 194 AXObjectImpl* ComputeParent() const override; |
| 195 AXObject* ComputeParentIfExists() const override; | 195 AXObjectImpl* ComputeParentIfExists() const override; |
| 196 | 196 |
| 197 // Low-level accessibility tree exploration. | 197 // Low-level accessibility tree exploration. |
| 198 AXObject* RawFirstChild() const override; | 198 AXObjectImpl* RawFirstChild() const override; |
| 199 AXObject* RawNextSibling() const override; | 199 AXObjectImpl* RawNextSibling() const override; |
| 200 void AddChildren() override; | 200 void AddChildren() override; |
| 201 bool CanHaveChildren() const override; | 201 bool CanHaveChildren() const override; |
| 202 void AddChild(AXObject*); | 202 void AddChild(AXObjectImpl*); |
| 203 void InsertChild(AXObject*, unsigned index); | 203 void InsertChild(AXObjectImpl*, unsigned index); |
| 204 | 204 |
| 205 // DOM and Render tree access. | 205 // DOM and Render tree access. |
| 206 Element* ActionElement() const override; | 206 Element* ActionElement() const override; |
| 207 Element* AnchorElement() const override; | 207 Element* AnchorElement() const override; |
| 208 Document* GetDocument() const override; | 208 Document* GetDocument() const override; |
| 209 Node* GetNode() const override { return node_; } | 209 Node* GetNode() const override { return node_; } |
| 210 | 210 |
| 211 // Modify or take an action on an object. | 211 // Modify or take an action on an object. |
| 212 void SetFocused(bool) final; | 212 void SetFocused(bool) final; |
| 213 void Increment() final; | 213 void Increment() final; |
| 214 void Decrement() final; | 214 void Decrement() final; |
| 215 void SetSequentialFocusNavigationStartingPoint() final; | 215 void SetSequentialFocusNavigationStartingPoint() final; |
| 216 | 216 |
| 217 // Notifications that this object may have changed. | 217 // Notifications that this object may have changed. |
| 218 void ChildrenChanged() override; | 218 void ChildrenChanged() override; |
| 219 void SelectionChanged() final; | 219 void SelectionChanged() final; |
| 220 void TextChanged() override; | 220 void TextChanged() override; |
| 221 void UpdateAccessibilityRole() final; | 221 void UpdateAccessibilityRole() final; |
| 222 | 222 |
| 223 // Position in set and Size of set | 223 // Position in set and Size of set |
| 224 int PosInSet() const override; | 224 int PosInSet() const override; |
| 225 int SetSize() const override; | 225 int SetSize() const override; |
| 226 | 226 |
| 227 // Aria-owns. | 227 // Aria-owns. |
| 228 void ComputeAriaOwnsChildren( | 228 void ComputeAriaOwnsChildren( |
| 229 HeapVector<Member<AXObject>>& owned_children) const; | 229 HeapVector<Member<AXObjectImpl>>& owned_children) const; |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 Member<Node> node_; | 232 Member<Node> node_; |
| 233 | 233 |
| 234 bool IsNativeCheckboxInMixedState() const; | 234 bool IsNativeCheckboxInMixedState() const; |
| 235 String TextFromDescendants(AXObjectSet& visited, | 235 String TextFromDescendants(AXObjectSet& visited, |
| 236 bool recursive) const override; | 236 bool recursive) const override; |
| 237 String NativeTextAlternative(AXObjectSet& visited, | 237 String NativeTextAlternative(AXObjectSet& visited, |
| 238 AXNameFrom&, | 238 AXNameFrom&, |
| 239 AXRelatedObjectVector*, | 239 AXRelatedObjectVector*, |
| 240 NameSources*, | 240 NameSources*, |
| 241 bool* found_text_alternative) const; | 241 bool* found_text_alternative) const; |
| 242 float StepValueForRange() const; | 242 float StepValueForRange() const; |
| 243 bool IsDescendantOfElementType(HashSet<QualifiedName>& tag_names) const; | 243 bool IsDescendantOfElementType(HashSet<QualifiedName>& tag_names) const; |
| 244 String PlaceholderFromNativeAttribute() const; | 244 String PlaceholderFromNativeAttribute() const; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 } // namespace blink | 247 } // namespace blink |
| 248 | 248 |
| 249 #endif // AXNodeObject_h | 249 #endif // AXNodeObject_h |
| OLD | NEW |