1 /*
2 * Copyright (C) 2008, 2009 Apple 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
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "config.h"
27 #include "AccessibilityUIElement.h"
28
29 #include <JavaScriptCore/JSRetainPtr.h>
30
31 // Static Functions
32
toAXElement(JSObjectRef object)33 static inline AccessibilityUIElement* toAXElement(JSObjectRef object)
34 {
35 // FIXME: We should ASSERT that it is the right class here.
36 return static_cast<AccessibilityUIElement*>(JSObjectGetPrivate(object));
37 }
38
allAttributesCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)39 static JSValueRef allAttributesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
40 {
41 JSRetainPtr<JSStringRef> attributes(Adopt, toAXElement(thisObject)->allAttributes());
42 return JSValueMakeString(context, attributes.get());
43 }
44
attributesOfLinkedUIElementsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)45 static JSValueRef attributesOfLinkedUIElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
46 {
47 JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfLinkedUIElements());
48 return JSValueMakeString(context, linkedUIDescription.get());
49 }
50
attributesOfDocumentLinksCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)51 static JSValueRef attributesOfDocumentLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
52 {
53 JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfDocumentLinks());
54 return JSValueMakeString(context, linkedUIDescription.get());
55 }
56
attributesOfChildrenCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)57 static JSValueRef attributesOfChildrenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
58 {
59 JSRetainPtr<JSStringRef> childrenDescription(Adopt, toAXElement(thisObject)->attributesOfChildren());
60 return JSValueMakeString(context, childrenDescription.get());
61 }
62
parameterizedAttributeNamesCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)63 static JSValueRef parameterizedAttributeNamesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
64 {
65 JSRetainPtr<JSStringRef> parameterizedAttributeNames(Adopt, toAXElement(thisObject)->parameterizedAttributeNames());
66 return JSValueMakeString(context, parameterizedAttributeNames.get());
67 }
68
attributesOfColumnHeadersCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)69 static JSValueRef attributesOfColumnHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
70 {
71 JSRetainPtr<JSStringRef> attributesOfColumnHeaders(Adopt, toAXElement(thisObject)->attributesOfColumnHeaders());
72 return JSValueMakeString(context, attributesOfColumnHeaders.get());
73 }
74
attributesOfRowHeadersCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)75 static JSValueRef attributesOfRowHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
76 {
77 JSRetainPtr<JSStringRef> attributesOfRowHeaders(Adopt, toAXElement(thisObject)->attributesOfRowHeaders());
78 return JSValueMakeString(context, attributesOfRowHeaders.get());
79 }
80
attributesOfColumnsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)81 static JSValueRef attributesOfColumnsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
82 {
83 JSRetainPtr<JSStringRef> attributesOfColumns(Adopt, toAXElement(thisObject)->attributesOfColumns());
84 return JSValueMakeString(context, attributesOfColumns.get());
85 }
86
attributesOfRowsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)87 static JSValueRef attributesOfRowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
88 {
89 JSRetainPtr<JSStringRef> attributesOfRows(Adopt, toAXElement(thisObject)->attributesOfRows());
90 return JSValueMakeString(context, attributesOfRows.get());
91 }
92
attributesOfVisibleCellsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)93 static JSValueRef attributesOfVisibleCellsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
94 {
95 JSRetainPtr<JSStringRef> attributesOfVisibleCells(Adopt, toAXElement(thisObject)->attributesOfVisibleCells());
96 return JSValueMakeString(context, attributesOfVisibleCells.get());
97 }
98
attributesOfHeaderCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)99 static JSValueRef attributesOfHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
100 {
101 JSRetainPtr<JSStringRef> attributesOfHeader(Adopt, toAXElement(thisObject)->attributesOfHeader());
102 return JSValueMakeString(context, attributesOfHeader.get());
103 }
104
indexInTableCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)105 static JSValueRef indexInTableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
106 {
107 return JSValueMakeNumber(context, toAXElement(thisObject)->indexInTable());
108 }
109
rowIndexRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)110 static JSValueRef rowIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
111 {
112 JSRetainPtr<JSStringRef> rowIndexRange(Adopt, toAXElement(thisObject)->rowIndexRange());
113 return JSValueMakeString(context, rowIndexRange.get());
114 }
115
columnIndexRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)116 static JSValueRef columnIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
117 {
118 JSRetainPtr<JSStringRef> columnIndexRange(Adopt, toAXElement(thisObject)->columnIndexRange());
119 return JSValueMakeString(context, columnIndexRange.get());
120 }
121
lineForIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)122 static JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
123 {
124 int indexNumber = -1;
125 if (argumentCount == 1)
126 indexNumber = JSValueToNumber(context, arguments[0], exception);
127
128 return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber));
129 }
130
rangeForLineCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)131 static JSValueRef rangeForLineCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
132 {
133 int indexNumber = -1;
134 if (argumentCount == 1)
135 indexNumber = JSValueToNumber(context, arguments[0], exception);
136
137 JSRetainPtr<JSStringRef> rangeLine(Adopt, toAXElement(thisObject)->rangeForLine(indexNumber));
138 return JSValueMakeString(context, rangeLine.get());
139 }
140
boundsForRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)141 static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
142 {
143 unsigned location = UINT_MAX, length = 0;
144 if (argumentCount == 2) {
145 location = JSValueToNumber(context, arguments[0], exception);
146 length = JSValueToNumber(context, arguments[1], exception);
147 }
148
149 JSRetainPtr<JSStringRef> boundsDescription(Adopt, toAXElement(thisObject)->boundsForRange(location, length));
150 return JSValueMakeString(context, boundsDescription.get());
151 }
152
stringForRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)153 static JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
154 {
155 unsigned location = UINT_MAX, length = 0;
156 if (argumentCount == 2) {
157 location = JSValueToNumber(context, arguments[0], exception);
158 length = JSValueToNumber(context, arguments[1], exception);
159 }
160
161 JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->stringForRange(location, length));
162 return JSValueMakeString(context, stringDescription.get());
163 }
164
attributedStringForRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)165 static JSValueRef attributedStringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
166 {
167 unsigned location = UINT_MAX, length = 0;
168 if (argumentCount == 2) {
169 location = JSValueToNumber(context, arguments[0], exception);
170 length = JSValueToNumber(context, arguments[1], exception);
171 }
172
173 JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->attributedStringForRange(location, length));
174 return JSValueMakeString(context, stringDescription.get());
175 }
176
attributedStringRangeIsMisspelledCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)177 static JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
178 {
179 unsigned location = UINT_MAX, length = 0;
180 if (argumentCount == 2) {
181 location = JSValueToNumber(context, arguments[0], exception);
182 length = JSValueToNumber(context, arguments[1], exception);
183 }
184
185 return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length));
186 }
187
indexOfChildCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)188 static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
189 {
190 if (argumentCount != 1)
191 return 0;
192
193 JSObjectRef otherElement = JSValueToObject(context, arguments[0], exception);
194 AccessibilityUIElement* childElement = toAXElement(otherElement);
195 return JSValueMakeNumber(context, (double)toAXElement(thisObject)->indexOfChild(childElement));
196 }
197
childAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)198 static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
199 {
200 int indexNumber = -1;
201 if (argumentCount == 1)
202 indexNumber = JSValueToNumber(context, arguments[0], exception);
203
204 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber));
205 }
206
selectedChildAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)207 static JSValueRef selectedChildAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
208 {
209 int indexNumber = -1;
210 if (argumentCount == 1)
211 indexNumber = JSValueToNumber(context, arguments[0], exception);
212
213 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedChildAtIndex(indexNumber));
214 }
215
linkedUIElementAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)216 static JSValueRef linkedUIElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
217 {
218 int indexNumber = -1;
219 if (argumentCount == 1)
220 indexNumber = JSValueToNumber(context, arguments[0], exception);
221
222 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedUIElementAtIndex(indexNumber));
223 }
224
disclosedRowAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)225 static JSValueRef disclosedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
226 {
227 int indexNumber = 0;
228 if (argumentCount == 1)
229 indexNumber = JSValueToNumber(context, arguments[0], exception);
230
231 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedRowAtIndex(indexNumber));
232 }
233
ariaOwnsElementAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)234 static JSValueRef ariaOwnsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
235 {
236 int indexNumber = 0;
237 if (argumentCount == 1)
238 indexNumber = JSValueToNumber(context, arguments[0], exception);
239
240 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaOwnsElementAtIndex(indexNumber));
241 }
242
ariaFlowToElementAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)243 static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
244 {
245 int indexNumber = 0;
246 if (argumentCount == 1)
247 indexNumber = JSValueToNumber(context, arguments[0], exception);
248
249 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber));
250 }
251
selectedRowAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)252 static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
253 {
254 int indexNumber = 0;
255 if (argumentCount == 1)
256 indexNumber = JSValueToNumber(context, arguments[0], exception);
257
258 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedRowAtIndex(indexNumber));
259 }
260
isEqualCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)261 static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
262 {
263 JSObjectRef otherElement = 0;
264 if (argumentCount == 1)
265 otherElement = JSValueToObject(context, arguments[0], exception);
266 else
267 return JSValueMakeBoolean(context, false);
268
269 return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement)));
270 }
271
setSelectedChildCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)272 static JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
273 {
274 JSObjectRef element = 0;
275 if (argumentCount == 1)
276 element = JSValueToObject(context, arguments[0], exception);
277
278 toAXElement(thisObject)->setSelectedChild(toAXElement(element));
279
280 return JSValueMakeUndefined(context);
281 }
282
elementAtPointCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)283 static JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
284 {
285 int x = 0;
286 int y = 0;
287 if (argumentCount == 2) {
288 x = JSValueToNumber(context, arguments[0], exception);
289 y = JSValueToNumber(context, arguments[1], exception);
290 }
291
292 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->elementAtPoint(x, y));
293 }
294
isAttributeSupportedCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)295 static JSValueRef isAttributeSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
296 {
297 JSStringRef attribute = 0;
298 if (argumentCount == 1)
299 attribute = JSValueToStringCopy(context, arguments[0], exception);
300 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSupported(attribute));
301 if (attribute)
302 JSStringRelease(attribute);
303 return result;
304 }
305
isAttributeSettableCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)306 static JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
307 {
308 JSStringRef attribute = 0;
309 if (argumentCount == 1)
310 attribute = JSValueToStringCopy(context, arguments[0], exception);
311 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSettable(attribute));
312 if (attribute)
313 JSStringRelease(attribute);
314 return result;
315 }
316
317
isActionSupportedCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)318 static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
319 {
320 JSStringRef action = 0;
321 if (argumentCount == 1)
322 action = JSValueToStringCopy(context, arguments[0], exception);
323 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action));
324 if (action)
325 JSStringRelease(action);
326 return result;
327 }
328
boolAttributeValueCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)329 static JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
330 {
331 JSStringRef attribute = 0;
332 if (argumentCount == 1)
333 attribute = JSValueToStringCopy(context, arguments[0], exception);
334 bool val = toAXElement(thisObject)->boolAttributeValue(attribute);
335 JSValueRef result = JSValueMakeBoolean(context, val);
336 if (attribute)
337 JSStringRelease(attribute);
338 return result;
339 }
340
stringAttributeValueCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)341 static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
342 {
343 JSStringRef attribute = 0;
344 if (argumentCount == 1)
345 attribute = JSValueToStringCopy(context, arguments[0], exception);
346 JSRetainPtr<JSStringRef> stringAttributeValue(Adopt, toAXElement(thisObject)->stringAttributeValue(attribute));
347 JSValueRef result = JSValueMakeString(context, stringAttributeValue.get());
348 if (attribute)
349 JSStringRelease(attribute);
350 return result;
351 }
352
cellForColumnAndRowCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)353 static JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
354 {
355 unsigned column = 0, row = 0;
356 if (argumentCount == 2) {
357 column = JSValueToNumber(context, arguments[0], exception);
358 row = JSValueToNumber(context, arguments[1], exception);
359 }
360
361 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row));
362 }
363
titleUIElementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)364 static JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
365 {
366 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement());
367 }
368
parentElementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)369 static JSValueRef parentElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
370 {
371 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->parentElement());
372 }
373
disclosedByRowCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)374 static JSValueRef disclosedByRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
375 {
376 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedByRow());
377 }
378
setSelectedTextRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)379 static JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
380 {
381 unsigned location = UINT_MAX, length = 0;
382 if (argumentCount == 2) {
383 location = JSValueToNumber(context, arguments[0], exception);
384 length = JSValueToNumber(context, arguments[1], exception);
385 }
386
387 toAXElement(thisObject)->setSelectedTextRange(location, length);
388 return JSValueMakeUndefined(context);
389 }
390
incrementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)391 static JSValueRef incrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
392 {
393 toAXElement(thisObject)->increment();
394 return JSValueMakeUndefined(context);
395 }
396
decrementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)397 static JSValueRef decrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
398 {
399 toAXElement(thisObject)->decrement();
400 return JSValueMakeUndefined(context);
401 }
402
showMenuCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)403 static JSValueRef showMenuCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
404 {
405 toAXElement(thisObject)->showMenu();
406 return JSValueMakeUndefined(context);
407 }
408
pressCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)409 static JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
410 {
411 toAXElement(thisObject)->press();
412 return JSValueMakeUndefined(context);
413 }
414
takeFocusCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)415 static JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
416 {
417 toAXElement(thisObject)->takeFocus();
418 return JSValueMakeUndefined(context);
419 }
420
takeSelectionCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)421 static JSValueRef takeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
422 {
423 toAXElement(thisObject)->takeSelection();
424 return JSValueMakeUndefined(context);
425 }
426
addSelectionCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)427 static JSValueRef addSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
428 {
429 toAXElement(thisObject)->addSelection();
430 return JSValueMakeUndefined(context);
431 }
432
removeSelectionCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)433 static JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
434 {
435 toAXElement(thisObject)->removeSelection();
436 return JSValueMakeUndefined(context);
437 }
438
textMarkerRangeForElementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)439 static JSValueRef textMarkerRangeForElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
440 {
441 AccessibilityUIElement* uiElement = 0;
442 if (argumentCount == 1)
443 uiElement = toAXElement(JSValueToObject(context, arguments[0], exception));
444
445 return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement));
446 }
447
textMarkerRangeLengthCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)448 static JSValueRef textMarkerRangeLengthCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
449 {
450 AccessibilityTextMarkerRange* range = 0;
451 if (argumentCount == 1)
452 range = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
453
454 return JSValueMakeNumber(context, (int)toAXElement(thisObject)->textMarkerRangeLength(range));
455 }
456
textMarkerForPointCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)457 static JSValueRef textMarkerForPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
458 {
459 int x = 0;
460 int y = 0;
461 if (argumentCount == 2) {
462 x = JSValueToNumber(context, arguments[0], exception);
463 y = JSValueToNumber(context, arguments[1], exception);
464 }
465
466 return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->textMarkerForPoint(x, y));
467 }
468
textMarkerRangeForMarkersCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)469 static JSValueRef textMarkerRangeForMarkersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
470 {
471 AccessibilityTextMarker* startMarker = 0;
472 AccessibilityTextMarker* endMarker = 0;
473 if (argumentCount == 2) {
474 startMarker = toTextMarker(JSValueToObject(context, arguments[0], exception));
475 endMarker = toTextMarker(JSValueToObject(context, arguments[1], exception));
476 }
477
478 return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForMarkers(startMarker, endMarker));
479 }
480
startTextMarkerForTextMarkerRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)481 static JSValueRef startTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
482 {
483 AccessibilityTextMarkerRange* markerRange = 0;
484 if (argumentCount == 1)
485 markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
486
487 return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->startTextMarkerForTextMarkerRange(markerRange));
488 }
489
endTextMarkerForTextMarkerRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)490 static JSValueRef endTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
491 {
492 AccessibilityTextMarkerRange* markerRange = 0;
493 if (argumentCount == 1)
494 markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
495
496 return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarkerForTextMarkerRange(markerRange));
497 }
498
accessibilityElementForTextMarkerCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)499 static JSValueRef accessibilityElementForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
500 {
501 AccessibilityTextMarker* marker = 0;
502 if (argumentCount == 1)
503 marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
504
505 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->accessibilityElementForTextMarker(marker));
506 }
507
508 // Static Value Getters
509
getARIADropEffectsCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)510 static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
511 {
512 JSRetainPtr<JSStringRef> dropEffects(Adopt, toAXElement(thisObject)->ariaDropEffects());
513 return JSValueMakeString(context, dropEffects.get());
514 }
515
getARIAIsGrabbedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)516 static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
517 {
518 return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
519 }
520
getIsValidCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)521 static JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
522 {
523 AccessibilityUIElement* uiElement = toAXElement(thisObject);
524 if (!uiElement->platformUIElement())
525 return JSValueMakeBoolean(context, false);
526
527 // There might be other platform logic that one could check here...
528
529 return JSValueMakeBoolean(context, true);
530 }
531
getRoleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)532 static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
533 {
534 JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role());
535 return JSValueMakeString(context, role.get());
536 }
537
getSubroleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)538 static JSValueRef getSubroleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
539 {
540 JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->subrole());
541 return JSValueMakeString(context, role.get());
542 }
543
getRoleDescriptionCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)544 static JSValueRef getRoleDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
545 {
546 JSRetainPtr<JSStringRef> roleDesc(Adopt, toAXElement(thisObject)->roleDescription());
547 return JSValueMakeString(context, roleDesc.get());
548 }
549
getTitleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)550 static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
551 {
552 JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
553 return JSValueMakeString(context, title.get());
554 }
555
getDescriptionCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)556 static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
557 {
558 JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
559 return JSValueMakeString(context, description.get());
560 }
561
getStringValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)562 static JSValueRef getStringValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
563 {
564 JSRetainPtr<JSStringRef> stringValue(Adopt, toAXElement(thisObject)->stringValue());
565 return JSValueMakeString(context, stringValue.get());
566 }
567
getLanguageCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)568 static JSValueRef getLanguageCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
569 {
570 JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->language());
571 return JSValueMakeString(context, language.get());
572 }
573
getHelpTextCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)574 static JSValueRef getHelpTextCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
575 {
576 JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->helpText());
577 return JSValueMakeString(context, language.get());
578 }
579
getOrientationCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)580 static JSValueRef getOrientationCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
581 {
582 JSRetainPtr<JSStringRef> orientation(Adopt, toAXElement(thisObject)->orientation());
583 return JSValueMakeString(context, orientation.get());
584 }
585
getChildrenCountCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)586 static JSValueRef getChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
587 {
588 return JSValueMakeNumber(context, toAXElement(thisObject)->childrenCount());
589 }
590
rowCountCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)591 static JSValueRef rowCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
592 {
593 return JSValueMakeNumber(context, toAXElement(thisObject)->rowCount());
594 }
595
columnCountCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)596 static JSValueRef columnCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
597 {
598 return JSValueMakeNumber(context, toAXElement(thisObject)->columnCount());
599 }
600
getXCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)601 static JSValueRef getXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
602 {
603 return JSValueMakeNumber(context, toAXElement(thisObject)->x());
604 }
605
getYCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)606 static JSValueRef getYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
607 {
608 return JSValueMakeNumber(context, toAXElement(thisObject)->y());
609 }
610
getWidthCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)611 static JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
612 {
613 return JSValueMakeNumber(context, toAXElement(thisObject)->width());
614 }
615
getHeightCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)616 static JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
617 {
618 return JSValueMakeNumber(context, toAXElement(thisObject)->height());
619 }
620
getClickPointXCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)621 static JSValueRef getClickPointXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
622 {
623 return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointX());
624 }
625
getClickPointYCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)626 static JSValueRef getClickPointYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
627 {
628 return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointY());
629 }
630
getIntValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)631 static JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
632 {
633 return JSValueMakeNumber(context, toAXElement(thisObject)->intValue());
634 }
635
getMinValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)636 static JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
637 {
638 return JSValueMakeNumber(context, toAXElement(thisObject)->minValue());
639 }
640
getMaxValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)641 static JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
642 {
643 return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue());
644 }
645
getInsertionPointLineNumberCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)646 static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
647 {
648 return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber());
649 }
650
getSelectedTextRangeCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)651 static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
652 {
653 JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange());
654 return JSValueMakeString(context, selectedTextRange.get());
655 }
656
getIsEnabledCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)657 static JSValueRef getIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
658 {
659 return JSValueMakeBoolean(context, toAXElement(thisObject)->isEnabled());
660 }
661
getIsRequiredCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)662 static JSValueRef getIsRequiredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
663 {
664 return JSValueMakeBoolean(context, toAXElement(thisObject)->isRequired());
665 }
666
getIsFocusedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)667 static JSValueRef getIsFocusedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
668 {
669 return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocused());
670 }
671
getIsFocusableCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)672 static JSValueRef getIsFocusableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
673 {
674 return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocusable());
675 }
676
getIsSelectedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)677 static JSValueRef getIsSelectedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
678 {
679 return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelected());
680 }
681
getIsSelectableCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)682 static JSValueRef getIsSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
683 {
684 return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelectable());
685 }
686
getIsMultiSelectableCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)687 static JSValueRef getIsMultiSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
688 {
689 return JSValueMakeBoolean(context, toAXElement(thisObject)->isMultiSelectable());
690 }
691
getIsExpandedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)692 static JSValueRef getIsExpandedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
693 {
694 return JSValueMakeBoolean(context, toAXElement(thisObject)->isExpanded());
695 }
696
getIsCheckedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)697 static JSValueRef getIsCheckedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
698 {
699 return JSValueMakeBoolean(context, toAXElement(thisObject)->isChecked());
700 }
701
getIsVisibleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)702 static JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
703 {
704 return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible());
705 }
706
getIsOffScreenCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)707 static JSValueRef getIsOffScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
708 {
709 return JSValueMakeBoolean(context, toAXElement(thisObject)->isOffScreen());
710 }
711
getIsCollapsedCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)712 static JSValueRef getIsCollapsedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
713 {
714 return JSValueMakeBoolean(context, toAXElement(thisObject)->isCollapsed());
715 }
716
isIgnoredCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)717 static JSValueRef isIgnoredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
718 {
719 return JSValueMakeBoolean(context, toAXElement(thisObject)->isIgnored());
720 }
721
speakCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)722 static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
723 {
724 JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak());
725 return JSValueMakeString(context, speakString.get());
726 }
727
selectedChildrenCountCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)728 static JSValueRef selectedChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
729 {
730 return JSValueMakeNumber(context, toAXElement(thisObject)->selectedChildrenCount());
731 }
732
getHasPopupCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)733 static JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
734 {
735 return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup());
736 }
737
hierarchicalLevelCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef,JSValueRef *)738 static JSValueRef hierarchicalLevelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
739 {
740 return JSValueMakeNumber(context, toAXElement(thisObject)->hierarchicalLevel());
741 }
742
getValueDescriptionCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)743 static JSValueRef getValueDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
744 {
745 JSRetainPtr<JSStringRef> valueDescription(Adopt, toAXElement(thisObject)->valueDescription());
746 return JSValueMakeString(context, valueDescription.get());
747 }
748
getAccessibilityValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)749 static JSValueRef getAccessibilityValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
750 {
751 JSRetainPtr<JSStringRef> accessibilityValue(Adopt, toAXElement(thisObject)->accessibilityValue());
752 return JSValueMakeString(context, accessibilityValue.get());
753 }
754
getDocumentEncodingCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)755 static JSValueRef getDocumentEncodingCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
756 {
757 JSRetainPtr<JSStringRef> documentEncoding(Adopt, toAXElement(thisObject)->documentEncoding());
758 return JSValueMakeString(context, documentEncoding.get());
759 }
760
getDocumentURICallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)761 static JSValueRef getDocumentURICallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
762 {
763 JSRetainPtr<JSStringRef> documentURI(Adopt, toAXElement(thisObject)->documentURI());
764 return JSValueMakeString(context, documentURI.get());
765 }
766
getURLCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)767 static JSValueRef getURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
768 {
769 JSRetainPtr<JSStringRef> url(Adopt, toAXElement(thisObject)->url());
770 return JSValueMakeString(context, url.get());
771 }
772
addNotificationListenerCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)773 static JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
774 {
775 if (argumentCount != 1)
776 return JSValueMakeBoolean(context, false);
777
778 JSObjectRef callback = JSValueToObject(context, arguments[0], exception);
779 bool succeeded = toAXElement(thisObject)->addNotificationListener(callback);
780 return JSValueMakeBoolean(context, succeeded);
781 }
782
removeNotificationListenerCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)783 static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
784 {
785 toAXElement(thisObject)->removeNotificationListener();
786 return JSValueMakeUndefined(context);
787 }
788
789 // Implementation
790
791 // Unsupported methods on various platforms.
792 #if !PLATFORM(MAC)
speak()793 JSStringRef AccessibilityUIElement::speak() { return 0; }
rangeForLine(int line)794 JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; }
setSelectedChild(AccessibilityUIElement *) const795 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { }
selectedChildrenCount() const796 unsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; }
selectedChildAtIndex(unsigned) const797 AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; }
798 #endif
799
800 #if !PLATFORM(WIN)
isEqual(AccessibilityUIElement * otherElement)801 bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)
802 {
803 return platformUIElement() == otherElement->platformUIElement();
804 }
805 #endif
806
807 #if !SUPPORTS_AX_TEXTMARKERS
808
textMarkerRangeForElement(AccessibilityUIElement *)809 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*)
810 {
811 return 0;
812 }
813
textMarkerRangeLength(AccessibilityTextMarkerRange *)814 int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*)
815 {
816 return 0;
817 }
818
textMarkerRangeForMarkers(AccessibilityTextMarker *,AccessibilityTextMarker *)819 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker*, AccessibilityTextMarker*)
820 {
821 return 0;
822 }
823
startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange *)824 AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
825 {
826 return 0;
827 }
828
endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange *)829 AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
830 {
831 return 0;
832 }
833
accessibilityElementForTextMarker(AccessibilityTextMarker *)834 AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker*)
835 {
836 return 0;
837 }
838
textMarkerForPoint(int x,int y)839 AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y)
840 {
841 return 0;
842 }
843
844 #endif
845
846 // Destruction
847
finalize(JSObjectRef thisObject)848 static void finalize(JSObjectRef thisObject)
849 {
850 delete toAXElement(thisObject);
851 }
852
853 // Object Creation
854
makeJSAccessibilityUIElement(JSContextRef context,const AccessibilityUIElement & element)855 JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element)
856 {
857 return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element));
858 }
859
getJSClass()860 JSClassRef AccessibilityUIElement::getJSClass()
861 {
862 static JSStaticValue staticValues[] = {
863 { "accessibilityValue", getAccessibilityValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
864 { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
865 { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
866 { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
867 { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
868 { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
869 { "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
870 { "helpText", getHelpTextCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
871 { "stringValue", getStringValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
872 { "x", getXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
873 { "y", getYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
874 { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
875 { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
876 { "clickPointX", getClickPointXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
877 { "clickPointY", getClickPointYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
878 { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
879 { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
880 { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
881 { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
882 { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
883 { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
884 { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
885 { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
886 { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
887 { "isRequired", getIsRequiredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
888 { "isFocused", getIsFocusedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
889 { "isFocusable", getIsFocusableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
890 { "isSelected", getIsSelectedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
891 { "isSelectable", getIsSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
892 { "isMultiSelectable", getIsMultiSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
893 { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
894 { "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
895 { "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
896 { "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
897 { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
898 { "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
899 { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
900 { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
901 { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
902 { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
903 { "url", getURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
904 { "isValid", getIsValidCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
905 { "orientation", getOrientationCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
906 { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
907 { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
908 { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
909 { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
910 { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
911 { 0, 0, 0, 0 }
912 };
913
914 static JSStaticFunction staticFunctions[] = {
915 { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
916 { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
917 { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
918 { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
919 { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
920 { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
921 { "rangeForLine", rangeForLineCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
922 { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
923 { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
924 { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
925 { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
926 { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
927 { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
928 { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
929 { "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
930 { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
931 { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
932 { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
933 { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
934 { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
935 { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
936 { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
937 { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
938 { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
939 { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
940 { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
941 { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
942 { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
943 { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
944 { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
945 { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
946 { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
947 { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
948 { "disclosedByRow", disclosedByRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
949 { "increment", incrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
950 { "decrement", decrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
951 { "showMenu", showMenuCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
952 { "press", pressCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
953 { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
954 { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
955 { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
956 { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
957 { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
958 { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
959 { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
960 { "takeFocus", takeFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
961 { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
962 { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
963 { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
964 { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
965 { "textMarkerRangeForMarkers", textMarkerRangeForMarkersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
966 { "startTextMarkerForTextMarkerRange", startTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
967 { "endTextMarkerForTextMarkerRange", endTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
968 { "accessibilityElementForTextMarker", accessibilityElementForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
969 { "textMarkerRangeLength", textMarkerRangeLengthCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
970 { "textMarkerForPoint", textMarkerForPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
971 { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
972 { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
973 { 0, 0, 0 }
974 };
975
976 static JSClassDefinition classDefinition = {
977 0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions,
978 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
979 };
980
981 static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition);
982 return accessibilityUIElementClass;
983 }
984