Changeset 201087 in webkit


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

[GTK] accessibility/meter-element.html is failing
https://bugs.webkit.org/show_bug.cgi?id=115633

Reviewed by Chris Fleizach.

Source/WebCore:

The meter's value description should be exposed in the same fashion
as (we should have been exposing) aria-valuetext, namely through the
"valuetext" AtkObject attribute. This exposure is now in place. Also
implement AccessibilityProgressIndicator::valueDescription() so that
the ports do not have to special-case meter in the platform wrappers.
Map the meter element to the correct role (ATK_ROLE_LEVEL_BAR), and
ignore a previously-included accessible object resulting from the
use of the title attribute on a meter. Finally, do not expose the
meter's title as the accessible name because the HTML spec suggests
authors can supply the numeric unit as the value of title.

No new test file as the failure was identified by meter-element.html.
Seven new test cases were added for additional coverage. Also updated
the ATK expectations for spinbutton-value.html to reflect that we are now
exposing the value of aria-valuetext.

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::helpText):
(WebCore::AccessibilityNodeObject::accessibilityDescriptionForChildren):
(WebCore::AccessibilityNodeObject::visibleText):

  • accessibility/AccessibilityNodeObject.h:
  • accessibility/AccessibilityProgressIndicator.cpp:

(WebCore::AccessibilityProgressIndicator::valueDescription):

  • accessibility/AccessibilityProgressIndicator.h:
  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(webkitAccessibleGetAttributes):
(atkRole):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

Implement AccessibilityUIElement::valueDescription() and add mapping
from ATK_ROLE_LEVEL_BAR to AXProgressIndicator.

  • WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

(WTR::AccessibilityUIElement::valueDescription):

LayoutTests:

Seven new test cases were added to meter-element.html for additional
coverage. Also updated the ATK expectations for spinbutton-value.html
to reflect that we are now exposing the value of aria-valuetext.

  • accessibility/meter-element.html: New test cases added.
  • platform/gtk/TestExpectations: Unskip the previously-failing test.
  • platform/gtk/accessibility/meter-element-expected.txt: Updated.
  • platform/gtk/accessibility/spinbutton-value-expected.txt: Updated.
  • platform/mac/accessibility/meter-element-expected.txt: Updated.
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201083 r201087  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        [GTK] accessibility/meter-element.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=115633
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Seven new test cases were added to meter-element.html for additional
     9        coverage. Also updated the ATK expectations for spinbutton-value.html
     10        to reflect that we are now exposing the value of aria-valuetext.
     11
     12        * accessibility/meter-element.html: New test cases added.
     13        * platform/gtk/TestExpectations: Unskip the previously-failing test.
     14        * platform/gtk/accessibility/meter-element-expected.txt: Updated.
     15        * platform/gtk/accessibility/spinbutton-value-expected.txt: Updated.
     16        * platform/mac/accessibility/meter-element-expected.txt: Updated.
     17
    1182016-05-18  Ryan Haddad  <ryanhaddad@apple.com>
    219
  • trunk/LayoutTests/accessibility/meter-element.html

    r155653 r201087  
    1212<meter id="meter6" min=0 max=20 value=12 title="centimeters">12cm</meter>
    1313<meter id="meter7" min=0 max=10 value=2 title="centimeters">2cm</meter>
     14<meter id="meter8" value=0.75><img aria-label="75 out of 100" src="graph75.png"></meter>
     15<meter id="meter9" value=0.75><img aria-label="75 out of 100" aria-labelledby="label" src="graph75.png"></meter>
     16<meter id="meter10" value=0.75><img aria-labelledby="label" src="graph75.png"></meter>
     17<span id="label" style="color:green;">75 percent</span>
     18<meter id="meter11" value=0.75><img aria-labelledby="label1 label2" src="graph75.png"></meter>
     19<span id="label1" style="color:green;">75</span>
     20<span id="label2" style="color:green;">(100 total)</span>
     21<meter id="meter12" value=0.75><span style="color:green;">75 (out of 100 total)</span></meter>
     22<meter id="meter13" value=0.75><div><p><span style="color:green;">75 (out of 100 total)</span></p></div></meter>
     23<meter id="meter14" value=0.60><div aria-label="7 of 10"><span style="color:green;">&#9632;&#9632;&#9632;&#9632;&#9632;&#9632;</span><span>&#9633;&#9633;&#9633;&#9633;</span></div></meter>
    1424</div>
    1525
     
    2030
    2131if (window.testRunner && window.accessibilityController) {
    22     for (var k = 1; k < 8; k++) {
     32    for (var k = 1; k < 15; k++) {
    2333        var meter = accessibilityController.accessibleElementById("meter" + k);
    2434        debug("Meter" + k);
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r201072 r201087  
    21002100webkit.org/b/115437 fast/text/complex-initial-advance.html [ ImageOnlyFailure ]
    21012101
    2102 webkit.org/b/115633 accessibility/meter-element.html [ Failure ]
    2103 
    21042102webkit.org/b/116153 fast/css/text-overflow-ellipsis-full-truncate-rtl.html [ ImageOnlyFailure ]
    21052103
  • trunk/LayoutTests/platform/gtk/accessibility/meter-element-expected.txt

    r189467 r201087  
    1 CONSOLE MESSAGE: line 25: TypeError: undefined is not an object (evaluating 'meter.role')
    2      
    31This tests that the meter element is accessible.
    42
     
    75
    86Meter1
    9 FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
     7AXRole: AXProgressIndicator
     8AXTitle:
     9AXDescription:
     10AXValueDescription: 6 blocks used (out of 8 total)
     11AXValueSettable: false
     12
     13
     14Meter2
     15AXRole: AXProgressIndicator
     16AXTitle:
     17AXDescription:
     18AXValueDescription: 75%
     19AXValueSettable: false
     20
     21
     22Meter3
     23AXRole: AXProgressIndicator
     24AXTitle:
     25AXDescription:
     26AXValueDescription:
     27AXValueSettable: false
     28
     29
     30Meter4
     31AXRole: AXProgressIndicator
     32AXTitle:
     33AXDescription:
     34AXValueDescription: 12cm
     35AXValueSettable: false
     36
     37
     38Meter5
     39AXRole: AXProgressIndicator
     40AXTitle:
     41AXDescription:
     42AXValueDescription: 2cm
     43AXValueSettable: false
     44
     45
     46Meter6
     47AXRole: AXProgressIndicator
     48AXTitle:
     49AXDescription: centimeters
     50AXValueDescription: 12cm
     51AXValueSettable: false
     52
     53
     54Meter7
     55AXRole: AXProgressIndicator
     56AXTitle:
     57AXDescription: centimeters
     58AXValueDescription: 2cm
     59AXValueSettable: false
     60
     61
     62Meter8
     63AXRole: AXProgressIndicator
     64AXTitle:
     65AXDescription:
     66AXValueDescription: 75 out of 100
     67AXValueSettable: false
     68
     69
     70Meter9
     71AXRole: AXProgressIndicator
     72AXTitle:
     73AXDescription:
     74AXValueDescription: 75 percent
     75AXValueSettable: false
     76
     77
     78Meter10
     79AXRole: AXProgressIndicator
     80AXTitle:
     81AXDescription:
     82AXValueDescription: 75 percent
     83AXValueSettable: false
     84
     85
     86Meter11
     87AXRole: AXProgressIndicator
     88AXTitle:
     89AXDescription:
     90AXValueDescription: 75 (100 total)
     91AXValueSettable: false
     92
     93
     94Meter12
     95AXRole: AXProgressIndicator
     96AXTitle:
     97AXDescription:
     98AXValueDescription: 75 (out of 100 total)
     99AXValueSettable: false
     100
     101
     102Meter13
     103AXRole: AXProgressIndicator
     104AXTitle:
     105AXDescription:
     106AXValueDescription: 75 (out of 100 total)
     107AXValueSettable: false
     108
     109
     110Meter14
     111AXRole: AXProgressIndicator
     112AXTitle:
     113AXDescription:
     114AXValueDescription: 7 of 10
     115AXValueSettable: false
     116
     117
     118PASS successfullyParsed is true
    10119
    11120TEST COMPLETE
  • trunk/LayoutTests/platform/gtk/accessibility/spinbutton-value-expected.txt

    r189467 r201087  
    99PASS endsWith(axSpin.minValue, '1') is true
    1010PASS endsWith(axSpin.maxValue, '9') is true
    11 FAIL endsWith(axSpin.valueDescription, '5 of 9') should be true. Was false.
     11PASS endsWith(axSpin.valueDescription, '5 of 9') is true
    1212PASS axSpin.title is axUntitled.title
    1313PASS successfullyParsed is true
  • trunk/LayoutTests/platform/mac/accessibility/meter-element-expected.txt

    r155653 r201087  
    6060
    6161
     62Meter8
     63AXRole: AXProgressIndicator
     64AXTitle:
     65AXDescription:
     66AXValueDescription: 75 out of 100
     67AXValueSettable: false
     68
     69
     70Meter9
     71AXRole: AXProgressIndicator
     72AXTitle:
     73AXDescription:
     74AXValueDescription: 75 percent
     75AXValueSettable: false
     76
     77
     78Meter10
     79AXRole: AXProgressIndicator
     80AXTitle:
     81AXDescription:
     82AXValueDescription: 75 percent
     83AXValueSettable: false
     84
     85
     86Meter11
     87AXRole: AXProgressIndicator
     88AXTitle:
     89AXDescription:
     90AXValueDescription: 75 (100 total)
     91AXValueSettable: false
     92
     93
     94Meter12
     95AXRole: AXProgressIndicator
     96AXTitle:
     97AXDescription:
     98AXValueDescription: 75 (out of 100 total)
     99AXValueSettable: false
     100
     101
     102Meter13
     103AXRole: AXProgressIndicator
     104AXTitle:
     105AXDescription:
     106AXValueDescription: 75 (out of 100 total)
     107AXValueSettable: false
     108
     109
     110Meter14
     111AXRole: AXProgressIndicator
     112AXTitle:
     113AXDescription:
     114AXValueDescription: 7 of 10
     115AXValueSettable: false
     116
     117
    62118PASS successfullyParsed is true
    63119
  • trunk/Source/WebCore/ChangeLog

    r201086 r201087  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        [GTK] accessibility/meter-element.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=115633
     5
     6        Reviewed by Chris Fleizach.
     7
     8        The meter's value description should be exposed in the same fashion
     9        as (we should have been exposing) aria-valuetext, namely through the
     10        "valuetext" AtkObject attribute. This exposure is now in place. Also
     11        implement AccessibilityProgressIndicator::valueDescription() so that
     12        the ports do not have to special-case meter in the platform wrappers.
     13        Map the meter element to the correct role (ATK_ROLE_LEVEL_BAR), and
     14        ignore a previously-included accessible object resulting from the
     15        use of the title attribute on a meter. Finally, do not expose the
     16        meter's title as the accessible name because the HTML spec suggests
     17        authors can supply the numeric unit as the value of title.
     18
     19        No new test file as the failure was identified by meter-element.html.
     20        Seven new test cases were added for additional coverage. Also updated
     21        the ATK expectations for spinbutton-value.html to reflect that we are now
     22        exposing the value of aria-valuetext.
     23
     24        * accessibility/AccessibilityNodeObject.cpp:
     25        (WebCore::AccessibilityNodeObject::helpText):
     26        (WebCore::AccessibilityNodeObject::accessibilityDescriptionForChildren):
     27        (WebCore::AccessibilityNodeObject::visibleText):
     28        * accessibility/AccessibilityNodeObject.h:
     29        * accessibility/AccessibilityProgressIndicator.cpp:
     30        (WebCore::AccessibilityProgressIndicator::valueDescription):
     31        * accessibility/AccessibilityProgressIndicator.h:
     32        * accessibility/AccessibilityRenderObject.cpp:
     33        (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
     34        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     35        (webkitAccessibleGetAttributes):
     36        (atkRole):
     37        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     38        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     39
    1402016-05-18  Antti Koivisto  <antti@apple.com>
    241
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r200677 r201087  
    13561356    case SwitchRole:
    13571357    case TabRole:
    1358     case ProgressIndicatorRole:
    13591358        useTextUnderElement = true;
    13601359        break;
     
    13971396
    13981397    // The title attribute should be used as help text unless it is already being used as descriptive text.
     1398    // However, when the title attribute is the only text alternative provided, it may be exposed as the
     1399    // descriptive text. This is problematic in the case of meters because the HTML spec suggests authors
     1400    // can expose units through this attribute. Therefore, if the element is a meter, change its source
     1401    // type to HelpText.
    13991402    const AtomicString& title = getAttribute(titleAttr);
    1400     if (!title.isEmpty())
    1401         textOrder.append(AccessibilityText(title, TitleTagText));
     1403    if (!title.isEmpty()) {
     1404        if (!isMeter())
     1405            textOrder.append(AccessibilityText(title, TitleTagText));
     1406        else
     1407            textOrder.append(AccessibilityText(title, HelpText));
     1408    }
    14021409}
    14031410
     
    18911898}
    18921899
     1900String AccessibilityNodeObject::accessibilityDescriptionForChildren() const
     1901{
     1902    Node* node = this->node();
     1903    if (!node)
     1904        return String();
     1905
     1906    AXObjectCache* cache = axObjectCache();
     1907    if (!cache)
     1908        return String();
     1909
     1910    StringBuilder builder;
     1911    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
     1912        if (!is<Element>(child))
     1913            continue;
     1914
     1915        if (AccessibilityObject* axObject = cache->getOrCreate(child)) {
     1916            String description = axObject->ariaLabeledByAttribute();
     1917            if (description.isEmpty())
     1918                description = accessibleNameForNode(child);
     1919            appendNameToStringBuilder(builder, description);
     1920        }
     1921    }
     1922
     1923    return builder.toString();
     1924}
     1925
    18931926String AccessibilityNodeObject::accessibilityDescriptionForElements(Vector<Element*> &elements) const
    18941927{
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h

    r200677 r201087  
    124124    unsigned hierarchicalLevel() const override;
    125125    String textUnderElement(AccessibilityTextUnderElementMode = AccessibilityTextUnderElementMode()) const override;
     126    String accessibilityDescriptionForChildren() const;
    126127    String accessibilityDescription() const override;
    127128    String helpText() const override;
  • trunk/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp

    r177733 r201087  
    2222#include "AccessibilityProgressIndicator.h"
    2323
     24#include "AXObjectCache.h"
    2425#include "FloatConversion.h"
    2526#include "HTMLMeterElement.h"
     
    6162}
    6263   
     64String AccessibilityProgressIndicator::valueDescription() const
     65{
     66    // If the author has explicitly provided a value through aria-valuetext, use it.
     67    String description = AccessibilityRenderObject::valueDescription();
     68    if (!description.isEmpty())
     69        return description;
     70
     71#if ENABLE(METER_ELEMENT)
     72    if (!m_renderer->isMeter())
     73        return String();
     74
     75    HTMLMeterElement* meter = meterElement();
     76    if (!meter)
     77        return String();
     78
     79    // The HTML spec encourages authors to include a textual representation of the meter's state in
     80    // the element's contents. We'll fall back on that if there is not a more accessible alternative.
     81    AccessibilityObject* axMeter = axObjectCache()->getOrCreate(meter);
     82    if (is<AccessibilityNodeObject>(axMeter)) {
     83        description = downcast<AccessibilityNodeObject>(axMeter)->accessibilityDescriptionForChildren();
     84        if (!description.isEmpty())
     85            return description;
     86    }
     87
     88    return meter->textContent();
     89#endif
     90
     91    return String();
     92}
     93
    6394float AccessibilityProgressIndicator::valueForRange() const
    6495{
  • trunk/Source/WebCore/accessibility/AccessibilityProgressIndicator.h

    r197563 r201087  
    4747    bool isProgressIndicator() const override { return true; }
    4848
     49    String valueDescription() const override;
    4950    float valueForRange() const override;
    5051    float maxValueForRange() const override;
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r201067 r201087  
    13481348        return false;
    13491349   
     1350#if ENABLE(METER_ELEMENT)
     1351    // The render tree of meter includes a RenderBlock (meter) and a RenderMeter (div).
     1352    // We expose the latter and thus should ignore the former. However, if the author
     1353    // includes a title attribute on the element, hasAttributesRequiredForInclusion()
     1354    // will return true, potentially resulting in a redundant accessible object.
     1355    if (is<HTMLMeterElement>(node))
     1356        return true;
     1357#endif
     1358
    13501359    // Using the presence of an accessible name to decide an element's visibility is not
    13511360    // as definitive as previous checks, so this should remain as one of the last.
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r201072 r201087  
    421421        attributeSet = addToAtkAttributeSet(attributeSet, "readonly", isReadOnly.utf8().data());
    422422
     423    String valueDescription = coreObject->valueDescription();
     424    if (!valueDescription.isEmpty())
     425        attributeSet = addToAtkAttributeSet(attributeSet, "valuetext", valueDescription.utf8().data());
     426
    423427    // According to the W3C Core Accessibility API Mappings 1.1, section 5.4.1 General Rules:
    424428    // "User agents must expose the WAI-ARIA role string if the API supports a mechanism to do so."
     
    515519        return ATK_ROLE_PROGRESS_BAR; // Is this right?
    516520    case ProgressIndicatorRole:
    517         // return ATK_ROLE_SPIN_BUTTON; // Some confusion about this role in AccessibilityRenderObject.cpp
    518         return ATK_ROLE_PROGRESS_BAR;
     521        return coreObject->isMeter() ? ATK_ROLE_LEVEL_BAR : ATK_ROLE_PROGRESS_BAR;
    519522    case WindowRole:
    520523        return ATK_ROLE_WINDOW;
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r200563 r201087  
    31513151    }
    31523152   
    3153     if ([attributeName isEqualToString:NSAccessibilityValueDescriptionAttribute]) {
    3154         if (m_object->isMeter())
    3155             return [self baseAccessibilityTitle];
    3156        
     3153    if ([attributeName isEqualToString:NSAccessibilityValueDescriptionAttribute])
    31573154        return m_object->valueDescription();
    3158     }
    31593155   
    31603156    if ([attributeName isEqualToString:NSAccessibilityOrientationAttribute]) {
  • trunk/Tools/ChangeLog

    r201081 r201087  
     12016-05-18  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        [GTK] accessibility/meter-element.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=115633
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Implement AccessibilityUIElement::valueDescription() and add mapping
     9        from ATK_ROLE_LEVEL_BAR to AXProgressIndicator.
     10
     11        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
     12        (WTR::AccessibilityUIElement::valueDescription):
     13
    1142016-05-18  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r201072 r201087  
    383383    case ATK_ROLE_LABEL:
    384384        return "AXLabel";
     385    case ATK_ROLE_LEVEL_BAR:
     386        return "AXProgressIndicator";
    385387    case ATK_ROLE_LINK:
    386388        return "AXLink";
     
    14061408JSRetainPtr<JSStringRef> AccessibilityUIElement::valueDescription()
    14071409{
    1408     // FIXME: implement
    1409     return JSStringCreateWithCharacters(0, 0);
     1410    String valueText = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "valuetext");
     1411    GUniquePtr<gchar> valueDescription(g_strdup_printf("AXValueDescription: %s", valueText.utf8().data()));
     1412    return JSStringCreateWithUTF8CString(valueDescription.get());
    14101413}
    14111414
Note: See TracChangeset for help on using the changeset viewer.