• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008, 2009 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 AccessibilityObject_h
31 #define AccessibilityObject_h
32 
33 #include "IntRect.h"
34 #include "Range.h"
35 #include "VisiblePosition.h"
36 #include "VisibleSelection.h"
37 #include <wtf/Platform.h>
38 #include <wtf/RefPtr.h>
39 #include <wtf/Vector.h>
40 
41 #if PLATFORM(MAC)
42 #include <wtf/RetainPtr.h>
43 #elif PLATFORM(WIN) && !OS(WINCE)
44 #include "AccessibilityObjectWrapperWin.h"
45 #include "COMPtr.h"
46 #elif PLATFORM(CHROMIUM)
47 #include "AccessibilityObjectWrapper.h"
48 #endif
49 
50 typedef struct _NSRange NSRange;
51 
52 #ifdef __OBJC__
53 @class AccessibilityObjectWrapper;
54 @class NSArray;
55 @class NSAttributedString;
56 @class NSData;
57 @class NSMutableAttributedString;
58 @class NSString;
59 @class NSValue;
60 @class NSView;
61 #else
62 class NSArray;
63 class NSAttributedString;
64 class NSData;
65 class NSMutableAttributedString;
66 class NSString;
67 class NSValue;
68 class NSView;
69 #if PLATFORM(GTK)
70 typedef struct _AtkObject AtkObject;
71 typedef struct _AtkObject AccessibilityObjectWrapper;
72 #else
73 class AccessibilityObjectWrapper;
74 #endif
75 #endif
76 
77 namespace WebCore {
78 
79 class AXObjectCache;
80 class Element;
81 class Frame;
82 class FrameView;
83 class HTMLAnchorElement;
84 class HTMLAreaElement;
85 class IntPoint;
86 class IntSize;
87 class Node;
88 class RenderObject;
89 class RenderListItem;
90 class VisibleSelection;
91 class String;
92 class Widget;
93 
94 typedef unsigned AXID;
95 
96 enum AccessibilityRole {
97     UnknownRole = 1,
98     ButtonRole,
99     RadioButtonRole,
100     CheckBoxRole,
101     SliderRole,
102     TabGroupRole,
103     TextFieldRole,
104     StaticTextRole,
105     TextAreaRole,
106     ScrollAreaRole,
107     PopUpButtonRole,
108     MenuButtonRole,
109     TableRole,
110     ApplicationRole,
111     GroupRole,
112     RadioGroupRole,
113     ListRole,
114     ScrollBarRole,
115     ValueIndicatorRole,
116     ImageRole,
117     MenuBarRole,
118     MenuRole,
119     MenuItemRole,
120     ColumnRole,
121     RowRole,
122     ToolbarRole,
123     BusyIndicatorRole,
124     ProgressIndicatorRole,
125     WindowRole,
126     DrawerRole,
127     SystemWideRole,
128     OutlineRole,
129     IncrementorRole,
130     BrowserRole,
131     ComboBoxRole,
132     SplitGroupRole,
133     SplitterRole,
134     ColorWellRole,
135     GrowAreaRole,
136     SheetRole,
137     HelpTagRole,
138     MatteRole,
139     RulerRole,
140     RulerMarkerRole,
141     LinkRole,
142     DisclosureTriangleRole,
143     GridRole,
144     CellRole,
145     ColumnHeaderRole,
146     RowHeaderRole,
147     // AppKit includes SortButtonRole but it is misnamed and really a subrole of ButtonRole so we do not include it here.
148 
149     // WebCore-specific roles
150     WebCoreLinkRole,
151     ImageMapLinkRole,
152     ImageMapRole,
153     ListMarkerRole,
154     WebAreaRole,
155     HeadingRole,
156     ListBoxRole,
157     ListBoxOptionRole,
158     TableHeaderContainerRole,
159     DefinitionListTermRole,
160     DefinitionListDefinitionRole,
161     AnnotationRole,
162     SliderThumbRole,
163     IgnoredRole,
164     TabRole,
165     TabListRole,
166     TabPanelRole,
167     TreeRole,
168     TreeGridRole,
169     TreeItemRole,
170     DirectoryRole,
171     EditableTextRole,
172     ListItemRole,
173     MenuListPopupRole,
174     MenuListOptionRole,
175 
176     // ARIA Grouping roles
177     LandmarkApplicationRole,
178     LandmarkBannerRole,
179     LandmarkComplementaryRole,
180     LandmarkContentInfoRole,
181     LandmarkMainRole,
182     LandmarkNavigationRole,
183     LandmarkSearchRole,
184 
185     ApplicationAlertRole,
186     ApplicationAlertDialogRole,
187     ApplicationDialogRole,
188     ApplicationLogRole,
189     ApplicationMarqueeRole,
190     ApplicationStatusRole,
191     ApplicationTimerRole,
192 
193     DocumentRole,
194     DocumentArticleRole,
195     DocumentMathRole,
196     DocumentNoteRole,
197     DocumentRegionRole,
198 
199     UserInterfaceTooltipRole
200 };
201 
202 enum AccessibilityOrientation {
203     AccessibilityOrientationVertical,
204     AccessibilityOrientationHorizontal,
205 };
206 
207 enum AccessibilityObjectPlatformInclusion {
208     IncludeObject,
209     IgnoreObject,
210     DefaultBehavior,
211 };
212 
213 struct VisiblePositionRange {
214 
215     VisiblePosition start;
216     VisiblePosition end;
217 
VisiblePositionRangeVisiblePositionRange218     VisiblePositionRange() {}
219 
VisiblePositionRangeVisiblePositionRange220     VisiblePositionRange(const VisiblePosition& s, const VisiblePosition& e)
221         : start(s)
222         , end(e)
223     { }
224 
isNullVisiblePositionRange225     bool isNull() const { return start.isNull() || end.isNull(); }
226 };
227 
228 struct PlainTextRange {
229 
230     unsigned start;
231     unsigned length;
232 
PlainTextRangePlainTextRange233     PlainTextRange()
234         : start(0)
235         , length(0)
236     { }
237 
PlainTextRangePlainTextRange238     PlainTextRange(unsigned s, unsigned l)
239         : start(s)
240         , length(l)
241     { }
242 
isNullPlainTextRange243     bool isNull() const { return !start && !length; }
244 };
245 
246 class AccessibilityObject : public RefCounted<AccessibilityObject> {
247 protected:
248     AccessibilityObject();
249 public:
250     virtual ~AccessibilityObject();
251     virtual void detach();
252 
253     typedef Vector<RefPtr<AccessibilityObject> > AccessibilityChildrenVector;
254 
isAccessibilityRenderObject()255     virtual bool isAccessibilityRenderObject() const { return false; }
isAnchor()256     virtual bool isAnchor() const { return false; }
isAttachment()257     virtual bool isAttachment() const { return false; }
isHeading()258     virtual bool isHeading() const { return false; }
isLink()259     virtual bool isLink() const { return false; }
isImage()260     virtual bool isImage() const { return false; }
isNativeImage()261     virtual bool isNativeImage() const { return false; }
isImageButton()262     virtual bool isImageButton() const { return false; }
isPasswordField()263     virtual bool isPasswordField() const { return false; }
isTextControl()264     virtual bool isTextControl() const { return false; }
isNativeTextControl()265     virtual bool isNativeTextControl() const { return false; }
isWebArea()266     virtual bool isWebArea() const { return false; }
isCheckboxOrRadio()267     virtual bool isCheckboxOrRadio() const { return false; }
isListBox()268     virtual bool isListBox() const { return roleValue() == ListBoxRole; }
isMediaTimeline()269     virtual bool isMediaTimeline() const { return false; }
isMenuRelated()270     virtual bool isMenuRelated() const { return false; }
isMenu()271     virtual bool isMenu() const { return false; }
isMenuBar()272     virtual bool isMenuBar() const { return false; }
isMenuButton()273     virtual bool isMenuButton() const { return false; }
isMenuItem()274     virtual bool isMenuItem() const { return false; }
isFileUploadButton()275     virtual bool isFileUploadButton() const { return false; }
isInputImage()276     virtual bool isInputImage() const { return false; }
isProgressIndicator()277     virtual bool isProgressIndicator() const { return false; }
isSlider()278     virtual bool isSlider() const { return false; }
isControl()279     virtual bool isControl() const { return false; }
isList()280     virtual bool isList() const { return false; }
isDataTable()281     virtual bool isDataTable() const { return false; }
isTableRow()282     virtual bool isTableRow() const { return false; }
isTableColumn()283     virtual bool isTableColumn() const { return false; }
isTableCell()284     virtual bool isTableCell() const { return false; }
isFieldset()285     virtual bool isFieldset() const { return false; }
isGroup()286     virtual bool isGroup() const { return false; }
isARIATreeGridRow()287     virtual bool isARIATreeGridRow() const { return false; }
isImageMapLink()288     virtual bool isImageMapLink() const { return false; }
isMenuList()289     virtual bool isMenuList() const { return false; }
isMenuListPopup()290     virtual bool isMenuListPopup() const { return false; }
isMenuListOption()291     virtual bool isMenuListOption() const { return false; }
isTabList()292     bool isTabList() const { return roleValue() == TabListRole; }
isTabItem()293     bool isTabItem() const { return roleValue() == TabRole; }
isRadioGroup()294     bool isRadioGroup() const { return roleValue() == RadioGroupRole; }
isComboBox()295     bool isComboBox() const { return roleValue() == ComboBoxRole; }
isTree()296     bool isTree() const { return roleValue() == TreeRole; }
isTreeItem()297     bool isTreeItem() const { return roleValue() == TreeItemRole; }
isScrollbar()298     bool isScrollbar() const { return roleValue() == ScrollBarRole; }
isButton()299     bool isButton() const { return roleValue() == ButtonRole; }
300 
isChecked()301     virtual bool isChecked() const { return false; }
isEnabled()302     virtual bool isEnabled() const { return false; }
isSelected()303     virtual bool isSelected() const { return false; }
isFocused()304     virtual bool isFocused() const { return false; }
isHovered()305     virtual bool isHovered() const { return false; }
isIndeterminate()306     virtual bool isIndeterminate() const { return false; }
isLoaded()307     virtual bool isLoaded() const { return false; }
isMultiSelectable()308     virtual bool isMultiSelectable() const { return false; }
isOffScreen()309     virtual bool isOffScreen() const { return false; }
isPressed()310     virtual bool isPressed() const { return false; }
isReadOnly()311     virtual bool isReadOnly() const { return false; }
isVisited()312     virtual bool isVisited() const { return false; }
isRequired()313     virtual bool isRequired() const { return false; }
isLinked()314     virtual bool isLinked() const { return false; }
isExpanded()315     virtual bool isExpanded() const { return false; }
isVisible()316     virtual bool isVisible() const { return true; }
isCollapsed()317     virtual bool isCollapsed() const { return false; }
setIsExpanded(bool)318     virtual void setIsExpanded(bool) { }
319 
canSetFocusAttribute()320     virtual bool canSetFocusAttribute() const { return false; }
canSetTextRangeAttributes()321     virtual bool canSetTextRangeAttributes() const { return false; }
canSetValueAttribute()322     virtual bool canSetValueAttribute() const { return false; }
canSetSelectedAttribute()323     virtual bool canSetSelectedAttribute() const { return false; }
canSetSelectedChildrenAttribute()324     virtual bool canSetSelectedChildrenAttribute() const { return false; }
canSetExpandedAttribute()325     virtual bool canSetExpandedAttribute() const { return false; }
326 
hasIntValue()327     virtual bool hasIntValue() const { return false; }
328 
accessibilityShouldUseUniqueId()329     bool accessibilityShouldUseUniqueId() const { return true; }
accessibilityIsIgnored()330     virtual bool accessibilityIsIgnored() const  { return true; }
331 
headingLevel()332     virtual int headingLevel() const { return 0; }
intValue()333     virtual int intValue() const { return 0; }
valueDescription()334     virtual String valueDescription() const { return String(); }
valueForRange()335     virtual float valueForRange() const { return 0.0f; }
maxValueForRange()336     virtual float maxValueForRange() const { return 0.0f; }
minValueForRange()337     virtual float minValueForRange() const { return 0.0f; }
selectedRadioButton()338     virtual AccessibilityObject* selectedRadioButton() { return 0; }
selectedTabItem()339     virtual AccessibilityObject* selectedTabItem() { return 0; }
layoutCount()340     virtual int layoutCount() const { return 0; }
estimatedLoadingProgress()341     virtual double estimatedLoadingProgress() const { return 0; }
342     static bool isARIAControl(AccessibilityRole);
343     static bool isARIAInput(AccessibilityRole);
supportsARIAOwns()344     virtual bool supportsARIAOwns() const { return false; }
ariaOwnsElements(AccessibilityChildrenVector &)345     virtual void ariaOwnsElements(AccessibilityChildrenVector&) const { }
supportsARIAFlowTo()346     virtual bool supportsARIAFlowTo() const { return false; }
ariaFlowToElements(AccessibilityChildrenVector &)347     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
348 
349     // ARIA drag and drop
supportsARIADropping()350     virtual bool supportsARIADropping() { return false; }
supportsARIADragging()351     virtual bool supportsARIADragging() { return false; }
isARIAGrabbed()352     virtual bool isARIAGrabbed() { return false; }
setARIAGrabbed(bool)353     virtual void setARIAGrabbed(bool) { }
determineARIADropEffects(Vector<String> &)354     virtual void determineARIADropEffects(Vector<String>&) { }
355 
doAccessibilityHitTest(const IntPoint &)356     virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const { return 0; }
focusedUIElement()357     virtual AccessibilityObject* focusedUIElement() const { return 0; }
358 
firstChild()359     virtual AccessibilityObject* firstChild() const { return 0; }
lastChild()360     virtual AccessibilityObject* lastChild() const { return 0; }
previousSibling()361     virtual AccessibilityObject* previousSibling() const { return 0; }
nextSibling()362     virtual AccessibilityObject* nextSibling() const { return 0; }
363     virtual AccessibilityObject* parentObject() const = 0;
364     virtual AccessibilityObject* parentObjectUnignored() const;
parentObjectIfExists()365     virtual AccessibilityObject* parentObjectIfExists() const { return 0; }
366     static AccessibilityObject* firstAccessibleObjectFromNode(const Node*);
367 
observableObject()368     virtual AccessibilityObject* observableObject() const { return 0; }
linkedUIElements(AccessibilityChildrenVector &)369     virtual void linkedUIElements(AccessibilityChildrenVector&) const { }
titleUIElement()370     virtual AccessibilityObject* titleUIElement() const { return 0; }
exposesTitleUIElement()371     virtual bool exposesTitleUIElement() const { return true; }
correspondingControlForLabelElement()372     virtual AccessibilityObject* correspondingControlForLabelElement() const { return 0; }
373 
ariaRoleAttribute()374     virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; }
isPresentationalChildOfAriaRole()375     virtual bool isPresentationalChildOfAriaRole() const { return false; }
ariaRoleHasPresentationalChildren()376     virtual bool ariaRoleHasPresentationalChildren() const { return false; }
377 
setRoleValue(AccessibilityRole role)378     void setRoleValue(AccessibilityRole role) { m_role = role; }
roleValue()379     virtual AccessibilityRole roleValue() const { return m_role; }
ariaLabeledByAttribute()380     virtual String ariaLabeledByAttribute() const { return String(); }
ariaDescribedByAttribute()381     virtual String ariaDescribedByAttribute() const { return String(); }
accessibilityDescription()382     virtual String accessibilityDescription() const { return String(); }
ariaSelectedTextDOMRange()383     virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const { return 0; }
384 
axObjectCache()385     virtual AXObjectCache* axObjectCache() const { return 0; }
axObjectID()386     AXID axObjectID() const { return m_id; }
setAXObjectID(AXID axObjectID)387     void setAXObjectID(AXID axObjectID) { m_id = axObjectID; }
388 
389     static AccessibilityObject* anchorElementForNode(Node*);
anchorElement()390     virtual Element* anchorElement() const { return 0; }
actionElement()391     virtual Element* actionElement() const { return 0; }
boundingBoxRect()392     virtual IntRect boundingBoxRect() const { return IntRect(); }
393     virtual IntRect elementRect() const = 0;
394     virtual IntSize size() const = 0;
395     virtual IntPoint clickPoint() const;
396 
selectedTextRange()397     virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
selectionStart()398     unsigned selectionStart() const { return selectedTextRange().start; }
selectionEnd()399     unsigned selectionEnd() const { return selectedTextRange().length; }
400 
url()401     virtual KURL url() const { return KURL(); }
selection()402     virtual VisibleSelection selection() const { return VisibleSelection(); }
stringValue()403     virtual String stringValue() const { return String(); }
title()404     virtual String title() const { return String(); }
helpText()405     virtual String helpText() const { return String(); }
textUnderElement()406     virtual String textUnderElement() const { return String(); }
text()407     virtual String text() const { return String(); }
textLength()408     virtual int textLength() const { return 0; }
selectedText()409     virtual String selectedText() const { return String(); }
accessKey()410     virtual const AtomicString& accessKey() const { return nullAtom; }
411     const String& actionVerb() const;
widget()412     virtual Widget* widget() const { return 0; }
widgetForAttachmentView()413     virtual Widget* widgetForAttachmentView() const { return 0; }
document()414     virtual Document* document() const { return 0; }
topDocumentFrameView()415     virtual FrameView* topDocumentFrameView() const { return 0; }
416     virtual FrameView* documentFrameView() const;
417     virtual String language() const;
hierarchicalLevel()418     virtual unsigned hierarchicalLevel() const { return 0; }
419 
setFocused(bool)420     virtual void setFocused(bool) { }
setSelectedText(const String &)421     virtual void setSelectedText(const String&) { }
setSelectedTextRange(const PlainTextRange &)422     virtual void setSelectedTextRange(const PlainTextRange&) { }
setValue(const String &)423     virtual void setValue(const String&) { }
setSelected(bool)424     virtual void setSelected(bool) { }
setSelectedRows(AccessibilityChildrenVector &)425     virtual void setSelectedRows(AccessibilityChildrenVector&) { }
426 
makeRangeVisible(const PlainTextRange &)427     virtual void makeRangeVisible(const PlainTextRange&) { }
428     virtual bool press() const;
performDefaultAction()429     bool performDefaultAction() const { return press(); }
430 
431     virtual AccessibilityOrientation orientation() const;
increment()432     virtual void increment() { }
decrement()433     virtual void decrement() { }
434 
childrenChanged()435     virtual void childrenChanged() { }
contentChanged()436     virtual void contentChanged() { }
children()437     virtual const AccessibilityChildrenVector& children() { return m_children; }
addChildren()438     virtual void addChildren() { }
canHaveChildren()439     virtual bool canHaveChildren() const { return true; }
hasChildren()440     virtual bool hasChildren() const { return m_haveChildren; }
selectedChildren(AccessibilityChildrenVector &)441     virtual void selectedChildren(AccessibilityChildrenVector&) { }
visibleChildren(AccessibilityChildrenVector &)442     virtual void visibleChildren(AccessibilityChildrenVector&) { }
tabChildren(AccessibilityChildrenVector &)443     virtual void tabChildren(AccessibilityChildrenVector&) { }
shouldFocusActiveDescendant()444     virtual bool shouldFocusActiveDescendant() const { return false; }
activeDescendant()445     virtual AccessibilityObject* activeDescendant() const { return 0; }
handleActiveDescendantChanged()446     virtual void handleActiveDescendantChanged() { }
447 
448     static AccessibilityRole ariaRoleToWebCoreRole(const String&);
449 
visiblePositionRange()450     virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); }
visiblePositionRangeForLine(unsigned)451     virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const { return VisiblePositionRange(); }
452 
453     VisiblePositionRange visiblePositionRangeForUnorderedPositions(const VisiblePosition&, const VisiblePosition&) const;
454     VisiblePositionRange positionOfLeftWord(const VisiblePosition&) const;
455     VisiblePositionRange positionOfRightWord(const VisiblePosition&) const;
456     VisiblePositionRange leftLineVisiblePositionRange(const VisiblePosition&) const;
457     VisiblePositionRange rightLineVisiblePositionRange(const VisiblePosition&) const;
458     VisiblePositionRange sentenceForPosition(const VisiblePosition&) const;
459     VisiblePositionRange paragraphForPosition(const VisiblePosition&) const;
460     VisiblePositionRange styleRangeForPosition(const VisiblePosition&) const;
461     VisiblePositionRange visiblePositionRangeForRange(const PlainTextRange&) const;
462 
463     String stringForVisiblePositionRange(const VisiblePositionRange&) const;
boundsForVisiblePositionRange(const VisiblePositionRange &)464     virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return IntRect(); }
465     int lengthForVisiblePositionRange(const VisiblePositionRange&) const;
setSelectedVisiblePositionRange(const VisiblePositionRange &)466     virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const { }
467 
visiblePositionForPoint(const IntPoint &)468     virtual VisiblePosition visiblePositionForPoint(const IntPoint&) const { return VisiblePosition(); }
nextVisiblePosition(const VisiblePosition & visiblePos)469     VisiblePosition nextVisiblePosition(const VisiblePosition& visiblePos) const { return visiblePos.next(); }
previousVisiblePosition(const VisiblePosition & visiblePos)470     VisiblePosition previousVisiblePosition(const VisiblePosition& visiblePos) const { return visiblePos.previous(); }
471     VisiblePosition nextWordEnd(const VisiblePosition&) const;
472     VisiblePosition previousWordStart(const VisiblePosition&) const;
473     VisiblePosition nextLineEndPosition(const VisiblePosition&) const;
474     VisiblePosition previousLineStartPosition(const VisiblePosition&) const;
475     VisiblePosition nextSentenceEndPosition(const VisiblePosition&) const;
476     VisiblePosition previousSentenceStartPosition(const VisiblePosition&) const;
477     VisiblePosition nextParagraphEndPosition(const VisiblePosition&) const;
478     VisiblePosition previousParagraphStartPosition(const VisiblePosition&) const;
visiblePositionForIndex(unsigned,bool)479     virtual VisiblePosition visiblePositionForIndex(unsigned, bool /*lastIndexOK */) const { return VisiblePosition(); }
480 
visiblePositionForIndex(int)481     virtual VisiblePosition visiblePositionForIndex(int) const { return VisiblePosition(); }
indexForVisiblePosition(const VisiblePosition &)482     virtual int indexForVisiblePosition(const VisiblePosition&) const { return 0; }
483 
484     AccessibilityObject* accessibilityObjectForPosition(const VisiblePosition&) const;
485     int lineForPosition(const VisiblePosition&) const;
486     PlainTextRange plainTextRangeForVisiblePositionRange(const VisiblePositionRange&) const;
index(const VisiblePosition &)487     virtual int index(const VisiblePosition&) const { return -1; }
488 
doAXRangeForLine(unsigned)489     virtual PlainTextRange doAXRangeForLine(unsigned) const { return PlainTextRange(); }
490     PlainTextRange doAXRangeForPosition(const IntPoint&) const;
doAXRangeForIndex(unsigned)491     virtual PlainTextRange doAXRangeForIndex(unsigned) const { return PlainTextRange(); }
492     PlainTextRange doAXStyleRangeForIndex(unsigned) const;
493 
doAXStringForRange(const PlainTextRange &)494     virtual String doAXStringForRange(const PlainTextRange&) const { return String(); }
doAXBoundsForRange(const PlainTextRange &)495     virtual IntRect doAXBoundsForRange(const PlainTextRange&) const { return IntRect(); }
496     String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const;
497 
498     unsigned doAXLineForIndex(unsigned);
499 
stringValueForMSAA()500     virtual String stringValueForMSAA() const { return String(); }
stringRoleForMSAA()501     virtual String stringRoleForMSAA() const { return String(); }
nameForMSAA()502     virtual String nameForMSAA() const { return String(); }
descriptionForMSAA()503     virtual String descriptionForMSAA() const { return String(); }
roleValueForMSAA()504     virtual AccessibilityRole roleValueForMSAA() const { return roleValue(); }
505 
506     // Used by an ARIA tree to get all its rows.
507     void ariaTreeRows(AccessibilityChildrenVector&);
508     // Used by an ARIA tree item to get all of its direct rows that it can disclose.
509     void ariaTreeItemDisclosedRows(AccessibilityChildrenVector&);
510     // Used by an ARIA tree item to get only its content, and not its child tree items and groups.
511     void ariaTreeItemContent(AccessibilityChildrenVector&);
512 
513     // ARIA live-region features.
514     bool supportsARIALiveRegion() const;
515     bool isInsideARIALiveRegion() const;
ariaLiveRegionStatus()516     virtual const AtomicString& ariaLiveRegionStatus() const { return nullAtom; }
ariaLiveRegionRelevant()517     virtual const AtomicString& ariaLiveRegionRelevant() const { return nullAtom; }
ariaLiveRegionAtomic()518     virtual bool ariaLiveRegionAtomic() const { return false; }
ariaLiveRegionBusy()519     virtual bool ariaLiveRegionBusy() const { return false; }
520 
521 #if HAVE(ACCESSIBILITY)
522 #if PLATFORM(GTK)
523     AccessibilityObjectWrapper* wrapper() const;
524     void setWrapper(AccessibilityObjectWrapper*);
525 #else
wrapper()526     AccessibilityObjectWrapper* wrapper() const { return m_wrapper.get(); }
setWrapper(AccessibilityObjectWrapper * wrapper)527     void setWrapper(AccessibilityObjectWrapper* wrapper)
528     {
529         m_wrapper = wrapper;
530     }
531 #endif
532 #endif
533 
534     // a platform-specific method for determining if an attachment is ignored
535 #if HAVE(ACCESSIBILITY)
536     bool accessibilityIgnoreAttachment() const;
537 #else
accessibilityIgnoreAttachment()538     bool accessibilityIgnoreAttachment() const { return true; }
539 #endif
540 
541     // gives platforms the opportunity to indicate if and how an object should be included
542 #if HAVE(ACCESSIBILITY)
543     AccessibilityObjectPlatformInclusion accessibilityPlatformIncludesObject() const;
544 #else
accessibilityPlatformIncludesObject()545     AccessibilityObjectPlatformInclusion accessibilityPlatformIncludesObject() const { return DefaultBehavior; }
546 #endif
547 
548     // allows for an AccessibilityObject to update its render tree or perform
549     // other operations update type operations
updateBackingStore()550     virtual void updateBackingStore() { }
551 
552 protected:
553     AXID m_id;
554     AccessibilityChildrenVector m_children;
555     mutable bool m_haveChildren;
556     AccessibilityRole m_role;
557 
558     virtual void clearChildren();
isDetached()559     virtual bool isDetached() const { return true; }
560     RenderListItem* renderListItemContainerForNode(Node* node) const;
561 
562 #if PLATFORM(MAC)
563     RetainPtr<AccessibilityObjectWrapper> m_wrapper;
564 #elif PLATFORM(WIN) && !OS(WINCE)
565     COMPtr<AccessibilityObjectWrapper> m_wrapper;
566 #elif PLATFORM(GTK)
567     AtkObject* m_wrapper;
568 #elif PLATFORM(CHROMIUM)
569     RefPtr<AccessibilityObjectWrapper> m_wrapper;
570 #endif
571 };
572 
573 } // namespace WebCore
574 
575 #endif // AccessibilityObject_h
576