WebKitTools:
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jul 2008 23:26:05 +0000 (23:26 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jul 2008 23:26:05 +0000 (23:26 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@35048 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-range-value-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/aria-range-value.html [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityController.cpp
WebKitTools/DumpRenderTree/AccessibilityController.h
WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm

index 3ae685e..659487d 100644 (file)
@@ -1,3 +1,13 @@
+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.
diff --git a/LayoutTests/accessibility/aria-range-value-expected.txt b/LayoutTests/accessibility/aria-range-value-expected.txt
new file mode 100644 (file)
index 0000000..4956ba9
--- /dev/null
@@ -0,0 +1,5 @@
+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.
diff --git a/LayoutTests/accessibility/aria-range-value.html b/LayoutTests/accessibility/aria-range-value.html
new file mode 100644 (file)
index 0000000..99e3808
--- /dev/null
@@ -0,0 +1,36 @@
+<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>
index 2317dd9..b8faed5 100644 (file)
@@ -1,3 +1,21 @@
+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.
index 6096aad..2b0c85e 100644 (file)
@@ -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 }
     };
 
index 865ee87..c554d0c 100644 (file)
@@ -43,6 +43,9 @@ public:
     JSStringRef attributesOfLinkedUIElementsForFocusedElement();
     double widthOfFocusedElement();
     double heightOfFocusedElement();
+    float intValueOfFocusedElement();
+    float minValueOfFocusedElement();
+    float maxValueOfFocusedElement();
     
 private:
     static JSClassRef getJSClass();
index 7e07583..5d90528 100644 (file)
@@ -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;
+}