summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
index 8a92766..5958ccb 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -140,6 +140,18 @@ static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef funct
return JSValueMakeString(context, boundsDescription.get());
}
+static JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ unsigned location = UINT_MAX, length = 0;
+ if (argumentCount == 2) {
+ location = JSValueToNumber(context, arguments[0], exception);
+ length = JSValueToNumber(context, arguments[1], exception);
+ }
+
+ JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->stringForRange(location, length));
+ return JSValueMakeString(context, stringDescription.get());
+}
+
static JSValueRef childAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
int indexNumber = -1;
@@ -190,7 +202,8 @@ static JSValueRef attributeValueCallback(JSContextRef context, JSObjectRef funct
JSStringRef attribute = NULL;
if (argumentCount == 1)
attribute = JSValueToStringCopy(context, arguments[0], exception);
- JSValueRef result = JSValueMakeString(context, toAXElement(thisObject)->attributeValue(attribute));
+ JSRetainPtr<JSStringRef> attributeValue(Adopt, toAXElement(thisObject)->attributeValue(attribute));
+ JSValueRef result = JSValueMakeString(context, attributeValue.get());
if (attribute)
JSStringRelease(attribute);
return result;
@@ -250,6 +263,12 @@ static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject,
return JSValueMakeString(context, role.get());
}
+static JSValueRef getSubroleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->subrole());
+ return JSValueMakeString(context, role.get());
+}
+
static JSValueRef getTitleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
JSRetainPtr<JSStringRef> title(Adopt, toAXElement(thisObject)->title());
@@ -363,6 +382,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
{
static JSStaticValue staticValues[] = {
{ "role", getRoleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "subrole", getSubroleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "title", getTitleCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "description", getDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "language", getLanguageCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -392,6 +412,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
{ "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "elementAtPoint", elementAtPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "attributesOfColumnHeaders", attributesOfColumnHeadersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },