Changeset 244029 in webkit


Ignore:
Timestamp:
Apr 8, 2019 11:09:33 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

AX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
https://bugs.webkit.org/show_bug.cgi?id=156774

Patch by Eric Liang <ericliang@apple.com> on 2019-04-08
Reviewed by Chris Fleizach.

Source/WebCore:

Labelled SVGs without accessible descendants are exposed as AXImage rather than groups.

Unlabelled equivalents are not exposed. Otherwise, SVGs with accessible descendants are exposed as AXGroup.
Also added back functionalities from last patch of determining whether a SVG element should be ignored.

Test: accessibility/svg-shape-labelled.html

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):

  • accessibility/AccessibilitySVGElement.cpp:

(WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored const):

LayoutTests:

Added tests that verify svgs shapes that are labelled are exposed as images.

  • accessibility/resources/apple-logo.svg: Added.
  • accessibility/svg-shape-labelled-expected.txt: Added.
  • accessibility/svg-shape-labelled.html: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244026 r244029  
     12019-04-08  Eric Liang  <ericliang@apple.com>
     2
     3        AX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
     4        https://bugs.webkit.org/show_bug.cgi?id=156774
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Added tests that verify svgs shapes that are labelled are exposed as images.
     9        * accessibility/resources/apple-logo.svg: Added.
     10        * accessibility/svg-shape-labelled-expected.txt: Added.
     11        * accessibility/svg-shape-labelled.html: Added.
     12
    1132019-04-08  Shawn Roberts  <sroberts@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r244027 r244029  
     12019-04-08  Eric Liang  <ericliang@apple.com>
     2
     3        AX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
     4        https://bugs.webkit.org/show_bug.cgi?id=156774
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Labelled SVGs without accessible descendants are exposed as AXImage rather than groups.
     9
     10        Unlabelled equivalents are not exposed. Otherwise, SVGs with accessible descendants are exposed as AXGroup.
     11        Also added back functionalities from last patch of determining whether a SVG element should be ignored.
     12       
     13        Test: accessibility/svg-shape-labelled.html
     14
     15        * accessibility/AccessibilityRenderObject.cpp:
     16        (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
     17        * accessibility/AccessibilitySVGElement.cpp:
     18        (WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored const):
     19
    1202019-04-08  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r243894 r244029  
    32643264{
    32653265    // If a menu does not have valid menuitem children, it should not be exposed as a menu.
    3266     if (roleValue() == AccessibilityRole::Menu) {
     3266    auto role = roleValue();
     3267    if (role == AccessibilityRole::Menu) {
    32673268        // Elements marked as menus must have at least one menu item child.
    32683269        size_t menuItemCount = 0;
     
    32773278            m_role = AccessibilityRole::Group;
    32783279    }
     3280    if (role == AccessibilityRole::SVGRoot && !hasChildren())
     3281        m_role = AccessibilityRole::Image;
    32793282}
    32803283   
  • trunk/Source/WebCore/accessibility/AccessibilitySVGElement.cpp

    r241321 r244029  
    246246    // SVG shapes should not be included unless there's a concrete reason for inclusion.
    247247    // https://rawgit.com/w3c/aria/master/svg-aam/svg-aam.html#exclude_elements
    248     if (m_renderer->isSVGShape())
    249         return !(hasAttributesRequiredForInclusion() || canSetFocusAttribute() || element()->hasEventListeners());
     248    if (m_renderer->isSVGShape()) {
     249        if (canSetFocusAttribute() || element()->hasEventListeners())
     250            return false;
     251        if (auto svgParent = AccessibilityObject::matchedParent(*this, true, [] (const AccessibilityObject& object) {
     252            return object.hasAttributesRequiredForInclusion() || object.isAccessibilitySVGRoot();
     253        }))
     254            return !svgParent->hasAttributesRequiredForInclusion();
     255        return true;
     256    }
    250257
    251258    return AccessibilityRenderObject::computeAccessibilityIsIgnored();
Note: See TracChangeset for help on using the changeset viewer.