1563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark/*
2563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
3563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark *
4563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * Redistribution and use in source and binary forms, with or without
5563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * modification, are permitted provided that the following conditions
6563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * are met:
7563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 1. Redistributions of source code must retain the above copyright
8563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark *    notice, this list of conditions and the following disclaimer.
9563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 2. Redistributions in binary form must reproduce the above copyright
10563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark *    notice, this list of conditions and the following disclaimer in the
11563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark *    documentation and/or other materials provided with the distribution.
12563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark *
13563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark */
25563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
26563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include "config.h"
27563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include "AccessibilityUIElement.h"
28563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
29563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include <JavaScriptCore/JSRetainPtr.h>
30563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
31563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Static Functions
32563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic inline AccessibilityUIElement* toAXElement(JSObjectRef object)
34563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
35563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    // FIXME: We should ASSERT that it is the right class here.
360bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return static_cast<AccessibilityUIElement*>(JSObjectGetPrivate(object));
37563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
38563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
39563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef allAttributesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
40563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
41563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributes(Adopt, toAXElement(thisObject)->allAttributes());
42563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributes.get());
43563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
44563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
45563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfLinkedUIElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
46563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
47563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfLinkedUIElements());
48563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, linkedUIDescription.get());
49563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
50563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
51563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfDocumentLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
52563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
53563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> linkedUIDescription(Adopt, toAXElement(thisObject)->attributesOfDocumentLinks());
54563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, linkedUIDescription.get());
55563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
56563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
57563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfChildrenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
58563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
59563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> childrenDescription(Adopt, toAXElement(thisObject)->attributesOfChildren());
60563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, childrenDescription.get());
61563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
62563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
63563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef parameterizedAttributeNamesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
64563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
65563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> parameterizedAttributeNames(Adopt, toAXElement(thisObject)->parameterizedAttributeNames());
66563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, parameterizedAttributeNames.get());
67563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
68563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
69563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfColumnHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
70563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
71563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfColumnHeaders(Adopt, toAXElement(thisObject)->attributesOfColumnHeaders());
72563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfColumnHeaders.get());
73563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
74563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
75563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfRowHeadersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
76563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
77563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfRowHeaders(Adopt, toAXElement(thisObject)->attributesOfRowHeaders());
78563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfRowHeaders.get());
79563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
80563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
81563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfColumnsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
82563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
83563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfColumns(Adopt, toAXElement(thisObject)->attributesOfColumns());
84563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfColumns.get());
85563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
86563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
87563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfRowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
88563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
89563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfRows(Adopt, toAXElement(thisObject)->attributesOfRows());
90563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfRows.get());
91563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
92563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
93563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfVisibleCellsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
94563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
95563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfVisibleCells(Adopt, toAXElement(thisObject)->attributesOfVisibleCells());
96563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfVisibleCells.get());
97563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
98563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
99563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef attributesOfHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
100563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
101563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> attributesOfHeader(Adopt, toAXElement(thisObject)->attributesOfHeader());
102563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, attributesOfHeader.get());
103563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
104563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
105563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef indexInTableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
106563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
107563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->indexInTable());
108563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
109563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
110563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef rowIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
111563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
112563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> rowIndexRange(Adopt, toAXElement(thisObject)->rowIndexRange());
113563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, rowIndexRange.get());
114563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
115563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
116563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef columnIndexRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
117563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
118563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> columnIndexRange(Adopt, toAXElement(thisObject)->columnIndexRange());
119563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, columnIndexRange.get());
120563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
121563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
122563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
123563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
124563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    int indexNumber = -1;
125563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 1)
126563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        indexNumber = JSValueToNumber(context, arguments[0], exception);
127563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
128563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber));
129563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
130563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
131a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochstatic JSValueRef rangeForLineCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
132a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
133a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    int indexNumber = -1;
134a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (argumentCount == 1)
135a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        indexNumber = JSValueToNumber(context, arguments[0], exception);
136a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
137a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    JSRetainPtr<JSStringRef> rangeLine(Adopt, toAXElement(thisObject)->rangeForLine(indexNumber));
138a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return JSValueMakeString(context, rangeLine.get());
139a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
140a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
141563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
142563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
143563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    unsigned location = UINT_MAX, length = 0;
144563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 2) {
145563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        location = JSValueToNumber(context, arguments[0], exception);
146563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        length = JSValueToNumber(context, arguments[1], exception);
147563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    }
148563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
149563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> boundsDescription(Adopt, toAXElement(thisObject)->boundsForRange(location, length));
150563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, boundsDescription.get());
151563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
152563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
153231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
154231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{
155231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    unsigned location = UINT_MAX, length = 0;
156231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    if (argumentCount == 2) {
157231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        location = JSValueToNumber(context, arguments[0], exception);
158231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        length = JSValueToNumber(context, arguments[1], exception);
159231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    }
160231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
161231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->stringForRange(location, length));
162231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    return JSValueMakeString(context, stringDescription.get());
163231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}
164231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
1650617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsenstatic JSValueRef attributedStringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1660617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen{
1670617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    unsigned location = UINT_MAX, length = 0;
1680617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    if (argumentCount == 2) {
1690617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        location = JSValueToNumber(context, arguments[0], exception);
1700617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        length = JSValueToNumber(context, arguments[1], exception);
1710617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    }
1720617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen
1730617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->attributedStringForRange(location, length));
1740617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    return JSValueMakeString(context, stringDescription.get());
1750617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen}
1760617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen
1770617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsenstatic JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1780617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen{
1790617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    unsigned location = UINT_MAX, length = 0;
1800617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    if (argumentCount == 2) {
1810617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        location = JSValueToNumber(context, arguments[0], exception);
1820617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        length = JSValueToNumber(context, arguments[1], exception);
1830617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    }
1840617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen
1850617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen    return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length));
1860617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen}
1870617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen
188d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
189d0825bca7fe65beaee391d30da42e937db621564Steve Block{
190d0825bca7fe65beaee391d30da42e937db621564Steve Block    if (argumentCount != 1)
191d0825bca7fe65beaee391d30da42e937db621564Steve Block        return 0;
192d0825bca7fe65beaee391d30da42e937db621564Steve Block
193d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSObjectRef otherElement = JSValueToObject(context, arguments[0], exception);
194d0825bca7fe65beaee391d30da42e937db621564Steve Block    AccessibilityUIElement* childElement = toAXElement(otherElement);
195d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeNumber(context, (double)toAXElement(thisObject)->indexOfChild(childElement));
196d0825bca7fe65beaee391d30da42e937db621564Steve Block}
197d0825bca7fe65beaee391d30da42e937db621564Steve Block
198563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
199563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
200563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    int indexNumber = -1;
201563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 1)
202563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        indexNumber = JSValueToNumber(context, arguments[0], exception);
203563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
204563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->getChildAtIndex(indexNumber));
205563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
206563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
207e14391e94c850b8bd03680c23b38978db68687a8John Reckstatic JSValueRef selectedChildAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
208e14391e94c850b8bd03680c23b38978db68687a8John Reck{
209e14391e94c850b8bd03680c23b38978db68687a8John Reck    int indexNumber = -1;
210e14391e94c850b8bd03680c23b38978db68687a8John Reck    if (argumentCount == 1)
211e14391e94c850b8bd03680c23b38978db68687a8John Reck        indexNumber = JSValueToNumber(context, arguments[0], exception);
212e14391e94c850b8bd03680c23b38978db68687a8John Reck
213e14391e94c850b8bd03680c23b38978db68687a8John Reck    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedChildAtIndex(indexNumber));
214e14391e94c850b8bd03680c23b38978db68687a8John Reck}
215e14391e94c850b8bd03680c23b38978db68687a8John Reck
216545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdochstatic JSValueRef linkedUIElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
217545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch{
218545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch    int indexNumber = -1;
219545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch    if (argumentCount == 1)
220545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch        indexNumber = JSValueToNumber(context, arguments[0], exception);
221545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
222545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->linkedUIElementAtIndex(indexNumber));
223545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch}
224545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch
225643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef disclosedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
226643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
227643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    int indexNumber = 0;
228643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
229643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        indexNumber = JSValueToNumber(context, arguments[0], exception);
230643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
231643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedRowAtIndex(indexNumber));
232643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
233643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
234643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef ariaOwnsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
235643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
236643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    int indexNumber = 0;
237643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
238643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        indexNumber = JSValueToNumber(context, arguments[0], exception);
239643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
240643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaOwnsElementAtIndex(indexNumber));
241643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
242643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
243643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
244643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
245643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    int indexNumber = 0;
246643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
247643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        indexNumber = JSValueToNumber(context, arguments[0], exception);
248643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
249643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber));
250643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
251643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
252643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
253643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
254643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    int indexNumber = 0;
255643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
256643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        indexNumber = JSValueToNumber(context, arguments[0], exception);
257643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
258643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->selectedRowAtIndex(indexNumber));
259643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
260643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
261643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
262643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
263643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSObjectRef otherElement = 0;
264643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
265643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        otherElement = JSValueToObject(context, arguments[0], exception);
266643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    else
267643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        return JSValueMakeBoolean(context, false);
268643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
269643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement)));
270643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
271643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
272e14391e94c850b8bd03680c23b38978db68687a8John Reckstatic JSValueRef setSelectedChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
273e14391e94c850b8bd03680c23b38978db68687a8John Reck{
274e14391e94c850b8bd03680c23b38978db68687a8John Reck    JSObjectRef element = 0;
275e14391e94c850b8bd03680c23b38978db68687a8John Reck    if (argumentCount == 1)
276e14391e94c850b8bd03680c23b38978db68687a8John Reck        element = JSValueToObject(context, arguments[0], exception);
277e14391e94c850b8bd03680c23b38978db68687a8John Reck
278e14391e94c850b8bd03680c23b38978db68687a8John Reck    toAXElement(thisObject)->setSelectedChild(toAXElement(element));
279e14391e94c850b8bd03680c23b38978db68687a8John Reck
280e14391e94c850b8bd03680c23b38978db68687a8John Reck    return JSValueMakeUndefined(context);
281e14391e94c850b8bd03680c23b38978db68687a8John Reck}
282e14391e94c850b8bd03680c23b38978db68687a8John Reck
2830bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef elementAtPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
2840bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
2850bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    int x = 0;
2860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    int y = 0;
2870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (argumentCount == 2) {
2880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        x = JSValueToNumber(context, arguments[0], exception);
2890bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        y = JSValueToNumber(context, arguments[1], exception);
2900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    }
2910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
2920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->elementAtPoint(x, y));
2930bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
2940bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
295643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef isAttributeSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
296643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
297643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSStringRef attribute = 0;
298643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (argumentCount == 1)
299643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        attribute = JSValueToStringCopy(context, arguments[0], exception);
300643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSupported(attribute));
301643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (attribute)
302643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        JSStringRelease(attribute);
303643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return result;
304643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
3050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
306563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef isAttributeSettableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
307563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
308643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSStringRef attribute = 0;
309563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 1)
310563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        attribute = JSValueToStringCopy(context, arguments[0], exception);
311643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isAttributeSettable(attribute));
312563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (attribute)
313563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        JSStringRelease(attribute);
314563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return result;
315563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
316563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
3170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
3180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
3190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
3200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    JSStringRef action = 0;
3210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (argumentCount == 1)
3220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        action = JSValueToStringCopy(context, arguments[0], exception);
323643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action));
3240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (action)
3250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        JSStringRelease(action);
3260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return result;
3270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
3280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
329d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef boolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
330563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
331643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSStringRef attribute = 0;
332563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 1)
333563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        attribute = JSValueToStringCopy(context, arguments[0], exception);
334d0825bca7fe65beaee391d30da42e937db621564Steve Block    bool val = toAXElement(thisObject)->boolAttributeValue(attribute);
335d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSValueRef result = JSValueMakeBoolean(context, val);
336d0825bca7fe65beaee391d30da42e937db621564Steve Block    if (attribute)
337d0825bca7fe65beaee391d30da42e937db621564Steve Block        JSStringRelease(attribute);
338d0825bca7fe65beaee391d30da42e937db621564Steve Block    return result;
339d0825bca7fe65beaee391d30da42e937db621564Steve Block}
340d0825bca7fe65beaee391d30da42e937db621564Steve Block
341d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
342d0825bca7fe65beaee391d30da42e937db621564Steve Block{
343d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSStringRef attribute = 0;
344d0825bca7fe65beaee391d30da42e937db621564Steve Block    if (argumentCount == 1)
345d0825bca7fe65beaee391d30da42e937db621564Steve Block        attribute = JSValueToStringCopy(context, arguments[0], exception);
346d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSRetainPtr<JSStringRef> stringAttributeValue(Adopt, toAXElement(thisObject)->stringAttributeValue(attribute));
347d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSValueRef result = JSValueMakeString(context, stringAttributeValue.get());
348563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (attribute)
349563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        JSStringRelease(attribute);
350563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return result;
351563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
352563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
353563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef cellForColumnAndRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
354563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
355563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    unsigned column = 0, row = 0;
356563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 2) {
357563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        column = JSValueToNumber(context, arguments[0], exception);
358563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        row = JSValueToNumber(context, arguments[1], exception);
359563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    }
360563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
361563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->cellForColumnAndRow(column, row));
362563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
363563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
364563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef titleUIElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
365563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
366563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->titleUIElement());
367563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
368563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
369563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef parentElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
370563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
371563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->parentElement());
372563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
373563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
374643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef disclosedByRowCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
375643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
376643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->disclosedByRow());
377643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
378643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
379563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setSelectedTextRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
380563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
381563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    unsigned location = UINT_MAX, length = 0;
382563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (argumentCount == 2) {
383563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        location = JSValueToNumber(context, arguments[0], exception);
384563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        length = JSValueToNumber(context, arguments[1], exception);
385563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    }
386563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
387563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    toAXElement(thisObject)->setSelectedTextRange(location, length);
388643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeUndefined(context);
389563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
390563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
3910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef incrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
3920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
3930bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    toAXElement(thisObject)->increment();
394643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeUndefined(context);
3950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
3960bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
3970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef decrementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
3980bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
3990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    toAXElement(thisObject)->decrement();
400643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeUndefined(context);
4010bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
4020bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
403643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef showMenuCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
404643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
405643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    toAXElement(thisObject)->showMenu();
406643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeUndefined(context);
407643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
4080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
409dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef pressCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
410dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{
411dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    toAXElement(thisObject)->press();
412dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    return JSValueMakeUndefined(context);
413dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}
414dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
415d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef takeFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
416d0825bca7fe65beaee391d30da42e937db621564Steve Block{
417d0825bca7fe65beaee391d30da42e937db621564Steve Block    toAXElement(thisObject)->takeFocus();
418d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeUndefined(context);
419d0825bca7fe65beaee391d30da42e937db621564Steve Block}
420d0825bca7fe65beaee391d30da42e937db621564Steve Block
421d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef takeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
422d0825bca7fe65beaee391d30da42e937db621564Steve Block{
423d0825bca7fe65beaee391d30da42e937db621564Steve Block    toAXElement(thisObject)->takeSelection();
424d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeUndefined(context);
425d0825bca7fe65beaee391d30da42e937db621564Steve Block}
426d0825bca7fe65beaee391d30da42e937db621564Steve Block
427d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef addSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
428d0825bca7fe65beaee391d30da42e937db621564Steve Block{
429d0825bca7fe65beaee391d30da42e937db621564Steve Block    toAXElement(thisObject)->addSelection();
430d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeUndefined(context);
431d0825bca7fe65beaee391d30da42e937db621564Steve Block}
432d0825bca7fe65beaee391d30da42e937db621564Steve Block
433d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef removeSelectionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
434d0825bca7fe65beaee391d30da42e937db621564Steve Block{
435d0825bca7fe65beaee391d30da42e937db621564Steve Block    toAXElement(thisObject)->removeSelection();
436d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeUndefined(context);
437d0825bca7fe65beaee391d30da42e937db621564Steve Block}
438d0825bca7fe65beaee391d30da42e937db621564Steve Block
4395abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef textMarkerRangeForElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
4405abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
4415abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityUIElement* uiElement = 0;
4425abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 1)
4435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        uiElement = toAXElement(JSValueToObject(context, arguments[0], exception));
4445abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4455abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForElement(uiElement));
4465abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
4475abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4485abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef textMarkerRangeLengthCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
4495abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
4505abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarkerRange* range = 0;
4515abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 1)
4525abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        range = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
4535abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4545abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return JSValueMakeNumber(context, (int)toAXElement(thisObject)->textMarkerRangeLength(range));
4555abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
4565abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
45768513a70bcd92384395513322f1b801e7bf9c729Steve Blockstatic JSValueRef textMarkerForPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
45868513a70bcd92384395513322f1b801e7bf9c729Steve Block{
45968513a70bcd92384395513322f1b801e7bf9c729Steve Block    int x = 0;
46068513a70bcd92384395513322f1b801e7bf9c729Steve Block    int y = 0;
46168513a70bcd92384395513322f1b801e7bf9c729Steve Block    if (argumentCount == 2) {
46268513a70bcd92384395513322f1b801e7bf9c729Steve Block        x = JSValueToNumber(context, arguments[0], exception);
46368513a70bcd92384395513322f1b801e7bf9c729Steve Block        y = JSValueToNumber(context, arguments[1], exception);
46468513a70bcd92384395513322f1b801e7bf9c729Steve Block    }
46568513a70bcd92384395513322f1b801e7bf9c729Steve Block
46668513a70bcd92384395513322f1b801e7bf9c729Steve Block    return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->textMarkerForPoint(x, y));
46768513a70bcd92384395513322f1b801e7bf9c729Steve Block}
46868513a70bcd92384395513322f1b801e7bf9c729Steve Block
4695abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef textMarkerRangeForMarkersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
4705abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
4715abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarker* startMarker = 0;
4725abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarker* endMarker = 0;
4735abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 2) {
4745abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        startMarker = toTextMarker(JSValueToObject(context, arguments[0], exception));
4755abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        endMarker = toTextMarker(JSValueToObject(context, arguments[1], exception));
4765abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    }
4775abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4785abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeForMarkers(startMarker, endMarker));
4795abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
4805abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4815abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef startTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
4825abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
4835abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarkerRange* markerRange = 0;
4845abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 1)
4855abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
4865abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4875abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->startTextMarkerForTextMarkerRange(markerRange));
4885abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
4895abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4905abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef endTextMarkerForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
4915abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
4925abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarkerRange* markerRange = 0;
4935abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 1)
4945abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception));
4955abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4965abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return AccessibilityTextMarker::makeJSAccessibilityTextMarker(context, toAXElement(thisObject)->endTextMarkerForTextMarkerRange(markerRange));
4975abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
4985abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4995abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickstatic JSValueRef accessibilityElementForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
5005abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
5015abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    AccessibilityTextMarker* marker = 0;
5025abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    if (argumentCount == 1)
5035abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        marker = toTextMarker(JSValueToObject(context, arguments[0], exception));
5045abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
5055abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->accessibilityElementForTextMarker(marker));
5065abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
507d0825bca7fe65beaee391d30da42e937db621564Steve Block
508563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Static Value Getters
509563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
510643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
511643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
512643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> dropEffects(Adopt, toAXElement(thisObject)->ariaDropEffects());
513643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, dropEffects.get());
514643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
515643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
516643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
517643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
518643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
519643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
520643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
521643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
522643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
523643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    AccessibilityUIElement* uiElement = toAXElement(thisObject);
524643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (!uiElement->platformUIElement())
525643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        return JSValueMakeBoolean(context, false);
526643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
527643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    // There might be other platform logic that one could check here...
528643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
529643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeBoolean(context, true);
530643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
531643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
532563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
533563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
534563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role());
535563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, role.get());
536563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
537563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
538231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef getSubroleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
539231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{
540231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->subrole());
541231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    return JSValueMakeString(context, role.get());
542231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}
543231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
544643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getRoleDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
545643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
546643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> roleDesc(Adopt, toAXElement(thisObject)->roleDescription());
547643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, roleDesc.get());
548643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
549643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
550563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
551563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
552563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
553563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, title.get());
554563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
555563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
556563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
557563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
558563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
559563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, description.get());
560563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
561563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
562643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getStringValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
563643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
564643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> stringValue(Adopt, toAXElement(thisObject)->stringValue());
565643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, stringValue.get());
566643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
567643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
5680bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getLanguageCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
5690bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
5700bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->language());
5710bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeString(context, language.get());
5720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
5730bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
574dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef getHelpTextCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
575dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{
576dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    JSRetainPtr<JSStringRef> language(Adopt, toAXElement(thisObject)->helpText());
577dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    return JSValueMakeString(context, language.get());
578dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}
579dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
580643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getOrientationCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
581643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
582643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> orientation(Adopt, toAXElement(thisObject)->orientation());
583643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, orientation.get());
584643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
585643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
5860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
5870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
5880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeNumber(context, toAXElement(thisObject)->childrenCount());
5890bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
5900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
591dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef rowCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
592dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{
593dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    return JSValueMakeNumber(context, toAXElement(thisObject)->rowCount());
594dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}
595dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
596dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef columnCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
597dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{
598dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    return JSValueMakeNumber(context, toAXElement(thisObject)->columnCount());
599dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}
600dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
6010bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
6020bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6030bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeNumber(context, toAXElement(thisObject)->x());
6040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
6060bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
6070bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeNumber(context, toAXElement(thisObject)->y());
6090bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
611563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getWidthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
612563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
613563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->width());
614563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
615563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
616563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getHeightCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
617563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
618563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->height());
619563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
620563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
6210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getClickPointXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
6220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointX());
6240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
6260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getClickPointYCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
6270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeNumber(context, toAXElement(thisObject)->clickPointY());
6290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
631563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getIntValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
632563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
633563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->intValue());
634563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
635563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
636563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getMinValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
637563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
638563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->minValue());
639563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
640563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
641563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getMaxValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
642563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
643563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->maxValue());
644563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
645563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
646563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getInsertionPointLineNumberCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
647563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
648563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeNumber(context, toAXElement(thisObject)->insertionPointLineNumber());
649563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
650563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
651563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getSelectedTextRangeCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
652563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
653563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    JSRetainPtr<JSStringRef> selectedTextRange(Adopt, toAXElement(thisObject)->selectedTextRange());
654563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSValueMakeString(context, selectedTextRange.get());
655563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
656563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
6570bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getIsEnabledCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
6580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeBoolean(context, toAXElement(thisObject)->isEnabled());
6600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6610bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
6620bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getIsRequiredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
6630bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{
6640bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeBoolean(context, toAXElement(thisObject)->isRequired());
6650bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
6660bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
667f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef getIsFocusedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
668f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{
669f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocused());
670f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch}
671f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
672f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef getIsFocusableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
673f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{
674f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    return JSValueMakeBoolean(context, toAXElement(thisObject)->isFocusable());
675f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch}
676f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
677643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getIsSelectedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
678643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
679643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelected());
680643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
681643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
682d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
683d0825bca7fe65beaee391d30da42e937db621564Steve Block{
684d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isSelectable());
685d0825bca7fe65beaee391d30da42e937db621564Steve Block}
686d0825bca7fe65beaee391d30da42e937db621564Steve Block
687d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsMultiSelectableCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
688d0825bca7fe65beaee391d30da42e937db621564Steve Block{
689d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isMultiSelectable());
690d0825bca7fe65beaee391d30da42e937db621564Steve Block}
691d0825bca7fe65beaee391d30da42e937db621564Steve Block
692643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getIsExpandedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
693643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
694643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isExpanded());
695643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
696643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
697d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsCheckedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
698d0825bca7fe65beaee391d30da42e937db621564Steve Block{
699d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isChecked());
700d0825bca7fe65beaee391d30da42e937db621564Steve Block}
701d0825bca7fe65beaee391d30da42e937db621564Steve Block
702d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsVisibleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
703d0825bca7fe65beaee391d30da42e937db621564Steve Block{
704d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isVisible());
705d0825bca7fe65beaee391d30da42e937db621564Steve Block}
706d0825bca7fe65beaee391d30da42e937db621564Steve Block
707d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsOffScreenCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
708d0825bca7fe65beaee391d30da42e937db621564Steve Block{
709d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isOffScreen());
710d0825bca7fe65beaee391d30da42e937db621564Steve Block}
711d0825bca7fe65beaee391d30da42e937db621564Steve Block
712d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getIsCollapsedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
713d0825bca7fe65beaee391d30da42e937db621564Steve Block{
714d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isCollapsed());
715d0825bca7fe65beaee391d30da42e937db621564Steve Block}
716d0825bca7fe65beaee391d30da42e937db621564Steve Block
71768513a70bcd92384395513322f1b801e7bf9c729Steve Blockstatic JSValueRef isIgnoredCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
71868513a70bcd92384395513322f1b801e7bf9c729Steve Block{
71968513a70bcd92384395513322f1b801e7bf9c729Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->isIgnored());
72068513a70bcd92384395513322f1b801e7bf9c729Steve Block}
72168513a70bcd92384395513322f1b801e7bf9c729Steve Block
722a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochstatic JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
723a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
724a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak());
725a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return JSValueMakeString(context, speakString.get());
726a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
727a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
728e14391e94c850b8bd03680c23b38978db68687a8John Reckstatic JSValueRef selectedChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
729e14391e94c850b8bd03680c23b38978db68687a8John Reck{
730e14391e94c850b8bd03680c23b38978db68687a8John Reck    return JSValueMakeNumber(context, toAXElement(thisObject)->selectedChildrenCount());
731e14391e94c850b8bd03680c23b38978db68687a8John Reck}
732e14391e94c850b8bd03680c23b38978db68687a8John Reck
733d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
734d0825bca7fe65beaee391d30da42e937db621564Steve Block{
735d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup());
736d0825bca7fe65beaee391d30da42e937db621564Steve Block}
737d0825bca7fe65beaee391d30da42e937db621564Steve Block
738643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef hierarchicalLevelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
739643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
740643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeNumber(context, toAXElement(thisObject)->hierarchicalLevel());
741643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
742643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
7430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef getValueDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
744563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
7450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    JSRetainPtr<JSStringRef> valueDescription(Adopt, toAXElement(thisObject)->valueDescription());
7460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    return JSValueMakeString(context, valueDescription.get());
747563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
748563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
749643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getAccessibilityValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
750643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
751643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> accessibilityValue(Adopt, toAXElement(thisObject)->accessibilityValue());
752643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, accessibilityValue.get());
753643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
754643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
755643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getDocumentEncodingCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
756643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
757643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> documentEncoding(Adopt, toAXElement(thisObject)->documentEncoding());
758643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, documentEncoding.get());
759643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
760643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
761643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef getDocumentURICallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
762643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
763643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    JSRetainPtr<JSStringRef> documentURI(Adopt, toAXElement(thisObject)->documentURI());
764643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return JSValueMakeString(context, documentURI.get());
765643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
766643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
767d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef getURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
768d0825bca7fe65beaee391d30da42e937db621564Steve Block{
769d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSRetainPtr<JSStringRef> url(Adopt, toAXElement(thisObject)->url());
770d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeString(context, url.get());
771d0825bca7fe65beaee391d30da42e937db621564Steve Block}
772d0825bca7fe65beaee391d30da42e937db621564Steve Block
773d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
774d0825bca7fe65beaee391d30da42e937db621564Steve Block{
775d0825bca7fe65beaee391d30da42e937db621564Steve Block    if (argumentCount != 1)
776d0825bca7fe65beaee391d30da42e937db621564Steve Block        return JSValueMakeBoolean(context, false);
777d0825bca7fe65beaee391d30da42e937db621564Steve Block
778d0825bca7fe65beaee391d30da42e937db621564Steve Block    JSObjectRef callback = JSValueToObject(context, arguments[0], exception);
779d0825bca7fe65beaee391d30da42e937db621564Steve Block    bool succeeded = toAXElement(thisObject)->addNotificationListener(callback);
780d0825bca7fe65beaee391d30da42e937db621564Steve Block    return JSValueMakeBoolean(context, succeeded);
781d0825bca7fe65beaee391d30da42e937db621564Steve Block}
782d0825bca7fe65beaee391d30da42e937db621564Steve Block
783dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
784dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{
785dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    toAXElement(thisObject)->removeNotificationListener();
786dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    return JSValueMakeUndefined(context);
787dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}
788dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
7895abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick// Implementation
7905abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
791a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch// Unsupported methods on various platforms.
792a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if !PLATFORM(MAC)
793a94275402997c11dd2e778633dacf4b7e630a35dBen MurdochJSStringRef AccessibilityUIElement::speak() { return 0; }
794a94275402997c11dd2e778633dacf4b7e630a35dBen MurdochJSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; }
795e14391e94c850b8bd03680c23b38978db68687a8John Reckvoid AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { }
796e14391e94c850b8bd03680c23b38978db68687a8John Reckunsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; }
797e14391e94c850b8bd03680c23b38978db68687a8John ReckAccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; }
798a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
799a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
8006b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner#if !PLATFORM(WIN)
8016b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brennerbool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)
8026b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner{
8036b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    return platformUIElement() == otherElement->platformUIElement();
8046b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner}
8056b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner#endif
8066b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner
8075abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#if !SUPPORTS_AX_TEXTMARKERS
8085abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8095abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain MerrickAccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*)
8105abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8115abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8125abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8135abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8145abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickint AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*)
8155abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8165abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8175abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8185abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8195abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain MerrickAccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker*, AccessibilityTextMarker*)
8205abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8215abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8225abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8235abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8245abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain MerrickAccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
8255abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8265abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8275abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8285abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8295abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain MerrickAccessibilityTextMarker AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*)
8305abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8315abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8325abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8335abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
8345abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain MerrickAccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker*)
8355abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{
8365abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    return 0;
8375abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick}
8385abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
83968513a70bcd92384395513322f1b801e7bf9c729Steve BlockAccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y)
84068513a70bcd92384395513322f1b801e7bf9c729Steve Block{
84168513a70bcd92384395513322f1b801e7bf9c729Steve Block    return 0;
84268513a70bcd92384395513322f1b801e7bf9c729Steve Block}
84368513a70bcd92384395513322f1b801e7bf9c729Steve Block
8445abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#endif
8455abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
846563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Destruction
847563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
848563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic void finalize(JSObjectRef thisObject)
849563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
850563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    delete toAXElement(thisObject);
851563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
852563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
853563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Object Creation
854563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
855563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkJSObjectRef AccessibilityUIElement::makeJSAccessibilityUIElement(JSContextRef context, const AccessibilityUIElement& element)
856563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
857563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return JSObjectMake(context, AccessibilityUIElement::getJSClass(), new AccessibilityUIElement(element));
858563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
859563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
860563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkJSClassRef AccessibilityUIElement::getJSClass()
861563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{
862563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    static JSStaticValue staticValues[] = {
863643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "accessibilityValue", getAccessibilityValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
864563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
865231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
866643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "roleDescription", getRoleDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
867563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
868563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8690bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
870dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        { "helpText", getHelpTextCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
871643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "stringValue", getStringValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "x", getXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8730bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "y", getYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
874563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "width", getWidthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
875563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "height", getHeightCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8760bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "clickPointX", getClickPointXCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8770bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "clickPointY", getClickPointYCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
878563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "intValue", getIntValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
879563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
880563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8810bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
882dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
883dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
884563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
885563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "isRequired", getIsRequiredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
888f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch        { "isFocused", getIsFocusedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
889f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch        { "isFocusable", getIsFocusableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
890643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "isSelected", getIsSelectedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
891d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isSelectable", getIsSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
892d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isMultiSelectable", getIsMultiSelectableCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
893643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
894d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isChecked", getIsCheckedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
895d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isVisible", getIsVisibleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
896d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isOffScreen", getIsOffScreenCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
897d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
898d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
8990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
900643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
901643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
902643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
903d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "url", getURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
904643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "isValid", getIsValidCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
905643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "orientation", getOrientationCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
906643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
907643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
90868513a70bcd92384395513322f1b801e7bf9c729Steve Block        { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
909a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
910e14391e94c850b8bd03680c23b38978db68687a8John Reck        { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
911563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { 0, 0, 0, 0 }
912563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    };
913563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
914563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    static JSStaticFunction staticFunctions[] = {
915563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "allAttributes", allAttributesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
916563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfLinkedUIElements", attributesOfLinkedUIElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
917563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfDocumentLinks", attributesOfDocumentLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
918563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
919563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
920563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
921a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        { "rangeForLine", rangeForLineCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
922563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
923231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9240617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9250617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen        { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
926563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
927545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch        { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
928d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
930563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
931563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfRowHeaders", attributesOfRowHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
932563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfColumns", attributesOfColumnsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
933563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfRows", attributesOfRowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
934563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfVisibleCells", attributesOfVisibleCellsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
935563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "attributesOfHeader", attributesOfHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
936563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "indexInTable", indexInTableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
937563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "rowIndexRange", rowIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
938563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "columnIndexRange", columnIndexRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
939563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "cellForColumnAndRow", cellForColumnAndRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
940563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
941563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
942d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
943d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
944643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "isAttributeSupported", isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
945563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "isAttributeSettable", isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "isActionSupported", isActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
947563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { "parentElement", parentElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
948643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "disclosedByRow", disclosedByRowCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9490bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "increment", incrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        { "decrement", decrementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
951643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "showMenu", showMenuCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
952dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        { "press", pressCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
953643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
954643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
955643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
956643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
957643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
958d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "addNotificationListener", addNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
959dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        { "removeNotificationListener", removeNotificationListenerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
960d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "takeFocus", takeFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
961d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "takeSelection", takeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
962d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "addSelection", addSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
963d0825bca7fe65beaee391d30da42e937db621564Steve Block        { "removeSelection", removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9645abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "textMarkerRangeForElement", textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9655abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "textMarkerRangeForMarkers", textMarkerRangeForMarkersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9665abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "startTextMarkerForTextMarkerRange", startTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9675abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "endTextMarkerForTextMarkerRange", endTextMarkerForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9685abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "accessibilityElementForTextMarker", accessibilityElementForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
9695abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        { "textMarkerRangeLength", textMarkerRangeLengthCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
97068513a70bcd92384395513322f1b801e7bf9c729Steve Block        { "textMarkerForPoint", textMarkerForPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
971e14391e94c850b8bd03680c23b38978db68687a8John Reck        { "setSelectedChild", setSelectedChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
972e14391e94c850b8bd03680c23b38978db68687a8John Reck        { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
973563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        { 0, 0, 0 }
974563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    };
975563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
976563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    static JSClassDefinition classDefinition = {
977563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        0, kJSClassAttributeNone, "AccessibilityUIElement", 0, staticValues, staticFunctions,
978563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
979563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    };
980563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
981563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    static JSClassRef accessibilityUIElementClass = JSClassCreate(&classDefinition);
982563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    return accessibilityUIElementClass;
983563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
984