Title: [128227] trunk
- Revision
- 128227
- Author
- [email protected]
- Date
- 2012-09-11 15:00:35 -0700 (Tue, 11 Sep 2012)
Log Message
AX: title attribute is not exposed as the AXDescription on AXImage when there is no other fallback content
https://bugs.webkit.org/show_bug.cgi?id=96412
Reviewed by Jon Honeycutt.
Source/WebCore:
Ensure that if an image has a title attribute, but no alt attribute, it will fallback to use the title attribute
for the descriptive text.
Test: accessibility/img-fallsback-to-title.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityDescription):
LayoutTests:
* accessibility/img-fallsback-to-title.html: Added.
* platform/mac/accessibility/img-fallsback-to-title-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (128226 => 128227)
--- trunk/LayoutTests/ChangeLog 2012-09-11 21:29:59 UTC (rev 128226)
+++ trunk/LayoutTests/ChangeLog 2012-09-11 22:00:35 UTC (rev 128227)
@@ -1,3 +1,13 @@
+2012-09-11 Chris Fleizach <[email protected]>
+
+ AX: title attribute is not exposed as the AXDescription on AXImage when there is no other fallback content
+ https://bugs.webkit.org/show_bug.cgi?id=96412
+
+ Reviewed by Jon Honeycutt.
+
+ * accessibility/img-fallsback-to-title.html: Added.
+ * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Added.
+
2012-09-11 Stephen White <[email protected]>
[chromium] Mark some tests as needing a rebaseline due to SVG filters change.
Added: trunk/LayoutTests/accessibility/img-fallsback-to-title.html (0 => 128227)
--- trunk/LayoutTests/accessibility/img-fallsback-to-title.html (rev 0)
+++ trunk/LayoutTests/accessibility/img-fallsback-to-title.html 2012-09-11 22:00:35 UTC (rev 128227)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div role="group" tabindex="0" id="images">
+ <img alt="" height="100" width="100">
+ <img title="test1" height="100" width="100">
+ <img alt="alt" title="test2" height="100" width="100">
+ <div role="img" title="test3" width="100" height="100">test</div>
+ <div role="img" alt="alt" title="test4" width="100" height="100">test</div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that images will fallback to using the title attribute if no other descriptive text is present.");
+
+ if (window.accessibilityController) {
+
+ document.getElementById("images").focus();
+ var imagesGroup = accessibilityController.focusedElement;
+
+ // First image should have a description of "test1" because there is no alt tag (it should use the title).
+ // The title should NOT be in the help text.
+ var image1 = imagesGroup.childAtIndex(0).childAtIndex(0);
+ debug("Image1 description: " + image1.description);
+ debug("Image1 help: " + image1.helpText + "<br>");
+
+ // Second image should use the description from the alt tag instead of the title.
+ // The help text should reflect what's in the title.
+ var image2 = imagesGroup.childAtIndex(0).childAtIndex(1);
+ debug("Image2 description: " + image2.description);
+ debug("Image2 help: " + image2.helpText + "<br>");
+
+ // Now do the same checks for ARIA type images.
+ var image3 = imagesGroup.childAtIndex(1);
+ debug("Image3 description: " + image3.description);
+ debug("Image3 help: " + image3.helpText + "<br>");
+
+ // Now do the same checks for ARIA type images.
+ var image4 = imagesGroup.childAtIndex(2);
+ debug("Image4 description: " + image4.description);
+ debug("Image4 help: " + image4.helpText + "<br>");
+
+ // Verify that the first image (with an empty alt tag) is ignored
+ // by checking the children count of the group containing the native images == 2.
+ shouldBe("imagesGroup.childAtIndex(0).childrenCount", "2");
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/accessibility/img-fallsback-to-title-expected.txt (0 => 128227)
--- trunk/LayoutTests/platform/mac/accessibility/img-fallsback-to-title-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/img-fallsback-to-title-expected.txt 2012-09-11 22:00:35 UTC (rev 128227)
@@ -0,0 +1,25 @@
+
+test
+test
+This tests that images will fallback to using the title attribute if no other descriptive text is present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Image1 description: AXDescription: test1
+Image1 help: AXHelp:
+
+Image2 description: AXDescription: alt
+Image2 help: AXHelp: test2
+
+Image3 description: AXDescription: test3
+Image3 help: AXHelp:
+
+Image4 description: AXDescription: alt
+Image4 help: AXHelp: test4
+
+PASS imagesGroup.childAtIndex(0).childrenCount is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/Source/WebCore/ChangeLog (128226 => 128227)
--- trunk/Source/WebCore/ChangeLog 2012-09-11 21:29:59 UTC (rev 128226)
+++ trunk/Source/WebCore/ChangeLog 2012-09-11 22:00:35 UTC (rev 128227)
@@ -1,3 +1,18 @@
+2012-09-11 Chris Fleizach <[email protected]>
+
+ AX: title attribute is not exposed as the AXDescription on AXImage when there is no other fallback content
+ https://bugs.webkit.org/show_bug.cgi?id=96412
+
+ Reviewed by Jon Honeycutt.
+
+ Ensure that if an image has a title attribute, but no alt attribute, it will fallback to use the title attribute
+ for the descriptive text.
+
+ Test: accessibility/img-fallsback-to-title.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::accessibilityDescription):
+
2012-09-11 Rik Cabanier <[email protected]>
Clean up functions in RenderLayerBacking.h/.cpp
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (128226 => 128227)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-09-11 21:29:59 UTC (rev 128226)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-09-11 22:00:35 UTC (rev 128227)
@@ -1498,17 +1498,17 @@
if (!ariaDescription.isEmpty())
return ariaDescription;
- Node* node = m_renderer->node();
if (isImage() || isInputImage() || isNativeImage() || isCanvas()) {
- if (node && node->isHTMLElement()) {
- const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr);
- if (alt.isEmpty())
- return String();
+
+ // Images should use alt as long as the attribute is present, even if empty.
+ // Otherwise, it should fallback to other methods, like the title attribute.
+ const AtomicString& alt = getAttribute(altAttr);
+ if (!alt.isNull())
return alt;
- }
}
#if ENABLE(MATHML)
+ Node* node = m_renderer->node();
if (node && node->isElementNode() && static_cast<Element*>(node)->isMathMLElement())
return getAttribute(MathMLNames::alttextAttr);
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes