1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "config.h"
27 #include "AccessibilityUIElement.h"
28
29 #include <JavaScriptCore/JSRetainPtr.h>
30
31 // Static Functions
32
toAXElement(JSObjectRef object)33 static AccessibilityUIElement* toAXElement(JSObjectRef object)
34 {
35 // FIXME: We should ASSERT that it is the right class here.
36 return reinterpret_cast<AccessibilityUIElement*>(JSObjectGetPrivate(object));
37 }
38
allAttributesCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)39 static JSValueRef allAttributesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
40 {
41 JSRetainPtr<JSStringRef> attributes(Adopt, toAXElement(thisObject)->allAttributes());
42 return JSValueMakeString(context, attributes.get());
43 }
44
attributesOfLinkedUIElementsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)45 static JSValueRef attributesOfLinkedUIElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
46 {
47 JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfLinkedUIElements());
48 return JSValueMakeString(context, linkedUIDescription.get());
49 }
50
attributesOfDocumentLinksCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)51 static JSValueRef attributesOfDocumentLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
52 {
53 JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfDocumentLinks());
54 return JSValueMakeString(context, linkedUIDescription.get());
55 }
56
attributesOfChildrenCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)57 static JSValueRef attributesOfChildrenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
58 {
59 JSRetainPtr<JSStringRef> childrenDescription(Adopt, toAXElement(thisObject)->attributesOfChildren());
60 return JSValueMakeString(context, childrenDescription.get());
61 }
62
parameterizedAttributeNamesCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)63 static JSValueRef parameterizedAttributeNamesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
64 {
65 JSRetainPtr<JSStringRef> parameterizedAttributeNames(Adopt, toAXElement(thisObject)->parameterizedAttributeNames());
66 return JSValueMakeString(context, parameterizedAttributeNames.get());
67 }
68
attributesOfColumnHeadersCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)69 static JSValueRef attributesOfColumnHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
70 {
71 JSRetainPtr<JSStringRef> attributesOfColumnHeaders(Adopt, toAXElement(thisObject)->attributesOfColumnHeaders());
72 return JSValueMakeString(context, attributesOfColumnHeaders.get());
73 }
74
attributesOfRowHeadersCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)75 static JSValueRef attributesOfRowHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
76 {
77 JSRetainPtr<JSStringRef> attributesOfRowHeaders(Adopt, toAXElement(thisObject)->attributesOfRowHeaders());
78 return JSValueMakeString(context, attributesOfRowHeaders.get());
79 }
80
attributesOfColumnsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)81 static JSValueRef attributesOfColumnsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
82 {
83 JSRetainPtr<JSStringRef> attributesOfColumns(Adopt, toAXElement(thisObject)->attributesOfColumns());
84 return JSValueMakeString(context, attributesOfColumns.get());
85 }
86
attributesOfRowsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)87 static JSValueRef attributesOfRowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
88 {
89 JSRetainPtr<JSStringRef> attributesOfRows(Adopt, toAXElement(thisObject)->attributesOfRows());
90 return JSValueMakeString(context, attributesOfRows.get());
91 }
92
attributesOfVisibleCellsCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)93 static JSValueRef attributesOfVisibleCellsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
94 {
95 JSRetainPtr<JSStringRef> attributesOfVisibleCells(Adopt, toAXElement(thisObject)->attributesOfVisibleCells());
96 return JSValueMakeString(context, attributesOfVisibleCells.get());
97 }
98
attributesOfHeaderCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)99 static JSValueRef attributesOfHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
100 {
101 JSRetainPtr<JSStringRef> attributesOfHeader(Adopt, toAXElement(thisObject)->attributesOfHeader());
102 return JSValueMakeString(context, attributesOfHeader.get());
103 }
104
indexInTableCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)105 static JSValueRef indexInTableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
106 {
107 return JSValueMakeNumber(context, toAXElement(thisObject)->indexInTable());
108 }
109
rowIndexRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)110 static JSValueRef rowIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
111 {
112 JSRetainPtr<JSStringRef> rowIndexRange(Adopt, toAXElement(thisObject)->rowIndexRange());
113 return JSValueMakeString(context, rowIndexRange.get());
114 }
115
columnIndexRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)116 static JSValueRef columnIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
117 {
118 JSRetainPtr<JSStringRef> columnIndexRange(Adopt, toAXElement(thisObject)->columnIndexRange());
119 return JSValueMakeString(context, columnIndexRange.get());
120 }
121
lineForIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)122 static JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
123 {
124 int indexNumber = -1;
125 if (argumentCount == 1)
126 indexNumber = JSValueToNumber(context, arguments[0], exception);
127
128 return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber));
129 }
130
boundsForRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)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
childAtIndexCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)143 static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
144 {
145 int indexNumber = -1;
146 if (argumentCount == 1)
147 indexNumber = JSValueToNumber(context, arguments[0], exception);
148
149 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber));
150 }
151
cellForColumnAndRowCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)152 static JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
153 {
154 unsigned column = 0, row = 0;
155 if (argumentCount == 2) {
156 column = JSValueToNumber(context, arguments[0], exception);
157 row = JSValueToNumber(context, arguments[1], exception);
158 }
159
160 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row));
161 }
162
titleUIElementCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)163 static JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
164 {
165 return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement());
166 }
167
setSelectedTextRangeCallback(JSContextRef context,JSObjectRef function,JSObjectRef thisObject,size_t argumentCount,const JSValueRef arguments[],JSValueRef * exception)168 static JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
169 {
170 unsigned location = UINT_MAX, length = 0;
171 if (argumentCount == 2) {
172 location = JSValueToNumber(context, arguments[0], exception);
173 length = JSValueToNumber(context, arguments[1], exception);
174 }
175
176 toAXElement(thisObject)->setSelectedTextRange(location, length);
177 return 0;
178 }
179
180 // Static Value Getters
181
getRoleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)182 static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
183 {
184 JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role());
185 return JSValueMakeString(context, role.get());
186 }
187
getTitleCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)188 static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
189 {
190 JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
191 return JSValueMakeString(context, title.get());
192 }
193
getDescriptionCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)194 static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
195 {
196 JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
197 return JSValueMakeString(context, description.get());
198 }
199
getWidthCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)200 static JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
201 {
202 return JSValueMakeNumber(context, toAXElement(thisObject)->width());
203 }
204
getHeightCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)205 static JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
206 {
207 return JSValueMakeNumber(context, toAXElement(thisObject)->height());
208 }
209
getIntValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)210 static JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
211 {
212 return JSValueMakeNumber(context, toAXElement(thisObject)->intValue());
213 }
214
getMinValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)215 static JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
216 {
217 return JSValueMakeNumber(context, toAXElement(thisObject)->minValue());
218 }
219
getMaxValueCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)220 static JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
221 {
222 return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue());
223 }
224
getInsertionPointLineNumberCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)225 static JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
226 {
227 return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber());
228 }
229
getSelectedTextRangeCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)230 static JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
231 {
232 JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange());
233 return JSValueMakeString(context, selectedTextRange.get());
234 }
235
getSupportsPressActionCallback(JSContextRef context,JSObjectRef thisObject,JSStringRef propertyName,JSValueRef * exception)236 static JSValueRef getSupportsPressActionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
237 {
238 return JSValueMakeBoolean(context, toAXElement(thisObject)->supportsPressAction());
239 }
240
241 // Destruction
242
finalize(JSObjectRef thisObject)243 static void finalize(JSObjectRef thisObject)
244 {
245 delete toAXElement(thisObject);
246 }
247
248 // Object Creation
249
makeJSAccessibilityUIElement(JSContextRef context,const AccessibilityUIElement & element)250 JSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element)
251 {
252 return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element));
253 }
254
getJSClass()255 JSClassRef AccessibilityUIElement::getJSClass()
256 {
257 static JSStaticValue staticValues[] = {
258 { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
259 { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
260 { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
261 { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
262 { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
263 { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
264 { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
265 { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
266 { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
267 { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
268 { "supportsPressAction", getSupportsPressActionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
269 { 0, 0, 0, 0 }
270 };
271
272 static JSStaticFunction staticFunctions[] = {
273 { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
274 { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
275 { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
276 { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
277 { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
278 { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
279 { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
280 { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
281 { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
282 { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
283 { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
284 { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
285 { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
286 { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
287 { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
288 { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
289 { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
290 { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
291 { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
292 { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
293 { 0, 0, 0 }
294 };
295
296 static JSClassDefinition classDefinition = {
297 0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions,
298 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
299 };
300
301 static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition);
302 return accessibilityUIElementClass;
303 }
304