Changeset 51762 in webkit


Ignore:
Timestamp:
Dec 7, 2009 6:27:44 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-07 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Xan Lopez.

https://bugs.webkit.org/show_bug.cgi?id=25524
[Gtk] Expose the title attribute to assistive technologies

  • platform/gtk/accessibility/title-and-alt.html: Added.
  • platform/gtk/accessibility/title-and-alt-expected.txt: Added.

2009-12-07 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Xan Lopez.

https://bugs.webkit.org/show_bug.cgi?id=25524
[Gtk] Expose the title attribute to assistive technologies

Expose 'alt' attribute from images as accessible name.
Expose the 'title' core HTML attribute as accessible description.
This is a modified version of the original fix submitted by Mario Sanchez Prada,
adjusted so that it doesn't impact other platforms.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (webkit_accessible_get_name): (webkit_accessible_get_description):
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51760 r51762  
     12009-12-07  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25524
     6        [Gtk] Expose the title attribute to assistive technologies
     7
     8        * platform/gtk/accessibility/title-and-alt.html: Added.
     9        * platform/gtk/accessibility/title-and-alt-expected.txt: Added.
     10
    1112009-12-07  Oliver Hunt  <oliver@apple.com>
    212
  • trunk/WebCore/ChangeLog

    r51758 r51762  
     12009-12-07  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25524
     6        [Gtk] Expose the title attribute to assistive technologies
     7
     8        Expose 'alt' attribute from images as accessible name.
     9        Expose the 'title' core HTML attribute as accessible description.
     10        This is a modified version of the original fix submitted by Mario Sanchez Prada,
     11        adjusted so that it doesn't impact other platforms.
     12
     13        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     14        (webkit_accessible_get_name):
     15        (webkit_accessible_get_description):
     16
    1172009-12-07  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    218
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r51342 r51762  
    160160{
    161161    AccessibilityObject* coreObject = core(object);
     162    if (!coreObject->isAccessibilityRenderObject())
     163        return returnString(coreObject->stringValue());
     164
     165    AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject);
    162166    if (coreObject->isControl()) {
    163         AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject);
    164167        AccessibilityObject* label = renderObject->correspondingLabelForControlElement();
    165168        if (label)
    166169            return returnString(nameFromChildren(label));
    167170    }
     171
     172    if (renderObject->isImage() || renderObject->isInputImage()) {
     173        Node* node = renderObject->renderer()->node();
     174        if (node && node->isHTMLElement()) {
     175            // Get the attribute rather than altText String so as not to fall back on title.
     176            String alt = static_cast<HTMLElement*>(node)->getAttribute(HTMLNames::altAttr);
     177            if (!alt.isEmpty())
     178                return returnString(alt);
     179        }
     180    }
     181
    168182    return returnString(coreObject->stringValue());
    169183}
     
    172186{
    173187    AccessibilityObject* coreObject = core(object);
     188    Node* node = 0;
     189    if (coreObject->isAccessibilityRenderObject())
     190        node = static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->node();
     191    if (!node || !node->isHTMLElement() || coreObject->ariaRoleAttribute() != UnknownRole)
     192        return returnString(coreObject->accessibilityDescription());
    174193
    175194    // atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here.
    176     if (coreObject->roleValue() == TableRole && coreObject->ariaRoleAttribute() == UnknownRole) {
    177         Node* node = static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->node();
    178         if (node && node->isHTMLElement()) {
    179             String summary = static_cast<HTMLTableElement*>(node)->summary();
    180             if (!summary.isEmpty())
    181                 return returnString(summary);
    182         }
    183     }
     195    if (coreObject->roleValue() == TableRole) {
     196        String summary = static_cast<HTMLTableElement*>(node)->summary();
     197        if (!summary.isEmpty())
     198            return returnString(summary);
     199    }
     200
     201    // The title attribute should be reliably available as the object's descripton.
     202    // We do not want to fall back on other attributes in its absence. See bug 25524.
     203    String title = static_cast<HTMLElement*>(node)->title();
     204    if (!title.isEmpty())
     205        return returnString(title);
    184206
    185207    return returnString(coreObject->accessibilityDescription());
Note: See TracChangeset for help on using the changeset viewer.