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