• dmazzoni@google.com's avatar
    Source/WebCore: AccessibilityController should support listening to notifications on all elements. · 1851ba03
    dmazzoni@google.com authored
    https://bugs.webkit.org/show_bug.cgi?id=72866
    
    Changes accessibilitySetShouldRepostNotifications from an instance method
    into a class method so that it can be used for global notification listeners,
    not just for listeners on a particular object.
    
    Reviewed by Chris Fleizach.
    
    Test: accessibility/notification-listeners.html
    
    * accessibility/mac/WebAccessibilityObjectWrapper.h:
    * accessibility/mac/WebAccessibilityObjectWrapper.mm:
    (+[WebAccessibilityObjectWrapper accessibilitySetShouldRepostNotifications:]):
    (-[WebAccessibilityObjectWrapper accessibilityPostedNotification:]):
    
    Tools: Accessibility: AccessibilityController should support listening to notifications on all elements.
    https://bugs.webkit.org/show_bug.cgi?id=72866
    
    Adds addNotificationListener and removeNotificationListener methods
    to AccessibilityController, to listen to notifications on any element
    rather than a specific element. Mac (DRT and WKTR) and Chromium (DRT)
    implementations are all contained in this change.
    
    On Mac, refactors AccessibilityNotificationHandler into its own
    source file that can be used by both AccessibilityController and
    AccessibilityUIElement. (Both DRT and WKTR.)
    
    Reviewed by Chris Fleizach.
    
    * DumpRenderTree/AccessibilityController.cpp:
    (addNotificationListenerCallback):
    (removeNotificationListenerCallback):
    (AccessibilityController::getJSClass):
    * DumpRenderTree/AccessibilityController.h:
    * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
    * DumpRenderTree/chromium/AccessibilityController.cpp:
    (AccessibilityController::AccessibilityController):
    (AccessibilityController::notificationReceived):
    (AccessibilityController::addNotificationListenerCallback):
    (AccessibilityController::removeNotificationListenerCallback):
    * DumpRenderTree/chromium/AccessibilityController.h:
    * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
    (AccessibilityController::addNotificationListener):
    (AccessibilityController::removeNotificationListener):
    * DumpRenderTree/mac/AccessibilityControllerMac.mm:
    (AccessibilityController::~AccessibilityController):
    (AccessibilityController::addNotificationListener):
    (AccessibilityController::removeNotificationListener):
    * DumpRenderTree/mac/AccessibilityNotificationHandler.h: Added.
    * DumpRenderTree/mac/AccessibilityNotificationHandler.mm: Added.
    (-[NSString createJSStringRef]):
    (-[AccessibilityNotificationHandler init]):
    (-[AccessibilityNotificationHandler setPlatformElement:]):
    (-[AccessibilityNotificationHandler dealloc]):
    (-[AccessibilityNotificationHandler setCallback:]):
    (-[AccessibilityNotificationHandler startObserving]):
    (-[AccessibilityNotificationHandler _notificationReceived:]):
    * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
    (AccessibilityUIElement::addNotificationListener):
    * DumpRenderTree/win/AccessibilityControllerWin.cpp:
    (notificationListenerProc):
    (AccessibilityController::addNotificationListener):
    (AccessibilityController::removeNotificationListener):
    (AccessibilityController::winNotificationReceived):
    (AccessibilityController::winAddNotificationListener):
    * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
    (AccessibilityUIElement::addNotificationListener):
    * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
    (WTR::AccessibilityController::addNotificationListener):
    (WTR::AccessibilityController::removeNotificationListener):
    * WebKitTestRunner/InjectedBundle/AccessibilityController.h:
    (WTR::AccessibilityController::logAccessibilityEvents):
    * WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp:
    (WTR::AccessibilityTextMarker::AccessibilityTextMarker):
    * WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp:
    (WTR::AccessibilityTextMarkerRange::AccessibilityTextMarkerRange):
    * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl:
    * WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm: Added.
    (WTR::AccessibilityController::addNotificationListener):
    (WTR::AccessibilityController::removeNotificationListener):
    * WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.h: Added.
    * WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm: Added.
    (-[NSString createJSStringRef]):
    (-[AccessibilityNotificationHandler init]):
    (-[AccessibilityNotificationHandler setPlatformElement:]):
    (-[AccessibilityNotificationHandler dealloc]):
    (-[AccessibilityNotificationHandler setCallback:]):
    (-[AccessibilityNotificationHandler startObserving]):
    (-[AccessibilityNotificationHandler _notificationReceived:]):
    * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
    (WTR::AccessibilityUIElement::AccessibilityUIElement):
    (WTR::AccessibilityUIElement::verticalScrollbar):
    (WTR::AccessibilityUIElement::addNotificationListener):
    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
    
    LayoutTests: Accessibility: AccessibilityController should support listening to notifications on all elements.
    https://bugs.webkit.org/show_bug.cgi?id=72866
    
    Previously, the Mac implementation of AccessibilityUIElement.addNotificationListener
    incorrectly triggered on notifications from all elements. Now it only triggers on
    notifications from the correct element, and a new addNotificationListener method
    in AccessibilityController can be used to trigger on notifications from all elements.
    
    Updates 2 tests that depended on the old incorrect behavior.
    
    Reviewed by Chris Fleizach.
    
    * accessibility/notification-listeners.html: Added.
    * platform/chromium/accessibility/notification-listeners-expected.txt: Added.
    * platform/gtk/Skipped:
    * platform/mac/accessibility/aria-expanded-notifications.html:
    * platform/mac/accessibility/aria-listbox-selectedchildren-change.html:
    * platform/mac/accessibility/notification-listeners-expected.txt: Added.
    * platform/win/Skipped:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@102378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    1851ba03
project.pbxproj 52.7 KB