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