Title: [148617] trunk
Revision
148617
Author
[email protected]
Date
2013-04-17 09:42:45 -0700 (Wed, 17 Apr 2013)

Log Message

Source/WebCore: AX: When img@alt is undefined, WebKit should use @title as accessibility label if available
https://bugs.webkit.org/show_bug.cgi?id=114535

Reviewed by Tim Horton.

Don't hide images from Accessibility that have the title attribute on them.

Test: accessibility/empty-image-with-title.html

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

LayoutTests: When img@alt is undefined, WebKit should use @title as accessibility label if available
https://bugs.webkit.org/show_bug.cgi?id=114535

Reviewed by Tim Horton.

* accessibility/empty-image-with-title-expected.txt: Added.
* accessibility/empty-image-with-title.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148616 => 148617)


--- trunk/LayoutTests/ChangeLog	2013-04-17 16:32:44 UTC (rev 148616)
+++ trunk/LayoutTests/ChangeLog	2013-04-17 16:42:45 UTC (rev 148617)
@@ -1,3 +1,13 @@
+2013-04-17  Chris Fleizach  <[email protected]>
+
+        When img@alt is undefined, WebKit should use @title as accessibility label if available
+        https://bugs.webkit.org/show_bug.cgi?id=114535
+
+        Reviewed by Tim Horton.
+
+        * accessibility/empty-image-with-title-expected.txt: Added.
+        * accessibility/empty-image-with-title.html: Added.
+
 2013-04-17  Arpita Bahuguna  <[email protected]>
 
         getAttribute does not behave correctly for mixed-case attributes on HTML elements

Added: trunk/LayoutTests/accessibility/empty-image-with-title-expected.txt (0 => 148617)


--- trunk/LayoutTests/accessibility/empty-image-with-title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/empty-image-with-title-expected.txt	2013-04-17 16:42:45 UTC (rev 148617)
@@ -0,0 +1,12 @@
+
+This tests that if a missing image has a title attribute, it still appears in the AX hierarchy.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS image1.role is 'AXRole: AXImage'
+PASS image1.description is 'AXDescription: baz'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/empty-image-with-title.html (0 => 148617)


--- trunk/LayoutTests/accessibility/empty-image-with-title.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/empty-image-with-title.html	2013-04-17 16:42:45 UTC (rev 148617)
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<img id="image1" src="" title="baz" width="100" height="100">
+
+<div id="console"></div>
+
+<script>
+
+    description("This tests that if a missing image has a title attribute, it still appears in the AX hierarchy.");
+
+    if (window.accessibilityController) {
+
+          var image1 = accessibilityController.accessibleElementById("image1");
+          shouldBe("image1.role", "'AXRole: AXImage'");
+          shouldBe("image1.description", "'AXDescription: baz'");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148616 => 148617)


--- trunk/Source/WebCore/ChangeLog	2013-04-17 16:32:44 UTC (rev 148616)
+++ trunk/Source/WebCore/ChangeLog	2013-04-17 16:42:45 UTC (rev 148617)
@@ -1,3 +1,17 @@
+2013-04-17  Chris Fleizach  <[email protected]>
+
+        AX: When img@alt is undefined, WebKit should use @title as accessibility label if available
+        https://bugs.webkit.org/show_bug.cgi?id=114535
+
+        Reviewed by Tim Horton.
+
+        Don't hide images from Accessibility that have the title attribute on them.
+
+        Test: accessibility/empty-image-with-title.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
+
 2013-04-17  Arpita Bahuguna  <[email protected]>
 
         getAttribute does not behave correctly for mixed-case attributes on HTML elements

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (148616 => 148617)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-04-17 16:32:44 UTC (rev 148616)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-04-17 16:42:45 UTC (rev 148617)
@@ -1247,6 +1247,9 @@
             // informal standard is to ignore images with zero-length alt strings
             if (!alt.isNull())
                 return true;
+            // If an image has a title attribute on it, accessibility should be lenient and allow it to appear in the hierarchy (according to WAI-ARIA).
+            if (!getAttribute(titleAttr).isEmpty())
+                return false;
         }
         
         if (isNativeImage()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to