Changeset 272067 in webkit


Ignore:
Timestamp:
Jan 29, 2021 11:07:57 AM (3 years ago)
Author:
Andres Gonzalez
Message:

Support for aria-current state changed notifications.
https://bugs.webkit.org/show_bug.cgi?id=221074

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/aria-current-state-changed-notification.html

Added handling of the AXCurrentStateChanged notification for Mac and iOS
ports. This notification is fired when the aria-current attribute
changes.
Handling of this notification is required to properly update the
accessibility properties of the target object and convey them to
assistive technology clients.

  • accessibility/AXLogger.cpp:

(WebCore::operator<<): Renamed notification anumerand.

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::handleAttributeChange):

  • accessibility/AXObjectCache.h:
  • accessibility/atk/AXObjectCacheAtk.cpp:

(WebCore::AXObjectCache::postPlatformNotification):

  • accessibility/ios/AXObjectCacheIOS.mm:

(WebCore::AXObjectCache::postPlatformNotification):

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper accessibilityDOMIdentifier]):
(-[WebAccessibilityObjectWrapper postCurrentStateChangedNotification]):
(-[WebAccessibilityObjectWrapper accessibilityCurrentState]):
(-[WebAccessibilityObjectWrapper accessibilityARIACurrentStatus]): Renamed to accessibilityCurrentState.

  • accessibility/mac/AXObjectCacheMac.mm:

(WebCore::AXObjectCache::postPlatformNotification):

Tools:

Added AccessibilityUIElement::domIdentifier and currentStateValue used
in LayoutTests/accessibility/aria-current-state-changed-notification.html.

  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:

(WTR::AccessibilityUIElement::domIdentifier const): Non-Cocoa implementation.
(WTR::AccessibilityUIElement::currentStateValue const): Non-Cocoa implementation.

  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
  • WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
  • WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:

(WTR::AccessibilityUIElement::domIdentifier const):
(WTR::AccessibilityUIElement::stringAttributeValue):
(WTR::AccessibilityUIElement::currentStateValue const):

  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

(WTR::AccessibilityUIElement::domIdentifier const):
(WTR::AccessibilityUIElement::currentStateValue const):

LayoutTests:

  • accessibility/aria-current-state-changed-notification-expected.txt: Added.
  • accessibility/aria-current-state-changed-notification.html: Added.
  • accessibility/aria-current.html:

Use AccessibilityUIElement::currentStateValue for consistency and to
match closely how actual clients will invoke this functionality.

  • platform/gtk/TestExpectations:
  • platform/ios-wk1/TestExpectations:
  • platform/ios/TestExpectations:
  • platform/mac-wk1/TestExpectations:
  • platform/win/TestExpectations:
Location:
trunk
Files:
2 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r272063 r272067  
     12021-01-29  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Support for aria-current state changed notifications.
     4        https://bugs.webkit.org/show_bug.cgi?id=221074
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/aria-current-state-changed-notification-expected.txt: Added.
     9        * accessibility/aria-current-state-changed-notification.html: Added.
     10        * accessibility/aria-current.html:
     11        Use AccessibilityUIElement::currentStateValue for consistency and to
     12        match closely how actual clients will invoke this functionality.
     13        * platform/gtk/TestExpectations:
     14        * platform/ios-wk1/TestExpectations:
     15        * platform/ios/TestExpectations:
     16        * platform/mac-wk1/TestExpectations:
     17        * platform/win/TestExpectations:
     18
    1192021-01-29  Amir Mark Jr  <amir_mark@apple.com>
    220
  • trunk/LayoutTests/accessibility/aria-current.html

    r189642 r272067  
    3535
    3636<script>
    37 
    3837    description("This tests that aria-current causes the right attribute to be returned.");
    3938
     
    5150            el.focus();
    5251            var expectation = el.getAttribute("data-expected");
    53             var value = accessibilityController.focusedElement.stringAttributeValue('AXARIACurrent');
     52            var value = accessibilityController.focusedElement.currentStateValue;
    5453            verify(value, expectation, el);
    5554        }
    5655    }
    57 
    5856</script>
    59 
    6057<script src="../resources/js-test-post.js"></script>
    6158</body>
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r272051 r272067  
    13321332
    13331333webkit.org/b/182761 accessibility/gtk/aria-busy-changed-notification.html [ Pass Failure ]
     1334accessibility/aria-current-state-changed-notification.html [ Skip ]
    13341335webkit.org/b/182761 accessibility/gtk/aria-current-changed-notification.html [ Pass Failure ]
    13351336webkit.org/b/182761 accessibility/gtk/aria-disabled-changed-notification.html [ Pass Failure ]
  • trunk/LayoutTests/platform/ios-wk1/TestExpectations

    r269226 r272067  
    127127
    128128# Not supported on WK1
     129accessibility/aria-current-state-changed-notification.html [ Skip ]
    129130accessibility/ios-simulator/speak-selection-content.html [ Skip ]
    130131accessibility/ios-simulator/accessibility-events-setting.html [ Skip ]
  • trunk/LayoutTests/platform/ios/TestExpectations

    r272007 r272067  
    21632163fast/dom/linkify-phone-numbers.html [ Pass ]
    21642164
    2165 # Enable "aria-current" test for iOS
     2165# Enable "aria-current" tests for iOS.
    21662166webkit.org/b/149297 accessibility/aria-current.html [ Pass ]
     2167accessibility/aria-current-state-changed-notification.html [ Pass ]
    21672168
    21682169# Enable "aria-table-attributes" test for iOS
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r272063 r272067  
    967967webkit.org/b/208477 accessibility/mac/text-marker-for-index.html [ Skip ]
    968968accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
     969accessibility/aria-current-state-changed-notification.html [ Skip ]
     970accessibility/aria-current.html [ Skip ]
    969971
    970972# <rdar://problem/61066929> [ Stress GC ] flaky JSC::ExceptionScope::assertNoException crash under WebCore::ReadableStreamDefaultController
  • trunk/LayoutTests/platform/win/TestExpectations

    r271760 r272067  
    675675# TODO aria-current is not supported
    676676webkit.org/b/149018 accessibility/aria-current.html [ Skip ]
     677accessibility/aria-current-state-changed-notification.html [ Skip ]
    677678
    678679# TODO ARIA 1.1 table related attributes are not supported
  • trunk/Source/WebCore/ChangeLog

    r272066 r272067  
     12021-01-29  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Support for aria-current state changed notifications.
     4        https://bugs.webkit.org/show_bug.cgi?id=221074
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Test: accessibility/aria-current-state-changed-notification.html
     9
     10        Added handling of the AXCurrentStateChanged notification for Mac and iOS
     11        ports. This notification is fired when the aria-current attribute
     12        changes.
     13        Handling of this notification is required to properly update the
     14        accessibility properties of the target object and convey them to
     15        assistive technology clients.
     16
     17        * accessibility/AXLogger.cpp:
     18        (WebCore::operator<<): Renamed notification anumerand.
     19        * accessibility/AXObjectCache.cpp:
     20        (WebCore::AXObjectCache::handleAttributeChange):
     21        * accessibility/AXObjectCache.h:
     22        * accessibility/atk/AXObjectCacheAtk.cpp:
     23        (WebCore::AXObjectCache::postPlatformNotification):
     24        * accessibility/ios/AXObjectCacheIOS.mm:
     25        (WebCore::AXObjectCache::postPlatformNotification):
     26        * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
     27        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     28        (-[WebAccessibilityObjectWrapper accessibilityDOMIdentifier]):
     29        (-[WebAccessibilityObjectWrapper postCurrentStateChangedNotification]):
     30        (-[WebAccessibilityObjectWrapper accessibilityCurrentState]):
     31        (-[WebAccessibilityObjectWrapper accessibilityARIACurrentStatus]): Renamed to accessibilityCurrentState.
     32        * accessibility/mac/AXObjectCacheMac.mm:
     33        (WebCore::AXObjectCache::postPlatformNotification):
     34
    1352021-01-29  Sam Weinig  <weinig@apple.com>
    236
  • trunk/Source/WebCore/accessibility/AXLogger.cpp

    r271587 r272067  
    358358        stream << "AXChildrenChanged";
    359359        break;
    360     case AXObjectCache::AXNotification::AXCurrentChanged:
    361         stream << "AXCurrentChanged";
     360    case AXObjectCache::AXNotification::AXCurrentStateChanged:
     361        stream << "AXCurrentStateChanged";
    362362        break;
    363363    case AXObjectCache::AXNotification::AXDisabledStateChanged:
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r271587 r272067  
    17741774        deferModalChange(element);
    17751775    else if (attrName == aria_currentAttr)
    1776         postNotification(element, AXObjectCache::AXCurrentChanged);
     1776        postNotification(element, AXObjectCache::AXCurrentStateChanged);
    17771777    else if (attrName == aria_disabledAttr)
    17781778        postNotification(element, AXObjectCache::AXDisabledStateChanged);
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r271587 r272067  
    278278        AXCheckedStateChanged,
    279279        AXChildrenChanged,
    280         AXCurrentChanged,
     280        AXCurrentStateChanged,
    281281        AXDisabledStateChanged,
    282282        AXFocusedUIElementChanged,
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r265176 r272067  
    263263        break;
    264264
    265     case AXCurrentChanged:
     265    case AXCurrentStateChanged:
    266266        atk_object_notify_state_change(axObject, ATK_STATE_ACTIVE, coreObject->currentState() != AccessibilityCurrentState::False);
    267267        break;
  • trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm

    r270333 r272067  
    5050    NSString *notificationString = nil;
    5151    switch (notification) {
    52         case AXActiveDescendantChanged:
    53         case AXFocusedUIElementChanged:
    54             [obj->wrapper() postFocusChangeNotification];
    55             notificationString = @"AXFocusChanged";
    56             break;
    57         case AXSelectedTextChanged:
    58             [obj->wrapper() postSelectedTextChangeNotification];
    59             break;
    60         case AXLayoutComplete:
    61             [obj->wrapper() postLayoutChangeNotification];
    62             break;
    63         case AXLiveRegionChanged:
    64             [obj->wrapper() postLiveRegionChangeNotification];
    65             break;
    66         case AXLiveRegionCreated:
    67             [obj->wrapper() postLiveRegionCreatedNotification];
    68             break;
    69         case AXChildrenChanged:
    70             [obj->wrapper() postChildrenChangedNotification];
    71             break;
    72         case AXLoadComplete:
    73             [obj->wrapper() postLoadCompleteNotification];
    74             break;
    75         case AXInvalidStatusChanged:
    76             [obj->wrapper() postInvalidStatusChangedNotification];
    77             break;
    78         case AXCheckedStateChanged:
    79         case AXValueChanged:
    80             [obj->wrapper() postValueChangedNotification];
    81             notificationString = @"AXValueChanged";
    82             break;
    83         case AXExpandedChanged:
    84             [obj->wrapper() postExpandedChangedNotification];
    85             break;
    86         case AXSelectedChildrenChanged:
    87         default:
    88             break;
     52    case AXActiveDescendantChanged:
     53    case AXFocusedUIElementChanged:
     54        [obj->wrapper() postFocusChangeNotification];
     55        notificationString = @"AXFocusChanged";
     56        break;
     57    case AXSelectedTextChanged:
     58        [obj->wrapper() postSelectedTextChangeNotification];
     59        break;
     60    case AXLayoutComplete:
     61        [obj->wrapper() postLayoutChangeNotification];
     62        break;
     63    case AXLiveRegionChanged:
     64        [obj->wrapper() postLiveRegionChangeNotification];
     65        break;
     66    case AXLiveRegionCreated:
     67        [obj->wrapper() postLiveRegionCreatedNotification];
     68        break;
     69    case AXChildrenChanged:
     70        [obj->wrapper() postChildrenChangedNotification];
     71        break;
     72    case AXLoadComplete:
     73        [obj->wrapper() postLoadCompleteNotification];
     74        break;
     75    case AXInvalidStatusChanged:
     76        [obj->wrapper() postInvalidStatusChangedNotification];
     77        break;
     78    case AXCheckedStateChanged:
     79    case AXValueChanged:
     80        [obj->wrapper() postValueChangedNotification];
     81        notificationString = @"AXValueChanged";
     82        break;
     83    case AXExpandedChanged:
     84        [obj->wrapper() postExpandedChangedNotification];
     85        break;
     86    case AXCurrentStateChanged:
     87        [obj->wrapper() postCurrentStateChangedNotification];
     88        notificationString = @"AXCurrentStateChanged";
     89        break;
     90    default:
     91        break;
    8992    }
    90    
     93
    9194    // Used by DRT to know when notifications are posted.
    9295    if (notificationString)
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h

    r260366 r272067  
    6767- (void)postValueChangedNotification;
    6868- (void)postExpandedChangedNotification;
     69- (void)postCurrentStateChangedNotification;
    6970
    7071@end
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r271790 r272067  
    335335- (uint64_t)_axTextAreaTrait { return (1 << 24); }
    336336- (uint64_t)_axUpdatesFrequentlyTrait { return (1 << 25); }
     337
     338- (NSString *)accessibilityDOMIdentifier
     339{
     340    if (![self _prepareAccessibilityCall])
     341        return nil;
     342
     343    return self.axBackingObject->identifierAttribute();
     344}
    337345
    338346- (BOOL)accessibilityCanFuzzyHitTest
     
    20052013}
    20062014
     2015- (void)postCurrentStateChangedNotification
     2016{
     2017    // The UIKit accessibility wrapper will override and post appropriate notification.
     2018}
     2019
    20072020// These will be used by the UIKit wrapper to calculate an appropriate description of scroll status.
    20082021- (CGPoint)_accessibilityScrollPosition
     
    30323045}
    30333046
    3034 - (NSString *)accessibilityARIACurrentStatus
    3035 {
    3036     if (![self _prepareAccessibilityCall])
    3037         return nil;
    3038    
    3039     switch (self.axBackingObject->currentState()) {
    3040     case AccessibilityCurrentState::False:
    3041         return @"false";
    3042     case AccessibilityCurrentState::Page:
    3043         return @"page";
    3044     case AccessibilityCurrentState::Step:
    3045         return @"step";
    3046     case AccessibilityCurrentState::Location:
    3047         return @"location";
    3048     case AccessibilityCurrentState::Time:
    3049         return @"time";
    3050     case AccessibilityCurrentState::Date:
    3051         return @"date";
    3052     case AccessibilityCurrentState::True:
    3053         return @"true";
    3054     }
     3047- (NSString *)accessibilityCurrentState
     3048{
     3049    if (![self _prepareAccessibilityCall])
     3050        return nil;
     3051
     3052    return self.axBackingObject->currentValue();
    30553053}
    30563054
  • trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

    r270523 r272067  
    4141#endif
    4242
     43#ifndef NSAccessibilityCurrentStateChangedNotification
     44#define NSAccessibilityCurrentStateChangedNotification @"AXCurrentStateChanged"
     45#endif
     46
    4347#ifndef NSAccessibilityLiveRegionChangedNotification
    4448#define NSAccessibilityLiveRegionChangedNotification @"AXLiveRegionChanged"
     
    294298    NSString *macNotification;
    295299    switch (notification) {
    296         case AXActiveDescendantChanged:
    297             // An active descendant change for trees means a selected rows change.
    298             if (obj->isTree() || obj->isTable())
    299                 macNotification = NSAccessibilitySelectedRowsChangedNotification;
    300            
    301             // When a combobox uses active descendant, it means the selected item in its associated
    302             // list has changed. In these cases we should use selected children changed, because
    303             // we don't want the focus to change away from the combobox where the user is typing.
    304             else if (obj->isComboBox() || obj->isList() || obj->isListBox())
    305                 macNotification = NSAccessibilitySelectedChildrenChangedNotification;
    306             else
    307                 macNotification = NSAccessibilityFocusedUIElementChangedNotification;               
    308             break;
    309         case AXAutocorrectionOccured:
    310             macNotification = @"AXAutocorrectionOccurred";
    311             break;
    312         case AXFocusedUIElementChanged:
     300    case AXActiveDescendantChanged:
     301        // An active descendant change for trees means a selected rows change.
     302        if (obj->isTree() || obj->isTable())
     303            macNotification = NSAccessibilitySelectedRowsChangedNotification;
     304
     305        // When a combobox uses active descendant, it means the selected item in its associated
     306        // list has changed. In these cases we should use selected children changed, because
     307        // we don't want the focus to change away from the combobox where the user is typing.
     308        else if (obj->isComboBox() || obj->isList() || obj->isListBox())
     309            macNotification = NSAccessibilitySelectedChildrenChangedNotification;
     310        else
    313311            macNotification = NSAccessibilityFocusedUIElementChangedNotification;
    314             break;
    315         case AXLayoutComplete:
    316             macNotification = @"AXLayoutComplete";
    317             break;
    318         case AXLoadComplete:
    319         case AXFrameLoadComplete:
    320             macNotification = @"AXLoadComplete";
    321             // Frame loading events are handled by the UIProcess on macOS to improve reliability.
    322             // On macOS, before notifications are allowed by AppKit to be sent to clients, you need to have a client (e.g. VoiceOver)
    323             // register for that notification. Because these new processes appear before VO has a chance to register, it will often
    324             // miss AXLoadComplete notifications. By moving them to the UIProcess, we can eliminate that issue.
    325             skipSystemNotification = true;
    326             break;
    327         case AXInvalidStatusChanged:
    328             macNotification = @"AXInvalidStatusChanged";
    329             break;
    330         case AXSelectedChildrenChanged:
    331             if (obj->isTable() && obj->isExposable())
    332                 macNotification = NSAccessibilitySelectedRowsChangedNotification;
    333             else
    334                 macNotification = NSAccessibilitySelectedChildrenChangedNotification;
    335             break;
    336         case AXSelectedTextChanged:
    337             macNotification = NSAccessibilitySelectedTextChangedNotification;
    338             break;
    339         case AXCheckedStateChanged:
    340         case AXValueChanged:
    341             macNotification = NSAccessibilityValueChangedNotification;
    342             break;
    343         case AXLiveRegionCreated:
    344             macNotification = NSAccessibilityLiveRegionCreatedNotification;
    345             break;
    346         case AXLiveRegionChanged:
    347             macNotification = NSAccessibilityLiveRegionChangedNotification;
    348             break;
    349         case AXRowCountChanged:
    350             macNotification = NSAccessibilityRowCountChangedNotification;
    351             break;
    352         case AXRowExpanded:
    353             macNotification = NSAccessibilityRowExpandedNotification;
    354             break;
    355         case AXRowCollapsed:
    356             macNotification = NSAccessibilityRowCollapsedNotification;
    357             break;
    358         case AXElementBusyChanged:
    359             macNotification = @"AXElementBusyChanged";
    360             break;
    361         case AXExpandedChanged:
    362             macNotification = @"AXExpandedChanged";
    363             break;
    364         case AXMenuClosed:
    365             macNotification = (id)kAXMenuClosedNotification;
    366             break;
    367         case AXMenuListItemSelected:
    368         case AXMenuListValueChanged:
    369             macNotification = (id)kAXMenuItemSelectedNotification;
    370             break;
    371         case AXPressDidSucceed:
    372             macNotification = @"AXPressDidSucceed";
    373             break;
    374         case AXPressDidFail:
    375             macNotification = @"AXPressDidFail";
    376             break;
    377         case AXMenuOpened:
    378             macNotification = (id)kAXMenuOpenedNotification;
    379             break;
    380         case AXDraggingStarted:
    381             macNotification = (id)kAXDraggingSourceDragBeganNotification;
    382             break;
    383         case AXDraggingEnded:
    384             macNotification = (id)kAXDraggingSourceDragEndedNotification;
    385             break;
    386         case AXDraggingEnteredDropZone:
    387             macNotification = (id)kAXDraggingDestinationDropAllowedNotification;
    388             break;
    389         case AXDraggingDropped:
    390             macNotification = (id)kAXDraggingDestinationDragAcceptedNotification;
    391             break;
    392         case AXDraggingExitedDropZone:
    393             macNotification = (id)kAXDraggingDestinationDragNotAcceptedNotification;
    394             break;
    395         default:
    396             return;
    397     }
    398    
     312        break;
     313    case AXAutocorrectionOccured:
     314        macNotification = @"AXAutocorrectionOccurred";
     315        break;
     316    case AXCurrentStateChanged:
     317        macNotification = NSAccessibilityCurrentStateChangedNotification;
     318        break;
     319    case AXFocusedUIElementChanged:
     320        macNotification = NSAccessibilityFocusedUIElementChangedNotification;
     321        break;
     322    case AXLayoutComplete:
     323        macNotification = @"AXLayoutComplete";
     324        break;
     325    case AXLoadComplete:
     326    case AXFrameLoadComplete:
     327        macNotification = @"AXLoadComplete";
     328        // Frame loading events are handled by the UIProcess on macOS to improve reliability.
     329        // On macOS, before notifications are allowed by AppKit to be sent to clients, you need to have a client (e.g. VoiceOver)
     330        // register for that notification. Because these new processes appear before VO has a chance to register, it will often
     331        // miss AXLoadComplete notifications. By moving them to the UIProcess, we can eliminate that issue.
     332        skipSystemNotification = true;
     333        break;
     334    case AXInvalidStatusChanged:
     335        macNotification = @"AXInvalidStatusChanged";
     336        break;
     337    case AXSelectedChildrenChanged:
     338        if (obj->isTable() && obj->isExposable())
     339            macNotification = NSAccessibilitySelectedRowsChangedNotification;
     340        else
     341            macNotification = NSAccessibilitySelectedChildrenChangedNotification;
     342        break;
     343    case AXSelectedTextChanged:
     344        macNotification = NSAccessibilitySelectedTextChangedNotification;
     345        break;
     346    case AXCheckedStateChanged:
     347    case AXValueChanged:
     348        macNotification = NSAccessibilityValueChangedNotification;
     349        break;
     350    case AXLiveRegionCreated:
     351        macNotification = NSAccessibilityLiveRegionCreatedNotification;
     352        break;
     353    case AXLiveRegionChanged:
     354        macNotification = NSAccessibilityLiveRegionChangedNotification;
     355        break;
     356    case AXRowCountChanged:
     357        macNotification = NSAccessibilityRowCountChangedNotification;
     358        break;
     359    case AXRowExpanded:
     360        macNotification = NSAccessibilityRowExpandedNotification;
     361        break;
     362    case AXRowCollapsed:
     363        macNotification = NSAccessibilityRowCollapsedNotification;
     364        break;
     365    case AXElementBusyChanged:
     366        macNotification = @"AXElementBusyChanged";
     367        break;
     368    case AXExpandedChanged:
     369        macNotification = @"AXExpandedChanged";
     370        break;
     371    case AXMenuClosed:
     372        macNotification = (id)kAXMenuClosedNotification;
     373        break;
     374    case AXMenuListItemSelected:
     375    case AXMenuListValueChanged:
     376        macNotification = (id)kAXMenuItemSelectedNotification;
     377        break;
     378    case AXPressDidSucceed:
     379        macNotification = @"AXPressDidSucceed";
     380        break;
     381    case AXPressDidFail:
     382        macNotification = @"AXPressDidFail";
     383        break;
     384    case AXMenuOpened:
     385        macNotification = (id)kAXMenuOpenedNotification;
     386        break;
     387    case AXDraggingStarted:
     388        macNotification = (id)kAXDraggingSourceDragBeganNotification;
     389        break;
     390    case AXDraggingEnded:
     391        macNotification = (id)kAXDraggingSourceDragEndedNotification;
     392        break;
     393    case AXDraggingEnteredDropZone:
     394        macNotification = (id)kAXDraggingDestinationDropAllowedNotification;
     395        break;
     396    case AXDraggingDropped:
     397        macNotification = (id)kAXDraggingDestinationDragAcceptedNotification;
     398        break;
     399    case AXDraggingExitedDropZone:
     400        macNotification = (id)kAXDraggingDestinationDragNotAcceptedNotification;
     401        break;
     402    default:
     403        return;
     404    }
     405
    399406    // NSAccessibilityPostNotification will call this method, (but not when running DRT), so ASSERT here to make sure it does not crash.
    400407    // https://bugs.webkit.org/show_bug.cgi?id=46662
  • trunk/Tools/ChangeLog

    r272064 r272067  
     12021-01-29  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Support for aria-current state changed notifications.
     4        https://bugs.webkit.org/show_bug.cgi?id=221074
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Added AccessibilityUIElement::domIdentifier and currentStateValue used
     9        in LayoutTests/accessibility/aria-current-state-changed-notification.html.
     10
     11        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
     12        (WTR::AccessibilityUIElement::domIdentifier const): Non-Cocoa implementation.
     13        (WTR::AccessibilityUIElement::currentStateValue const): Non-Cocoa implementation.
     14        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
     15        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
     16        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
     17        (WTR::AccessibilityUIElement::domIdentifier const):
     18        (WTR::AccessibilityUIElement::stringAttributeValue):
     19        (WTR::AccessibilityUIElement::currentStateValue const):
     20        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     21        (WTR::AccessibilityUIElement::domIdentifier const):
     22        (WTR::AccessibilityUIElement::currentStateValue const):
     23
    1242021-01-29  David Kilzer  <ddkilzer@apple.com>
    225
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp

    r271790 r272067  
    112112
    113113#if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY)
     114JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const { return nullptr; }
     115JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const { return nullptr; }
    114116RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
    115117RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

    r271790 r272067  
    6969#if PLATFORM(COCOA)
    7070    id platformUIElement() { return m_element.get(); }
    71 #endif
    72 #if !PLATFORM(COCOA)
     71#else
    7372    PlatformUIElement platformUIElement() { return m_element; }
    7473#endif
     
    7978
    8079    bool isEqual(AccessibilityUIElement* otherElement);
    81    
     80    JSRetainPtr<JSStringRef> domIdentifier() const;
     81
    8282    RefPtr<AccessibilityUIElement> elementAtPoint(int x, int y);
    8383    RefPtr<AccessibilityUIElement> childAtIndex(unsigned);
     
    174174    bool isExpanded() const;
    175175    bool isChecked() const;
     176    JSRetainPtr<JSStringRef> currentStateValue() const;
    176177    bool isIndeterminate() const;
    177178    bool isVisible() const;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

    r271790 r272067  
    2828] interface AccessibilityUIElement {
    2929    boolean isEqual(AccessibilityUIElement otherElement);
     30    readonly attribute DOMString domIdentifier;
    3031    readonly attribute boolean isIsolatedObject;
    3132
     
    9293    readonly attribute boolean isExpanded;
    9394    readonly attribute boolean isChecked;
     95    readonly attribute DOMString currentStateValue;
    9496    readonly attribute boolean isIndeterminate;
    9597    readonly attribute boolean isVisible;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

    r271790 r272067  
    7171- (UIAccessibilityTraits)_axTextAreaTrait;
    7272- (UIAccessibilityTraits)_axSearchFieldTrait;
    73 - (NSString *)accessibilityARIACurrentStatus;
     73- (NSString *)accessibilityCurrentState;
    7474- (NSUInteger)accessibilityRowCount;
    7575- (NSUInteger)accessibilityColumnCount;
     
    118118
    119119@interface NSObject (WebAccessibilityObjectWrapperPrivate)
     120- (NSString *)accessibilityDOMIdentifier;
    120121- (CGPathRef)_accessibilityPath;
    121122@end
     
    174175        return false;
    175176    return platformUIElement() == otherElement->platformUIElement();
     177}
     178
     179JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
     180{
     181    id value = [m_element accessibilityDOMIdentifier];
     182    if ([value isKindOfClass:[NSString class]])
     183        return [value createJSStringRef];
     184    return nullptr;
    176185}
    177186
     
    364373
    365374    if (JSStringIsEqualToUTF8CString(attribute, "AXARIACurrent"))
    366         return [[m_element accessibilityARIACurrentStatus] createJSStringRef];
     375        return [[m_element accessibilityCurrentState] createJSStringRef];
    367376
    368377    if (JSStringIsEqualToUTF8CString(attribute, "AXExpandedTextValue"))
     
    609618{
    610619    return false;
     620}
     621
     622JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const
     623{
     624    id value = [m_element accessibilityCurrentState];
     625    if ([value isKindOfClass:[NSString class]])
     626        return [value createJSStringRef];
     627    return nullptr;
    611628}
    612629
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r269635 r272067  
    4343#import <wtf/cocoa/VectorCocoa.h>
    4444
     45#define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
     46
    4547#ifndef NSAccessibilityOwnsAttribute
    4648#define NSAccessibilityOwnsAttribute @"AXOwns"
     
    5759#ifndef NSAccessibilityPathAttribute
    5860#define NSAccessibilityPathAttribute @"AXPath"
     61#endif
     62
     63#ifndef NSAccessibilityARIACurrentAttribute
     64#define NSAccessibilityARIACurrentAttribute @"AXARIACurrent"
    5965#endif
    6066
     
    328334}
    329335
     336JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const
     337{
     338    id value = attributeValue(m_element.get(), NSAccessibilityDOMIdentifierAttribute);
     339    if ([value isKindOfClass:[NSString class]])
     340        return [value createJSStringRef];
     341    return nullptr;
     342}
     343
    330344void AccessibilityUIElement::getLinkedUIElements(Vector<RefPtr<AccessibilityUIElement>>& elementVector)
    331345{
     
    975989    // On the Mac, intValue()==1 if a a checkable control is checked.
    976990    return intValue() == 1;
     991}
     992
     993JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const
     994{
     995    id value = attributeValue(m_element.get(), NSAccessibilityARIACurrentAttribute);
     996    if ([value isKindOfClass:[NSString class]])
     997        return [value createJSStringRef];
     998    return nullptr;
    977999}
    9781000
Note: See TracChangeset for help on using the changeset viewer.