Changeset 223766 in webkit


Ignore:
Timestamp:
Oct 20, 2017 9:30:20 AM (7 years ago)
Author:
jdiggs@igalia.com
Message:

AX: [ATK] Events missing and state incorrect for aria-activedescendant
https://bugs.webkit.org/show_bug.cgi?id=178523

Reviewed by Chris Fleizach.

Source/WebCore:

When the aria-activedescendant of an element changes, emit object:state-changed:focused.
When a focused element has a valid active descendant, do not expose the focused state on
the element, but rather on the active descendant. Also expose the focusable state on the
active descendant.

Tests: accessibility/gtk/aria-activedescendant-changed-notification.html

accessibility/gtk/aria-activedescendant.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
(WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):

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

(WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):

  • accessibility/atk/AXObjectCacheAtk.cpp:

(WebCore::AXObjectCache::postPlatformNotification):

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(setAtkStateSetFromCoreObject):

LayoutTests:

  • accessibility/gtk/aria-activedescendant-changed-notification-expected.txt: Added.
  • accessibility/gtk/aria-activedescendant-changed-notification.html: Added.
  • accessibility/gtk/aria-activedescendant-expected.txt: Added.
  • accessibility/gtk/aria-activedescendant.html: Added.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223762 r223766  
     12017-10-20  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: [ATK] Events missing and state incorrect for aria-activedescendant
     4        https://bugs.webkit.org/show_bug.cgi?id=178523
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/gtk/aria-activedescendant-changed-notification-expected.txt: Added.
     9        * accessibility/gtk/aria-activedescendant-changed-notification.html: Added.
     10        * accessibility/gtk/aria-activedescendant-expected.txt: Added.
     11        * accessibility/gtk/aria-activedescendant.html: Added.
     12
    1132017-10-20  Per Arne Vollan  <pvollan@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r223757 r223766  
     12017-10-20  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: [ATK] Events missing and state incorrect for aria-activedescendant
     4        https://bugs.webkit.org/show_bug.cgi?id=178523
     5
     6        Reviewed by Chris Fleizach.
     7
     8        When the aria-activedescendant of an element changes, emit object:state-changed:focused.
     9        When a focused element has a valid active descendant, do not expose the focused state on
     10        the element, but rather on the active descendant. Also expose the focusable state on the
     11        active descendant.
     12
     13        Tests: accessibility/gtk/aria-activedescendant-changed-notification.html
     14               accessibility/gtk/aria-activedescendant.html
     15
     16        * accessibility/AccessibilityObject.cpp:
     17        (WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
     18        (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
     19        * accessibility/AccessibilityObject.h:
     20        * accessibility/AccessibilityRenderObject.cpp:
     21        (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
     22        * accessibility/atk/AXObjectCacheAtk.cpp:
     23        (WebCore::AXObjectCache::postPlatformNotification):
     24        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     25        (setAtkStateSetFromCoreObject):
     26
    1272017-10-20  Ms2ger  <Ms2ger@igalia.com>
    228
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r223190 r223766  
    34083408}
    34093409
     3410bool AccessibilityObject::isActiveDescendantOfFocusedContainer() const
     3411{
     3412    AccessibilityChildrenVector containers;
     3413    ariaActiveDescendantReferencingElements(containers);
     3414    for (auto& container : containers) {
     3415        if (container->isFocused())
     3416            return true;
     3417    }
     3418
     3419    return false;
     3420}
     3421
     3422void AccessibilityObject::ariaActiveDescendantReferencingElements(AccessibilityChildrenVector& containers) const
     3423{
     3424    ariaElementsReferencedByAttribute(containers, aria_activedescendantAttr);
     3425}
     3426
    34103427void AccessibilityObject::ariaControlsElements(AccessibilityChildrenVector& ariaControls) const
    34113428{
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r223190 r223766  
    671671
    672672    virtual bool supportsARIAOwns() const { return false; }
     673    bool isActiveDescendantOfFocusedContainer() const;
     674    void ariaActiveDescendantReferencingElements(AccessibilityChildrenVector&) const;
    673675    void ariaControlsElements(AccessibilityChildrenVector&) const;
    674676    void ariaControlsReferencingElements(AccessibilityChildrenVector&) const;
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r223151 r223766  
    23962396bool AccessibilityRenderObject::shouldNotifyActiveDescendant() const
    23972397{
     2398#if PLATFORM(GTK)
     2399    // According to the Core AAM spec, ATK expects object:state-changed:focused notifications
     2400    // whenever the active descendant changes.
     2401    return true;
     2402#endif
    23982403    // We want to notify that the combo box has changed its active descendant,
    23992404    // but we do not want to change the focus, because focus should remain with the combo box.
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r222705 r223766  
    281281        break;
    282282
     283    case AXActiveDescendantChanged:
     284        if (AccessibilityObject* descendant = coreObject->activeDescendant())
     285            platformHandleFocusedUIElementChanged(nullptr, descendant->node());
     286        break;
     287
    283288    default:
    284289        break;
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r223190 r223766  
    963963        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
    964964
    965     if (coreObject->isFocused() || isTextWithCaret(coreObject))
     965    // According to the Core AAM, if the element which is focused has a valid aria-activedescendant,
     966    // we should not expose the focused state on the element which is actually focused, but instead
     967    // on its active descendant.
     968    if ((coreObject->isFocused() && !coreObject->activeDescendant()) || isTextWithCaret(coreObject))
    966969        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED);
     970    else if (coreObject->isActiveDescendantOfFocusedContainer()) {
     971        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
     972        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED);
     973    }
    967974
    968975    if (coreObject->orientation() == AccessibilityOrientationHorizontal)
Note: See TracChangeset for help on using the changeset viewer.