AX: HTML indeterminate IDL attribute not mapped to checkbox value=2 for native checkboxes
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jun 2016 01:19:13 +0000 (01:19 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jun 2016 01:19:13 +0000 (01:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158876
<rdar://problem/26842619>

Reviewed by Joanmarie Diggs.

Source/WebCore:

The indeterminate state was not being reported for native checkboxes.

Also the isIndeterminate() method was relying on whether the appearance changed, which does not happen on Mac, so that
was not being reported correctly. Changed that to check the actual attribute.

Test: accessibility/checkbox-mixed-value.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isIndeterminate):
(WebCore::AccessibilityNodeObject::isPressed):
(WebCore::AccessibilityNodeObject::checkboxOrRadioValue):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::checkboxOrRadioValue):

LayoutTests:

* accessibility/checkbox-mixed-value-expected.txt: Added.
* accessibility/checkbox-mixed-value.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/checkbox-mixed-value-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/checkbox-mixed-value.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp

index b43c4b5..84e753c 100644 (file)
@@ -1,3 +1,14 @@
+2016-06-17  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: HTML indeterminate IDL attribute not mapped to checkbox value=2 for native checkboxes
+        https://bugs.webkit.org/show_bug.cgi?id=158876
+        <rdar://problem/26842619>
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/checkbox-mixed-value-expected.txt: Added.
+        * accessibility/checkbox-mixed-value.html: Added.
+
 2016-06-17  Dean Jackson  <dino@apple.com>
 
         REGRESSION (r199819): CrashTracer: [GraphicsContext3D::getInternalFramebufferSize
diff --git a/LayoutTests/accessibility/checkbox-mixed-value-expected.txt b/LayoutTests/accessibility/checkbox-mixed-value-expected.txt
new file mode 100644 (file)
index 0000000..4800eee
--- /dev/null
@@ -0,0 +1,18 @@
+Tests whether mixed values are reported properly on native checkboxes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+1: AXRole: AXCheckBox
+Indeterminate status: true
+
+2: AXRole: AXCheckBox
+Indeterminate status: false
+
+3: AXRole: AXCheckBox
+Indeterminate status: false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/checkbox-mixed-value.html b/LayoutTests/accessibility/checkbox-mixed-value.html
new file mode 100644 (file)
index 0000000..02da54b
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="content">
+
+<input type="checkbox" id="element1" indeterminate="true">
+<input type="checkbox" id="element2" indeterminate="false">
+<input type="checkbox" id="element3">
+
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("Tests whether mixed values are reported properly on native checkboxes.");
+
+    if (window.accessibilityController) {
+          for (var i = 1; i <= 3; i++) {
+              var element = accessibilityController.accessibleElementById("element" + i);
+              debug(i + ": " + element.role);
+              debug("Indeterminate status: " + element.isIndeterminate + "\n");
+          }
+
+          document.getElementById("content").style.visibility = "hidden";
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index d393e43..f94806b 100644 (file)
@@ -1,3 +1,25 @@
+2016-06-17  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: HTML indeterminate IDL attribute not mapped to checkbox value=2 for native checkboxes
+        https://bugs.webkit.org/show_bug.cgi?id=158876
+        <rdar://problem/26842619>
+
+        Reviewed by Joanmarie Diggs.
+
+        The indeterminate state was not being reported for native checkboxes. 
+
+        Also the isIndeterminate() method was relying on whether the appearance changed, which does not happen on Mac, so that
+        was not being reported correctly. Changed that to check the actual attribute.
+
+        Test: accessibility/checkbox-mixed-value.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isIndeterminate):
+        (WebCore::AccessibilityNodeObject::isPressed):
+        (WebCore::AccessibilityNodeObject::checkboxOrRadioValue):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::checkboxOrRadioValue):
+
 2016-06-17  Dean Jackson  <dino@apple.com>
 
         REGRESSION (r199819): CrashTracer: [GraphicsContext3D::getInternalFramebufferSize
index 1a96098..13a5bfb 100644 (file)
@@ -665,8 +665,7 @@ bool AccessibilityNodeObject::isEnabled() const
 
 bool AccessibilityNodeObject::isIndeterminate() const
 {
-    auto* node = this->node();
-    return is<HTMLInputElement>(node) && downcast<HTMLInputElement>(*node).shouldAppearIndeterminate();
+    return equalLettersIgnoringASCIICase(getAttribute(indeterminateAttr), "true");
 }
 
 bool AccessibilityNodeObject::isPressed() const
@@ -938,7 +937,7 @@ AccessibilityObject* AccessibilityNodeObject::selectedTabItem()
 AccessibilityButtonState AccessibilityNodeObject::checkboxOrRadioValue() const
 {
     if (isNativeCheckboxOrRadio())
-        return isChecked() ? ButtonStateOn : ButtonStateOff;
+        return isIndeterminate() ? ButtonStateMixed : isChecked() ? ButtonStateOn : ButtonStateOff;
 
     return AccessibilityObject::checkboxOrRadioValue();
 }
index 3cb4def..01e3f3c 100644 (file)
@@ -2498,7 +2498,7 @@ AccessibilityButtonState AccessibilityObject::checkboxOrRadioValue() const
         return ButtonStateMixed;
     }
     
-    if (equalLettersIgnoringASCIICase(getAttribute(indeterminateAttr), "true"))
+    if (isIndeterminate())
         return ButtonStateMixed;
     
     return ButtonStateOff;