Title: [102470] trunk
Revision
102470
Author
cfleiz...@apple.com
Date
2011-12-09 13:25:50 -0800 (Fri, 09 Dec 2011)

Log Message

WebKit should ignore images with @alt matching only whitespace
https://bugs.webkit.org/show_bug.cgi?id=74189

Reviewed by Darin Adler.

Source/WebCore: 

Test: accessibility/img-alt-tag-only-whitespace.html

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

LayoutTests: 

* accessibility/img-alt-tag-only-whitespace.html: Added.
* platform/mac/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102469 => 102470)


--- trunk/LayoutTests/ChangeLog	2011-12-09 21:25:08 UTC (rev 102469)
+++ trunk/LayoutTests/ChangeLog	2011-12-09 21:25:50 UTC (rev 102470)
@@ -1,3 +1,13 @@
+2011-12-09  Chris Fleizach  <cfleiz...@apple.com>
+
+        WebKit should ignore images with @alt matching only whitespace
+        https://bugs.webkit.org/show_bug.cgi?id=74189
+
+        Reviewed by Darin Adler.
+
+        * accessibility/img-alt-tag-only-whitespace.html: Added.
+        * platform/mac/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.
+
 2011-12-09  Tony Chang  <t...@chromium.org>
 
         Try to deflake a repaint test on Chromium.  It looks like we're

Added: trunk/LayoutTests/accessibility/img-alt-tag-only-whitespace.html (0 => 102470)


--- trunk/LayoutTests/accessibility/img-alt-tag-only-whitespace.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-tag-only-whitespace.html	2011-12-09 21:25:50 UTC (rev 102470)
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div tabindex="0" role="group" id="images">
+<img id="firstimage" alt=" " src=""
+<img alt="	" src=""
+<img alt="   Image " src=""
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that images with alt tags that only have white space are ignored.");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("images").focus();
+        var imagesGroup = accessibilityController.focusedElement;
+        shouldBe("imagesGroup.childrenCount", "1");
+        console.log("Image description: " + imagesGroup.childAtIndex(0).description);
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/accessibility/img-alt-tag-only-whitespace-expected.txt (0 => 102470)


--- trunk/LayoutTests/platform/mac/accessibility/img-alt-tag-only-whitespace-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/img-alt-tag-only-whitespace-expected.txt	2011-12-09 21:25:50 UTC (rev 102470)
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: line 26: Image description: AXDescription:    Image 
+
+
+
+This tests that images with alt tags that only have white space are ignored.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imagesGroup.childrenCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (102469 => 102470)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 21:25:08 UTC (rev 102469)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 21:25:50 UTC (rev 102470)
@@ -1,3 +1,15 @@
+2011-12-09  Chris Fleizach  <cfleiz...@apple.com>
+
+        WebKit should ignore images with @alt matching only whitespace
+        https://bugs.webkit.org/show_bug.cgi?id=74189
+
+        Reviewed by Darin Adler.
+
+        Test: accessibility/img-alt-tag-only-whitespace.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
+
 2011-12-09  Anders Carlsson  <ander...@apple.com>
 
         Remove NSAnimationContext calls

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (102469 => 102470)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-12-09 21:25:08 UTC (rev 102469)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-12-09 21:25:50 UTC (rev 102470)
@@ -1897,7 +1897,7 @@
             Element* elt = static_cast<Element*>(node);
             const AtomicString& alt = elt->getAttribute(altAttr);
             // don't ignore an image that has an alt tag
-            if (!alt.isEmpty())
+            if (!alt.string().containsOnlyWhitespace())
                 return false;
             // informal standard is to ignore images with zero-length alt strings
             if (!alt.isNull())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to