Commit fe260cb4 authored by bdakin@apple.com's avatar bdakin@apple.com

WebKitTools:

2008-07-07  Beth Dakin  <bdakin@apple.com>

        Reviewed by Anders.

        This patch extends DRT accessibility tests to add the ability to 
        query the intValue, minValue, and maxValue of the focused element.

        * DumpRenderTree/AccessibilityController.cpp:
        (intValueOfFocusedElementCallback):
        (minValueOfFocusedElementCallback):
        (maxValueOfFocusedElementCallback):
        (AccessibilityController::staticFunctions):
        * DumpRenderTree/AccessibilityController.h:
        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
        (AccessibilityController::intValueOfFocusedElement):
        (AccessibilityController::minValueOfFocusedElement):
        (AccessibilityController::maxValueOfFocusedElement):

LayoutTests:

2008-07-07  Beth Dakin  <bdakin@apple.com>

        Reviewed by Anders.

        New test that uses the ability to query int value, min value, and 
        max value in the accessibility tests.

        * accessibility/aria-range-value-expected.txt: Added.
        * accessibility/aria-range-value.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f6ca06d8
2008-07-07 Beth Dakin <bdakin@apple.com>
Reviewed by Anders.
New test that uses the ability to query int value, min value, and
max value in the accessibility tests.
* accessibility/aria-range-value-expected.txt: Added.
* accessibility/aria-range-value.html: Added.
2008-07-07 Michelangelo De Simone <m.des@mac.com>
Reviewed by Adele.
In accessibility, the following should be a progress indicator:
X
This test PASSES in DumpRenderTree. The value is 5, the minValue is 0, and the max value is 10.
<html>
<body>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function checkValue() {
if (!window.accessibilityController)
return;
var aria = document.getElementById("range");
aria.focus();
var value = accessibilityController.intValueOfFocusedElement();
var minValue = accessibilityController.minValueOfFocusedElement();
var maxValue = accessibilityController.maxValueOfFocusedElement();
var result = document.getElementById("result");
if (value == 5 && minValue == 0 && maxValue == 10)
result.innerText = "This test PASSES in DumpRenderTree. The value is " + value + ", the minValue is "
+ minValue + ", and the max value is " + maxValue + ".";
else
result.innerText = "This test FAILS in DumpRenderTree. The value, minValue, and/or maxValue of the range must be incorrect.";
}
</script>
<div>
<p>In accessibility, the following should be a progress indicator:</p>
<p><span tabindex="0" role="range" id="range" aria-valuenow=5 aria-valuemin=0 aria-valuemax=10>X</span></p>
<span id="result"></span>
<script>
checkValue();
</script>
</div>
</body>
</html>
2008-07-07 Beth Dakin <bdakin@apple.com>
Reviewed by Anders.
This patch extends DRT accessibility tests to add the ability to
query the intValue, minValue, and maxValue of the focused element.
* DumpRenderTree/AccessibilityController.cpp:
(intValueOfFocusedElementCallback):
(minValueOfFocusedElementCallback):
(maxValueOfFocusedElementCallback):
(AccessibilityController::staticFunctions):
* DumpRenderTree/AccessibilityController.h:
* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::intValueOfFocusedElement):
(AccessibilityController::minValueOfFocusedElement):
(AccessibilityController::maxValueOfFocusedElement):
2008-07-07 Steve Falkenburg <sfalken@apple.com>
Fix build.
......
......@@ -84,6 +84,27 @@ static JSValueRef heightOfFocusedElementCallback(JSContextRef context, JSObjectR
return JSValueMakeNumber(context, height);
}
static JSValueRef intValueOfFocusedElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
float value = controller->intValueOfFocusedElement();
return JSValueMakeNumber(context, value);
}
static JSValueRef minValueOfFocusedElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
float value = controller->minValueOfFocusedElement();
return JSValueMakeNumber(context, value);
}
static JSValueRef maxValueOfFocusedElementCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
AccessibilityController* controller = reinterpret_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
float value = controller->maxValueOfFocusedElement();
return JSValueMakeNumber(context, value);
}
// Object Creation
void AccessibilityController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
......@@ -120,6 +141,9 @@ JSStaticFunction* AccessibilityController::staticFunctions()
{ "attributesOfLinkedUIElementsForFocusedElement", attributesOfLinkedUIElementsForFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "widthOfFocusedElement", widthOfFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "heightOfFocusedElement", heightOfFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "intValueOfFocusedElement", intValueOfFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "minValueOfFocusedElement", minValueOfFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "maxValueOfFocusedElement", maxValueOfFocusedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
......
......@@ -43,6 +43,9 @@ public:
JSStringRef attributesOfLinkedUIElementsForFocusedElement();
double widthOfFocusedElement();
double heightOfFocusedElement();
float intValueOfFocusedElement();
float minValueOfFocusedElement();
float maxValueOfFocusedElement();
private:
static JSClassRef getJSClass();
......
......@@ -186,3 +186,33 @@ double AccessibilityController::heightOfFocusedElement()
NSValue* sizeValue = [accessibilityObject accessibilityAttributeValue:@"AXSize"];
return (double)[sizeValue sizeValue].height;
}
float AccessibilityController::intValueOfFocusedElement()
{
WebHTMLView* view = [[mainFrame frameView] documentView];
id accessibilityObject = [view accessibilityFocusedUIElement];
id value = [accessibilityObject accessibilityAttributeValue:@"AXValue"];
if ([value isKindOfClass:[NSNumber class]])
return [(NSNumber*)value floatValue];
return 0.0f;
}
float AccessibilityController::minValueOfFocusedElement()
{
WebHTMLView* view = [[mainFrame frameView] documentView];
id accessibilityObject = [view accessibilityFocusedUIElement];
id value = [accessibilityObject accessibilityAttributeValue:@"AXMinValue"];
if ([value isKindOfClass:[NSNumber class]])
return [(NSNumber*)value floatValue];
return 0.0f;
}
float AccessibilityController::maxValueOfFocusedElement()
{
WebHTMLView* view = [[mainFrame frameView] documentView];
id accessibilityObject = [view accessibilityFocusedUIElement];
id value = [accessibilityObject accessibilityAttributeValue:@"AXMaxValue"];
if ([value isKindOfClass:[NSNumber class]])
return [(NSNumber*)value floatValue];
return 0.0f;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment