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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
131 static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
132 { |
|
133 unsigned location = UINT_MAX, length = 0; |
|
134 if (argumentCount == 2) { |
|
135 location = JSValueToNumber(context, arguments[0], exception); |
|
136 length = JSValueToNumber(context, arguments[1], exception); |
|
137 } |
|
138 |
|
139 JSRetainPtr<JSStringRef> boundsDescription(Adopt, toAXElement(thisObject)->boundsForRange(location, length)); |
|
140 return JSValueMakeString(context, boundsDescription.get()); |
|
141 } |
|
142 |
|
143 static JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
144 { |
|
145 unsigned location = UINT_MAX, length = 0; |
|
146 if (argumentCount == 2) { |
|
147 location = JSValueToNumber(context, arguments[0], exception); |
|
148 length = JSValueToNumber(context, arguments[1], exception); |
|
149 } |
|
150 |
|
151 JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->stringForRange(location, length)); |
|
152 return JSValueMakeString(context, stringDescription.get()); |
|
153 } |
|
154 |
|
155 static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
156 { |
|
157 if (argumentCount != 1) |
|
158 return 0; |
|
159 |
|
160 JSObjectRef otherElement = JSValueToObject(context, arguments[0], exception); |
|
161 AccessibilityUIElement* childElement = toAXElement(otherElement); |
|
162 return JSValueMakeNumber(context, (double)toAXElement(thisObject)->indexOfChild(childElement)); |
|
163 } |
|
164 |
|
165 static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
166 { |
|
167 int indexNumber = -1; |
|
168 if (argumentCount == 1) |
|
169 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
170 |
|
171 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber)); |
|
172 } |
|
173 |
|
174 static JSValueRef linkedUIElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
175 { |
|
176 int indexNumber = -1; |
|
177 if (argumentCount == 1) |
|
178 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
179 |
|
180 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedUIElementAtIndex(indexNumber)); |
|
181 } |
|
182 |
|
183 static JSValueRef disclosedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
184 { |
|
185 int indexNumber = 0; |
|
186 if (argumentCount == 1) |
|
187 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
188 |
|
189 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedRowAtIndex(indexNumber)); |
|
190 } |
|
191 |
|
192 static JSValueRef ariaOwnsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
193 { |
|
194 int indexNumber = 0; |
|
195 if (argumentCount == 1) |
|
196 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
197 |
|
198 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaOwnsElementAtIndex(indexNumber)); |
|
199 } |
|
200 |
|
201 static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
202 { |
|
203 int indexNumber = 0; |
|
204 if (argumentCount == 1) |
|
205 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
206 |
|
207 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber)); |
|
208 } |
|
209 |
|
210 static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
211 { |
|
212 int indexNumber = 0; |
|
213 if (argumentCount == 1) |
|
214 indexNumber = JSValueToNumber(context, arguments[0], exception); |
|
215 |
|
216 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedRowAtIndex(indexNumber)); |
|
217 } |
|
218 |
|
219 static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
220 { |
|
221 JSObjectRef otherElement = 0; |
|
222 if (argumentCount == 1) |
|
223 otherElement = JSValueToObject(context, arguments[0], exception); |
|
224 else |
|
225 return JSValueMakeBoolean(context, false); |
|
226 |
|
227 return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement))); |
|
228 } |
|
229 |
|
230 static JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
231 { |
|
232 int x = 0; |
|
233 int y = 0; |
|
234 if (argumentCount == 2) { |
|
235 x = JSValueToNumber(context, arguments[0], exception); |
|
236 y = JSValueToNumber(context, arguments[1], exception); |
|
237 } |
|
238 |
|
239 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->elementAtPoint(x, y)); |
|
240 } |
|
241 |
|
242 static JSValueRef isAttributeSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
243 { |
|
244 JSStringRef attribute = 0; |
|
245 if (argumentCount == 1) |
|
246 attribute = JSValueToStringCopy(context, arguments[0], exception); |
|
247 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSupported(attribute)); |
|
248 if (attribute) |
|
249 JSStringRelease(attribute); |
|
250 return result; |
|
251 } |
|
252 |
|
253 static JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
254 { |
|
255 JSStringRef attribute = 0; |
|
256 if (argumentCount == 1) |
|
257 attribute = JSValueToStringCopy(context, arguments[0], exception); |
|
258 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSettable(attribute)); |
|
259 if (attribute) |
|
260 JSStringRelease(attribute); |
|
261 return result; |
|
262 } |
|
263 |
|
264 |
|
265 static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
266 { |
|
267 JSStringRef action = 0; |
|
268 if (argumentCount == 1) |
|
269 action = JSValueToStringCopy(context, arguments[0], exception); |
|
270 JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action)); |
|
271 if (action) |
|
272 JSStringRelease(action); |
|
273 return result; |
|
274 } |
|
275 |
|
276 static JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
277 { |
|
278 JSStringRef attribute = 0; |
|
279 if (argumentCount == 1) |
|
280 attribute = JSValueToStringCopy(context, arguments[0], exception); |
|
281 bool val = toAXElement(thisObject)->boolAttributeValue(attribute); |
|
282 JSValueRef result = JSValueMakeBoolean(context, val); |
|
283 if (attribute) |
|
284 JSStringRelease(attribute); |
|
285 return result; |
|
286 } |
|
287 |
|
288 static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
289 { |
|
290 JSStringRef attribute = 0; |
|
291 if (argumentCount == 1) |
|
292 attribute = JSValueToStringCopy(context, arguments[0], exception); |
|
293 JSRetainPtr<JSStringRef> stringAttributeValue(Adopt, toAXElement(thisObject)->stringAttributeValue(attribute)); |
|
294 JSValueRef result = JSValueMakeString(context, stringAttributeValue.get()); |
|
295 if (attribute) |
|
296 JSStringRelease(attribute); |
|
297 return result; |
|
298 } |
|
299 |
|
300 static JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
301 { |
|
302 unsigned column = 0, row = 0; |
|
303 if (argumentCount == 2) { |
|
304 column = JSValueToNumber(context, arguments[0], exception); |
|
305 row = JSValueToNumber(context, arguments[1], exception); |
|
306 } |
|
307 |
|
308 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row)); |
|
309 } |
|
310 |
|
311 static JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
312 { |
|
313 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement()); |
|
314 } |
|
315 |
|
316 static JSValueRef parentElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
317 { |
|
318 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->parentElement()); |
|
319 } |
|
320 |
|
321 static JSValueRef disclosedByRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
322 { |
|
323 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedByRow()); |
|
324 } |
|
325 |
|
326 static JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
327 { |
|
328 unsigned location = UINT_MAX, length = 0; |
|
329 if (argumentCount == 2) { |
|
330 location = JSValueToNumber(context, arguments[0], exception); |
|
331 length = JSValueToNumber(context, arguments[1], exception); |
|
332 } |
|
333 |
|
334 toAXElement(thisObject)->setSelectedTextRange(location, length); |
|
335 return JSValueMakeUndefined(context); |
|
336 } |
|
337 |
|
338 static JSValueRef incrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
339 { |
|
340 toAXElement(thisObject)->increment(); |
|
341 return JSValueMakeUndefined(context); |
|
342 } |
|
343 |
|
344 static JSValueRef decrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
345 { |
|
346 toAXElement(thisObject)->decrement(); |
|
347 return JSValueMakeUndefined(context); |
|
348 } |
|
349 |
|
350 static JSValueRef showMenuCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
351 { |
|
352 toAXElement(thisObject)->showMenu(); |
|
353 return JSValueMakeUndefined(context); |
|
354 } |
|
355 |
|
356 static JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
357 { |
|
358 toAXElement(thisObject)->press(); |
|
359 return JSValueMakeUndefined(context); |
|
360 } |
|
361 |
|
362 static JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
363 { |
|
364 toAXElement(thisObject)->takeFocus(); |
|
365 return JSValueMakeUndefined(context); |
|
366 } |
|
367 |
|
368 static JSValueRef takeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
369 { |
|
370 toAXElement(thisObject)->takeSelection(); |
|
371 return JSValueMakeUndefined(context); |
|
372 } |
|
373 |
|
374 static JSValueRef addSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
375 { |
|
376 toAXElement(thisObject)->addSelection(); |
|
377 return JSValueMakeUndefined(context); |
|
378 } |
|
379 |
|
380 static JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
381 { |
|
382 toAXElement(thisObject)->removeSelection(); |
|
383 return JSValueMakeUndefined(context); |
|
384 } |
|
385 |
|
386 |
|
387 // Static Value Getters |
|
388 |
|
389 static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
390 { |
|
391 JSRetainPtr<JSStringRef> dropEffects(Adopt, toAXElement(thisObject)->ariaDropEffects()); |
|
392 return JSValueMakeString(context, dropEffects.get()); |
|
393 } |
|
394 |
|
395 static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
396 { |
|
397 return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed()); |
|
398 } |
|
399 |
|
400 static JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
401 { |
|
402 AccessibilityUIElement* uiElement = toAXElement(thisObject); |
|
403 if (!uiElement->platformUIElement()) |
|
404 return JSValueMakeBoolean(context, false); |
|
405 |
|
406 // There might be other platform logic that one could check here... |
|
407 |
|
408 return JSValueMakeBoolean(context, true); |
|
409 } |
|
410 |
|
411 static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
412 { |
|
413 JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role()); |
|
414 return JSValueMakeString(context, role.get()); |
|
415 } |
|
416 |
|
417 static JSValueRef getSubroleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
418 { |
|
419 JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->subrole()); |
|
420 return JSValueMakeString(context, role.get()); |
|
421 } |
|
422 |
|
423 static JSValueRef getRoleDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
424 { |
|
425 JSRetainPtr<JSStringRef> roleDesc(Adopt, toAXElement(thisObject)->roleDescription()); |
|
426 return JSValueMakeString(context, roleDesc.get()); |
|
427 } |
|
428 |
|
429 static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
430 { |
|
431 JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title()); |
|
432 return JSValueMakeString(context, title.get()); |
|
433 } |
|
434 |
|
435 static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
436 { |
|
437 JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description()); |
|
438 return JSValueMakeString(context, description.get()); |
|
439 } |
|
440 |
|
441 static JSValueRef getStringValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
442 { |
|
443 JSRetainPtr<JSStringRef> stringValue(Adopt, toAXElement(thisObject)->stringValue()); |
|
444 return JSValueMakeString(context, stringValue.get()); |
|
445 } |
|
446 |
|
447 static JSValueRef getLanguageCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
448 { |
|
449 JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->language()); |
|
450 return JSValueMakeString(context, language.get()); |
|
451 } |
|
452 |
|
453 static JSValueRef getHelpTextCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
454 { |
|
455 JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->helpText()); |
|
456 return JSValueMakeString(context, language.get()); |
|
457 } |
|
458 |
|
459 static JSValueRef getOrientationCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
460 { |
|
461 JSRetainPtr<JSStringRef> orientation(Adopt, toAXElement(thisObject)->orientation()); |
|
462 return JSValueMakeString(context, orientation.get()); |
|
463 } |
|
464 |
|
465 static JSValueRef getChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
466 { |
|
467 return JSValueMakeNumber(context, toAXElement(thisObject)->childrenCount()); |
|
468 } |
|
469 |
|
470 static JSValueRef rowCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
471 { |
|
472 return JSValueMakeNumber(context, toAXElement(thisObject)->rowCount()); |
|
473 } |
|
474 |
|
475 static JSValueRef columnCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
476 { |
|
477 return JSValueMakeNumber(context, toAXElement(thisObject)->columnCount()); |
|
478 } |
|
479 |
|
480 static JSValueRef getXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
481 { |
|
482 return JSValueMakeNumber(context, toAXElement(thisObject)->x()); |
|
483 } |
|
484 |
|
485 static JSValueRef getYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
486 { |
|
487 return JSValueMakeNumber(context, toAXElement(thisObject)->y()); |
|
488 } |
|
489 |
|
490 static JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
491 { |
|
492 return JSValueMakeNumber(context, toAXElement(thisObject)->width()); |
|
493 } |
|
494 |
|
495 static JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
496 { |
|
497 return JSValueMakeNumber(context, toAXElement(thisObject)->height()); |
|
498 } |
|
499 |
|
500 static JSValueRef getClickPointXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
501 { |
|
502 return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointX()); |
|
503 } |
|
504 |
|
505 static JSValueRef getClickPointYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
506 { |
|
507 return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointY()); |
|
508 } |
|
509 |
|
510 static JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
511 { |
|
512 return JSValueMakeNumber(context, toAXElement(thisObject)->intValue()); |
|
513 } |
|
514 |
|
515 static JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
516 { |
|
517 return JSValueMakeNumber(context, toAXElement(thisObject)->minValue()); |
|
518 } |
|
519 |
|
520 static JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
521 { |
|
522 return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue()); |
|
523 } |
|
524 |
|
525 static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
526 { |
|
527 return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber()); |
|
528 } |
|
529 |
|
530 static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
531 { |
|
532 JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange()); |
|
533 return JSValueMakeString(context, selectedTextRange.get()); |
|
534 } |
|
535 |
|
536 static JSValueRef getIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
537 { |
|
538 return JSValueMakeBoolean(context, toAXElement(thisObject)->isEnabled()); |
|
539 } |
|
540 |
|
541 static JSValueRef getIsRequiredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
542 { |
|
543 return JSValueMakeBoolean(context, toAXElement(thisObject)->isRequired()); |
|
544 } |
|
545 |
|
546 static JSValueRef getIsSelectedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
547 { |
|
548 return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelected()); |
|
549 } |
|
550 |
|
551 static JSValueRef getIsSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
552 { |
|
553 return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelectable()); |
|
554 } |
|
555 |
|
556 static JSValueRef getIsMultiSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
557 { |
|
558 return JSValueMakeBoolean(context, toAXElement(thisObject)->isMultiSelectable()); |
|
559 } |
|
560 |
|
561 static JSValueRef getIsExpandedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
562 { |
|
563 return JSValueMakeBoolean(context, toAXElement(thisObject)->isExpanded()); |
|
564 } |
|
565 |
|
566 static JSValueRef getIsCheckedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
567 { |
|
568 return JSValueMakeBoolean(context, toAXElement(thisObject)->isChecked()); |
|
569 } |
|
570 |
|
571 static JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
572 { |
|
573 return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible()); |
|
574 } |
|
575 |
|
576 static JSValueRef getIsOffScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
577 { |
|
578 return JSValueMakeBoolean(context, toAXElement(thisObject)->isOffScreen()); |
|
579 } |
|
580 |
|
581 static JSValueRef getIsCollapsedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
582 { |
|
583 return JSValueMakeBoolean(context, toAXElement(thisObject)->isCollapsed()); |
|
584 } |
|
585 |
|
586 static JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
587 { |
|
588 return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup()); |
|
589 } |
|
590 |
|
591 static JSValueRef hierarchicalLevelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) |
|
592 { |
|
593 return JSValueMakeNumber(context, toAXElement(thisObject)->hierarchicalLevel()); |
|
594 } |
|
595 |
|
596 static JSValueRef getValueDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
597 { |
|
598 JSRetainPtr<JSStringRef> valueDescription(Adopt, toAXElement(thisObject)->valueDescription()); |
|
599 return JSValueMakeString(context, valueDescription.get()); |
|
600 } |
|
601 |
|
602 static JSValueRef getAccessibilityValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
603 { |
|
604 JSRetainPtr<JSStringRef> accessibilityValue(Adopt, toAXElement(thisObject)->accessibilityValue()); |
|
605 return JSValueMakeString(context, accessibilityValue.get()); |
|
606 } |
|
607 |
|
608 static JSValueRef getDocumentEncodingCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
609 { |
|
610 JSRetainPtr<JSStringRef> documentEncoding(Adopt, toAXElement(thisObject)->documentEncoding()); |
|
611 return JSValueMakeString(context, documentEncoding.get()); |
|
612 } |
|
613 |
|
614 static JSValueRef getDocumentURICallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
615 { |
|
616 JSRetainPtr<JSStringRef> documentURI(Adopt, toAXElement(thisObject)->documentURI()); |
|
617 return JSValueMakeString(context, documentURI.get()); |
|
618 } |
|
619 |
|
620 static JSValueRef getURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) |
|
621 { |
|
622 JSRetainPtr<JSStringRef> url(Adopt, toAXElement(thisObject)->url()); |
|
623 return JSValueMakeString(context, url.get()); |
|
624 } |
|
625 |
|
626 static JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
627 { |
|
628 if (argumentCount != 1) |
|
629 return JSValueMakeBoolean(context, false); |
|
630 |
|
631 JSObjectRef callback = JSValueToObject(context, arguments[0], exception); |
|
632 bool succeeded = toAXElement(thisObject)->addNotificationListener(callback); |
|
633 return JSValueMakeBoolean(context, succeeded); |
|
634 } |
|
635 |
|
636 static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
|
637 { |
|
638 toAXElement(thisObject)->removeNotificationListener(); |
|
639 return JSValueMakeUndefined(context); |
|
640 } |
|
641 |
|
642 // Destruction |
|
643 |
|
644 static void finalize(JSObjectRef thisObject) |
|
645 { |
|
646 delete toAXElement(thisObject); |
|
647 } |
|
648 |
|
649 // Object Creation |
|
650 |
|
651 JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element) |
|
652 { |
|
653 return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element)); |
|
654 } |
|
655 |
|
656 JSClassRef AccessibilityUIElement::getJSClass() |
|
657 { |
|
658 static JSStaticValue staticValues[] = { |
|
659 { "accessibilityValue", getAccessibilityValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
660 { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
661 { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
662 { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
663 { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
664 { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
665 { "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
666 { "helpText", getHelpTextCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
667 { "stringValue", getStringValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
668 { "x", getXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
669 { "y", getYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
670 { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
671 { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
672 { "clickPointX", getClickPointXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
673 { "clickPointY", getClickPointYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
674 { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
675 { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
676 { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
677 { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
678 { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
679 { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
680 { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
681 { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
682 { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
683 { "isRequired", getIsRequiredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
684 { "isSelected", getIsSelectedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
685 { "isSelectable", getIsSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
686 { "isMultiSelectable", getIsMultiSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
687 { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
688 { "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
689 { "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
690 { "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
691 { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
692 { "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
693 { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
694 { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
695 { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
696 { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
697 { "url", getURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
698 { "isValid", getIsValidCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
699 { "orientation", getOrientationCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
700 { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
701 { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
702 { 0, 0, 0, 0 } |
|
703 }; |
|
704 |
|
705 static JSStaticFunction staticFunctions[] = { |
|
706 { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
707 { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
708 { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
709 { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
710 { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
711 { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
712 { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
713 { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
714 { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
715 { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
716 { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
717 { "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
718 { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
719 { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
720 { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
721 { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
722 { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
723 { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
724 { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
725 { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
726 { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
727 { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
728 { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
729 { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
730 { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
731 { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
732 { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
733 { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
734 { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
735 { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
736 { "disclosedByRow", disclosedByRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
737 { "increment", incrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
738 { "decrement", decrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
739 { "showMenu", showMenuCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
740 { "press", pressCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
741 { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
742 { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
743 { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
744 { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
745 { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
746 { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
747 { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
748 { "takeFocus", takeFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
749 { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
750 { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
751 { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
752 { 0, 0, 0 } |
|
753 }; |
|
754 |
|
755 static JSClassDefinition classDefinition = { |
|
756 0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions, |
|
757 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
|
758 }; |
|
759 |
|
760 static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition); |
|
761 return accessibilityUIElementClass; |
|
762 } |
|