AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 19:34:51 +0000 (19:34 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jan 2018 19:34:51 +0000 (19:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181994

Reviewed by Chris Fleizach.

Source/WebCore:

Only return AccessibilityRole::Group if we have no author-provided
ARIA role attribute value.

Test: accessibility/svg-element-with-aria-role.html

* accessibility/AccessibilitySVGRoot.cpp:
(WebCore::AccessibilitySVGRoot::roleValue const):
* accessibility/AccessibilitySVGRoot.h:

LayoutTests:

* accessibility/svg-element-with-aria-role.html: Added.
* platform/gtk/accessibility/svg-element-with-aria-role-expected.txt: Added.
* platform/mac/accessibility/svg-element-with-aria-role-expected.txt: Added.
* platform/win/TestExpectations: Skip test.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/svg-element-with-aria-role.html [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/svg-element-with-aria-role-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/svg-element-with-aria-role-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilitySVGRoot.cpp
Source/WebCore/accessibility/AccessibilitySVGRoot.h

index 8154cca..75ef7bc 100644 (file)
@@ -1,3 +1,15 @@
+2018-01-24  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root
+        https://bugs.webkit.org/show_bug.cgi?id=181994
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/svg-element-with-aria-role.html: Added.
+        * platform/gtk/accessibility/svg-element-with-aria-role-expected.txt: Added.
+        * platform/mac/accessibility/svg-element-with-aria-role-expected.txt: Added.
+        * platform/win/TestExpectations: Skip test.
+
 2018-01-24  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Compute the progress and currentIteration properties on getComputedTiming()
diff --git a/LayoutTests/accessibility/svg-element-with-aria-role.html b/LayoutTests/accessibility/svg-element-with-aria-role.html
new file mode 100644 (file)
index 0000000..8a351fd
--- /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>
+
+<div class="contents">
+  <svg xmlns="http://www.w3.org/2000/svg" id="test1" role="graphics-document">
+    <g role="graphics-object" id="test2"></g>
+  </svg>
+  <svg xmlns="http://www.w3.org/2000/svg" id="test3" role="button" aria-label="click me">
+    <rect fill="gray" stroke="black" width="60" height="15" />
+  </svg>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that ARIA roles used on SVG elements are exposed.")
+    if (window.accessibilityController) {
+        var test = accessibilityController.accessibleElementById("test1");
+        debug("test1: " + test.role + " " + test.subrole);
+
+        test = accessibilityController.accessibleElementById("test2");
+        debug("test2: " + test.role + " " + test.subrole);
+
+        test = accessibilityController.accessibleElementById("test3");
+        debug("test3: " + test.role + " " + test.subrole);
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/accessibility/svg-element-with-aria-role-expected.txt b/LayoutTests/platform/gtk/accessibility/svg-element-with-aria-role-expected.txt
new file mode 100644 (file)
index 0000000..822bf58
--- /dev/null
@@ -0,0 +1,13 @@
+This tests that ARIA roles used on SVG elements are exposed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+test1: AXRole: AXDocument 
+test2: AXRole: AXGroup 
+test3: AXRole: AXButton 
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/svg-element-with-aria-role-expected.txt b/LayoutTests/platform/mac/accessibility/svg-element-with-aria-role-expected.txt
new file mode 100644 (file)
index 0000000..b90f2e8
--- /dev/null
@@ -0,0 +1,13 @@
+This tests that ARIA roles used on SVG elements are exposed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+test1: AXRole: AXGroup AXSubrole: AXDocument
+test2: AXRole: AXGroup AXSubrole: 
+test3: AXRole: AXButton AXSubrole: 
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
index 7125a40..68a080c 100644 (file)
@@ -3120,6 +3120,7 @@ accessibility/w3c-svg-content-language-attribute.html [ Failure ]
 accessibility/w3c-svg-description-calculation.html [ Failure ]
 accessibility/w3c-svg-name-calculation.html [ Failure ]
 accessibility/w3c-svg-roles.html [ Failure ]
+accessibility/svg-element-with-aria-role.html [ Failure ]
 accessibility/win/select-element-valuechange-event.html [ Failure ]
 css1/box_properties/float_on_text_elements.html [ Failure ]
 css1/units/length_units.html [ Failure ]
index 86f36df..85faf72 100644 (file)
@@ -1,3 +1,19 @@
+2018-01-24  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root
+        https://bugs.webkit.org/show_bug.cgi?id=181994
+
+        Reviewed by Chris Fleizach.
+
+        Only return AccessibilityRole::Group if we have no author-provided
+        ARIA role attribute value.
+
+        Test: accessibility/svg-element-with-aria-role.html
+
+        * accessibility/AccessibilitySVGRoot.cpp:
+        (WebCore::AccessibilitySVGRoot::roleValue const):
+        * accessibility/AccessibilitySVGRoot.h:
+
 2018-01-24  Alex Christensen  <achristensen@webkit.org>
 
         Remove unused QTKit preference
index b1dd9bf..f14dd67 100644 (file)
@@ -63,5 +63,13 @@ AccessibilityObject* AccessibilitySVGRoot::parentObject() const
     return AccessibilitySVGElement::parentObject();
 }
 
+AccessibilityRole AccessibilitySVGRoot::roleValue() const
+{
+    AccessibilityRole ariaRole = ariaRoleAttribute();
+    if (ariaRole != AccessibilityRole::Unknown)
+        return ariaRole;
+
+    return AccessibilityRole::Group;
+}
     
 } // namespace WebCore
index 951eb76..b815635 100644 (file)
@@ -47,7 +47,7 @@ private:
     bool isAccessibilitySVGRoot() const override { return true; }
 
     WeakPtr<AccessibilityRenderObject> m_parent;
-    AccessibilityRole roleValue() const override { return AccessibilityRole::Group; }
+    AccessibilityRole roleValue() const override;
 };
     
 } // namespace WebCore