Changeset 201072 in webkit


Ignore:
Timestamp:
May 18, 2016 12:12:09 AM (8 years ago)
Author:
jdiggs@igalia.com
Message:

AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description
https://bugs.webkit.org/show_bug.cgi?id=157822

Reviewed by Chris Fleizach.

Source/WebCore:

Remove the old code which was overriding WebCore Accessibility and always use
AccessibilityText.

If the AccessibilityText's textSource is HelpText or SummaryText, it should be exposed
as the AtkObject description. If the textSource is TitleTagText and there is no other
text alternative, the value should also be exposed in this fashion. Note that AtkObject's
description property is equivalent to AXAPI's AXHelp property.

If the AccessibilityText's textSource is anything other than the above, the first
non-empty value should be exposed as the AtkObject name. Depending on the source of
the name content, AtkObject's name property can be the equivalent of AXAPI's AXTitle.
However, most of the time, AtkObject's name property is equivalent to AXAPI's
AXDescription property.

By making these changes, what WebKit exposes for ATK is now extremely similar to what
WebKit exposes on the Mac (modulo the property names) and also with what is defined in
the HTML Accessibility and Accessible Name and Description Computation API mappings specs.

Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because
asking for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject
description in GNU/Linux. But as indicated above, what ATK calls a "description" is what
the Mac calls "help."

Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal
with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187
has been opened for that task.) In the meantime, the existing tests have been given platform
checks to ask for the right property on each platform. This was done in such a way as to not
require other (non-ATK) platforms change their current expectations files.

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(webkitAccessibleGetName):
(webkitAccessibleGetDescription):

Tools:

Fix AccessibilityUIElement::helpText() so that it returns an empty string rather than
nullptr upon failure.

  • WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

(WTR::AccessibilityUIElement::helpText):

LayoutTests:

Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because asking
for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject description in
GNU/Linux. But what the Mac calls a "description" is what ATK calls a "name." What ATK calls a
"description" is what the Mac calls "help."

Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal with
with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187 has
been opened for that task.) In the meantime, the existing tests have been given platform checks
to ask for the right property on each platform. This was done in such a way as to not require
other (non-ATK) platforms change their current expectations files.

In addition to the above, three previously-failing tests were corrected and are now passing.

  • accessibility/alt-tag-on-image-with-nonimage-role.html:
  • accessibility/aria-help.html:
  • accessibility/aria-label.html:
  • accessibility/aria-labeled-with-hidden-node.html:
  • accessibility/aria-labelledby-on-input.html:
  • accessibility/aria-labelledby-overrides-aria-labeledby.html:
  • accessibility/aria-labelledby-overrides-label.html:
  • accessibility/aria-labelledby-stay-within.html:
  • accessibility/aria-labelledby-with-descendants.html:
  • accessibility/aria-namefrom-author.html:
  • accessibility/aria-option-role.html:
  • accessibility/canvas-description-and-role.html:
  • accessibility/empty-image-with-title.html:
  • accessibility/fieldset-element.html:
  • accessibility/focusable-div.html:
  • accessibility/gtk/no-notification-for-unrendered-iframe-children-expected.txt:
  • accessibility/gtk/no-notification-for-unrendered-iframe-children.html:
  • accessibility/gtk/title-and-alt-expected.txt:
  • accessibility/gtk/title-and-alt.html:
  • accessibility/help-text.html:
  • accessibility/img-alt-tag-only-whitespace-expected.txt:
  • accessibility/img-alt-tag-only-whitespace.html:
  • accessibility/img-aria-button-alt-tag.html:
  • accessibility/img-fallsback-to-title.html:
  • accessibility/input-image-alt.html:
  • accessibility/loading-iframe-sends-notification.html:
  • accessibility/media-element.html:
  • accessibility/radio-button-title-label.html:
  • accessibility/self-referencing-aria-labelledby.html:
  • accessibility/svg-bounds.html:
  • platform/gtk/TestExpectations:
  • platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Added.
  • platform/gtk/accessibility/aria-help-expected.txt:
  • platform/gtk/accessibility/aria-hidden-negates-no-visibility-expected.txt: Added.
  • platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Added.
  • platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Added.
  • platform/gtk/accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
  • platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
  • platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Added.
  • platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Added.
  • platform/gtk/accessibility/aria-namefrom-author-expected.txt: Added.
  • platform/gtk/accessibility/aria-option-role-expected.txt: Added.
  • platform/gtk/accessibility/aria-switch-text-expected.txt:
  • platform/gtk/accessibility/canvas-description-and-role-expected.txt: Added.
  • platform/gtk/accessibility/empty-image-with-title-expected.txt: Added.
  • platform/gtk/accessibility/fieldset-element-expected.txt: Added.
  • platform/gtk/accessibility/focusable-div-expected.txt: Added.
  • platform/gtk/accessibility/help-text-expected.txt: Added.
  • platform/gtk/accessibility/image-link-expected.txt:
  • platform/gtk/accessibility/image-map1-expected.txt:
  • platform/gtk/accessibility/image-map2-expected.txt:
  • platform/gtk/accessibility/image-with-alt-and-map-expected.txt:
  • platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.
  • platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Added.
  • platform/gtk/accessibility/img-fallsback-to-title-expected.txt:
  • platform/gtk/accessibility/input-image-alt-expected.txt: Added.
  • platform/gtk/accessibility/media-element-expected.txt:
  • platform/gtk/accessibility/radio-button-title-label-expected.txt:
  • platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Added.
  • platform/gtk/accessibility/svg-bounds-expected.txt: Added.
Location:
trunk
Files:
19 added
45 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201069 r201072  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description
     4        https://bugs.webkit.org/show_bug.cgi?id=157822
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because asking
     9        for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject description in
     10        GNU/Linux. But what the Mac calls a "description" is what ATK calls a "name." What ATK calls a
     11        "description" is what the Mac calls "help."
     12
     13        Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal with
     14        with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187 has
     15        been opened for that task.) In the meantime, the existing tests have been given platform checks
     16        to ask for the right property on each platform. This was done in such a way as to not require
     17        other (non-ATK) platforms change their current expectations files.
     18
     19        In addition to the above, three previously-failing tests were corrected and are now passing.
     20
     21        * accessibility/alt-tag-on-image-with-nonimage-role.html:
     22        * accessibility/aria-help.html:
     23        * accessibility/aria-label.html:
     24        * accessibility/aria-labeled-with-hidden-node.html:
     25        * accessibility/aria-labelledby-on-input.html:
     26        * accessibility/aria-labelledby-overrides-aria-labeledby.html:
     27        * accessibility/aria-labelledby-overrides-label.html:
     28        * accessibility/aria-labelledby-stay-within.html:
     29        * accessibility/aria-labelledby-with-descendants.html:
     30        * accessibility/aria-namefrom-author.html:
     31        * accessibility/aria-option-role.html:
     32        * accessibility/canvas-description-and-role.html:
     33        * accessibility/empty-image-with-title.html:
     34        * accessibility/fieldset-element.html:
     35        * accessibility/focusable-div.html:
     36        * accessibility/gtk/no-notification-for-unrendered-iframe-children-expected.txt:
     37        * accessibility/gtk/no-notification-for-unrendered-iframe-children.html:
     38        * accessibility/gtk/title-and-alt-expected.txt:
     39        * accessibility/gtk/title-and-alt.html:
     40        * accessibility/help-text.html:
     41        * accessibility/img-alt-tag-only-whitespace-expected.txt:
     42        * accessibility/img-alt-tag-only-whitespace.html:
     43        * accessibility/img-aria-button-alt-tag.html:
     44        * accessibility/img-fallsback-to-title.html:
     45        * accessibility/input-image-alt.html:
     46        * accessibility/loading-iframe-sends-notification.html:
     47        * accessibility/media-element.html:
     48        * accessibility/radio-button-title-label.html:
     49        * accessibility/self-referencing-aria-labelledby.html:
     50        * accessibility/svg-bounds.html:
     51        * platform/gtk/TestExpectations:
     52        * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Added.
     53        * platform/gtk/accessibility/aria-help-expected.txt:
     54        * platform/gtk/accessibility/aria-hidden-negates-no-visibility-expected.txt: Added.
     55        * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Added.
     56        * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Added.
     57        * platform/gtk/accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
     58        * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
     59        * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Added.
     60        * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Added.
     61        * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Added.
     62        * platform/gtk/accessibility/aria-option-role-expected.txt: Added.
     63        * platform/gtk/accessibility/aria-switch-text-expected.txt:
     64        * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Added.
     65        * platform/gtk/accessibility/empty-image-with-title-expected.txt: Added.
     66        * platform/gtk/accessibility/fieldset-element-expected.txt: Added.
     67        * platform/gtk/accessibility/focusable-div-expected.txt: Added.
     68        * platform/gtk/accessibility/help-text-expected.txt: Added.
     69        * platform/gtk/accessibility/image-link-expected.txt:
     70        * platform/gtk/accessibility/image-map1-expected.txt:
     71        * platform/gtk/accessibility/image-map2-expected.txt:
     72        * platform/gtk/accessibility/image-with-alt-and-map-expected.txt:
     73        * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.
     74        * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Added.
     75        * platform/gtk/accessibility/img-fallsback-to-title-expected.txt:
     76        * platform/gtk/accessibility/input-image-alt-expected.txt: Added.
     77        * platform/gtk/accessibility/media-element-expected.txt:
     78        * platform/gtk/accessibility/radio-button-title-label-expected.txt:
     79        * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Added.
     80        * platform/gtk/accessibility/svg-bounds-expected.txt: Added.
     81
    1822016-05-17  Saam barati  <sbarati@apple.com>
    283
  • trunk/LayoutTests/accessibility/alt-tag-on-image-with-nonimage-role.html

    r160311 r201072  
    2525
    2626        var group = accessibilityController.accessibleElementById("group");
    27         shouldBe("group.description", "'AXDescription: TEST2'");
     27        var button = accessibilityController.accessibleElementById("button");
    2828
    29         var button = accessibilityController.accessibleElementById("button");
    30         shouldBe("button.description", "'AXDescription: TEST3'");
     29        if (accessibilityController.platformName == "atk") {
     30            shouldBe("group.title", "'AXTitle: TEST2'");
     31            shouldBe("button.title", "'AXTitle: TEST3'");
     32        } else {
     33            shouldBe("group.description", "'AXDescription: TEST2'");
     34            shouldBe("button.description", "'AXDescription: TEST3'");
     35        }
    3136    }
    3237
  • trunk/LayoutTests/accessibility/aria-help.html

    r159128 r201072  
    2121        document.getElementById("button").focus();
    2222        var button = accessibilityController.focusedElement;
    23         shouldBe("button.helpText", "'AXHelp: click here'");
     23        if (accessibilityController.platformName == "atk")
     24            shouldBe("button.description", "'AXDescription: click here'");
     25        else
     26            shouldBe("button.helpText", "'AXHelp: click here'");
    2427    }
    2528
  • trunk/LayoutTests/accessibility/aria-label.html

    r155274 r201072  
    1919          body.focus();
    2020          var obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
    21           var succeeded = obj.description == "AXDescription: aria label";
     21          var succeeded;
     22          if (accessibilityController.platformName == "atk")
     23              succeeded = obj.title == "AXTitle: aria label";
     24          else
     25              succeeded = obj.description == "AXDescription: aria label";
    2226          shouldBe("succeeded", "true");
    2327
    2428          obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(1);
    25           succeeded = obj.description == "AXDescription: aria link";
     29          if (accessibilityController.platformName == "atk")
     30              succeeded = obj.title == "AXTitle: aria link";
     31          else
     32              succeeded = obj.description == "AXDescription: aria link";
    2633          shouldBe("succeeded", "true");
    2734    }
  • trunk/LayoutTests/accessibility/aria-labeled-with-hidden-node.html

    r157221 r201072  
    1818    if (window.accessibilityController) {
    1919       var button = accessibilityController.accessibleElementById("button");
    20        shouldBe("button.description", "'AXDescription: TITLE'");
     20       if (accessibilityController.platformName == "atk")
     21           shouldBe("button.title", "'AXTitle: TITLE'");
     22       else
     23           shouldBe("button.description", "'AXDescription: TITLE'");
    2124    }
    2225</script>
  • trunk/LayoutTests/accessibility/aria-labelledby-on-input.html

    r120111 r201072  
    1515            labeledItem.focus();
    1616            var result = document.getElementById("result");
    17             result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
     17            if (accessibilityController.platformName == "atk")
     18                result.innerText = "\nThe accessibility title is \"" + accessibilityController.focusedElement.title + "\"";
     19            else
     20                result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
    1821        }
    1922    </script>
  • trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-labeledby.html

    r159482 r201072  
    2424   
    2525    if (window.accessibilityController) {
    26         var linkDescription = accessibilityController.accessibleElementById("link").description;
    27        
    28         shouldBe("linkDescription", "'AXDescription: Y Z'");
    29        
     26        if (accessibilityController.platformName == "atk") {
     27            var linkTitle = accessibilityController.accessibleElementById("link").title;
     28            shouldBe("linkTitle", "'AXTitle: Y Z'");
     29        } else {
     30            var linkDescription = accessibilityController.accessibleElementById("link").description;
     31            shouldBe("linkDescription", "'AXDescription: Y Z'");
     32        }
    3033        // Hide superfluous text.
    3134        document.getElementById("test").style.display = "none";
  • trunk/LayoutTests/accessibility/aria-labelledby-overrides-label.html

    r155274 r201072  
    2323          text = accessibilityController.focusedElement;
    2424
    25           debug("text.description is " + text.description);
     25          if (accessibilityController.platformName == "atk")
     26              debug("text.title is " + text.title);
     27          else
     28              debug("text.description is " + text.description);
    2629
    2730          // There should be no title UI element.
  • trunk/LayoutTests/accessibility/aria-labelledby-stay-within.html

    r120111 r201072  
    3333            labeledItem.focus();
    3434            var result = document.getElementById("result");
    35             if ( accessibilityController.focusedElement.description == "AXDescription: Reply Item Five" ) {
     35            var resultValue;
     36            if (accessibilityController.platformName == "atk")
     37                resultValue = accessibilityController.focusedElement.title;
     38            else
     39                resultValue = accessibilityController.focusedElement.description;
     40            if (resultValue.endsWith("Reply Item Five")) {
    3641               result.innerText = "Passed";
    3742            }
    3843            else {
    39                result.innerText = "Failed. Result ==" + accessibilityController.focusedElement.description + "==";
     44               result.innerText = "Failed. Result ==" + resultValue + "==";
    4045            }
    4146        }
  • trunk/LayoutTests/accessibility/aria-labelledby-with-descendants.html

    r174074 r201072  
    5050          for (var k = 1; k < 8; k++) {
    5151              var test = accessibilityController.accessibleElementById("test" + k);
    52               debug("test " + k + ": aria-labelledby description: " + test.description);
     52              if (accessibilityController.platformName == "atk")
     53                  debug("test " + k + ": aria-labelledby description: " + test.title);
     54              else
     55                  debug("test " + k + ": aria-labelledby description: " + test.description);
    5356              debug("test " + k + ": expected description: " + document.getElementById("test" + k).getAttribute("data-label") + "\n");
    5457          }
  • trunk/LayoutTests/accessibility/aria-namefrom-author.html

    r174074 r201072  
    6868
    6969    if (window.accessibilityController) {
    70         debug("Button description: " + accessibilityController.accessibleElementById("button").description);
     70        if (accessibilityController.platformName == "atk")
     71            debug("Button title: " + accessibilityController.accessibleElementById("button").title);
     72        else
     73            debug("Button description: " + accessibilityController.accessibleElementById("button").description);
    7174        document.getElementById("content").style.visibility = "hidden";
    7275    }
  • trunk/LayoutTests/accessibility/aria-option-role.html

    r155274 r201072  
    3030
    3131          debug("secondChild.role is " + secondChild.role);
    32           debug("secondChild.description is " + secondChild.description);
     32          if (accessibilityController.platformName == "atk")
     33              debug("secondChild.title is " + secondChild.title);
     34          else
     35              debug("secondChild.description is " + secondChild.description);
    3336
    3437          shouldBe("firstChild.childrenCount", "0");
  • trunk/LayoutTests/accessibility/canvas-description-and-role.html

    r155274 r201072  
    2222
    2323    var axCanvas1 = axContainer.childAtIndex(0);
    24     debug('Canvas 1 description: ' + axCanvas1.description);
     24    if (accessibilityController.platformName == "atk")
     25        debug('Canvas 1 title: ' + axCanvas1.title);
     26    else
     27        debug('Canvas 1 description: ' + axCanvas1.description);
    2528    debug('Canvas 1 role: ' + axCanvas1.role);
    2629
    2730    var axCanvas2 = axContainer.childAtIndex(1);
    28     debug('Canvas 2 description: ' + axCanvas2.description);
     31    if (accessibilityController.platformName == "atk")
     32        debug('Canvas 2 title: ' + axCanvas2.title);
     33    else
     34        debug('Canvas 2 description: ' + axCanvas2.description);
    2935    debug('Canvas 2 role: ' + axCanvas2.role);
    3036}
  • trunk/LayoutTests/accessibility/empty-image-with-title.html

    r155274 r201072  
    1818          var image1 = accessibilityController.accessibleElementById("image1");
    1919          debug("image1.role is " + image1.role);
    20           debug("image1.description is " + image1.description);
     20          if (accessibilityController.platformName == "atk")
     21              debug("image1.title is " + image1.title);
     22          else
     23              debug("image1.description is " + image1.description);
    2124    }
    2225
  • trunk/LayoutTests/accessibility/fieldset-element.html

    r157434 r201072  
    7979        fieldsetTestCount = document.getElementsByClassName("fieldsetTest").length;
    8080        for (var i = 0; i < fieldsetTestCount; ++i) {
    81             fieldsetDescription = accessibilityController.accessibleElementById("f" + i).description;
     81            if (accessibilityController.platformName == "atk")
     82                fieldsetDescription = accessibilityController.accessibleElementById("f" + i).title;
     83            else
     84                fieldsetDescription = accessibilityController.accessibleElementById("f" + i).description;
    8285            debug(fieldsetDescription);
    8386        }
  • trunk/LayoutTests/accessibility/focusable-div.html

    r162576 r201072  
    5151    shouldBe("document.activeElement == div3", "true");
    5252    window.axDiv3 = accessibilityController.focusedElement;
    53     shouldBe("lastChar(axDiv3.description)", "\"D\"");
     53    if (accessibilityController.platformName == "atk")
     54        shouldBe("lastChar(axDiv3.title)", "\"D\"");
     55    else
     56        shouldBe("lastChar(axDiv3.description)", "\"D\"");
    5457
    5558    var div4 = document.getElementById('div4');
  • trunk/LayoutTests/accessibility/gtk/no-notification-for-unrendered-iframe-children-expected.txt

    r187777 r201072  
    55
    66
    7 AXChildrenAdded on AXDescription: inner body
    8 AXChildrenAdded on AXDescription: inner body
     7AXChildrenAdded on AXTitle: inner body
     8AXChildrenAdded on AXTitle: inner body
    99PASS successfullyParsed is true
    1010
  • trunk/LayoutTests/accessibility/gtk/no-notification-for-unrendered-iframe-children.html

    r187804 r201072  
    2222        accessibilityController.addNotificationListener(function(element, notification) {
    2323            if (notification == "AXChildrenAdded" && element.role == "AXRole: AXGroup")
    24                 debug(notification + " on " + element.description);
     24                debug(notification + " on " + element.title);
    2525        });
    2626    }
  • trunk/LayoutTests/accessibility/gtk/title-and-alt-expected.txt

    r200942 r201072  
    11
    2 Functional label:
     2Functional label:   
    33This tests the exposure of alt and title information.
    44
     
    88PASS image.title is 'AXTitle: Image alt attr'
    99PASS image.description is 'AXDescription: Image title attr'
    10 PASS link.title is 'AXTitle: '
     10PASS link.title is 'AXTitle: Functional label'
    1111PASS link.description is 'AXDescription: Link title attr'
    12 PASS entry.title is 'AXTitle: '
    13 PASS entry.description is 'AXDescription: Entry title attr'
     12PASS entry.title is 'AXTitle: Entry title attr'
     13PASS entry.description is 'AXDescription: '
    1414PASS button.title is 'AXTitle: Submit'
    1515PASS button.description is 'AXDescription: Submit button title attr'
  • trunk/LayoutTests/accessibility/gtk/title-and-alt.html

    r200260 r201072  
    2424
    2525        var link = accessibilityController.accessibleElementById("link");
    26         shouldBe("link.title", "'AXTitle: Functional label.'");
     26        shouldBe("link.title", "'AXTitle: Functional label'");
    2727        shouldBe("link.description", "'AXDescription: Link title attr'");
    2828
    2929        var entry = accessibilityController.accessibleElementById("entry");
    30         shouldBe("entry.title", "'AXTitle: '");
    31         shouldBe("entry.description", "'AXDescription: Entry title attr'");
     30        shouldBe("entry.title", "'AXTitle: Entry title attr'");
     31        shouldBe("entry.description", "'AXDescription: '");
    3232
    3333        var button = accessibilityController.accessibleElementById("button");
  • trunk/LayoutTests/accessibility/help-text.html

    r167054 r201072  
    6666            if (!ax)
    6767                continue;
    68             var output = ax.helpText.replace("AXHelp: ", "");
     68            var output;
     69            if (accessibilityController.platformName == "atk")
     70                output = ax.description.replace("AXDescription: ", "");
     71            else
     72                output = ax.helpText.replace("AXHelp: ", "");
    6973            var result = document.getElementById("console");
    7074            if (expectation === output)
  • trunk/LayoutTests/accessibility/img-alt-tag-only-whitespace-expected.txt

    r158810 r201072  
    1 CONSOLE MESSAGE: line 26: Image description: AXDescription:    Image
     1CONSOLE MESSAGE: line 27: Image description: AXDescription:    Image
    22
    33
  • trunk/LayoutTests/accessibility/img-alt-tag-only-whitespace.html

    r155274 r201072  
    2424        var imagesGroup = accessibilityController.focusedElement;
    2525        shouldBe("imagesGroup.childrenCount", "1");
    26         console.log("Image description: " + imagesGroup.childAtIndex(0).description);
     26        if (accessibilityController.platformName != "atk")
     27            console.log("Image description: " + imagesGroup.childAtIndex(0).description);
     28        else
     29            console.log("Image title: " + imagesGroup.childAtIndex(0).title);
    2730    }
    2831
  • trunk/LayoutTests/accessibility/img-aria-button-alt-tag.html

    r155274 r201072  
    2222            var body = document.getElementById("body").focus();
    2323            var imgUIElement = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
    24             debug("imgUIElement.description is " + imgUIElement.description);
     24            if (accessibilityController.platformName == "atk")
     25                debug("imgUIElement.title is " + imgUIElement.title);
     26            else
     27                debug("imgUIElement.description is " + imgUIElement.description);
    2528        }
    2629    </script>
  • trunk/LayoutTests/accessibility/img-fallsback-to-title.html

    r155274 r201072  
    2929        // The title should NOT be in the help text.
    3030        var image1 = imagesGroup.childAtIndex(0).childAtIndex(0);
    31         debug("Image1 description: " + image1.description);
    32         debug("Image1 help: " + image1.helpText + "<br>");
     31        if (accessibilityController.platformName == "atk") {
     32            debug("Image1 title: " + image1.title);
     33            debug("Image1 description: " + image1.description + "<br>");
     34        } else {
     35            debug("Image1 description: " + image1.description);
     36            debug("Image1 help: " + image1.helpText + "<br>");
     37        }
    3338
    3439        // Second image should use the description from the alt tag instead of the title.
    3540        // The help text should reflect what's in the title.
    3641        var image2 = imagesGroup.childAtIndex(0).childAtIndex(1);
    37         debug("Image2 description: " + image2.description);
    38         debug("Image2 help: " + image2.helpText + "<br>");
     42        if (accessibilityController.platformName == "atk") {
     43            debug("Image2 title: " + image2.title);
     44            debug("Image2 description: " + image2.description + "<br>");
     45        } else {
     46            debug("Image2 description: " + image2.description);
     47            debug("Image2 help: " + image2.helpText + "<br>");
     48        }
    3949
    4050        // Now do the same checks for ARIA type images.
    4151        var image3 = imagesGroup.childAtIndex(1);
    42         debug("Image3 description: " + image3.description);
    43         debug("Image3 help: " + image3.helpText + "<br>");
     52        if (accessibilityController.platformName == "atk") {
     53            debug("Image3 title: " + image3.title);
     54            debug("Image3 description: " + image3.description + "<br>");
     55        } else {
     56            debug("Image3 description: " + image3.description);
     57            debug("Image3 help: " + image3.helpText + "<br>");
     58        }
    4459
    4560        // Now do the same checks for ARIA type images.
    4661        var image4 = imagesGroup.childAtIndex(2);
    47         debug("Image4 description: " + image4.description);
    48         debug("Image4 help: " + image4.helpText + "<br>");
     62        if (accessibilityController.platformName == "atk") {
     63            debug("Image4 title: " + image4.title);
     64            debug("Image4 description: " + image4.description + "<br>");
     65        } else {
     66            debug("Image4 description: " + image4.description);
     67            debug("Image4 help: " + image4.helpText + "<br>");
     68        }
    4969
    5070        // Verify that the first image (with an empty alt tag) is ignored
  • trunk/LayoutTests/accessibility/input-image-alt.html

    r155274 r201072  
    1818            var img = accessibilityController.focusedElement;
    1919
    20             debug("img.description is " + img.description);
     20            if (accessibilityController.platformName == "atk")
     21                debug("img.title is " + img.title);
     22            else
     23                debug("img.description is " + img.description);
    2124        }
    2225    </script>
  • trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html

    r160903 r201072  
    5555            window.accessibilityController.addNotificationListener(function (target, notification) {
    5656                // Ignore this notification if it's not on the iframe or not about the iframe being loaded.
    57                 if (target.description.indexOf("InnerFrame") == -1
     57
     58                var targetString;
     59                if (accessibilityController.platformName == "atk")
     60                    targetString = target.title;
     61                else
     62                    targetString = target.description;
     63
     64                if (targetString.indexOf("InnerFrame") == -1
    5865                    || (notification != "AXLoadComplete" && notification != "AXLayoutComplete"))
    5966                    return;
  • trunk/LayoutTests/accessibility/media-element.html

    r155274 r201072  
    1919            function dumpObject(axObject)
    2020            {
    21                 debug(indent(indentLevel) + "description: " + axObject.description);
     21            if (accessibilityController.platformName == "atk")
     22                debug(indent(indentLevel) + "title: " + axObject.title);
     23            else
     24                debug(indent(indentLevel) + "description: " + axObject.description);
    2225                debug(indent(indentLevel) + "role: " + axObject.role);
    2326                if (axObject.subrole && axObject.subrole != 'AXSubrole: ') debug(indent(indentLevel) + "subrole: " + axObject.subrole);
  • trunk/LayoutTests/accessibility/radio-button-title-label.html

    r178255 r201072  
    4040            var radio2 = accessibilityController.accessibleElementById("r2");
    4141            titleUIElement = radio2.titleUIElement();
    42             shouldBe("radio2.description", "'AXDescription: LABEL2a'");
    43             shouldBe("radio2.title", "'AXTitle: '");
     42            if (accessibilityController.platformName == "atk") {
     43                shouldBe("radio2.title", "'AXTitle: LABEL2a'");
     44                shouldBe("radio2.description", "'AXDescription: '");
     45            } else {
     46                shouldBe("radio2.description", "'AXDescription: LABEL2a'");
     47                shouldBe("radio2.title", "'AXTitle: '");
     48            }
    4449            shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
    4550
     
    4752            var radio3 = accessibilityController.accessibleElementById("r3");
    4853            titleUIElement = radio3.titleUIElement();
    49             shouldBe("radio3.description", "'AXDescription: radio3'");
    50             shouldBe("radio3.title", "'AXTitle: '");
     54            if (accessibilityController.platformName == "atk") {
     55                shouldBe("radio3.title", "'AXTitle: radio3'");
     56                shouldBe("radio2.description", "'AXDescription: '");
     57            } else {
     58                shouldBe("radio3.description", "'AXDescription: radio3'");
     59                shouldBe("radio3.title", "'AXTitle: '");
     60            }
    5161            shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
    5262
  • trunk/LayoutTests/accessibility/self-referencing-aria-labelledby.html

    r155601 r201072  
    4141        for (var i = 0; i < testCount; ++i) {
    4242            var test = accessibilityController.accessibleElementById("t" + i);
    43             shouldBe("test.description", "'AXDescription: X Y Z'");
     43            if (accessibilityController.platformName == "atk")
     44                shouldBe("test.title", "'AXTitle: X Y Z'");
     45            else
     46                shouldBe("test.description", "'AXDescription: X Y Z'");
    4447        }
    4548    }
  • trunk/LayoutTests/accessibility/svg-bounds.html

    r155274 r201072  
    3535}
    3636
     37function label(element) {
     38    return accessibilityController.platformName == "atk" ? element.title: element.description;
     39}
     40
    3741if (window.testRunner && window.accessibilityController) {
    3842    window.testRunner.dumpAsText();
     
    4751    var face = container.childAtIndex(0);
    4852    debug('Face role: ' + face.role);
    49     debug('Face label: ' + face.description);
     53    debug('Face label: ' + label(face));
    5054    debug('FaceX: ' + (pageX(face) - x));
    5155    debug('FaceY: ' + Math.abs(pageY(face) - y));
     
    5458    var eye = container.childAtIndex(1);
    5559    debug('Eye role: ' + eye.role);
    56     debug('Eye label: ' + eye.description);
     60    debug('Eye label: ' + label(eye));
    5761    debug('EyeX: ' + (pageX(eye) - x));
    5862    debug('EyeY: ' + Math.abs(pageY(eye) - y));
     
    6165    var nose = container.childAtIndex(3);
    6266    debug('Nose role: ' + nose.role);
    63     debug('Nose label: ' + nose.description);
     67    debug('Nose label: ' + label(nose));
    6468    debug('NoseX: ' + (pageX(nose) - x));
    6569    debug('NoseY: ' + Math.abs(pageY(nose) - y));
     
    6872    var mouth = container.childAtIndex(4);
    6973    debug('Mouth role: ' + mouth.role);
    70     debug('Mouth label: ' + mouth.description);
     74    debug('Mouth label: ' + label(mouth));
    7175    debug('MouthX: ' + (pageX(mouth) - x));
    7276    debug('MouthY: ' + Math.floor(Math.abs(pageY(mouth) - y)));
     
    7579    // Text varies by about 1 - 2 pixels depending on the platform,
    7680    // so just print the text coordinates divided by 10.
    77     var text = container.childAtIndex(5).childAtIndex(0);
     81    var text = container.childAtIndex(5);
     82    if (accessibilityController.platformName != "atk")
     83        text = text.childAtIndex(0);
    7884    debug('Text role: ' + text.role);
    7985    debug('TextX/10: ' + Math.floor((pageX(text) - x) / 10));
     
    8389    var image = container.childAtIndex(6);
    8490    debug('Image role: ' + image.role);
    85     debug('Image label: ' + image.description);
     91    debug('Image label: ' + label(image));
    8692    debug('ImageX: ' + (pageX(image) - x));
    8793    debug('ImageY: ' + Math.abs(pageY(image) - y));
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r200973 r201072  
    17411741webkit.org/b/42194 http/tests/security/drag-drop-same-unique-origin.html [ Failure ]
    17421742
    1743 webkit.org/b/106340 accessibility/img-fallsback-to-title.html [ Failure ]
    1744 
    17451743# svg/ failures
    17461744webkit.org/b/42457 svg/custom/embedded-svg-allowed-in-dashboard.xml [ Failure ]
     
    19601958Bug(GTK) sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.3/S15.9.3.1_A5_T6.html [ Failure ]
    19611959
    1962 webkit.org/b/157187 accessibility/gtk/title-and-alt.html [ Failure ]
    1963 
    19641960# Expose title direction in WebKit API
    19651961webkit.org/b/58845 fast/dom/title-directionality.html [ Failure ]
     
    22342230# Test globally skipped, passing on GTK port
    22352231webkit.org/b/124349 fast/hidpi/image-srcset-relative-svg-canvas.html [ Pass ]
    2236 
    2237 webkit.org/b/131496 accessibility/help-text.html [ Failure ]
    22382232
    22392233webkit.org/b/131498 fast/css/cascade/box-shadow-and-webkit-box-shadow-cascade-order.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/gtk/accessibility/aria-help-expected.txt

    r189467 r201072  
    55
    66
    7 FAIL button.helpText should be AXHelp: click here (of type string). Was null (of type object).
     7PASS button.description is 'AXDescription: click here'
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/platform/gtk/accessibility/aria-switch-text-expected.txt

    r189467 r201072  
    1313widget.description is AXDescription:
    1414widget.childrenCount is 0
    15 widget.title is AXTitle: Three
    16 widget.description is AXDescription: foo
     15widget.title is AXTitle: foo
     16widget.description is AXDescription:
    1717widget.childrenCount is 0
    1818PASS successfullyParsed is true
  • trunk/LayoutTests/platform/gtk/accessibility/image-link-expected.txt

    r197448 r201072  
    3131AXSize: { 280.000000, 210.000000 }
    3232AXTitle: Delicious cake
    33 AXDescription: Delicious cake
     33AXDescription:
    3434AXFocusable: 0
    3535AXFocused: 0
  • trunk/LayoutTests/platform/gtk/accessibility/image-map1-expected.txt

    r189467 r201072  
    77Link1 role: AXRole: AXLink
    88Link1 title: AXTitle: Link1
    9 Link1 description: AXDescription: Link1
     9Link1 description: AXDescription:
    1010
    1111Link2 role: AXRole: AXLink
    1212Link2 title: AXTitle: Link2
    13 Link2 description: AXDescription: Link2
     13Link2 description: AXDescription:
    1414
    1515Link3 role: AXRole: AXLink
    1616Link3 title: AXTitle: Link3
    17 Link3 description: AXDescription: Link3
     17Link3 description: AXDescription:
    1818
    1919PASS successfullyParsed is true
  • trunk/LayoutTests/platform/gtk/accessibility/image-map2-expected.txt

    r189467 r201072  
    2626AXSize: { 123.000000, 62.000000 }
    2727AXTitle: Link1
    28 AXDescription: Link1
     28AXDescription:
    2929AXValue:
    3030AXFocusable: 0
     
    4646AXSize: { 122.000000, 14.000000 }
    4747AXTitle: Link2
    48 AXDescription: Link2
     48AXDescription:
    4949AXValue:
    5050AXFocusable: 0
  • trunk/LayoutTests/platform/gtk/accessibility/image-with-alt-and-map-expected.txt

    r193841 r201072  
    88AXRole: AXWebArea AXTitle:  AXDescription:
    99  AXRole: AXSection AXTitle:  AXDescription:
    10     AXRole: AXImageMap AXTitle: foo bar baz AXDescription: foo bar baz
    11       AXRole: AXLink AXTitle: foo AXDescription: foo
    12       AXRole: AXLink AXTitle: bar AXDescription: bar
    13       AXRole: AXLink AXTitle: baz AXDescription: baz
     10    AXRole: AXImageMap AXTitle: foo bar baz AXDescription:
     11      AXRole: AXLink AXTitle: foo AXDescription:
     12      AXRole: AXLink AXTitle: bar AXDescription:
     13      AXRole: AXLink AXTitle: baz AXDescription:
    1414PASS successfullyParsed is true
    1515
  • trunk/LayoutTests/platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt

    r201071 r201072  
    1 CONSOLE MESSAGE: line 26: Image description: AXDescription:    Image
     1CONSOLE MESSAGE: line 29: Image title: AXTitle:    Image
    22
    33
  • trunk/LayoutTests/platform/gtk/accessibility/img-fallsback-to-title-expected.txt

    r189467 r201072  
    1    
    2 test
     1     test
    32test
    43This tests that images will fallback to using the title attribute if no other descriptive text is present.
     
    76
    87
    9 Image1 description: AXDescription: test1
    10 Image1 help: AXHelp:
     8Image1 title: AXTitle: test1
     9Image1 description: AXDescription:
    1110
     11Image2 title: AXTitle: alt
    1212Image2 description: AXDescription: test2
    13 Image2 help: AXHelp: test2
    1413
    15 Image3 description: AXDescription: test3
    16 Image3 help: AXHelp:
     14Image3 title: AXTitle: test3
     15Image3 description: AXDescription:
    1716
    18 Image4 description: AXDescription: alt
    19 Image4 help: AXHelp: test4
     17Image4 title: AXTitle: alt
     18Image4 description: AXDescription: test4
    2019
    2120PASS imagesGroup.childAtIndex(0).childrenCount is 2
  • trunk/LayoutTests/platform/gtk/accessibility/media-element-expected.txt

    r189467 r201072  
    66State at 'canplaythrough' event:
    77
    8     description: AXDescription:
     8    title: AXTitle:
    99    role: AXRole: AXVideo
    1010
    1111
    12         description: AXDescription: Video Playback
     12        title: AXTitle: Video Playback
    1313        role: AXRole: AXToolbar
    1414
    1515
    16             description: AXDescription: Play
     16            title: AXTitle: Play
    1717            role: AXRole: AXButton
    1818
    1919
    20             description: AXDescription: Duration
     20            title: AXTitle: Duration
    2121            role: AXRole: AXSlider
    2222
    2323
    24             description: AXDescription: Remaining
     24            title: AXTitle: Remaining
    2525            role: AXRole: AXTimer
    2626
    2727
    28             description: AXDescription: Display Full Screen
     28            title: AXTitle: Display Full Screen
    2929            role: AXRole: AXButton
    3030
    3131
    32             description: AXDescription: Mute
     32            title: AXTitle: Mute
    3333            role: AXRole: AXButton
    3434
    3535
    36             description: AXDescription: Volume
     36            title: AXTitle: Volume
    3737            role: AXRole: AXSlider
    3838
  • trunk/LayoutTests/platform/gtk/accessibility/radio-button-title-label-expected.txt

    r189467 r201072  
    66PASS radio1.title is 'AXTitle: LABEL'
    77PASS titleUIElement.isEqual(accessibilityController.accessibleElementById('label1')) is true
    8 PASS radio2.description is 'AXDescription: LABEL2a'
    9 PASS radio2.title is 'AXTitle: '
     8PASS radio2.title is 'AXTitle: LABEL2a'
     9PASS radio2.description is 'AXDescription: '
    1010PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
    11 PASS radio3.description is 'AXDescription: radio3'
    12 PASS radio3.title is 'AXTitle: '
     11PASS radio3.title is 'AXTitle: radio3'
     12PASS radio2.description is 'AXDescription: '
    1313PASS !titleUIElement || titleUIElement.title == 'AXTitle: ' is true
    1414PASS successfullyParsed is true
  • trunk/Source/WebCore/ChangeLog

    r201071 r201072  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description
     4        https://bugs.webkit.org/show_bug.cgi?id=157822
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Remove the old code which was overriding WebCore Accessibility and always use
     9        AccessibilityText.
     10
     11        If the AccessibilityText's textSource is HelpText or SummaryText, it should be exposed
     12        as the AtkObject description. If the textSource is TitleTagText and there is no other
     13        text alternative, the value should also be exposed in this fashion. Note that AtkObject's
     14        description property is equivalent to AXAPI's AXHelp property.
     15
     16        If the AccessibilityText's textSource is anything other than the above, the first
     17        non-empty value should be exposed as the AtkObject name. Depending on the source of
     18        the name content, AtkObject's name property can be the equivalent of AXAPI's AXTitle.
     19        However, most of the time, AtkObject's name property is equivalent to AXAPI's
     20        AXDescription property.
     21
     22        By making these changes, what WebKit exposes for ATK is now extremely similar to what
     23        WebKit exposes on the Mac (modulo the property names) and also with what is defined in
     24        the HTML Accessibility and Accessible Name and Description Computation API mappings specs.
     25
     26        Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because
     27        asking for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject
     28        description in GNU/Linux. But as indicated above, what ATK calls a "description" is what
     29        the Mac calls "help."
     30
     31        Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal
     32        with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187
     33        has been opened for that task.) In the meantime, the existing tests have been given platform
     34        checks to ask for the right property on each platform. This was done in such a way as to not
     35        require other (non-ATK) platforms change their current expectations files.
     36
     37        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     38        (webkitAccessibleGetName):
     39        (webkitAccessibleGetDescription):
     40
    1412016-05-17  Zalan Bujtas  <zalan@apple.com>
    242
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r200677 r201072  
    112112    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
    113113
    114     AccessibilityObject* coreObject = core(object);
    115     if (coreObject->isFieldset()) {
    116         AccessibilityObject* label = coreObject->titleUIElement();
    117         if (label) {
    118             AtkObject* atkObject = label->wrapper();
    119             if (ATK_IS_TEXT(atkObject))
    120                 return atk_text_get_text(ATK_TEXT(atkObject), 0, -1);
    121         }
    122     }
    123 
    124     if (coreObject->isControl()) {
    125         AccessibilityObject* label = coreObject->correspondingLabelForControlElement();
    126         if (label) {
    127             AtkObject* atkObject = label->wrapper();
    128             if (ATK_IS_TEXT(atkObject))
    129                 return atk_text_get_text(ATK_TEXT(atkObject), 0, -1);
    130         }
    131 
    132         // Try text under the node.
    133         String textUnder = coreObject->textUnderElement();
    134         if (textUnder.length())
    135             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, textUnder);
    136     }
    137 
    138     if (is<SVGElement>(coreObject->element())) {
    139         Vector<AccessibilityText> textOrder;
    140         coreObject->accessibilityText(textOrder);
    141 
    142         for (const auto& text : textOrder) {
    143             if (text.textSource != HelpText && text.textSource != SummaryText)
    144                 return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, text.text);
    145         }
    146         // FIXME: This is to keep the next blocks from returning duplicate text.
    147         // This behavior should be extended to all elements; not just SVG.
    148         return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, "");
    149     }
    150 
    151     if (coreObject->isImage() || coreObject->isInputImage() || coreObject->isImageMap() || coreObject->isImageMapLink()) {
    152         Node* node = coreObject->node();
    153         if (is<HTMLElement>(node)) {
    154             // Get the attribute rather than altText String so as not to fall back on title.
    155             const AtomicString& alt = downcast<HTMLElement>(*node).getAttribute(HTMLNames::altAttr);
    156             if (!alt.isEmpty())
    157                 return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, alt);
    158         }
    159     }
    160 
    161     // Fallback for the webArea object: just return the document's title.
    162     if (coreObject->isWebArea()) {
    163         Document* document = coreObject->document();
    164         if (document)
    165             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, document->title());
    166     }
    167 
    168     // Nothing worked so far, try with the AccessibilityObject's
    169     // title() before going ahead with stringValue().
    170     String axTitle = accessibilityTitle(coreObject);
    171     if (!axTitle.isEmpty())
    172         return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, axTitle);
    173 
    174     return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, coreObject->stringValue());
     114    Vector<AccessibilityText> textOrder;
     115    core(object)->accessibilityText(textOrder);
     116
     117    for (const auto& text : textOrder) {
     118        // FIXME: This check is here because AccessibilityNodeObject::titleElementText()
     119        // appends an empty String for the LabelByElementText source when there is a
     120        // titleUIElement(). Removing this check makes some fieldsets lose their name.
     121        if (text.text.isEmpty())
     122            continue;
     123
     124        // WebCore Accessibility should provide us with the text alternative computation
     125        // in the order defined by that spec. So take the first thing that our platform
     126        // does not expose via the AtkObject description.
     127        if (text.textSource != HelpText && text.textSource != SummaryText)
     128            return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, text.text);
     129    }
     130
     131    return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, "");
    175132}
    176133
     
    180137    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
    181138
    182     AccessibilityObject* coreObject = core(object);
    183     Node* node = nullptr;
    184     if (coreObject->isAccessibilityRenderObject())
    185         node = coreObject->node();
    186 
    187     if (is<SVGElement>(node)) {
    188         Vector<AccessibilityText> textOrder;
    189         coreObject->accessibilityText(textOrder);
    190 
    191         for (const auto& text : textOrder) {
    192             if (text.textSource == HelpText || text.textSource == SummaryText || text.textSource == TitleTagText)
    193                 return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
    194         }
    195         // FIXME: This is to keep the next blocks from returning duplicate text.
    196         // This behavior should be extended to all elements; not just SVG.
    197         return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, "");
    198     }
    199 
    200     if (!is<HTMLElement>(node) || coreObject->ariaRoleAttribute() != UnknownRole || coreObject->isImage())
    201         return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, accessibilityDescription(coreObject));
    202 
    203     // atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here.
    204     if (coreObject->roleValue() == TableRole) {
    205         const AtomicString& summary = downcast<HTMLTableElement>(*node).summary();
    206         if (!summary.isEmpty())
    207             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, summary);
    208     }
    209 
    210     // The title attribute should be reliably available as the object's descripton.
    211     // We do not want to fall back on other attributes in its absence. See bug 25524.
    212     String title = downcast<HTMLElement>(*node).title();
    213     if (!title.isEmpty())
    214         return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, title);
    215 
    216     return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, accessibilityDescription(coreObject));
     139    Vector<AccessibilityText> textOrder;
     140    core(object)->accessibilityText(textOrder);
     141
     142    bool nameTextAvailable = false;
     143    for (const auto& text : textOrder) {
     144        // WebCore Accessibility should provide us with the text alternative computation
     145        // in the order defined by that spec. So take the first thing that our platform
     146        // does not expose via the AtkObject name.
     147        if (text.textSource == HelpText || text.textSource == SummaryText)
     148            return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
     149
     150        // If there is no other text alternative, the title tag contents will have been
     151        // used for the AtkObject name. We don't want to duplicate it here.
     152        if (text.textSource == TitleTagText && nameTextAvailable)
     153            return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
     154
     155        nameTextAvailable = true;
     156    }
     157
     158    return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, "");
    217159}
    218160
  • trunk/Tools/ChangeLog

    r201056 r201072  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description
     4        https://bugs.webkit.org/show_bug.cgi?id=157822
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Fix AccessibilityUIElement::helpText() so that it returns an empty string rather than
     9        nullptr upon failure.
     10
     11        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
     12        (WTR::AccessibilityUIElement::helpText):
     13
    1142016-05-17  Beth Dakin  <bdakin@apple.com>
    215
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r200677 r201072  
    12231223    AtkRelationSet* relationSet = atk_object_ref_relation_set(ATK_OBJECT(m_element.get()));
    12241224    if (!relationSet)
    1225         return nullptr;
     1225        return JSStringCreateWithCharacters(0, 0);
    12261226
    12271227    AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY);
    12281228    if (!relation)
    1229         return nullptr;
     1229        return JSStringCreateWithCharacters(0, 0);
    12301230
    12311231    GPtrArray* targetList = atk_relation_get_target(relation);
    12321232    if (!targetList || !targetList->len)
    1233         return nullptr;
     1233        return JSStringCreateWithCharacters(0, 0);
    12341234
    12351235    StringBuilder builder;
Note: See TracChangeset for help on using the changeset viewer.