| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer in the | |
| 12 * documentation and/or other materials provided with the distribution. | |
| 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
| 14 * its contributors may be used to endorse or promote products derived | |
| 15 * from this software without specific prior written permission. | |
| 16 * | |
| 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 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 | |
| 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. | |
| 27 */ | |
| 28 | |
| 29 #ifndef AXRenderObject_h | |
| 30 #define AXRenderObject_h | |
| 31 | |
| 32 #include "core/accessibility/AXNodeObject.h" | |
| 33 #include "platform/geometry/LayoutRect.h" | |
| 34 #include "wtf/Forward.h" | |
| 35 | |
| 36 namespace blink { | |
| 37 | |
| 38 class AXSVGRoot; | |
| 39 class Element; | |
| 40 class FrameView; | |
| 41 class HTMLAreaElement; | |
| 42 class IntPoint; | |
| 43 class Node; | |
| 44 class VisibleSelection; | |
| 45 class Widget; | |
| 46 | |
| 47 class AXRenderObject : public AXNodeObject { | |
| 48 protected: | |
| 49 explicit AXRenderObject(RenderObject*); | |
| 50 public: | |
| 51 static PassRefPtr<AXRenderObject> create(RenderObject*); | |
| 52 virtual ~AXRenderObject(); | |
| 53 | |
| 54 // Public, overridden from AXObject. | |
| 55 virtual RenderObject* renderer() const override final { return m_renderer; } | |
| 56 virtual LayoutRect elementRect() const override; | |
| 57 | |
| 58 void setRenderer(RenderObject*); | |
| 59 RenderBoxModelObject* renderBoxModelObject() const; | |
| 60 Document* topDocument() const; | |
| 61 bool shouldNotifyActiveDescendant() const; | |
| 62 virtual ScrollableArea* getScrollableAreaIfScrollable() const override final
; | |
| 63 virtual AccessibilityRole determineAccessibilityRole() override; | |
| 64 void checkCachedElementRect() const; | |
| 65 void updateCachedElementRect() const; | |
| 66 | |
| 67 protected: | |
| 68 RenderObject* m_renderer; | |
| 69 mutable LayoutRect m_cachedElementRect; | |
| 70 mutable LayoutRect m_cachedFrameRect; | |
| 71 mutable IntPoint m_cachedScrollPosition; | |
| 72 mutable bool m_cachedElementRectDirty; | |
| 73 | |
| 74 // | |
| 75 // Overridden from AXObject. | |
| 76 // | |
| 77 | |
| 78 virtual void init() override; | |
| 79 virtual void detach() override; | |
| 80 virtual bool isDetached() const override { return !m_renderer; } | |
| 81 virtual bool isAXRenderObject() const override { return true; } | |
| 82 | |
| 83 // Check object role or purpose. | |
| 84 virtual bool isAttachment() const override; | |
| 85 virtual bool isFileUploadButton() const override; | |
| 86 virtual bool isLinked() const override; | |
| 87 virtual bool isLoaded() const override; | |
| 88 virtual bool isOffScreen() const override; | |
| 89 virtual bool isReadOnly() const override; | |
| 90 virtual bool isVisited() const override; | |
| 91 | |
| 92 // Check object state. | |
| 93 virtual bool isFocused() const override; | |
| 94 virtual bool isSelected() const override; | |
| 95 | |
| 96 // Whether objects are ignored, i.e. not included in the tree. | |
| 97 virtual AXObjectInclusion defaultObjectInclusion() const override; | |
| 98 virtual bool computeAccessibilityIsIgnored() const override; | |
| 99 | |
| 100 // Properties of static elements. | |
| 101 virtual const AtomicString& accessKey() const override; | |
| 102 virtual AccessibilityOrientation orientation() const override; | |
| 103 virtual String text() const override; | |
| 104 virtual int textLength() const override; | |
| 105 virtual KURL url() const override; | |
| 106 | |
| 107 // Properties of interactive elements. | |
| 108 virtual String actionVerb() const override; | |
| 109 virtual String stringValue() const override; | |
| 110 | |
| 111 // ARIA attributes. | |
| 112 virtual AXObject* activeDescendant() const override; | |
| 113 virtual void ariaFlowToElements(AccessibilityChildrenVector&) const override
; | |
| 114 virtual void ariaControlsElements(AccessibilityChildrenVector&) const overri
de; | |
| 115 virtual void ariaDescribedbyElements(AccessibilityChildrenVector&) const ove
rride; | |
| 116 virtual void ariaLabelledbyElements(AccessibilityChildrenVector&) const over
ride; | |
| 117 virtual void ariaOwnsElements(AccessibilityChildrenVector&) const override; | |
| 118 | |
| 119 virtual bool ariaHasPopup() const override; | |
| 120 virtual bool ariaRoleHasPresentationalChildren() const override; | |
| 121 virtual bool isPresentationalChildOfAriaRole() const override; | |
| 122 virtual bool shouldFocusActiveDescendant() const override; | |
| 123 virtual bool supportsARIADragging() const override; | |
| 124 virtual bool supportsARIADropping() const override; | |
| 125 virtual bool supportsARIAFlowTo() const override; | |
| 126 virtual bool supportsARIAOwns() const override; | |
| 127 | |
| 128 // ARIA live-region features. | |
| 129 virtual const AtomicString& liveRegionStatus() const override; | |
| 130 virtual const AtomicString& liveRegionRelevant() const override; | |
| 131 virtual bool liveRegionAtomic() const override; | |
| 132 virtual bool liveRegionBusy() const override; | |
| 133 | |
| 134 // Accessibility Text. | |
| 135 virtual String textUnderElement() const override; | |
| 136 | |
| 137 // Accessibility Text - (To be deprecated). | |
| 138 virtual String helpText() const override; | |
| 139 | |
| 140 // Location and click point in frame-relative coordinates. | |
| 141 virtual void markCachedElementRectDirty() const override; | |
| 142 virtual IntPoint clickPoint() override; | |
| 143 | |
| 144 // Hit testing. | |
| 145 virtual AXObject* accessibilityHitTest(const IntPoint&) const override; | |
| 146 virtual AXObject* elementAccessibilityHitTest(const IntPoint&) const overrid
e; | |
| 147 | |
| 148 // High-level accessibility tree access. Other modules should only use these
functions. | |
| 149 virtual AXObject* computeParent() const override; | |
| 150 virtual AXObject* computeParentIfExists() const override; | |
| 151 | |
| 152 // Low-level accessibility tree exploration, only for use within the accessi
bility module. | |
| 153 virtual AXObject* firstChild() const override; | |
| 154 virtual AXObject* nextSibling() const override; | |
| 155 virtual void addChildren() override; | |
| 156 virtual bool canHaveChildren() const override; | |
| 157 virtual void updateChildrenIfNecessary() override; | |
| 158 virtual bool needsToUpdateChildren() const override { return m_childrenDirty
; } | |
| 159 virtual void setNeedsToUpdateChildren() override { m_childrenDirty = true; } | |
| 160 virtual void clearChildren() override; | |
| 161 virtual AXObject* observableObject() const override; | |
| 162 | |
| 163 // Properties of the object's owning document or page. | |
| 164 virtual double estimatedLoadingProgress() const override; | |
| 165 | |
| 166 // DOM and Render tree access. | |
| 167 virtual Node* node() const override; | |
| 168 virtual Document* document() const override; | |
| 169 virtual FrameView* documentFrameView() const override; | |
| 170 virtual Element* anchorElement() const override; | |
| 171 virtual Widget* widgetForAttachmentView() const override; | |
| 172 | |
| 173 // Selected text. | |
| 174 virtual PlainTextRange selectedTextRange() const override; | |
| 175 | |
| 176 // Modify or take an action on an object. | |
| 177 virtual void setSelectedTextRange(const PlainTextRange&) override; | |
| 178 virtual void setValue(const String&) override; | |
| 179 virtual void scrollTo(const IntPoint&) const override; | |
| 180 | |
| 181 // Notifications that this object may have changed. | |
| 182 virtual void handleActiveDescendantChanged() override; | |
| 183 virtual void handleAriaExpandedChanged() override; | |
| 184 virtual void textChanged() override; | |
| 185 | |
| 186 // Text metrics. Most of these should be deprecated, needs major cleanup. | |
| 187 virtual int index(const VisiblePosition&) const override; | |
| 188 virtual VisiblePosition visiblePositionForIndex(int) const override; | |
| 189 virtual void lineBreaks(Vector<int>&) const override; | |
| 190 | |
| 191 private: | |
| 192 bool isAllowedChildOfTree() const; | |
| 193 void ariaListboxSelectedChildren(AccessibilityChildrenVector&); | |
| 194 PlainTextRange ariaSelectedTextRange() const; | |
| 195 bool nodeIsTextControl(const Node*) const; | |
| 196 bool isTabItemSelected() const; | |
| 197 AXObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) co
nst; | |
| 198 bool renderObjectIsObservable(RenderObject*) const; | |
| 199 RenderObject* renderParentObject() const; | |
| 200 bool isDescendantOfElementType(const HTMLQualifiedName& tagName) const; | |
| 201 bool isSVGImage() const; | |
| 202 void detachRemoteSVGRoot(); | |
| 203 AXSVGRoot* remoteSVGRootElement() const; | |
| 204 AXObject* remoteSVGElementHitTest(const IntPoint&) const; | |
| 205 void offsetBoundingBoxForRemoteSVGElement(LayoutRect&) const; | |
| 206 void addHiddenChildren(); | |
| 207 void addTextFieldChildren(); | |
| 208 void addImageMapChildren(); | |
| 209 void addCanvasChildren(); | |
| 210 void addAttachmentChildren(); | |
| 211 void addPopupChildren(); | |
| 212 void addRemoteSVGChildren(); | |
| 213 void addInlineTextBoxChildren(); | |
| 214 | |
| 215 void ariaSelectedRows(AccessibilityChildrenVector&); | |
| 216 bool elementAttributeValue(const QualifiedName&) const; | |
| 217 bool inheritsPresentationalRole() const; | |
| 218 LayoutRect computeElementRect() const; | |
| 219 VisibleSelection selection() const; | |
| 220 int indexForVisiblePosition(const VisiblePosition&) const; | |
| 221 void accessibilityChildrenFromAttribute(QualifiedName attr, AccessibilityChi
ldrenVector&) const; | |
| 222 }; | |
| 223 | |
| 224 DEFINE_AX_OBJECT_TYPE_CASTS(AXRenderObject, isAXRenderObject()); | |
| 225 | |
| 226 } // namespace blink | |
| 227 | |
| 228 #endif // AXRenderObject_h | |
| OLD | NEW |