OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
(...skipping 11 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebAXObject_h | 31 #ifndef WebAXObject_h |
32 #define WebAXObject_h | 32 #define WebAXObject_h |
33 | 33 |
34 #include "WebAccessibilityObject.h" | 34 #include "../platform/WebCommon.h" |
| 35 #include "../platform/WebPrivatePtr.h" |
| 36 #include "../platform/WebVector.h" |
| 37 #include "WebAXEnums.h" |
| 38 |
| 39 #if WEBKIT_IMPLEMENTATION |
| 40 namespace WTF { template <typename T> class PassRefPtr; } |
| 41 #endif |
| 42 |
| 43 namespace WebCore { class AccessibilityObject; } |
35 | 44 |
36 namespace WebKit { | 45 namespace WebKit { |
37 | 46 |
38 // FIXME: rename WebAccessibilityObject to WebAXObject and get rid of this tempo
rary typedef (http://crbug.com/269034). | 47 class WebNode; |
39 typedef WebAccessibilityObject WebAXObject; | 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 WebAXObject { |
| 56 public: |
| 57 ~WebAXObject() { reset(); } |
| 58 |
| 59 WebAXObject() { } |
| 60 WebAXObject(const WebAXObject& o) { assign(o); } |
| 61 WebAXObject& operator=(const WebAXObject& o) |
| 62 { |
| 63 assign(o); |
| 64 return *this; |
| 65 } |
| 66 |
| 67 WEBKIT_EXPORT void reset(); |
| 68 WEBKIT_EXPORT void assign(const WebAXObject&); |
| 69 WEBKIT_EXPORT bool equals(const WebAXObject&) 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 WebAXObjects 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 WebAXObject childAt(unsigned) const; |
| 95 WEBKIT_EXPORT WebAXObject parentObject() const; |
| 96 |
| 97 WEBKIT_EXPORT bool isAnchor() const; |
| 98 WEBKIT_EXPORT bool isAriaReadOnly() const; |
| 99 WEBKIT_EXPORT bool isButtonStateMixed() const; |
| 100 WEBKIT_EXPORT bool isChecked() const; |
| 101 WEBKIT_EXPORT bool isClickable() const; |
| 102 WEBKIT_EXPORT bool isCollapsed() const; |
| 103 WEBKIT_EXPORT bool isControl() const; |
| 104 WEBKIT_EXPORT bool isEnabled() const; |
| 105 WEBKIT_EXPORT bool isFocused() const; |
| 106 WEBKIT_EXPORT bool isHovered() const; |
| 107 WEBKIT_EXPORT bool isIndeterminate() const; |
| 108 WEBKIT_EXPORT bool isLinked() const; |
| 109 WEBKIT_EXPORT bool isLoaded() const; |
| 110 WEBKIT_EXPORT bool isMultiSelectable() const; |
| 111 WEBKIT_EXPORT bool isOffScreen() const; |
| 112 WEBKIT_EXPORT bool isPasswordField() const; |
| 113 WEBKIT_EXPORT bool isPressed() const; |
| 114 WEBKIT_EXPORT bool isReadOnly() const; |
| 115 WEBKIT_EXPORT bool isRequired() const; |
| 116 WEBKIT_EXPORT bool isSelected() const; |
| 117 WEBKIT_EXPORT bool isSelectedOptionActive() const; |
| 118 WEBKIT_EXPORT bool isVertical() const; |
| 119 WEBKIT_EXPORT bool isVisible() const; |
| 120 WEBKIT_EXPORT bool isVisited() const; |
| 121 |
| 122 WEBKIT_EXPORT WebString accessKey() const; |
| 123 WEBKIT_EXPORT bool ariaHasPopup() const; |
| 124 WEBKIT_EXPORT bool ariaLiveRegionAtomic() const; |
| 125 WEBKIT_EXPORT bool ariaLiveRegionBusy() const; |
| 126 WEBKIT_EXPORT WebString ariaLiveRegionRelevant() const; |
| 127 WEBKIT_EXPORT WebString ariaLiveRegionStatus() const; |
| 128 WEBKIT_EXPORT WebRect boundingBoxRect() const; |
| 129 WEBKIT_EXPORT bool canvasHasFallbackContent() const; |
| 130 WEBKIT_EXPORT WebPoint clickPoint() const; |
| 131 WEBKIT_EXPORT void colorValue(int& r, int& g, int& b) const; |
| 132 WEBKIT_EXPORT double estimatedLoadingProgress() const; |
| 133 WEBKIT_EXPORT WebString helpText() const; |
| 134 WEBKIT_EXPORT int headingLevel() const; |
| 135 WEBKIT_EXPORT int hierarchicalLevel() const; |
| 136 WEBKIT_EXPORT WebAXObject hitTest(const WebPoint&) const; |
| 137 WEBKIT_EXPORT WebString keyboardShortcut() const; |
| 138 WEBKIT_EXPORT WebAXRole role() const; |
| 139 WEBKIT_EXPORT unsigned selectionEnd() const; |
| 140 WEBKIT_EXPORT unsigned selectionEndLineNumber() const; |
| 141 WEBKIT_EXPORT unsigned selectionStart() const; |
| 142 WEBKIT_EXPORT unsigned selectionStartLineNumber() const; |
| 143 WEBKIT_EXPORT WebString stringValue() const; |
| 144 WEBKIT_EXPORT WebString title() const; |
| 145 WEBKIT_EXPORT WebAXObject titleUIElement() const; |
| 146 WEBKIT_EXPORT WebURL url() const; |
| 147 |
| 148 WEBKIT_EXPORT bool supportsRangeValue() const; |
| 149 WEBKIT_EXPORT WebString valueDescription() const; |
| 150 WEBKIT_EXPORT float valueForRange() const; |
| 151 WEBKIT_EXPORT float maxValueForRange() const; |
| 152 WEBKIT_EXPORT float minValueForRange() const; |
| 153 |
| 154 WEBKIT_EXPORT WebNode node() const; |
| 155 WEBKIT_EXPORT WebDocument document() const; |
| 156 WEBKIT_EXPORT bool hasComputedStyle() const; |
| 157 WEBKIT_EXPORT WebString computedStyleDisplay() const; |
| 158 WEBKIT_EXPORT bool accessibilityIsIgnored() const; |
| 159 WEBKIT_EXPORT bool lineBreaks(WebVector<int>&) const; |
| 160 |
| 161 // Actions |
| 162 WEBKIT_EXPORT WebString actionVerb() const; // The verb corresponding to per
formDefaultAction. |
| 163 WEBKIT_EXPORT bool canDecrement() const; |
| 164 WEBKIT_EXPORT bool canIncrement() const; |
| 165 WEBKIT_EXPORT bool canPress() const; |
| 166 WEBKIT_EXPORT bool canSetFocusAttribute() const; |
| 167 WEBKIT_EXPORT bool canSetSelectedAttribute() const; |
| 168 WEBKIT_EXPORT bool canSetValueAttribute() const; |
| 169 WEBKIT_EXPORT bool performDefaultAction() const; |
| 170 WEBKIT_EXPORT bool press() const; |
| 171 WEBKIT_EXPORT bool increment() const; |
| 172 WEBKIT_EXPORT bool decrement() const; |
| 173 WEBKIT_EXPORT void setFocused(bool) const; |
| 174 WEBKIT_EXPORT void setSelectedTextRange(int selectionStart, int selectionEnd
) const; |
| 175 |
| 176 // For a table |
| 177 WEBKIT_EXPORT unsigned columnCount() const; |
| 178 WEBKIT_EXPORT unsigned rowCount() const; |
| 179 WEBKIT_EXPORT WebAXObject cellForColumnAndRow(unsigned column, unsigned row)
const; |
| 180 WEBKIT_EXPORT WebAXObject headerContainerObject() const; |
| 181 WEBKIT_EXPORT WebAXObject rowAtIndex(unsigned rowIndex) const; |
| 182 WEBKIT_EXPORT WebAXObject columnAtIndex(unsigned columnIndex) const; |
| 183 |
| 184 // For a table row |
| 185 WEBKIT_EXPORT unsigned rowIndex() const; |
| 186 WEBKIT_EXPORT WebAXObject rowHeader() const; |
| 187 |
| 188 // For a table column |
| 189 WEBKIT_EXPORT unsigned columnIndex() const; |
| 190 WEBKIT_EXPORT WebAXObject columnHeader() const; |
| 191 |
| 192 // For a table cell |
| 193 WEBKIT_EXPORT unsigned cellColumnIndex() const; |
| 194 WEBKIT_EXPORT unsigned cellColumnSpan() const; |
| 195 WEBKIT_EXPORT unsigned cellRowIndex() const; |
| 196 WEBKIT_EXPORT unsigned cellRowSpan() const; |
| 197 |
| 198 // Make this object visible by scrolling as many nested scrollable views as
needed. |
| 199 WEBKIT_EXPORT void scrollToMakeVisible() const; |
| 200 // Same, but if the whole object can't be made visible, try for this subrect
, in local coordinates. |
| 201 WEBKIT_EXPORT void scrollToMakeVisibleWithSubFocus(const WebRect&) const; |
| 202 // Scroll this object to a given point in global coordinates of the top-leve
l window. |
| 203 WEBKIT_EXPORT void scrollToGlobalPoint(const WebPoint&) const; |
| 204 |
| 205 #if WEBKIT_IMPLEMENTATION |
| 206 WebAXObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); |
| 207 WebAXObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&)
; |
| 208 operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const; |
| 209 #endif |
| 210 |
| 211 private: |
| 212 WebPrivatePtr<WebCore::AccessibilityObject> m_private; |
| 213 }; |
40 | 214 |
41 } // namespace WebKit | 215 } // namespace WebKit |
42 | 216 |
43 #endif | 217 #endif |
OLD | NEW |