WebCore:
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2009 00:29:06 +0000 (00:29 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2009 00:29:06 +0000 (00:29 +0000)
2009-08-04  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Darin Adler.

        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
        https://bugs.webkit.org/show_bug.cgi?id=27994

        Test: platform/mac/accessibility/aria-valuetext.html

        * accessibility/AccessibilityObject.h:
        (WebCore::AccessibilityObject::valueDescription):
        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::valueDescription):
        * accessibility/AccessibilityRenderObject.h:
        * accessibility/mac/AccessibilityObjectWrapper.mm:
        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
        * html/HTMLAttributeNames.in:

WebKitTools:

2009-08-04  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Darin Adler.

        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
        https://bugs.webkit.org/show_bug.cgi?id=27994

        Expose valueDescription for accessibility.

        * DumpRenderTree/AccessibilityUIElement.cpp:
        (getValueDescriptionCallback):
        (AccessibilityUIElement::getJSClass):
        * DumpRenderTree/AccessibilityUIElement.h:
        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
        (AccessibilityUIElement::valueDescription):
        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
        (AccessibilityUIElement::valueDescription):

LayoutTests:

2009-08-04  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Darin Adler.

        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
        https://bugs.webkit.org/show_bug.cgi?id=27994

        * platform/mac/accessibility/aria-valuetext-expected.txt: Added.
        * platform/mac/accessibility/aria-valuetext.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46788 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/aria-valuetext-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/aria-valuetext.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/accessibility/AccessibilityObject.h
WebCore/accessibility/AccessibilityRenderObject.cpp
WebCore/accessibility/AccessibilityRenderObject.h
WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
WebKitTools/DumpRenderTree/AccessibilityUIElement.h
WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

index e3df46b..d0953e0 100644 (file)
@@ -2,6 +2,16 @@
 
         Reviewed by Darin Adler.
 
+        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
+        https://bugs.webkit.org/show_bug.cgi?id=27994
+
+        * platform/mac/accessibility/aria-valuetext-expected.txt: Added.
+        * platform/mac/accessibility/aria-valuetext.html: Added.
+
+2009-08-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
         Bug 27993 - AXSliders are missing required attributes and actions
         https://bugs.webkit.org/show_bug.cgi?id=27993
 
diff --git a/LayoutTests/platform/mac/accessibility/aria-valuetext-expected.txt b/LayoutTests/platform/mac/accessibility/aria-valuetext-expected.txt
new file mode 100644 (file)
index 0000000..0268031
--- /dev/null
@@ -0,0 +1,11 @@
+slider
+This tests that aria-valuetext reachable as the AXValueDescription
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS succeeded is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/aria-valuetext.html b/LayoutTests/platform/mac/accessibility/aria-valuetext.html
new file mode 100644 (file)
index 0000000..4d3ca98
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="slider" role="slider" aria-valuetext="MAX" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">slider</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that aria-valuetext reachable as the AXValueDescription");
+
+    if (window.accessibilityController) {
+
+          // this text field should be required.
+          document.getElementById("body").focus();
+          var obj = accessibilityController.focusedElement.childAtIndex(0);
+          var succeeded = obj.valueDescription == "MAX";
+          shouldBe("succeeded", "true");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index e7e3d73..add169d 100644 (file)
@@ -1,3 +1,21 @@
+2009-08-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
+        https://bugs.webkit.org/show_bug.cgi?id=27994
+
+        Test: platform/mac/accessibility/aria-valuetext.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::valueDescription):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::valueDescription):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * html/HTMLAttributeNames.in:
+
 2009-08-04  Michael Nordman  <michaeln@google.com>
 
         Reviewed by Alexey Proskuryakov.
index ad10eee..6a5f97d 100644 (file)
@@ -265,6 +265,7 @@ public:
     virtual bool accessibilityIsIgnored() const  { return true; };
 
     virtual int intValue() const { return 0; }
+    virtual String valueDescription() const { return String(); }
     virtual float valueForRange() const { return 0.0f; }
     virtual float maxValueForRange() const { return 0.0f; }
     virtual float minValueForRange() const { return 0.0f; }
index bacfcbb..794a06a 100644 (file)
@@ -751,6 +751,15 @@ int AccessibilityRenderObject::intValue() const
     return static_cast<HTMLInputElement*>(node)->checked();
 }
 
+String AccessibilityRenderObject::valueDescription() const
+{
+    // Only sliders and progress bars support value descriptions currently.
+    if (!isProgressIndicator() && !isSlider())
+        return String();
+    
+    return getAttribute(aria_valuetextAttr).string();
+}
+    
 float AccessibilityRenderObject::valueForRange() const
 {
     if (!isProgressIndicator() && !isSlider())
index 20a755d..f571f82 100644 (file)
@@ -114,6 +114,7 @@ public:
     
     static int headingLevel(Node*);
     virtual int intValue() const;
+    virtual String valueDescription() const;
     virtual float valueForRange() const;
     virtual float maxValueForRange() const;
     virtual float minValueForRange() const;
index 0e14a19..199dbb9 100644 (file)
@@ -1429,6 +1429,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return nil;
     }
     
+    if ([attributeName isEqualToString:NSAccessibilityValueDescriptionAttribute])
+        return m_object->valueDescription();
+    
     if ([attributeName isEqualToString:NSAccessibilityOrientationAttribute]) {
         AccessibilityOrientation elementOrientation = m_object->orientation();
         if (elementOrientation == AccessibilityOrientationVertical)
index 645382b..4b6a016 100644 (file)
@@ -1,3 +1,21 @@
+2009-08-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Bug 27994 - WAI-ARIA: aria-valuetext needs to be implemented
+        https://bugs.webkit.org/show_bug.cgi?id=27994
+
+        Expose valueDescription for accessibility. 
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (getValueDescriptionCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::valueDescription):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::valueDescription):
+
 2009-08-04  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Mark Rowe.
index d330295..8a92766 100644 (file)
@@ -339,6 +339,12 @@ static JSValueRef getIsRequiredCallback(JSContextRef context, JSObjectRef thisOb
     return JSValueMakeBoolean(context, toAXElement(thisObject)->isRequired());
 }
 
+static JSValueRef getValueDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    JSRetainPtr<JSStringRef> valueDescription(Adopt, toAXElement(thisObject)->valueDescription());
+    return JSValueMakeString(context, valueDescription.get());
+}
+
 // Destruction
 
 static void finalize(JSObjectRef thisObject)
@@ -374,6 +380,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isRequired", getIsRequiredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0, 0 }
     };
 
index b6fd09e..0bf0fef 100644 (file)
@@ -92,6 +92,7 @@ public:
     double intValue();
     double minValue();
     double maxValue();
+    JSStringRef valueDescription();
     int insertionPointLineNumber();
     JSStringRef selectedTextRange();
     bool isEnabled();
index 32adcb5..e9fa47b 100644 (file)
@@ -385,6 +385,14 @@ double AccessibilityUIElement::maxValue()
     return 0.0;
 }
 
+JSStringRef AccessibilityUIElement::valueDescription()
+{
+    NSString* valueDescription = [m_element accessibilityAttributeValue:NSAccessibilityValueDescriptionAttribute];
+     if ([valueDescription isKindOfClass:[NSString class]])
+         return [valueDescription createJSStringRef];
+    return 0;
+}
+
 int AccessibilityUIElement::insertionPointLineNumber()
 {
     id value = [m_element accessibilityAttributeValue:NSAccessibilityInsertionPointLineNumberAttribute];
index 8981560..cfcfc54 100644 (file)
@@ -224,6 +224,11 @@ double AccessibilityUIElement::clickPointY()
     return 0;
 }
 
+JSStringRef AccessibilityUIElement::valueDescription()
+{
+    return 0;
+}
+
 double AccessibilityUIElement::intValue()
 {
     BSTR valueBSTR;