Changeset 204708 in webkit


Ignore:
Timestamp:
Aug 22, 2016 6:33:00 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

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

Patch by Joanmarie Diggs <jdiggs@igalia.com> on 2016-05-25

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:
releases/WebKitGTK/webkit-2.12
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog

    r204707 r204708  
     12016-05-25  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        Unreviewed.
     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-25  Joanmarie Diggs  <jdiggs@igalia.com>
    219
  • releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/meter-element.html

    r155653 r204708  
    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);
  • releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/TestExpectations

    r204707 r204708  
    20362036
    20372037webkit.org/b/115437 fast/text/complex-initial-advance.html [ ImageOnlyFailure ]
    2038 
    2039 webkit.org/b/115633 accessibility/meter-element.html [ Failure ]
    20402038
    20412039webkit.org/b/116153 fast/css/text-overflow-ellipsis-full-truncate-rtl.html [ ImageOnlyFailure ]
  • releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/meter-element-expected.txt

    r189467 r204708  
    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
  • releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/spinbutton-value-expected.txt

    r189467 r204708  
    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
  • releases/WebKitGTK/webkit-2.12/LayoutTests/platform/mac/accessibility/meter-element-expected.txt

    r155653 r204708  
    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
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog

    r204707 r204708  
     12016-05-25  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        Unreviewed.
     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-25  Joanmarie Diggs  <jdiggs@igalia.com>
    241
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r201270 r204708  
    13551355    case SwitchRole:
    13561356    case TabRole:
    1357     case ProgressIndicatorRole:
    13581357        useTextUnderElement = true;
    13591358        break;
     
    13961395
    13971396    // The title attribute should be used as help text unless it is already being used as descriptive text.
     1397    // However, when the title attribute is the only text alternative provided, it may be exposed as the
     1398    // descriptive text. This is problematic in the case of meters because the HTML spec suggests authors
     1399    // can expose units through this attribute. Therefore, if the element is a meter, change its source
     1400    // type to HelpText.
    13981401    const AtomicString& title = getAttribute(titleAttr);
    1399     if (!title.isEmpty())
    1400         textOrder.append(AccessibilityText(title, TitleTagText));
     1402    if (!title.isEmpty()) {
     1403        if (!isMeter())
     1404            textOrder.append(AccessibilityText(title, TitleTagText));
     1405        else
     1406            textOrder.append(AccessibilityText(title, HelpText));
     1407    }
    14011408}
    14021409
     
    18941901}
    18951902
     1903String AccessibilityNodeObject::accessibilityDescriptionForChildren() const
     1904{
     1905    Node* node = this->node();
     1906    if (!node)
     1907        return String();
     1908
     1909    AXObjectCache* cache = axObjectCache();
     1910    if (!cache)
     1911        return String();
     1912
     1913    StringBuilder builder;
     1914    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
     1915        if (!is<Element>(child))
     1916            continue;
     1917
     1918        if (AccessibilityObject* axObject = cache->getOrCreate(child)) {
     1919            String description = axObject->ariaLabeledByAttribute();
     1920            if (description.isEmpty())
     1921                description = accessibleNameForNode(child);
     1922            appendNameToStringBuilder(builder, description);
     1923        }
     1924    }
     1925
     1926    return builder.toString();
     1927}
     1928
    18961929String AccessibilityNodeObject::accessibilityDescriptionForElements(Vector<Element*> &elements) const
    18971930{
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityNodeObject.h

    r201270 r204708  
    124124    virtual unsigned hierarchicalLevel() const override;
    125125    virtual String textUnderElement(AccessibilityTextUnderElementMode = AccessibilityTextUnderElementMode()) const override;
     126    virtual String accessibilityDescriptionForChildren() const;
    126127    virtual String accessibilityDescription() const override;
    127128    virtual String helpText() const override;
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp

    r177733 r204708  
    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{
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityProgressIndicator.h

    r177733 r204708  
    4747    virtual bool isProgressIndicator() const override { return true; }
    4848
     49    virtual String valueDescription() const override;
    4950    virtual float valueForRange() const override;
    5051    virtual float maxValueForRange() const override;
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r201270 r204708  
    13671367        return false;
    13681368   
     1369#if ENABLE(METER_ELEMENT)
     1370    // The render tree of meter includes a RenderBlock (meter) and a RenderMeter (div).
     1371    // We expose the latter and thus should ignore the former. However, if the author
     1372    // includes a title attribute on the element, hasAttributesRequiredForInclusion()
     1373    // will return true, potentially resulting in a redundant accessible object.
     1374    if (is<HTMLMeterElement>(node))
     1375        return true;
     1376#endif
     1377
    13691378    // Using the presence of an accessible name to decide an element's visibility is not
    13701379    // as definitive as previous checks, so this should remain as one of the last.
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r204707 r204708  
    427427    if (!isReadOnly.isEmpty())
    428428        attributeSet = addToAtkAttributeSet(attributeSet, "readonly", isReadOnly.utf8().data());
     429
     430    String valueDescription = coreObject->valueDescription();
     431    if (!valueDescription.isEmpty())
     432        attributeSet = addToAtkAttributeSet(attributeSet, "valuetext", valueDescription.utf8().data());
    429433
    430434    // According to the W3C Core Accessibility API Mappings 1.1, section 5.4.1 General Rules:
     
    514518        return ATK_ROLE_PROGRESS_BAR; // Is this right?
    515519    case ProgressIndicatorRole:
    516         // return ATK_ROLE_SPIN_BUTTON; // Some confusion about this role in AccessibilityRenderObject.cpp
    517         return ATK_ROLE_PROGRESS_BAR;
     520        return coreObject->isMeter() ? ATK_ROLE_LEVEL_BAR : ATK_ROLE_PROGRESS_BAR;
    518521    case WindowRole:
    519522        return ATK_ROLE_WINDOW;
  • releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r196699 r204708  
    31273127    }
    31283128   
    3129     if ([attributeName isEqualToString:NSAccessibilityValueDescriptionAttribute]) {
    3130         if (m_object->isMeter())
    3131             return [self baseAccessibilityTitle];
    3132        
     3129    if ([attributeName isEqualToString:NSAccessibilityValueDescriptionAttribute])
    31333130        return m_object->valueDescription();
    3134     }
    31353131   
    31363132    if ([attributeName isEqualToString:NSAccessibilityOrientationAttribute]) {
  • releases/WebKitGTK/webkit-2.12/Tools/ChangeLog

    r204707 r204708  
     12016-05-25  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        Unreviewed.
     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-25  Joanmarie Diggs  <jdiggs@igalia.com>
    215
  • releases/WebKitGTK/webkit-2.12/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r204707 r204708  
    380380    case ATK_ROLE_LABEL:
    381381        return "AXLabel";
     382    case ATK_ROLE_LEVEL_BAR:
     383        return "AXProgressIndicator";
    382384    case ATK_ROLE_LINK:
    383385        return "AXLink";
     
    14011403JSRetainPtr<JSStringRef> AccessibilityUIElement::valueDescription()
    14021404{
    1403     // FIXME: implement
    1404     return JSStringCreateWithCharacters(0, 0);
     1405    String valueText = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "valuetext");
     1406    GUniquePtr<gchar> valueDescription(g_strdup_printf("AXValueDescription: %s", valueText.utf8().data()));
     1407    return JSStringCreateWithUTF8CString(valueDescription.get());
    14051408}
    14061409
Note: See TracChangeset for help on using the changeset viewer.