AX: WebKit does not expose max/min value of <progress> element
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Sep 2015 20:03:34 +0000 (20:03 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Sep 2015 20:03:34 +0000 (20:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148707

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Allow native progress indicator elements to report min/max values by rewriting special
case code for ARIA progress bars.

Test: accessibility/mac/progress-element-min-max.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

* accessibility/mac/progress-element-min-max-expected.txt: Added.
* accessibility/mac/progress-element-min-max.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/progress-element-min-max-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/progress-element-min-max.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 082a9c4..40c451b 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-02  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: WebKit does not expose max/min value of <progress> element
+        https://bugs.webkit.org/show_bug.cgi?id=148707
+
+        Reviewed by Mario Sanchez Prada.
+
+        * accessibility/mac/progress-element-min-max-expected.txt: Added.
+        * accessibility/mac/progress-element-min-max.html: Added.
+
 2015-09-01  Dean Jackson  <dino@apple.com>
 
         [mediacontrols] Improve media controls testing helpers
diff --git a/LayoutTests/accessibility/mac/progress-element-min-max-expected.txt b/LayoutTests/accessibility/mac/progress-element-min-max-expected.txt
new file mode 100644 (file)
index 0000000..8af2cb9
--- /dev/null
@@ -0,0 +1,12 @@
+
+This tests that the min/max values for a native progress element are exposed to the Mac platform.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS progress.maxValue is 75
+PASS progress.minValue is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/progress-element-min-max.html b/LayoutTests/accessibility/mac/progress-element-min-max.html
new file mode 100644 (file)
index 0000000..58d939e
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<progress id="progress" value="50" max="75">Foo</progress>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the min/max values for a native progress element are exposed to the Mac platform.");
+
+    if (window.accessibilityController) {
+
+        var progress = accessibilityController.accessibleElementById("progress");
+        shouldBe("progress.maxValue", "75");
+        // There's actually no min attribute for <progress> elements, so this is always zero.
+        shouldBe("progress.minValue", "0");
+    }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 46ae40d..154ad87 100644 (file)
@@ -1,3 +1,18 @@
+2015-09-02  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: WebKit does not expose max/min value of <progress> element
+        https://bugs.webkit.org/show_bug.cgi?id=148707
+
+        Reviewed by Mario Sanchez Prada.
+
+        Allow native progress indicator elements to report min/max values by rewriting special
+        case code for ARIA progress bars.
+
+        Test: accessibility/mac/progress-element-min-max.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2015-09-02  Hyemi Shin  <hyemi.sin@samsung.com>
 
         [GStreamer] Simplify linking pads in AudioDestination and correct old comment.
index 3b8d675..f433230 100644 (file)
@@ -2571,14 +2571,14 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     
     if ([attributeName isEqualToString: NSAccessibilityMinValueAttribute]) {
         // Indeterminate progress indicator should return 0.
-        if (m_object->isProgressIndicator() && !m_object->hasAttribute(aria_valuenowAttr))
+        if (m_object->ariaRoleAttribute() == ProgressIndicatorRole && !m_object->hasAttribute(aria_valuenowAttr))
             return @0;
         return [NSNumber numberWithFloat:m_object->minValueForRange()];
     }
     
     if ([attributeName isEqualToString: NSAccessibilityMaxValueAttribute]) {
         // Indeterminate progress indicator should return 0.
-        if (m_object->isProgressIndicator() && !m_object->hasAttribute(aria_valuenowAttr))
+        if (m_object->ariaRoleAttribute() == ProgressIndicatorRole && !m_object->hasAttribute(aria_valuenowAttr))
             return @0;
         return [NSNumber numberWithFloat:m_object->maxValueForRange()];
     }