2011-04-27 Chris Fleizach <cfleizach@apple.com>
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 05:43:12 +0000 (05:43 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 05:43:12 +0000 (05:43 +0000)
        Reviewed by Beth Dakin.

        <rdar://problem/9315254> ARIA role attribute implemented incorrectly; does not support token list with fallbacks
        https://bugs.webkit.org/show_bug.cgi?id=59648

        * accessibility/aria-fallback-roles.html: Added.
        * platform/mac/accessibility/aria-fallback-roles-expected.txt: Added.
2011-04-27  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Beth Dakin.

        <rdar://problem/9315254> ARIA role attribute implemented incorrectly; does not support token list with fallbacks
        https://bugs.webkit.org/show_bug.cgi?id=59648

        Test: accessibility/aria-fallback-roles.html

        * accessibility/AccessibilityObject.cpp:
        (WebCore::AccessibilityObject::ariaRoleToWebCoreRole):

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

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-fallback-roles.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/aria-fallback-roles-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp

index 014a70d..08a8c77 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-27  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        <rdar://problem/9315254> ARIA role attribute implemented incorrectly; does not support token list with fallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=59648
+
+        * accessibility/aria-fallback-roles.html: Added.
+        * platform/mac/accessibility/aria-fallback-roles-expected.txt: Added.
+
 2011-04-27  Mark Pilgrim  <pilgrim@chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/accessibility/aria-fallback-roles.html b/LayoutTests/accessibility/aria-fallback-roles.html
new file mode 100644 (file)
index 0000000..dc47541
--- /dev/null
@@ -0,0 +1,36 @@
+<!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">
+
+<span tabindex="0" id="test" role="unknownrole switch checkbox" aria-checked="true">test</span>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that aria fallback roles work correctly.");
+    if (window.accessibilityController) {
+
+        if (window.accessibilityController) {
+
+            var test = document.getElementById("test");
+            test.focus();
+            test = accessibilityController.focusedElement;
+
+            debug("Role should be: " + test.role);
+        }
+    }
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/accessibility/aria-fallback-roles-expected.txt b/LayoutTests/platform/mac/accessibility/aria-fallback-roles-expected.txt
new file mode 100644 (file)
index 0000000..a2f7d62
--- /dev/null
@@ -0,0 +1,8 @@
+test
+This tests that aria fallback roles work correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Role should be: AXRole: AXCheckBox
+
index 9200594..5af79d9 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-27  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        <rdar://problem/9315254> ARIA role attribute implemented incorrectly; does not support token list with fallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=59648
+
+        Test: accessibility/aria-fallback-roles.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::ariaRoleToWebCoreRole):
+
 2011-04-27  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Dan Bernstein.
index df95f6f..e3c4c27 100644 (file)
@@ -977,8 +977,21 @@ static ARIARoleMap* createARIARoleMap()
 AccessibilityRole AccessibilityObject::ariaRoleToWebCoreRole(const String& value)
 {
     ASSERT(!value.isEmpty());
+    
     static const ARIARoleMap* roleMap = createARIARoleMap();
-    return roleMap->get(value);
+
+    Vector<String> roleVector;
+    value.split(' ', roleVector);
+    AccessibilityRole role = UnknownRole;
+    unsigned size = roleVector.size();
+    for (unsigned i = 0; i < size; ++i) {
+        String roleName = roleVector[i];
+        role = roleMap->get(roleName);
+        if (role)
+            return role;
+    }
+    
+    return role;
 }
 
 const AtomicString& AccessibilityObject::placeholderValue() const