Disabled touch adjust feature in case of SDK version.
[framework/web/webkit-efl.git] / Tools / DumpRenderTree / AccessibilityUIElement.cpp
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 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
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
153 static JSValueRef rangeForPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
154 {
155     int x = 0, y = 0;
156     if (argumentCount == 2) {
157         x = JSValueToNumber(context, arguments[0], exception);
158         y = JSValueToNumber(context, arguments[1], exception);
159     }
160     
161     JSRetainPtr<JSStringRef> rangeDescription(Adopt, toAXElement(thisObject)->rangeForPosition(x, y));
162     return JSValueMakeString(context, rangeDescription.get());    
163 }
164
165 static JSValueRef stringForRangeCallback(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)->stringForRange(location, length));
174     return JSValueMakeString(context, stringDescription.get());    
175 }
176
177 static JSValueRef attributedStringForRangeCallback(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     JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->attributedStringForRange(location, length));
186     return JSValueMakeString(context, stringDescription.get());    
187 }
188
189 static JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
190 {
191     unsigned location = UINT_MAX, length = 0;
192     if (argumentCount == 2) {
193         location = JSValueToNumber(context, arguments[0], exception);
194         length = JSValueToNumber(context, arguments[1], exception);
195     }
196     
197     return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length));
198 }
199
200 static JSValueRef uiElementForSearchPredicateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
201 {
202     AccessibilityUIElement* startElement = 0;
203     bool isDirectionNext = true;
204     JSStringRef searchKey = 0;
205     JSStringRef searchText = 0;
206     if (argumentCount == 4) {
207         JSObjectRef startElementObject = JSValueToObject(context, arguments[0], exception);
208         if (startElementObject)
209             startElement = toAXElement(startElementObject);
210         isDirectionNext = JSValueToBoolean(context, arguments[1]);
211         if (JSValueIsString(context, arguments[2]))
212             searchKey = JSValueToStringCopy(context, arguments[2], exception);
213         if (JSValueIsString(context, arguments[3]))
214             searchText = JSValueToStringCopy(context, arguments[3], exception);
215     }
216     
217     JSObjectRef resultObject = AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(startElement, isDirectionNext, searchKey, searchText));
218     if (searchKey)
219         JSStringRelease(searchKey);
220     if (searchText)
221         JSStringRelease(searchText);
222     
223     return resultObject;
224 }
225
226 static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
227 {
228     if (argumentCount != 1)
229         return 0;
230     
231     JSObjectRef otherElement = JSValueToObject(context, arguments[0], exception);
232     AccessibilityUIElement* childElement = toAXElement(otherElement);
233     return JSValueMakeNumber(context, (double)toAXElement(thisObject)->indexOfChild(childElement));
234 }
235
236 static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
237 {
238     int indexNumber = -1;
239     if (argumentCount == 1)
240         indexNumber = JSValueToNumber(context, arguments[0], exception);
241     
242     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber));
243 }
244
245 static JSValueRef selectedChildAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
246 {
247     int indexNumber = -1;
248     if (argumentCount == 1)
249         indexNumber = JSValueToNumber(context, arguments[0], exception);
250     
251     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedChildAtIndex(indexNumber));
252 }
253
254 static JSValueRef linkedUIElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
255 {
256     int indexNumber = -1;
257     if (argumentCount == 1)
258         indexNumber = JSValueToNumber(context, arguments[0], exception);
259     
260     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedUIElementAtIndex(indexNumber));
261 }
262
263 static JSValueRef disclosedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
264 {
265     int indexNumber = 0;
266     if (argumentCount == 1)
267         indexNumber = JSValueToNumber(context, arguments[0], exception);
268     
269     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedRowAtIndex(indexNumber));
270 }
271
272 static JSValueRef ariaOwnsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
273 {
274     int indexNumber = 0;
275     if (argumentCount == 1)
276         indexNumber = JSValueToNumber(context, arguments[0], exception);
277     
278     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaOwnsElementAtIndex(indexNumber));
279 }
280
281 static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
282 {
283     int indexNumber = 0;
284     if (argumentCount == 1)
285         indexNumber = JSValueToNumber(context, arguments[0], exception);
286     
287     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber));
288 }
289
290 static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
291 {
292     int indexNumber = 0;
293     if (argumentCount == 1)
294         indexNumber = JSValueToNumber(context, arguments[0], exception);
295     
296     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedRowAtIndex(indexNumber));
297 }
298
299 static JSValueRef rowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
300 {
301     int indexNumber = 0;
302     if (argumentCount == 1)
303         indexNumber = JSValueToNumber(context, arguments[0], exception);
304     
305     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->rowAtIndex(indexNumber));
306 }
307
308 static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
309 {
310     JSObjectRef otherElement = 0;
311     if (argumentCount == 1)
312         otherElement = JSValueToObject(context, arguments[0], exception);
313     else
314         return JSValueMakeBoolean(context, false);
315     
316     return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement)));
317 }
318
319 static JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
320 {
321     JSObjectRef element = 0;
322     if (argumentCount == 1)
323         element = JSValueToObject(context, arguments[0], exception);
324
325     toAXElement(thisObject)->setSelectedChild(toAXElement(element));
326
327     return JSValueMakeUndefined(context);
328 }
329
330 static JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
331 {
332     int x = 0;
333     int y = 0;
334     if (argumentCount == 2) {
335         x = JSValueToNumber(context, arguments[0], exception);
336         y = JSValueToNumber(context, arguments[1], exception);
337     }
338     
339     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->elementAtPoint(x, y));
340 }
341
342 static JSValueRef isAttributeSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
343 {
344     JSStringRef attribute = 0;
345     if (argumentCount == 1)
346         attribute = JSValueToStringCopy(context, arguments[0], exception);    
347     JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSupported(attribute));
348     if (attribute)
349         JSStringRelease(attribute);
350     return result;
351 }
352
353 static JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
354 {
355     JSStringRef attribute = 0;
356     if (argumentCount == 1)
357         attribute = JSValueToStringCopy(context, arguments[0], exception);    
358     JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSettable(attribute));
359     if (attribute)
360         JSStringRelease(attribute);
361     return result;
362 }
363
364
365 static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
366 {
367     JSStringRef action = 0;
368     if (argumentCount == 1)
369         action = JSValueToStringCopy(context, arguments[0], exception);    
370     JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action));
371     if (action)
372         JSStringRelease(action);
373     return result;
374 }
375
376 static JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
377 {
378     JSStringRef attribute = 0;
379     if (argumentCount == 1)
380         attribute = JSValueToStringCopy(context, arguments[0], exception);
381     bool val = toAXElement(thisObject)->boolAttributeValue(attribute);
382     JSValueRef result = JSValueMakeBoolean(context, val);
383     if (attribute)
384         JSStringRelease(attribute);
385     return result;
386 }
387
388 static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
389 {
390     JSStringRef attribute = 0;
391     if (argumentCount == 1)
392         attribute = JSValueToStringCopy(context, arguments[0], exception);
393     JSRetainPtr<JSStringRef> stringAttributeValue(Adopt, toAXElement(thisObject)->stringAttributeValue(attribute));
394     JSValueRef result = JSValueMakeString(context, stringAttributeValue.get());
395     if (attribute)
396         JSStringRelease(attribute);
397     return result;
398 }
399
400 static JSValueRef uiElementAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
401 {
402     JSRetainPtr<JSStringRef> attribute;
403     if (argumentCount == 1)
404         attribute.adopt(JSValueToStringCopy(context, arguments[0], exception));
405     
406     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementAttributeValue(attribute.get()));
407 }
408
409 static JSValueRef numberAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
410 {
411     JSStringRef attribute = 0;
412     if (argumentCount == 1)
413         attribute = JSValueToStringCopy(context, arguments[0], exception);
414     double val = toAXElement(thisObject)->numberAttributeValue(attribute);
415     JSValueRef result = JSValueMakeNumber(context, val);
416     if (attribute)
417         JSStringRelease(attribute);
418     return result;
419 }
420
421 static JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
422 {
423     unsigned column = 0, row = 0;
424     if (argumentCount == 2) {
425         column = JSValueToNumber(context, arguments[0], exception);
426         row = JSValueToNumber(context, arguments[1], exception);
427     }
428     
429     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row));
430 }
431
432 static JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
433 {
434     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement());
435 }
436
437 static JSValueRef parentElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
438 {
439     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->parentElement());
440 }
441
442 static JSValueRef disclosedByRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
443 {
444     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedByRow());
445 }
446
447 static JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
448 {
449     unsigned location = UINT_MAX, length = 0;
450     if (argumentCount == 2) {
451         location = JSValueToNumber(context, arguments[0], exception);
452         length = JSValueToNumber(context, arguments[1], exception);
453     }
454     
455     toAXElement(thisObject)->setSelectedTextRange(location, length);
456     return JSValueMakeUndefined(context);
457 }
458
459 static JSValueRef incrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
460 {
461     toAXElement(thisObject)->increment();
462     return JSValueMakeUndefined(context);
463 }
464
465 static JSValueRef decrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
466 {
467     toAXElement(thisObject)->decrement();
468     return JSValueMakeUndefined(context);
469 }
470
471 static JSValueRef showMenuCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
472 {
473     toAXElement(thisObject)->showMenu();
474     return JSValueMakeUndefined(context);
475 }
476
477 static JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
478 {
479     toAXElement(thisObject)->press();
480     return JSValueMakeUndefined(context);
481 }
482
483 static JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
484 {
485     toAXElement(thisObject)->takeFocus();
486     return JSValueMakeUndefined(context);
487 }
488
489 static JSValueRef takeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
490 {
491     toAXElement(thisObject)->takeSelection();
492     return JSValueMakeUndefined(context);
493 }
494
495 static JSValueRef addSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
496 {
497     toAXElement(thisObject)->addSelection();
498     return JSValueMakeUndefined(context);
499 }
500
501 static JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
502 {
503     toAXElement(thisObject)->removeSelection();
504     return JSValueMakeUndefined(context);
505 }
506
507 static JSValueRef textMarkerRangeForElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
508 {
509     AccessibilityUIElement* uiElement = 0;
510     if (argumentCount == 1)
511         uiElement = toAXElement(JSValueToObject(context, arguments[0], exception));
512     
513     return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement));
514 }
515
516 static JSValueRef attributedStringForTextMarkerRangeContainsAttributeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
517 {
518     AccessibilityTextMarkerRange* markerRange = 0;
519     JSStringRef attribute = 0;
520     if (argumentCount == 2) {
521         attribute = JSValueToStringCopy(context, arguments[0], exception);
522         markerRange = toTextMarkerRange(JSValueToObject(context, arguments[1], exception));
523     }
524     
525     JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringForTextMarkerRangeContainsAttribute(attribute, markerRange));
526     if (attribute)
527         JSStringRelease(attribute);
528     
529     return result;    
530 }
531
532 static JSValueRef indexForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
533 {
534     AccessibilityTextMarker* marker = 0;
535     if (argumentCount == 1)
536         marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
537     
538     return JSValueMakeNumber(context, toAXElement(thisObject)->indexForTextMarker(marker));
539 }
540
541 static JSValueRef isTextMarkerValidCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
542 {
543     AccessibilityTextMarker* marker = 0;
544     if (argumentCount == 1)
545         marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
546     
547     return JSValueMakeBoolean(context, toAXElement(thisObject)->isTextMarkerValid(marker));
548 }
549
550 static JSValueRef textMarkerForIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
551 {
552     int textIndex = 0;
553     if (argumentCount == 1)
554         textIndex = JSValueToNumber(context, arguments[0], exception);
555     
556     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->textMarkerForIndex(textIndex));
557 }
558
559 static JSValueRef textMarkerRangeLengthCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
560 {
561     AccessibilityTextMarkerRange* range = 0;
562     if (argumentCount == 1)
563         range = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
564     
565     return JSValueMakeNumber(context, (int)toAXElement(thisObject)->textMarkerRangeLength(range));
566 }
567
568 static JSValueRef nextTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
569 {
570     AccessibilityTextMarker* marker = 0;
571     if (argumentCount == 1)
572         marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
573     
574     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->nextTextMarker(marker));
575 }
576
577 static JSValueRef previousTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
578 {
579     AccessibilityTextMarker* marker = 0;
580     if (argumentCount == 1)
581         marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
582     
583     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->previousTextMarker(marker));
584 }
585
586 static JSValueRef stringForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
587 {
588     AccessibilityTextMarkerRange* markerRange = 0;
589     if (argumentCount == 1)
590         markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
591     
592     JSRetainPtr<JSStringRef> markerRangeString(Adopt, toAXElement(thisObject)->stringForTextMarkerRange(markerRange));
593     return JSValueMakeString(context, markerRangeString.get());    
594 }
595
596 static JSValueRef textMarkerForPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
597 {
598     int x = 0;
599     int y = 0;
600     if (argumentCount == 2) {
601         x = JSValueToNumber(context, arguments[0], exception);
602         y = JSValueToNumber(context, arguments[1], exception);
603     }
604     
605     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->textMarkerForPoint(x, y));
606 }
607
608 static JSValueRef textMarkerRangeForMarkersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
609 {
610     AccessibilityTextMarker* startMarker = 0;
611     AccessibilityTextMarker* endMarker = 0;
612     if (argumentCount == 2) {
613         startMarker = toTextMarker(JSValueToObject(context, arguments[0], exception));
614         endMarker = toTextMarker(JSValueToObject(context, arguments[1], exception));
615     }
616     
617     return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForMarkers(startMarker, endMarker));
618 }
619
620 static JSValueRef startTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
621 {
622     AccessibilityTextMarkerRange* markerRange = 0;
623     if (argumentCount == 1)
624         markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
625     
626     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->startTextMarkerForTextMarkerRange(markerRange));
627 }
628
629 static JSValueRef endTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
630 {
631     AccessibilityTextMarkerRange* markerRange = 0;
632     if (argumentCount == 1)
633         markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
634     
635     return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarkerForTextMarkerRange(markerRange));
636 }
637
638 static JSValueRef accessibilityElementForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
639 {
640     AccessibilityTextMarker* marker = 0;
641     if (argumentCount == 1)
642         marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
643     
644     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->accessibilityElementForTextMarker(marker));
645 }
646
647 // Static Value Getters
648
649 static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
650 {
651     JSRetainPtr<JSStringRef> dropEffects(Adopt, toAXElement(thisObject)->ariaDropEffects());
652     return JSValueMakeString(context, dropEffects.get());
653 }
654
655 static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
656 {
657     return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
658 }
659
660 static JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
661 {
662     AccessibilityUIElement* uiElement = toAXElement(thisObject);
663     if (!uiElement->platformUIElement())
664         return JSValueMakeBoolean(context, false);
665     
666     // There might be other platform logic that one could check here...
667     
668     return JSValueMakeBoolean(context, true);
669 }
670
671 static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
672 {
673     JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role());
674     return JSValueMakeString(context, role.get());
675 }
676
677 static JSValueRef getSubroleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
678 {
679     JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->subrole());
680     return JSValueMakeString(context, role.get());
681 }
682
683 static JSValueRef getRoleDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
684 {
685     JSRetainPtr<JSStringRef> roleDesc(Adopt, toAXElement(thisObject)->roleDescription());
686     return JSValueMakeString(context, roleDesc.get());
687 }
688
689 static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
690 {
691     JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
692     return JSValueMakeString(context, title.get());
693 }
694
695 static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
696 {
697     JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
698     return JSValueMakeString(context, description.get());
699 }
700
701 static JSValueRef getStringValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
702 {
703     JSRetainPtr<JSStringRef> stringValue(Adopt, toAXElement(thisObject)->stringValue());
704     return JSValueMakeString(context, stringValue.get());
705 }
706
707 static JSValueRef getLanguageCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
708 {
709     JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->language());
710     return JSValueMakeString(context, language.get());
711 }
712
713 static JSValueRef getHelpTextCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
714 {
715     JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->helpText());
716     return JSValueMakeString(context, language.get());
717 }
718
719 static JSValueRef getOrientationCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
720 {
721     JSRetainPtr<JSStringRef> orientation(Adopt, toAXElement(thisObject)->orientation());
722     return JSValueMakeString(context, orientation.get());
723 }
724
725 static JSValueRef getChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
726 {
727     return JSValueMakeNumber(context, toAXElement(thisObject)->childrenCount());
728 }
729
730 static JSValueRef rowCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
731 {
732     return JSValueMakeNumber(context, toAXElement(thisObject)->rowCount());
733 }
734
735 static JSValueRef columnCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
736 {
737     return JSValueMakeNumber(context, toAXElement(thisObject)->columnCount());
738 }
739
740 static JSValueRef getXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
741 {
742     return JSValueMakeNumber(context, toAXElement(thisObject)->x());
743 }
744
745 static JSValueRef getYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
746 {
747     return JSValueMakeNumber(context, toAXElement(thisObject)->y());
748 }
749
750 static JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
751 {
752     return JSValueMakeNumber(context, toAXElement(thisObject)->width());
753 }
754
755 static JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
756 {
757     return JSValueMakeNumber(context, toAXElement(thisObject)->height());
758 }
759
760 static JSValueRef getClickPointXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
761 {
762     return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointX());
763 }
764
765 static JSValueRef getClickPointYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
766 {
767     return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointY());
768 }
769
770 static JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
771 {
772     return JSValueMakeNumber(context, toAXElement(thisObject)->intValue());
773 }
774
775 static JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
776 {
777     return JSValueMakeNumber(context, toAXElement(thisObject)->minValue());
778 }
779
780 static JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
781 {
782     return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue());
783 }
784
785 static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
786 {
787     return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber());
788 }
789
790 static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
791 {
792     JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange());
793     return JSValueMakeString(context, selectedTextRange.get());
794 }
795
796 static JSValueRef getIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
797 {
798     return JSValueMakeBoolean(context, toAXElement(thisObject)->isEnabled());
799 }
800
801 static JSValueRef getIsRequiredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
802 {
803     return JSValueMakeBoolean(context, toAXElement(thisObject)->isRequired());
804 }
805
806 static JSValueRef getIsFocusedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
807 {
808     return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocused());
809 }
810
811 static JSValueRef getIsFocusableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
812 {
813     return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocusable());
814 }
815
816 static JSValueRef getIsSelectedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
817 {
818     return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelected());
819 }
820
821 static JSValueRef getIsSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
822 {
823     return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelectable());
824 }
825
826 static JSValueRef getIsMultiSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
827 {
828     return JSValueMakeBoolean(context, toAXElement(thisObject)->isMultiSelectable());
829 }
830
831 static JSValueRef getIsSelectedOptionActiveCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
832 {
833     return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelectedOptionActive());
834 }
835
836 static JSValueRef getIsExpandedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
837 {
838     return JSValueMakeBoolean(context, toAXElement(thisObject)->isExpanded());
839 }
840
841 static JSValueRef getIsCheckedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
842 {
843     return JSValueMakeBoolean(context, toAXElement(thisObject)->isChecked());
844 }
845
846 static JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
847 {
848     return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible());
849 }
850
851 static JSValueRef getIsOffScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
852 {
853     return JSValueMakeBoolean(context, toAXElement(thisObject)->isOffScreen());
854 }
855
856 static JSValueRef getIsCollapsedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
857 {
858     return JSValueMakeBoolean(context, toAXElement(thisObject)->isCollapsed());
859 }
860
861 static JSValueRef isIgnoredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
862 {
863     return JSValueMakeBoolean(context, toAXElement(thisObject)->isIgnored());
864 }
865
866 static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
867 {
868     JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak());
869     return JSValueMakeString(context, speakString.get());
870 }
871
872 static JSValueRef selectedChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
873 {
874     return JSValueMakeNumber(context, toAXElement(thisObject)->selectedChildrenCount());
875 }
876
877 static JSValueRef horizontalScrollbarCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
878 {
879     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->horizontalScrollbar());
880 }
881
882 static JSValueRef verticalScrollbarCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
883 {
884     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->verticalScrollbar());
885 }
886
887 static JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
888 {
889     return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup());
890 }
891
892 static JSValueRef hierarchicalLevelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
893 {
894     return JSValueMakeNumber(context, toAXElement(thisObject)->hierarchicalLevel());
895 }
896
897 static JSValueRef getValueDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
898 {
899     JSRetainPtr<JSStringRef> valueDescription(Adopt, toAXElement(thisObject)->valueDescription());
900     return JSValueMakeString(context, valueDescription.get());
901 }
902
903 static JSValueRef getAccessibilityValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
904 {
905     JSRetainPtr<JSStringRef> accessibilityValue(Adopt, toAXElement(thisObject)->accessibilityValue());
906     return JSValueMakeString(context, accessibilityValue.get());
907 }
908
909 static JSValueRef getDocumentEncodingCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
910 {
911     JSRetainPtr<JSStringRef> documentEncoding(Adopt, toAXElement(thisObject)->documentEncoding());
912     return JSValueMakeString(context, documentEncoding.get());
913 }
914
915 static JSValueRef getDocumentURICallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
916 {
917     JSRetainPtr<JSStringRef> documentURI(Adopt, toAXElement(thisObject)->documentURI());
918     return JSValueMakeString(context, documentURI.get());
919 }
920
921 static JSValueRef getURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
922 {
923     JSRetainPtr<JSStringRef> url(Adopt, toAXElement(thisObject)->url());
924     return JSValueMakeString(context, url.get());
925 }
926
927 static JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
928 {
929     if (argumentCount != 1)
930         return JSValueMakeBoolean(context, false);
931     
932     JSObjectRef callback = JSValueToObject(context, arguments[0], exception);
933     bool succeeded = toAXElement(thisObject)->addNotificationListener(callback);
934     return JSValueMakeBoolean(context, succeeded);
935 }
936
937 static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
938 {
939     toAXElement(thisObject)->removeNotificationListener();
940     return JSValueMakeUndefined(context);
941 }
942
943 // Implementation
944
945 // Unsupported methods on various platforms.
946 #if !PLATFORM(MAC)
947 JSStringRef AccessibilityUIElement::speak() { return 0; }
948 JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; }
949 JSStringRef AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
950 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { }
951 unsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; }
952 AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; }
953 AccessibilityUIElement AccessibilityUIElement::horizontalScrollbar() const { return 0; }
954 AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const { return 0; }
955 AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef) const { return 0; }
956 #endif
957
958 #if !PLATFORM(WIN)
959 bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)
960 {
961     return platformUIElement() == otherElement->platformUIElement();
962 }
963 #endif
964
965 #if !SUPPORTS_AX_TEXTMARKERS
966
967 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*)
968 {
969     return 0;
970 }
971
972 int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*)
973 {
974     return 0;
975 }
976
977 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker*, AccessibilityTextMarker*)
978 {
979     return 0;
980 }
981
982 AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
983 {
984     return 0;
985 }
986
987 AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
988 {
989     return 0;   
990 }
991
992 AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker*)
993 {
994     return 0;
995 }
996
997 AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y)
998 {
999     return 0;
1000 }
1001
1002 AccessibilityTextMarker AccessibilityUIElement::previousTextMarker(AccessibilityTextMarker*)
1003 {
1004     return 0;    
1005 }
1006
1007 AccessibilityTextMarker AccessibilityUIElement::nextTextMarker(AccessibilityTextMarker*)
1008 {
1009     return 0;
1010 }
1011
1012 JSStringRef AccessibilityUIElement::stringForTextMarkerRange(AccessibilityTextMarkerRange*)
1013 {
1014     return 0;
1015 }
1016
1017 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef, AccessibilityTextMarkerRange*)
1018 {
1019     return false;
1020 }
1021
1022 int AccessibilityUIElement::indexForTextMarker(AccessibilityTextMarker*)
1023 {
1024     return -1;
1025 }
1026
1027 bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker*)
1028 {
1029     return false;
1030 }
1031
1032 AccessibilityTextMarker AccessibilityUIElement::textMarkerForIndex(int)
1033 {
1034     return 0;
1035 }
1036
1037 #endif
1038
1039 // Destruction
1040
1041 static void finalize(JSObjectRef thisObject)
1042 {
1043     delete toAXElement(thisObject);
1044 }
1045
1046 // Object Creation
1047
1048 JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element)
1049 {
1050     return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element));
1051 }
1052
1053 JSClassRef AccessibilityUIElement::getJSClass()
1054 {
1055     static JSStaticValue staticValues[] = {
1056         { "accessibilityValue", getAccessibilityValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1057         { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1058         { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1059         { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1060         { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1061         { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1062         { "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1063         { "helpText", getHelpTextCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1064         { "stringValue", getStringValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1065         { "x", getXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1066         { "y", getYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1067         { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1068         { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1069         { "clickPointX", getClickPointXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1070         { "clickPointY", getClickPointYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1071         { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1072         { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1073         { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1074         { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1075         { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1076         { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1077         { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1078         { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1079         { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1080         { "isRequired", getIsRequiredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1081         { "isFocused", getIsFocusedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1082         { "isFocusable", getIsFocusableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1083         { "isSelected", getIsSelectedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1084         { "isSelectable", getIsSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1085         { "isMultiSelectable", getIsMultiSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1086         { "isSelectedOptionActive", getIsSelectedOptionActiveCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1087         { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1088         { "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1089         { "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1090         { "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1091         { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1092         { "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1093         { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1094         { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1095         { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1096         { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1097         { "url", getURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1098         { "isValid", getIsValidCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1099         { "orientation", getOrientationCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1100         { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1101         { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1102         { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1103         { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1104         { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1105         { "horizontalScrollbar", horizontalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1106         { "verticalScrollbar", verticalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1107         { 0, 0, 0, 0 }
1108     };
1109
1110     static JSStaticFunction staticFunctions[] = {
1111         { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1112         { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1113         { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1114         { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1115         { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1116         { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1117         { "rangeForLine", rangeForLineCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1118         { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1119         { "rangeForPosition", rangeForPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1120         { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1121         { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1122         { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1123         { "uiElementForSearchPredicate", uiElementForSearchPredicateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1124         { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1125         { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1126         { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1127         { "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1128         { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1129         { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1130         { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1131         { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1132         { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1133         { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1134         { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1135         { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1136         { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1137         { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1138         { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1139         { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1140         { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1141         { "uiElementAttributeValue", uiElementAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1142         { "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1143         { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1144         { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1145         { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1146         { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1147         { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1148         { "disclosedByRow", disclosedByRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1149         { "increment", incrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1150         { "decrement", decrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1151         { "showMenu", showMenuCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1152         { "press", pressCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1153         { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1154         { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1155         { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1156         { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1157         { "rowAtIndex", rowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1158         { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1159         { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1160         { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1161         { "takeFocus", takeFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1162         { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1163         { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1164         { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1165         { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1166         { "attributedStringForTextMarkerRangeContainsAttribute", attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1167         { "indexForTextMarker", indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1168         { "isTextMarkerValid", isTextMarkerValidCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1169         { "textMarkerRangeForMarkers", textMarkerRangeForMarkersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1170         { "textMarkerForIndex", textMarkerForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1171         { "startTextMarkerForTextMarkerRange", startTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1172         { "endTextMarkerForTextMarkerRange", endTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1173         { "accessibilityElementForTextMarker", accessibilityElementForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1174         { "textMarkerRangeLength", textMarkerRangeLengthCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1175         { "textMarkerForPoint", textMarkerForPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1176         { "nextTextMarker", nextTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1177         { "previousTextMarker", previousTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1178         { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1179         { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1180         { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
1181         { 0, 0, 0 }
1182     };
1183
1184     static JSClassDefinition classDefinition = {
1185         0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions,
1186         0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
1187     };
1188
1189     static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition);
1190     return accessibilityUIElementClass;
1191 }