AX: svg:image not accessible
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 22:56:47 +0000 (22:56 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 22:56:47 +0000 (22:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96341

Reviewed by Adele Peterson.

Source/WebCore:

Test: accessibility/svg-image.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):

LayoutTests:

* accessibility/svg-image.html: Added.
* platform/mac/accessibility/svg-image-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/svg-image.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/svg-image-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp

index 6fe6a49..54900f5 100644 (file)
@@ -1,3 +1,13 @@
+2012-09-12  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: svg:image not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=96341
+
+        Reviewed by Adele Peterson.
+
+        * accessibility/svg-image.html: Added.
+        * platform/mac/accessibility/svg-image-expected.txt: Added.
+
 2012-09-12  Ojan Vafai  <ojan@chromium.org>
 
         percentage widths rendered wrong in vertical writing mode with orthogonal parent
 2012-09-12  Ojan Vafai  <ojan@chromium.org>
 
         percentage widths rendered wrong in vertical writing mode with orthogonal parent
diff --git a/LayoutTests/accessibility/svg-image.html b/LayoutTests/accessibility/svg-image.html
new file mode 100644 (file)
index 0000000..053d210
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<img id="realimage" tabindex="0" alt="TestImage" width="100" height="100">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<image tabindex="0" id="svgimage" alt="TestImage" x="20" y="20" width="298" height="65" xlink:href="resources/cake.png"/>
+
+</svg>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that SVG images are accessible elements and they have the same attributes as real images.");
+
+    if (window.accessibilityController) {
+        document.getElementById("realimage").focus();
+        var realImage = accessibilityController.focusedElement;
+
+        document.getElementById("svgimage").focus();
+        var svgImage = accessibilityController.focusedElement;
+        shouldBe("svgImage.role", "realImage.role");
+        shouldBe("svgImage.description", "realImage.description");
+       
+        debug("SVG Image Role: " + svgImage.role);
+        debug("SVG Image Description: " + svgImage.description);
+    }
+
+</script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/accessibility/svg-image-expected.txt b/LayoutTests/platform/mac/accessibility/svg-image-expected.txt
new file mode 100644 (file)
index 0000000..d0bffd7
--- /dev/null
@@ -0,0 +1,14 @@
+
+This tests that SVG images are accessible elements and they have the same attributes as real images.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS svgImage.role is realImage.role
+PASS svgImage.description is realImage.description
+SVG Image Role: AXRole: AXImage
+SVG Image Description: AXDescription: TestImage
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
index 9da6b64..32cf92c 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-12  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: svg:image not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=96341
+
+        Reviewed by Adele Peterson.
+
+        Test: accessibility/svg-image.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+
 2012-09-12  Ojan Vafai  <ojan@chromium.org>
 
         percentage widths rendered wrong in vertical writing mode with orthogonal parent
 2012-09-12  Ojan Vafai  <ojan@chromium.org>
 
         percentage widths rendered wrong in vertical writing mode with orthogonal parent
index f0fb5ea..16d79c2 100644 (file)
@@ -2356,11 +2356,12 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
         return LegendRole;
     if (m_renderer->isText())
         return StaticTextRole;
         return LegendRole;
     if (m_renderer->isText())
         return StaticTextRole;
-    if (cssBox && cssBox->isImage()) {
+    if ((cssBox && cssBox->isImage()) || m_renderer->isSVGImage()) {
         if (node && node->hasTagName(inputTag))
             return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
         return ImageRole;
     }
         if (node && node->hasTagName(inputTag))
             return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
         return ImageRole;
     }
+    
     if (node && node->hasTagName(canvasTag))
         return CanvasRole;
 
     if (node && node->hasTagName(canvasTag))
         return CanvasRole;