| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebAccessibilityObject_h | |
| 32 #define WebAccessibilityObject_h | |
| 33 | |
| 34 #include "../platform/WebCommon.h" | |
| 35 #include "../platform/WebPrivatePtr.h" | |
| 36 #include "../platform/WebVector.h" | |
| 37 #include "WebAccessibilityRole.h" | |
| 38 | |
| 39 #if WEBKIT_IMPLEMENTATION | |
| 40 namespace WTF { template <typename T> class PassRefPtr; } | |
| 41 #endif | |
| 42 | |
| 43 namespace WebCore { class AccessibilityObject; } | |
| 44 | |
| 45 namespace WebKit { | |
| 46 | |
| 47 class WebNode; | |
| 48 class WebDocument; | |
| 49 class WebString; | |
| 50 class WebURL; | |
| 51 struct WebPoint; | |
| 52 struct WebRect; | |
| 53 | |
| 54 // A container for passing around a reference to AccessibilityObject. | |
| 55 class WebAccessibilityObject { | |
| 56 public: | |
| 57 ~WebAccessibilityObject() { reset(); } | |
| 58 | |
| 59 WebAccessibilityObject() { } | |
| 60 WebAccessibilityObject(const WebAccessibilityObject& o) { assign(o); } | |
| 61 WebAccessibilityObject& operator=(const WebAccessibilityObject& o) | |
| 62 { | |
| 63 assign(o); | |
| 64 return *this; | |
| 65 } | |
| 66 | |
| 67 WEBKIT_EXPORT void reset(); | |
| 68 WEBKIT_EXPORT void assign(const WebAccessibilityObject&); | |
| 69 WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; | |
| 70 | |
| 71 bool isNull() const { return m_private.isNull(); } | |
| 72 // isDetached also checks for null, so it's safe to just call isDetached. | |
| 73 WEBKIT_EXPORT bool isDetached() const; | |
| 74 | |
| 75 // Static methods for enabling accessibility. | |
| 76 WEBKIT_EXPORT static void enableAccessibility(); | |
| 77 WEBKIT_EXPORT static bool accessibilityEnabled(); | |
| 78 | |
| 79 WEBKIT_EXPORT void startCachingComputedObjectAttributesUntilTreeMutates(); | |
| 80 WEBKIT_EXPORT void stopCachingComputedObjectAttributes(); | |
| 81 | |
| 82 WEBKIT_EXPORT int axID() const; | |
| 83 | |
| 84 // Update the underlying tree, and return true if this object is | |
| 85 // still valid (not detached). Note that calling this method | |
| 86 // can cause other WebAccessibilityObjects to become invalid, too, | |
| 87 // so always call isDetached if updateBackingStoreAndCheckValidity | |
| 88 // has been called on any object, or if any other WebCore code has run. | |
| 89 WEBKIT_EXPORT bool updateBackingStoreAndCheckValidity(); | |
| 90 | |
| 91 WEBKIT_EXPORT WebString accessibilityDescription() const; | |
| 92 WEBKIT_EXPORT unsigned childCount() const; | |
| 93 | |
| 94 WEBKIT_EXPORT WebAccessibilityObject childAt(unsigned) const; | |
| 95 WEBKIT_EXPORT WebAccessibilityObject firstChild() const; | |
| 96 WEBKIT_EXPORT WebAccessibilityObject focusedChild() const; | |
| 97 WEBKIT_EXPORT WebAccessibilityObject lastChild() const; | |
| 98 WEBKIT_EXPORT WebAccessibilityObject nextSibling() const; | |
| 99 WEBKIT_EXPORT WebAccessibilityObject parentObject() const; | |
| 100 WEBKIT_EXPORT WebAccessibilityObject previousSibling() const; | |
| 101 | |
| 102 WEBKIT_EXPORT bool isAnchor() const; | |
| 103 WEBKIT_EXPORT bool isAriaReadOnly() const; | |
| 104 WEBKIT_EXPORT bool isButtonStateMixed() const; | |
| 105 WEBKIT_EXPORT bool isChecked() const; | |
| 106 WEBKIT_EXPORT bool isCollapsed() const; | |
| 107 WEBKIT_EXPORT bool isControl() const; | |
| 108 WEBKIT_EXPORT bool isEnabled() const; | |
| 109 WEBKIT_EXPORT bool isFocused() const; | |
| 110 WEBKIT_EXPORT bool isHovered() const; | |
| 111 WEBKIT_EXPORT bool isIndeterminate() const; | |
| 112 WEBKIT_EXPORT bool isLinked() const; | |
| 113 WEBKIT_EXPORT bool isLoaded() const; | |
| 114 WEBKIT_EXPORT bool isMultiSelectable() const; | |
| 115 WEBKIT_EXPORT bool isOffScreen() const; | |
| 116 WEBKIT_EXPORT bool isPasswordField() const; | |
| 117 WEBKIT_EXPORT bool isPressed() const; | |
| 118 WEBKIT_EXPORT bool isReadOnly() const; | |
| 119 WEBKIT_EXPORT bool isRequired() const; | |
| 120 WEBKIT_EXPORT bool isSelected() const; | |
| 121 WEBKIT_EXPORT bool isSelectedOptionActive() const; | |
| 122 WEBKIT_EXPORT bool isVertical() const; | |
| 123 WEBKIT_EXPORT bool isVisible() const; | |
| 124 WEBKIT_EXPORT bool isVisited() const; | |
| 125 | |
| 126 WEBKIT_EXPORT WebString accessKey() const; | |
| 127 WEBKIT_EXPORT bool ariaHasPopup() const; | |
| 128 WEBKIT_EXPORT bool ariaLiveRegionAtomic() const; | |
| 129 WEBKIT_EXPORT bool ariaLiveRegionBusy() const; | |
| 130 WEBKIT_EXPORT WebString ariaLiveRegionRelevant() const; | |
| 131 WEBKIT_EXPORT WebString ariaLiveRegionStatus() const; | |
| 132 WEBKIT_EXPORT WebRect boundingBoxRect() const; | |
| 133 WEBKIT_EXPORT bool canvasHasFallbackContent() const; | |
| 134 WEBKIT_EXPORT WebPoint clickPoint() const; | |
| 135 WEBKIT_EXPORT void colorValue(int& r, int& g, int& b) const; | |
| 136 WEBKIT_EXPORT double estimatedLoadingProgress() const; | |
| 137 WEBKIT_EXPORT WebString helpText() const; | |
| 138 WEBKIT_EXPORT int headingLevel() const; | |
| 139 WEBKIT_EXPORT int hierarchicalLevel() const; | |
| 140 WEBKIT_EXPORT WebAccessibilityObject hitTest(const WebPoint&) const; | |
| 141 WEBKIT_EXPORT WebString keyboardShortcut() const; | |
| 142 WEBKIT_EXPORT WebAccessibilityRole roleValue() const; | |
| 143 WEBKIT_EXPORT unsigned selectionEnd() const; | |
| 144 WEBKIT_EXPORT unsigned selectionEndLineNumber() const; | |
| 145 WEBKIT_EXPORT unsigned selectionStart() const; | |
| 146 WEBKIT_EXPORT unsigned selectionStartLineNumber() const; | |
| 147 WEBKIT_EXPORT WebString stringValue() const; | |
| 148 WEBKIT_EXPORT WebString title() const; | |
| 149 WEBKIT_EXPORT WebAccessibilityObject titleUIElement() const; | |
| 150 WEBKIT_EXPORT WebURL url() const; | |
| 151 | |
| 152 WEBKIT_EXPORT bool supportsRangeValue() const; | |
| 153 WEBKIT_EXPORT WebString valueDescription() const; | |
| 154 WEBKIT_EXPORT float valueForRange() const; | |
| 155 WEBKIT_EXPORT float maxValueForRange() const; | |
| 156 WEBKIT_EXPORT float minValueForRange() const; | |
| 157 | |
| 158 WEBKIT_EXPORT WebNode node() const; | |
| 159 WEBKIT_EXPORT WebDocument document() const; | |
| 160 WEBKIT_EXPORT bool hasComputedStyle() const; | |
| 161 WEBKIT_EXPORT WebString computedStyleDisplay() const; | |
| 162 WEBKIT_EXPORT bool accessibilityIsIgnored() const; | |
| 163 WEBKIT_EXPORT bool lineBreaks(WebVector<int>&) const; | |
| 164 | |
| 165 // Actions | |
| 166 WEBKIT_EXPORT WebString actionVerb() const; // The verb corresponding to per
formDefaultAction. | |
| 167 WEBKIT_EXPORT bool canDecrement() const; | |
| 168 WEBKIT_EXPORT bool canIncrement() const; | |
| 169 WEBKIT_EXPORT bool canPress() const; | |
| 170 WEBKIT_EXPORT bool canSetFocusAttribute() const; | |
| 171 WEBKIT_EXPORT bool canSetSelectedAttribute() const; | |
| 172 WEBKIT_EXPORT bool canSetValueAttribute() const; | |
| 173 WEBKIT_EXPORT bool performDefaultAction() const; | |
| 174 WEBKIT_EXPORT bool press() const; | |
| 175 WEBKIT_EXPORT bool increment() const; | |
| 176 WEBKIT_EXPORT bool decrement() const; | |
| 177 WEBKIT_EXPORT void setFocused(bool) const; | |
| 178 WEBKIT_EXPORT void setSelectedTextRange(int selectionStart, int selectionEnd
) const; | |
| 179 | |
| 180 // For a table | |
| 181 WEBKIT_EXPORT unsigned columnCount() const; | |
| 182 WEBKIT_EXPORT unsigned rowCount() const; | |
| 183 WEBKIT_EXPORT WebAccessibilityObject cellForColumnAndRow(unsigned column, un
signed row) const; | |
| 184 WEBKIT_EXPORT WebAccessibilityObject headerContainerObject() const; | |
| 185 WEBKIT_EXPORT WebAccessibilityObject rowAtIndex(unsigned rowIndex) const; | |
| 186 WEBKIT_EXPORT WebAccessibilityObject columnAtIndex(unsigned columnIndex) con
st; | |
| 187 | |
| 188 // For a table row | |
| 189 WEBKIT_EXPORT unsigned rowIndex() const; | |
| 190 WEBKIT_EXPORT WebAccessibilityObject rowHeader() const; | |
| 191 | |
| 192 // For a table column | |
| 193 WEBKIT_EXPORT unsigned columnIndex() const; | |
| 194 WEBKIT_EXPORT WebAccessibilityObject columnHeader() const; | |
| 195 | |
| 196 // For a table cell | |
| 197 WEBKIT_EXPORT unsigned cellColumnIndex() const; | |
| 198 WEBKIT_EXPORT unsigned cellColumnSpan() const; | |
| 199 WEBKIT_EXPORT unsigned cellRowIndex() const; | |
| 200 WEBKIT_EXPORT unsigned cellRowSpan() const; | |
| 201 | |
| 202 // Make this object visible by scrolling as many nested scrollable views as
needed. | |
| 203 WEBKIT_EXPORT void scrollToMakeVisible() const; | |
| 204 // Same, but if the whole object can't be made visible, try for this subrect
, in local coordinates. | |
| 205 WEBKIT_EXPORT void scrollToMakeVisibleWithSubFocus(const WebRect&) const; | |
| 206 // Scroll this object to a given point in global coordinates of the top-leve
l window. | |
| 207 WEBKIT_EXPORT void scrollToGlobalPoint(const WebPoint&) const; | |
| 208 | |
| 209 #if WEBKIT_IMPLEMENTATION | |
| 210 WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&)
; | |
| 211 WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::Accessibili
tyObject>&); | |
| 212 operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const; | |
| 213 #endif | |
| 214 | |
| 215 private: | |
| 216 WebPrivatePtr<WebCore::AccessibilityObject> m_private; | |
| 217 }; | |
| 218 | |
| 219 } // namespace WebKit | |
| 220 | |
| 221 #endif | |
| OLD | NEW |