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