Title: [93565] trunk
Revision
93565
Author
commit-qu...@webkit.org
Date
2011-08-22 17:24:30 -0700 (Mon, 22 Aug 2011)

Log Message

Patch by Alice Boxhall <aboxh...@chromium.org> on 2011-08-22
Reviewed by Chris Fleizach.

aria-labelledby should be used in preference to aria-labeledby
https://bugs.webkit.org/show_bug.cgi?id=62351

Source/WebCore:

Test: accessibility/aria-labelledby-overrides-aria-labeledby.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::ariaLabelledByElements): Renamed from ariaLabeledByElements.
(WebCore::AccessibilityRenderObject::ariaLabelledByAttribute): Renamed from ariaLabeledByAttribute,
and re-ordered to prefer the standard spelling.
(WebCore::AccessibilityRenderObject::title):
(WebCore::AccessibilityRenderObject::hasTextAlternative):
* accessibility/AccessibilityRenderObject.h:

LayoutTests:

* accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
* accessibility/aria-labelledby-overrides-aria-labeledby.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93564 => 93565)


--- trunk/LayoutTests/ChangeLog	2011-08-23 00:14:13 UTC (rev 93564)
+++ trunk/LayoutTests/ChangeLog	2011-08-23 00:24:30 UTC (rev 93565)
@@ -1,3 +1,13 @@
+2011-08-22  Alice Boxhall  <aboxh...@chromium.org>
+
+        Reviewed by Chris Fleizach.
+
+        aria-labelledby should be used in preference to aria-labeledby
+        https://bugs.webkit.org/show_bug.cgi?id=62351
+
+        * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
+        * accessibility/aria-labelledby-overrides-aria-labeledby.html: Added.
+
 2011-08-22  Adam Barth  <aba...@webkit.org>
 
         HTMLSourceTracker crashes when network packets break poorly

Added: trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt (0 => 93565)


--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt	2011-08-23 00:24:30 UTC (rev 93565)
@@ -0,0 +1,12 @@
+Alpha Beta Gamma Delta Epsilon
+This tests that if aria-labelledby is used, then non-standard aria-labeledby attributes are ignored.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS obj.title is "AXTitle: Gamma"
+PASS obj.title is "AXTitle: Epsilon"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby.html (0 => 93565)


--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby.html	2011-08-23 00:24:30 UTC (rev 93565)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<button aria-labelledby="gamma" aria-labeledby="delta">Alpha</button>
+<button aria-labeledby="epsilon">Beta</button>
+<span id="gamma">Gamma</span>
+<span id="delta">Delta</span>
+<span id="epsilon">Epsilon</span>
+
+<p id="description"></p>
+<ul id="console"></ul>
+
+<script>
+    description("This tests that if aria-labelledby is used, then non-standard aria-labeledby attributes are ignored.");
+
+    function log(str) {
+        var console = document.getElementById("console");
+        var li = document.createElement("li");
+        li.appendChild(document.createTextNode(str));
+        console.appendChild(li);
+    }
+
+    function logAXObject(obj) {
+          log("for " + obj.allAttributes());
+          log("children:\n" + obj.attributesOfChildren());
+          log("obj.title is " + obj.title);
+          log("obj.description is " + obj.description);
+    }
+    if (window.accessibilityController) {
+          var body = document.getElementById("body");
+          body.focus();
+          var groupObj = accessibilityController.focusedElement.childAtIndex(0);
+          var obj = groupObj.childAtIndex(0);
+          // Title from aria-labelledby element, aria-labeledby is ignored
+          shouldBe("obj.title", '"AXTitle: Gamma"');
+          var obj = groupObj.childAtIndex(1);
+          // aria-labeledby is used if no aria-labelledby present
+          shouldBe("obj.title", '"AXTitle: Epsilon"');
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (93564 => 93565)


--- trunk/Source/WebCore/ChangeLog	2011-08-23 00:14:13 UTC (rev 93564)
+++ trunk/Source/WebCore/ChangeLog	2011-08-23 00:24:30 UTC (rev 93565)
@@ -1,3 +1,20 @@
+2011-08-22  Alice Boxhall  <aboxh...@chromium.org>
+
+        Reviewed by Chris Fleizach.
+
+        aria-labelledby should be used in preference to aria-labeledby
+        https://bugs.webkit.org/show_bug.cgi?id=62351
+
+        Test: accessibility/aria-labelledby-overrides-aria-labeledby.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::ariaLabelledByElements): Renamed from ariaLabeledByElements.
+        (WebCore::AccessibilityRenderObject::ariaLabelledByAttribute): Renamed from ariaLabeledByAttribute,
+        and re-ordered to prefer the standard spelling.
+        (WebCore::AccessibilityRenderObject::title):
+        (WebCore::AccessibilityRenderObject::hasTextAlternative):
+        * accessibility/AccessibilityRenderObject.h:
+
 2011-08-22  Nat Duca  <nd...@chromium.org>
 
         Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (93564 => 93565)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-08-23 00:14:13 UTC (rev 93564)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-08-23 00:24:30 UTC (rev 93565)
@@ -1241,17 +1241,17 @@
     }
 }
     
-void AccessibilityRenderObject::ariaLabeledByElements(Vector<Element*>& elements) const
+void AccessibilityRenderObject::ariaLabelledByElements(Vector<Element*>& elements) const
 {
-    elementsFromAttribute(elements, aria_labeledbyAttr);
+    elementsFromAttribute(elements, aria_labelledbyAttr);
     if (!elements.size())
-        elementsFromAttribute(elements, aria_labelledbyAttr);
+        elementsFromAttribute(elements, aria_labeledbyAttr);
 }
    
-String AccessibilityRenderObject::ariaLabeledByAttribute() const
+String AccessibilityRenderObject::ariaLabelledByAttribute() const
 {
     Vector<Element*> elements;
-    ariaLabeledByElements(elements);
+    ariaLabelledByElements(elements);
     
     return accessibilityDescriptionForElements(elements);
 }
@@ -1300,6 +1300,7 @@
     if (!node)
         return String();
     
+
     const AtomicString& title = getAttribute(titleAttr);
     if (!title.isEmpty())
         return title;
@@ -1590,9 +1591,9 @@
 
 bool AccessibilityRenderObject::hasTextAlternative() const
 {
-    // ARIA: section 2A, bullet #3 says if aria-labeledby or aria-label appears, it should
+    // ARIA: section 2A, bullet #3 says if aria-labelledby or aria-label appears, it should
     // override the "label" element association.
-    if (!ariaLabeledByAttribute().isEmpty() || !getAttribute(aria_labelAttr).isEmpty())
+    if (!ariaLabelledByAttribute().isEmpty() || !getAttribute(aria_labelAttr).isEmpty())
         return true;
         
     return false;   

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (93564 => 93565)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-08-23 00:14:13 UTC (rev 93564)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-08-23 00:24:30 UTC (rev 93565)
@@ -185,7 +185,7 @@
     virtual PlainTextRange selectedTextRange() const;
     virtual VisibleSelection selection() const;
     virtual String stringValue() const;
-    virtual String ariaLabeledByAttribute() const;
+    virtual String ariaLabelledByAttribute() const;
     virtual String title() const;
     virtual String ariaDescribedByAttribute() const;
     virtual String accessibilityDescription() const;
@@ -266,7 +266,7 @@
     mutable bool m_childrenDirty;
     
     void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
-    void ariaLabeledByElements(Vector<Element*>& elements) const;
+    void ariaLabelledByElements(Vector<Element*>& elements) const;
     bool needsToUpdateChildren() const { return m_childrenDirty; }
     
     virtual bool isDetached() const { return !m_renderer; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to