• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2008 Nuanti Ltd.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef AXObject_h
31 #define AXObject_h
32 
33 #include "core/editing/VisiblePosition.h"
34 #include "platform/geometry/FloatQuad.h"
35 #include "platform/geometry/LayoutRect.h"
36 #include "wtf/Forward.h"
37 #include "wtf/RefPtr.h"
38 #include "wtf/Vector.h"
39 
40 namespace blink {
41 
42 class AXObject;
43 class AXObjectCache;
44 class Element;
45 class LocalFrame;
46 class FrameView;
47 class HTMLAnchorElement;
48 class HTMLAreaElement;
49 class IntPoint;
50 class IntSize;
51 class Node;
52 class Range;
53 class RenderObject;
54 class RenderListItem;
55 class ScrollableArea;
56 class VisibleSelection;
57 class Widget;
58 
59 typedef unsigned AXID;
60 
61 enum AccessibilityRole {
62     AlertDialogRole = 1,
63     AlertRole,
64     AnnotationRole,
65     ApplicationRole,
66     ArticleRole,
67     BannerRole,
68     BrowserRole,
69     BusyIndicatorRole,
70     ButtonRole,
71     CanvasRole,
72     CellRole,
73     CheckBoxRole,
74     ColorWellRole,
75     ColumnHeaderRole,
76     ColumnRole,
77     ComboBoxRole,
78     ComplementaryRole,
79     ContentInfoRole,
80     DefinitionRole,
81     DescriptionListDetailRole,
82     DescriptionListTermRole,
83     DetailsRole,
84     DialogRole,
85     DirectoryRole,
86     DisclosureTriangleRole,
87     DivRole,
88     DocumentRole,
89     DrawerRole,
90     EditableTextRole,
91     EmbeddedObjectRole,
92     FigcaptionRole,
93     FigureRole,
94     FooterRole,
95     FormRole,
96     GridRole,
97     GroupRole,
98     GrowAreaRole,
99     HeadingRole,
100     HelpTagRole,
101     HorizontalRuleRole,
102     IframeRole,
103     IgnoredRole,
104     ImageMapLinkRole,
105     ImageMapRole,
106     ImageRole,
107     IncrementorRole,
108     InlineTextBoxRole,
109     LabelRole,
110     LegendRole,
111     LinkRole,
112     ListBoxOptionRole,
113     ListBoxRole,
114     ListItemRole,
115     ListMarkerRole,
116     ListRole,
117     LogRole,
118     MainRole,
119     MarqueeRole,
120     MathElementRole,
121     MathRole,
122     MatteRole,
123     MenuBarRole,
124     MenuButtonRole,
125     MenuItemRole,
126     MenuListOptionRole,
127     MenuListPopupRole,
128     MenuRole,
129     NavigationRole,
130     NoneRole,
131     NoteRole,
132     OutlineRole,
133     ParagraphRole,
134     PopUpButtonRole,
135     PresentationalRole,
136     ProgressIndicatorRole,
137     RadioButtonRole,
138     RadioGroupRole,
139     RegionRole,
140     RootWebAreaRole,
141     RowHeaderRole,
142     RowRole,
143     RulerMarkerRole,
144     RulerRole,
145     SVGRootRole,
146     ScrollAreaRole,
147     ScrollBarRole,
148     SeamlessWebAreaRole,
149     SearchRole,
150     SheetRole,
151     SliderRole,
152     SliderThumbRole,
153     SpinButtonPartRole,
154     SpinButtonRole,
155     SplitGroupRole,
156     SplitterRole,
157     StaticTextRole,
158     StatusRole,
159     SystemWideRole,
160     TabGroupRole,
161     TabListRole,
162     TabPanelRole,
163     TabRole,
164     TableHeaderContainerRole,
165     TableRole,
166     TextAreaRole,
167     TextFieldRole,
168     TimerRole,
169     ToggleButtonRole,
170     ToolbarRole,
171     TreeGridRole,
172     TreeItemRole,
173     TreeRole,
174     UnknownRole,
175     UserInterfaceTooltipRole,
176     ValueIndicatorRole,
177     WebAreaRole,
178     WindowRole,
179 };
180 
181 enum AccessibilityTextSource {
182     AlternativeText,
183     ChildrenText,
184     SummaryText,
185     HelpText,
186     VisibleText,
187     TitleTagText,
188     PlaceholderText,
189     LabelByElementText,
190 };
191 
192 enum AccessibilityState {
193     AXBusyState,
194     AXCheckedState,
195     AXCollapsedState,
196     AXEnabledState,
197     AXExpandedState,
198     AXFocusableState,
199     AXFocusedState,
200     AXHaspopupState,
201     AXHoveredState,
202     AXIndeterminateState,
203     AXInvisibleState,
204     AXLinkedState,
205     AXMultiselectableState,
206     AXOffscreenState,
207     AXPressedState,
208     AXProtectedState,
209     AXReadonlyState,
210     AXRequiredState,
211     AXSelectableState,
212     AXSelectedState,
213     AXVerticalState,
214     AXVisitedState
215 };
216 
217 struct AccessibilityText {
218     String text;
219     AccessibilityTextSource textSource;
220     RefPtr<AXObject> textElement;
221 
AccessibilityTextAccessibilityText222     AccessibilityText(const String& t, const AccessibilityTextSource& s)
223     : text(t)
224     , textSource(s)
225     { }
226 
AccessibilityTextAccessibilityText227     AccessibilityText(const String& t, const AccessibilityTextSource& s, const RefPtr<AXObject> element)
228     : text(t)
229     , textSource(s)
230     , textElement(element)
231     { }
232 };
233 
234 enum AccessibilityOrientation {
235     AccessibilityOrientationVertical,
236     AccessibilityOrientationHorizontal,
237 };
238 
239 enum AXObjectInclusion {
240     IncludeObject,
241     IgnoreObject,
242     DefaultBehavior,
243 };
244 
245 enum AccessibilityButtonState {
246     ButtonStateOff = 0,
247     ButtonStateOn,
248     ButtonStateMixed,
249 };
250 
251 enum AccessibilityTextDirection {
252     AccessibilityTextDirectionLeftToRight,
253     AccessibilityTextDirectionRightToLeft,
254     AccessibilityTextDirectionTopToBottom,
255     AccessibilityTextDirectionBottomToTop
256 };
257 
258 class AXObject : public RefCounted<AXObject> {
259 public:
260     typedef Vector<RefPtr<AXObject> > AccessibilityChildrenVector;
261 
262     struct PlainTextRange {
263 
264         unsigned start;
265         unsigned length;
266 
PlainTextRangePlainTextRange267         PlainTextRange()
268             : start(0)
269             , length(0)
270         { }
271 
PlainTextRangePlainTextRange272         PlainTextRange(unsigned s, unsigned l)
273             : start(s)
274             , length(l)
275         { }
276 
isNullPlainTextRange277         bool isNull() const { return !start && !length; }
278     };
279 
280 protected:
281     AXObject();
282 
283 public:
284     virtual ~AXObject();
285 
286     // After constructing an AXObject, it must be given a
287     // unique ID, then added to AXObjectCache, and finally init() must
288     // be called last.
setAXObjectID(AXID axObjectID)289     void setAXObjectID(AXID axObjectID) { m_id = axObjectID; }
init()290     virtual void init() { }
291 
292     // When the corresponding WebCore object that this AXObject
293     // wraps is deleted, it must be detached.
294     virtual void detach();
295     virtual bool isDetached() const;
296 
297     // The AXObjectCache that owns this object, and its unique ID within this cache.
298     AXObjectCache* axObjectCache() const;
axObjectID()299     AXID axObjectID() const { return m_id; }
300 
301     // Determine subclass type.
isAXNodeObject()302     virtual bool isAXNodeObject() const { return false; }
isAXRenderObject()303     virtual bool isAXRenderObject() const { return false; }
isAXScrollbar()304     virtual bool isAXScrollbar() const { return false; }
isAXScrollView()305     virtual bool isAXScrollView() const { return false; }
isAXSVGRoot()306     virtual bool isAXSVGRoot() const { return false; }
307 
308     // Check object role or purpose.
roleValue()309     virtual AccessibilityRole roleValue() const { return m_role; }
310     bool isARIATextControl() const;
isARIATreeGridRow()311     virtual bool isARIATreeGridRow() const { return false; }
isAXTable()312     virtual bool isAXTable() const { return false; }
isAnchor()313     virtual bool isAnchor() const { return false; }
isAttachment()314     virtual bool isAttachment() const { return false; }
315     bool isButton() const;
isCanvas()316     bool isCanvas() const { return roleValue() == CanvasRole; }
isCheckbox()317     bool isCheckbox() const { return roleValue() == CheckBoxRole; }
isCheckboxOrRadio()318     bool isCheckboxOrRadio() const { return isCheckbox() || isRadioButton(); }
isColorWell()319     bool isColorWell() const { return roleValue() == ColorWellRole; }
isComboBox()320     bool isComboBox() const { return roleValue() == ComboBoxRole; }
isControl()321     virtual bool isControl() const { return false; }
isDataTable()322     virtual bool isDataTable() const { return false; }
isEmbeddedObject()323     virtual bool isEmbeddedObject() const { return false; }
isFieldset()324     virtual bool isFieldset() const { return false; }
isFileUploadButton()325     virtual bool isFileUploadButton() const { return false; }
isHeading()326     virtual bool isHeading() const { return false; }
isImage()327     virtual bool isImage() const { return false; }
isImageMapLink()328     virtual bool isImageMapLink() const { return false; }
isInputImage()329     virtual bool isInputImage() const { return false; }
330     bool isLandmarkRelated() const;
isLink()331     virtual bool isLink() const { return false; }
isList()332     virtual bool isList() const { return false; }
isListItem()333     bool isListItem() const { return roleValue() == ListItemRole; }
isListBoxOption()334     virtual bool isListBoxOption() const { return false; }
isMenu()335     virtual bool isMenu() const { return false; }
isMenuButton()336     virtual bool isMenuButton() const { return false; }
isMenuList()337     virtual bool isMenuList() const { return false; }
isMenuListOption()338     virtual bool isMenuListOption() const { return false; }
isMenuListPopup()339     virtual bool isMenuListPopup() const { return false; }
340     bool isMenuRelated() const;
isMockObject()341     virtual bool isMockObject() const { return false; }
isNativeSpinButton()342     virtual bool isNativeSpinButton() const { return false; }
isNativeTextControl()343     virtual bool isNativeTextControl() const { return false; } // input or textarea
isNonNativeTextControl()344     virtual bool isNonNativeTextControl() const { return false; } // contenteditable or role=textbox
isPasswordField()345     virtual bool isPasswordField() const { return false; }
isProgressIndicator()346     virtual bool isProgressIndicator() const { return false; }
isRadioButton()347     bool isRadioButton() const { return roleValue() == RadioButtonRole; }
isScrollbar()348     bool isScrollbar() const { return roleValue() == ScrollBarRole; }
isSlider()349     virtual bool isSlider() const { return false; }
isSpinButton()350     virtual bool isSpinButton() const { return roleValue() == SpinButtonRole; }
isSpinButtonPart()351     virtual bool isSpinButtonPart() const { return false; }
isTabItem()352     bool isTabItem() const { return roleValue() == TabRole; }
isTableCell()353     virtual bool isTableCell() const { return false; }
isTableRow()354     virtual bool isTableRow() const { return false; }
isTableCol()355     virtual bool isTableCol() const { return false; }
356     bool isTextControl() const;
isTree()357     bool isTree() const { return roleValue() == TreeRole; }
isTreeItem()358     bool isTreeItem() const { return roleValue() == TreeItemRole; }
isWebArea()359     bool isWebArea() const { return roleValue() == WebAreaRole; }
360 
361     // Check object state.
isChecked()362     virtual bool isChecked() const { return false; }
363     virtual bool isClickable() const;
isCollapsed()364     virtual bool isCollapsed() const { return false; }
isEnabled()365     virtual bool isEnabled() const { return false; }
366     bool isExpanded() const;
isFocused()367     virtual bool isFocused() const { return false; }
isHovered()368     virtual bool isHovered() const { return false; }
isIndeterminate()369     virtual bool isIndeterminate() const { return false; }
isLinked()370     virtual bool isLinked() const { return false; }
isLoaded()371     virtual bool isLoaded() const { return false; }
isMultiSelectable()372     virtual bool isMultiSelectable() const { return false; }
isOffScreen()373     virtual bool isOffScreen() const { return false; }
isPressed()374     virtual bool isPressed() const { return false; }
isReadOnly()375     virtual bool isReadOnly() const { return false; }
isRequired()376     virtual bool isRequired() const { return false; }
isSelected()377     virtual bool isSelected() const { return false; }
isSelectedOptionActive()378     virtual bool isSelectedOptionActive() const { return false; }
isVisible()379     virtual bool isVisible() const { return true; }
isVisited()380     virtual bool isVisited() const { return false; }
381 
382     // Check whether certain properties can be modified.
canSetFocusAttribute()383     virtual bool canSetFocusAttribute() const { return false; }
canSetValueAttribute()384     virtual bool canSetValueAttribute() const { return false; }
canSetSelectedAttribute()385     virtual bool canSetSelectedAttribute() const { return false; }
386 
387     // Whether objects are ignored, i.e. not included in the tree.
388     bool accessibilityIsIgnored() const;
389     bool accessibilityIsIgnoredByDefault() const;
390     AXObjectInclusion accessibilityPlatformIncludesObject() const;
391     virtual AXObjectInclusion defaultObjectInclusion() const;
392     bool isInertOrAriaHidden() const;
393     bool lastKnownIsIgnoredValue();
394     void setLastKnownIsIgnoredValue(bool);
395 
396     // Properties of static elements.
accessKey()397     virtual const AtomicString& accessKey() const { return nullAtom; }
canvasHasFallbackContent()398     virtual bool canvasHasFallbackContent() const { return false; }
exposesTitleUIElement()399     virtual bool exposesTitleUIElement() const { return true; }
headingLevel()400     virtual int headingLevel() const { return 0; }
401     // 1-based, to match the aria-level spec.
hierarchicalLevel()402     virtual unsigned hierarchicalLevel() const { return 0; }
403     virtual AccessibilityOrientation orientation() const;
text()404     virtual String text() const { return String(); }
textLength()405     virtual int textLength() const { return 0; }
titleUIElement()406     virtual AXObject* titleUIElement() const { return 0; }
url()407     virtual KURL url() const { return KURL(); }
408 
409     // For an inline text box.
textDirection()410     virtual AccessibilityTextDirection textDirection() const { return AccessibilityTextDirectionLeftToRight; }
411     // The integer horizontal pixel offset of each character in the string; negative values for RTL.
textCharacterOffsets(Vector<int> &)412     virtual void textCharacterOffsets(Vector<int>&) const { }
413     // The start and end character offset of each word in the inline text box.
wordBoundaries(Vector<PlainTextRange> & words)414     virtual void wordBoundaries(Vector<PlainTextRange>& words) const { }
415 
416     // Properties of interactive elements.
417     virtual String actionVerb() const;
418     virtual AccessibilityButtonState checkboxOrRadioValue() const;
colorValue(int & r,int & g,int & b)419     virtual void colorValue(int& r, int& g, int& b) const { r = 0; g = 0; b = 0; }
valueDescription()420     virtual String valueDescription() const { return String(); }
valueForRange()421     virtual float valueForRange() const { return 0.0f; }
maxValueForRange()422     virtual float maxValueForRange() const { return 0.0f; }
minValueForRange()423     virtual float minValueForRange() const { return 0.0f; }
stringValue()424     virtual String stringValue() const { return String(); }
425 
426     // ARIA attributes.
activeDescendant()427     virtual AXObject* activeDescendant() const { return 0; }
ariaDescribedByAttribute()428     virtual String ariaDescribedByAttribute() const { return String(); }
ariaFlowToElements(AccessibilityChildrenVector &)429     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
ariaControlsElements(AccessibilityChildrenVector &)430     virtual void ariaControlsElements(AccessibilityChildrenVector&) const { }
ariaDescribedbyElements(AccessibilityChildrenVector & describedby)431     virtual void ariaDescribedbyElements(AccessibilityChildrenVector& describedby) const { };
ariaLabelledbyElements(AccessibilityChildrenVector & labelledby)432     virtual void ariaLabelledbyElements(AccessibilityChildrenVector& labelledby) const { };
ariaOwnsElements(AccessibilityChildrenVector & owns)433     virtual void ariaOwnsElements(AccessibilityChildrenVector& owns) const { };
ariaHasPopup()434     virtual bool ariaHasPopup() const { return false; }
435     bool ariaIsMultiline() const;
ariaLabeledByAttribute()436     virtual String ariaLabeledByAttribute() const { return String(); }
437     bool ariaPressedIsPresent() const;
ariaRoleAttribute()438     virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; }
ariaRoleHasPresentationalChildren()439     virtual bool ariaRoleHasPresentationalChildren() const { return false; }
isARIAGrabbed()440     virtual bool isARIAGrabbed() { return false; }
isPresentationalChildOfAriaRole()441     virtual bool isPresentationalChildOfAriaRole() const { return false; }
shouldFocusActiveDescendant()442     virtual bool shouldFocusActiveDescendant() const { return false; }
443     bool supportsARIAAttributes() const;
supportsARIADragging()444     virtual bool supportsARIADragging() const { return false; }
supportsARIADropping()445     virtual bool supportsARIADropping() const { return false; }
supportsARIAFlowTo()446     virtual bool supportsARIAFlowTo() const { return false; }
supportsARIAOwns()447     virtual bool supportsARIAOwns() const { return false; }
448     bool supportsRangeValue() const;
449 
450     // ARIA trees.
451     // Used by an ARIA tree to get all its rows.
452     void ariaTreeRows(AccessibilityChildrenVector&);
453 
454     // ARIA live-region features.
455     bool supportsARIALiveRegion() const;
ariaLiveRegionStatus()456     virtual const AtomicString& ariaLiveRegionStatus() const { return nullAtom; }
ariaLiveRegionRelevant()457     virtual const AtomicString& ariaLiveRegionRelevant() const { return nullAtom; }
ariaLiveRegionAtomic()458     virtual bool ariaLiveRegionAtomic() const { return false; }
ariaLiveRegionBusy()459     virtual bool ariaLiveRegionBusy() const { return false; }
460 
461     // Accessibility Text.
textUnderElement()462     virtual String textUnderElement() const { return String(); }
463 
464     // Accessibility Text - (To be deprecated).
accessibilityDescription()465     virtual String accessibilityDescription() const { return String(); }
title()466     virtual String title() const { return String(); }
helpText()467     virtual String helpText() const { return String(); }
468 
469     // Location and click point in frame-relative coordinates.
elementRect()470     virtual LayoutRect elementRect() const { return m_explicitElementRect; }
setElementRect(LayoutRect r)471     void setElementRect(LayoutRect r) { m_explicitElementRect = r; }
472     virtual void markCachedElementRectDirty() const;
473     virtual IntPoint clickPoint();
474 
475     // Hit testing.
476     // Called on the root AX object to return the deepest available element.
accessibilityHitTest(const IntPoint &)477     virtual AXObject* accessibilityHitTest(const IntPoint&) const { return 0; }
478     // Called on the AX object after the render tree determines which is the right AXRenderObject.
479     virtual AXObject* elementAccessibilityHitTest(const IntPoint&) const;
480 
481     // High-level accessibility tree access. Other modules should only use these functions.
482     const AccessibilityChildrenVector& children();
483     virtual AXObject* parentObject() const = 0;
484     AXObject* parentObjectUnignored() const;
parentObjectIfExists()485     virtual AXObject* parentObjectIfExists() const { return 0; }
486 
487     // Low-level accessibility tree exploration, only for use within the accessibility module.
firstChild()488     virtual AXObject* firstChild() const { return 0; }
nextSibling()489     virtual AXObject* nextSibling() const { return 0; }
490     static AXObject* firstAccessibleObjectFromNode(const Node*);
addChildren()491     virtual void addChildren() { }
canHaveChildren()492     virtual bool canHaveChildren() const { return true; }
hasChildren()493     bool hasChildren() const { return m_haveChildren; }
494     virtual void updateChildrenIfNecessary();
needsToUpdateChildren()495     virtual bool needsToUpdateChildren() const { return false; }
setNeedsToUpdateChildren()496     virtual void setNeedsToUpdateChildren() { }
497     virtual void clearChildren();
detachFromParent()498     virtual void detachFromParent() { }
observableObject()499     virtual AXObject* observableObject() const { return 0; }
scrollBar(AccessibilityOrientation)500     virtual AXObject* scrollBar(AccessibilityOrientation) { return 0; }
501 
502     // Properties of the object's owning document or page.
estimatedLoadingProgress()503     virtual double estimatedLoadingProgress() const { return 0; }
504     AXObject* focusedUIElement() const;
505 
506     // DOM and Render tree access.
node()507     virtual Node* node() const { return 0; }
renderer()508     virtual RenderObject* renderer() const { return 0; }
509     virtual Document* document() const;
510     virtual FrameView* documentFrameView() const;
anchorElement()511     virtual Element* anchorElement() const { return 0; }
actionElement()512     virtual Element* actionElement() const { return 0; }
widgetForAttachmentView()513     virtual Widget* widgetForAttachmentView() const { return 0; }
514     String language() const;
515     bool hasAttribute(const QualifiedName&) const;
516     const AtomicString& getAttribute(const QualifiedName&) const;
517 
518     // Selected text.
selectedTextRange()519     virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
520 
521     // Modify or take an action on an object.
increment()522     virtual void increment() { }
decrement()523     virtual void decrement() { }
performDefaultAction()524     bool performDefaultAction() const { return press(); }
525     virtual bool press() const;
526     // Make this object visible by scrolling as many nested scrollable views as needed.
527     void scrollToMakeVisible() const;
528     // Same, but if the whole object can't be made visible, try for this subrect, in local coordinates.
529     void scrollToMakeVisibleWithSubFocus(const IntRect&) const;
530     // Scroll this object to a given point in global coordinates of the top-level window.
531     void scrollToGlobalPoint(const IntPoint&) const;
setFocused(bool)532     virtual void setFocused(bool) { }
setSelected(bool)533     virtual void setSelected(bool) { }
setSelectedText(const String &)534     void setSelectedText(const String&) { }
setSelectedTextRange(const PlainTextRange &)535     virtual void setSelectedTextRange(const PlainTextRange&) { }
setValue(const String &)536     virtual void setValue(const String&) { }
setValue(float)537     virtual void setValue(float) { }
538 
539     // Notifications that this object may have changed.
childrenChanged()540     virtual void childrenChanged() { }
handleActiveDescendantChanged()541     virtual void handleActiveDescendantChanged() { }
handleAriaExpandedChanged()542     virtual void handleAriaExpandedChanged() { }
543     void notifyIfIgnoredValueChanged();
544     virtual void selectionChanged();
textChanged()545     virtual void textChanged() { }
updateAccessibilityRole()546     virtual void updateAccessibilityRole() { }
547 
548     // Text metrics. Most of these should be deprecated, needs major cleanup.
visiblePositionForIndex(int)549     virtual VisiblePosition visiblePositionForIndex(int) const { return VisiblePosition(); }
550     int lineForPosition(const VisiblePosition&) const;
index(const VisiblePosition &)551     virtual int index(const VisiblePosition&) const { return -1; }
lineBreaks(Vector<int> &)552     virtual void lineBreaks(Vector<int>&) const { }
553 
554     // Static helper functions.
555     static bool isARIAControl(AccessibilityRole);
556     static bool isARIAInput(AccessibilityRole);
557     static AccessibilityRole ariaRoleToWebCoreRole(const String&);
558     static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&);
559 
560 protected:
561     AXID m_id;
562     AccessibilityChildrenVector m_children;
563     mutable bool m_haveChildren;
564     AccessibilityRole m_role;
565     AXObjectInclusion m_lastKnownIsIgnoredValue;
566     LayoutRect m_explicitElementRect;
567 
computeAccessibilityIsIgnored()568     virtual bool computeAccessibilityIsIgnored() const { return true; }
569 
570     // If this object itself scrolls, return its ScrollableArea.
getScrollableAreaIfScrollable()571     virtual ScrollableArea* getScrollableAreaIfScrollable() const { return 0; }
scrollTo(const IntPoint &)572     virtual void scrollTo(const IntPoint&) const { }
573 
574     AccessibilityRole buttonRoleType() const;
575 
allowsTextRanges()576     bool allowsTextRanges() const { return isTextControl(); }
getLengthForTextRange()577     unsigned getLengthForTextRange() const { return text().length(); }
578 
579     bool m_detached;
580 };
581 
582 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \
583     DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.predicate)
584 
585 } // namespace blink
586 
587 #endif // AXObject_h
588