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