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 "WebAXEnums.h" | |
38 #include "WebAccessibilityRole.h" | |
39 | |
40 #if WEBKIT_IMPLEMENTATION | |
41 namespace WTF { template <typename T> class PassRefPtr; } | |
42 #endif | |
43 | |
44 namespace WebCore { class AccessibilityObject; } | |
45 | |
46 namespace WebKit { | |
47 | |
48 class WebNode; | |
49 class WebDocument; | |
50 class WebString; | |
51 class WebURL; | |
52 struct WebPoint; | |
53 struct WebRect; | |
54 | |
55 // A container for passing around a reference to AccessibilityObject. | |
56 // FIXME: rename this to WebAXObject (http://crbug.com/269034). | |
57 class WebAccessibilityObject { | |
58 public: | |
59 ~WebAccessibilityObject() { reset(); } | |
60 | |
61 WebAccessibilityObject() { } | |
62 WebAccessibilityObject(const WebAccessibilityObject& o) { assign(o); } | |
63 WebAccessibilityObject& operator=(const WebAccessibilityObject& o) | |
64 { | |
65 assign(o); | |
66 return *this; | |
67 } | |
68 | |
69 WEBKIT_EXPORT void reset(); | |
70 WEBKIT_EXPORT void assign(const WebAccessibilityObject&); | |
71 WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; | |
72 | |
73 bool isNull() const { return m_private.isNull(); } | |
74 // isDetached also checks for null, so it's safe to just call isDetached. | |
75 WEBKIT_EXPORT bool isDetached() const; | |
76 | |
77 // Static methods for enabling accessibility. | |
78 WEBKIT_EXPORT static void enableAccessibility(); | |
79 WEBKIT_EXPORT static bool accessibilityEnabled(); | |
80 | |
81 WEBKIT_EXPORT void startCachingComputedObjectAttributesUntilTreeMutates(); | |
82 WEBKIT_EXPORT void stopCachingComputedObjectAttributes(); | |
83 | |
84 WEBKIT_EXPORT int axID() const; | |
85 | |
86 // Update the underlying tree, and return true if this object is | |
87 // still valid (not detached). Note that calling this method | |
88 // can cause other WebAccessibilityObjects to become invalid, too, | |
89 // so always call isDetached if updateBackingStoreAndCheckValidity | |
90 // has been called on any object, or if any other WebCore code has run. | |
91 WEBKIT_EXPORT bool updateBackingStoreAndCheckValidity(); | |
92 | |
93 WEBKIT_EXPORT WebString accessibilityDescription() const; | |
94 WEBKIT_EXPORT unsigned childCount() const; | |
95 | |
96 WEBKIT_EXPORT WebAccessibilityObject childAt(unsigned) const; | |
97 WEBKIT_EXPORT WebAccessibilityObject parentObject() const; | |
98 | |
99 WEBKIT_EXPORT bool isAnchor() const; | |
100 WEBKIT_EXPORT bool isAriaReadOnly() const; | |
101 WEBKIT_EXPORT bool isButtonStateMixed() const; | |
102 WEBKIT_EXPORT bool isChecked() const; | |
103 WEBKIT_EXPORT bool isClickable() const; | |
104 WEBKIT_EXPORT bool isCollapsed() const; | |
105 WEBKIT_EXPORT bool isControl() const; | |
106 WEBKIT_EXPORT bool isEnabled() const; | |
107 WEBKIT_EXPORT bool isFocused() const; | |
108 WEBKIT_EXPORT bool isHovered() const; | |
109 WEBKIT_EXPORT bool isIndeterminate() const; | |
110 WEBKIT_EXPORT bool isLinked() const; | |
111 WEBKIT_EXPORT bool isLoaded() const; | |
112 WEBKIT_EXPORT bool isMultiSelectable() const; | |
113 WEBKIT_EXPORT bool isOffScreen() const; | |
114 WEBKIT_EXPORT bool isPasswordField() const; | |
115 WEBKIT_EXPORT bool isPressed() const; | |
116 WEBKIT_EXPORT bool isReadOnly() const; | |
117 WEBKIT_EXPORT bool isRequired() const; | |
118 WEBKIT_EXPORT bool isSelected() const; | |
119 WEBKIT_EXPORT bool isSelectedOptionActive() const; | |
120 WEBKIT_EXPORT bool isVertical() const; | |
121 WEBKIT_EXPORT bool isVisible() const; | |
122 WEBKIT_EXPORT bool isVisited() const; | |
123 | |
124 WEBKIT_EXPORT WebString accessKey() const; | |
125 WEBKIT_EXPORT bool ariaHasPopup() const; | |
126 WEBKIT_EXPORT bool ariaLiveRegionAtomic() const; | |
127 WEBKIT_EXPORT bool ariaLiveRegionBusy() const; | |
128 WEBKIT_EXPORT WebString ariaLiveRegionRelevant() const; | |
129 WEBKIT_EXPORT WebString ariaLiveRegionStatus() const; | |
130 WEBKIT_EXPORT WebRect boundingBoxRect() const; | |
131 WEBKIT_EXPORT bool canvasHasFallbackContent() const; | |
132 WEBKIT_EXPORT WebPoint clickPoint() const; | |
133 WEBKIT_EXPORT void colorValue(int& r, int& g, int& b) const; | |
134 WEBKIT_EXPORT double estimatedLoadingProgress() const; | |
135 WEBKIT_EXPORT WebString helpText() const; | |
136 WEBKIT_EXPORT int headingLevel() const; | |
137 WEBKIT_EXPORT int hierarchicalLevel() const; | |
138 WEBKIT_EXPORT WebAccessibilityObject hitTest(const WebPoint&) const; | |
139 WEBKIT_EXPORT WebString keyboardShortcut() const; | |
140 WEBKIT_EXPORT WebAccessibilityRole roleValue() const; // Deprecated, use rol
e(). | |
141 WEBKIT_EXPORT WebAXRole role() const; | |
142 WEBKIT_EXPORT unsigned selectionEnd() const; | |
143 WEBKIT_EXPORT unsigned selectionEndLineNumber() const; | |
144 WEBKIT_EXPORT unsigned selectionStart() const; | |
145 WEBKIT_EXPORT unsigned selectionStartLineNumber() const; | |
146 WEBKIT_EXPORT WebString stringValue() const; | |
147 WEBKIT_EXPORT WebString title() const; | |
148 WEBKIT_EXPORT WebAccessibilityObject titleUIElement() const; | |
149 WEBKIT_EXPORT WebURL url() const; | |
150 | |
151 WEBKIT_EXPORT bool supportsRangeValue() const; | |
152 WEBKIT_EXPORT WebString valueDescription() const; | |
153 WEBKIT_EXPORT float valueForRange() const; | |
154 WEBKIT_EXPORT float maxValueForRange() const; | |
155 WEBKIT_EXPORT float minValueForRange() const; | |
156 | |
157 WEBKIT_EXPORT WebNode node() const; | |
158 WEBKIT_EXPORT WebDocument document() const; | |
159 WEBKIT_EXPORT bool hasComputedStyle() const; | |
160 WEBKIT_EXPORT WebString computedStyleDisplay() const; | |
161 WEBKIT_EXPORT bool accessibilityIsIgnored() const; | |
162 WEBKIT_EXPORT bool lineBreaks(WebVector<int>&) const; | |
163 | |
164 // Actions | |
165 WEBKIT_EXPORT WebString actionVerb() const; // The verb corresponding to per
formDefaultAction. | |
166 WEBKIT_EXPORT bool canDecrement() const; | |
167 WEBKIT_EXPORT bool canIncrement() const; | |
168 WEBKIT_EXPORT bool canPress() const; | |
169 WEBKIT_EXPORT bool canSetFocusAttribute() const; | |
170 WEBKIT_EXPORT bool canSetSelectedAttribute() const; | |
171 WEBKIT_EXPORT bool canSetValueAttribute() const; | |
172 WEBKIT_EXPORT bool performDefaultAction() const; | |
173 WEBKIT_EXPORT bool press() const; | |
174 WEBKIT_EXPORT bool increment() const; | |
175 WEBKIT_EXPORT bool decrement() const; | |
176 WEBKIT_EXPORT void setFocused(bool) const; | |
177 WEBKIT_EXPORT void setSelectedTextRange(int selectionStart, int selectionEnd
) const; | |
178 | |
179 // For a table | |
180 WEBKIT_EXPORT unsigned columnCount() const; | |
181 WEBKIT_EXPORT unsigned rowCount() const; | |
182 WEBKIT_EXPORT WebAccessibilityObject cellForColumnAndRow(unsigned column, un
signed row) const; | |
183 WEBKIT_EXPORT WebAccessibilityObject headerContainerObject() const; | |
184 WEBKIT_EXPORT WebAccessibilityObject rowAtIndex(unsigned rowIndex) const; | |
185 WEBKIT_EXPORT WebAccessibilityObject columnAtIndex(unsigned columnIndex) con
st; | |
186 | |
187 // For a table row | |
188 WEBKIT_EXPORT unsigned rowIndex() const; | |
189 WEBKIT_EXPORT WebAccessibilityObject rowHeader() const; | |
190 | |
191 // For a table column | |
192 WEBKIT_EXPORT unsigned columnIndex() const; | |
193 WEBKIT_EXPORT WebAccessibilityObject columnHeader() const; | |
194 | |
195 // For a table cell | |
196 WEBKIT_EXPORT unsigned cellColumnIndex() const; | |
197 WEBKIT_EXPORT unsigned cellColumnSpan() const; | |
198 WEBKIT_EXPORT unsigned cellRowIndex() const; | |
199 WEBKIT_EXPORT unsigned cellRowSpan() const; | |
200 | |
201 // Make this object visible by scrolling as many nested scrollable views as
needed. | |
202 WEBKIT_EXPORT void scrollToMakeVisible() const; | |
203 // Same, but if the whole object can't be made visible, try for this subrect
, in local coordinates. | |
204 WEBKIT_EXPORT void scrollToMakeVisibleWithSubFocus(const WebRect&) const; | |
205 // Scroll this object to a given point in global coordinates of the top-leve
l window. | |
206 WEBKIT_EXPORT void scrollToGlobalPoint(const WebPoint&) const; | |
207 | |
208 #if WEBKIT_IMPLEMENTATION | |
209 WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&)
; | |
210 WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::Accessibili
tyObject>&); | |
211 operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const; | |
212 #endif | |
213 | |
214 private: | |
215 WebPrivatePtr<WebCore::AccessibilityObject> m_private; | |
216 }; | |
217 | |
218 } // namespace WebKit | |
219 | |
220 #endif | |
OLD | NEW |