Changeset 155601 in webkit


Ignore:
Timestamp:
Sep 12, 2013 2:51:25 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Self-referencing aria-labelledby only uses contents.
https://bugs.webkit.org/show_bug.cgi?id=120814

Patch by Samuel White <Samuel White> on 2013-09-12
Reviewed by Mario Sanchez Prada.

Source/WebCore:

Implemented additional 'Text Alternative Computation' steps documented at:
http://www.w3.org/WAI/PF/aria/complete#textalternativecomputation. This allows us to remove
our raw text node iteration that was previously forcing us to do our computation incorrectly.
Element content is now sourced using textUnderElement (step 2C of the computation).

Test: accessibility/self-referencing-aria-labelledby.html

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::accessibleNameForNode):
(WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements):

LayoutTests:

Test to verify that self-referencing aria-labelledby behavior works as expected.

  • accessibility/self-referencing-aria-labelledby-expected.txt: Added.
  • accessibility/self-referencing-aria-labelledby.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r155599 r155601  
     12013-09-12  Samuel White  <samuel_white@apple.com>
     2
     3        AX: Self-referencing aria-labelledby only uses contents.
     4        https://bugs.webkit.org/show_bug.cgi?id=120814
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        Test to verify that self-referencing aria-labelledby behavior works as expected.
     9
     10        * accessibility/self-referencing-aria-labelledby-expected.txt: Added.
     11        * accessibility/self-referencing-aria-labelledby.html: Added.
     12
    1132013-09-12  Denis Nomiyama  <d.nomiyama@samsung.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r155600 r155601  
     12013-09-12  Samuel White  <samuel_white@apple.com>
     2
     3        AX: Self-referencing aria-labelledby only uses contents.
     4        https://bugs.webkit.org/show_bug.cgi?id=120814
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        Implemented additional 'Text Alternative Computation' steps documented at:
     9        http://www.w3.org/WAI/PF/aria/complete#textalternativecomputation. This allows us to remove
     10        our raw text node iteration that was previously forcing us to do our computation incorrectly.
     11        Element content is now sourced using textUnderElement (step 2C of the computation).
     12
     13        Test: accessibility/self-referencing-aria-labelledby.html
     14
     15        * accessibility/AccessibilityNodeObject.cpp:
     16        (WebCore::accessibleNameForNode):
     17        (WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements):
     18
    1192013-09-12  Commit Queue  <commit-queue@webkit.org>
    220
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r155543 r155601  
    17531753static String accessibleNameForNode(Node* node)
    17541754{
    1755     if (node->isTextNode())
    1756         return toText(node)->data();
    1757 
     1755    if (!node->isHTMLElement())
     1756        return String();
     1757   
     1758    HTMLElement* element = toHTMLElement(node);
     1759   
     1760    const AtomicString& ariaLabel = element->fastGetAttribute(aria_labelAttr);
     1761    if (!ariaLabel.isEmpty())
     1762        return ariaLabel;
     1763   
     1764    const AtomicString& alt = element->fastGetAttribute(altAttr);
     1765    if (!alt.isEmpty())
     1766        return alt;
     1767   
    17581768    if (isHTMLInputElement(node))
    17591769        return toHTMLInputElement(node)->value();
    1760 
    1761     if (node->isHTMLElement()) {
    1762         const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr);
    1763         if (!alt.isEmpty())
    1764             return alt;
    1765     }
    1766 
     1770   
     1771    String text = node->document().axObjectCache()->getOrCreate(node)->textUnderElement();
     1772    if (!text.isEmpty())
     1773        return text;
     1774   
     1775    const AtomicString& title = element->fastGetAttribute(titleAttr);
     1776    if (!title.isEmpty())
     1777        return title;
     1778   
    17671779    return String();
    17681780}
     
    17731785    unsigned size = elements.size();
    17741786    for (unsigned i = 0; i < size; ++i) {
    1775         Element* idElement = elements[i];
    1776 
    1777         builder.append(accessibleNameForNode(idElement));
    1778         for (Node* n = idElement->firstChild(); n; n = NodeTraversal::next(n, idElement))
    1779             builder.append(accessibleNameForNode(n));
    1780 
    1781         if (i != size - 1)
     1787        if (i)
    17821788            builder.append(' ');
     1789       
     1790        builder.append(accessibleNameForNode(elements[i]));
    17831791    }
    17841792    return builder.toString();
Note: See TracChangeset for help on using the changeset viewer.