Title: [273869] trunk
Revision
273869
Author
andresg...@apple.com
Date
2021-03-03 18:31:17 -0800 (Wed, 03 Mar 2021)

Log Message

Replace the multiple WebAccessibilityObjectWrapperIOS postXXXNotification methods with a single postNotification method.
https://bugs.webkit.org/show_bug.cgi?id=221707

Reviewed by Chris Fleizach.

Source/WebCore:

Instead of having a postXXXNotification method per notification in the
iOS WebAccessibilitObjectWrapper implementation, we now have a single
method that takes the name of the notification. This cleans up the
existing notification posting code and simplifies adding new notifications.

* accessibility/AXLogger.cpp:
(WebCore::operator<<): Added a new notification constant AXPageScrolled.
* accessibility/AXObjectCache.h:
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::notificationPlatformName):
Handles all notifications used on iOS.
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityScroll:]):
Uses the helper AXObjectCache::notificationPlatformName to get page scrolled notification name.
(-[WebAccessibilityObjectWrapper postFocusChangeNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postSelectedTextChangeNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postLayoutChangeNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postLiveRegionChangeNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postLiveRegionCreatedNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postLoadCompleteNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postChildrenChangedNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postInvalidStatusChangedNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postValueChangedNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postExpandedChangedNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postScrollStatusChangeNotification]): Deleted.
(-[WebAccessibilityObjectWrapper postCurrentStateChangedNotification]): Deleted.

LayoutTests:

The name of the notification is now "AXPageScrolled". Adjusted the script
and the expected output accordingly.

* accessibility/ios-simulator/scroll-in-overflow-div-expected.txt:
* accessibility/ios-simulator/scroll-in-overflow-div.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273868 => 273869)


--- trunk/LayoutTests/ChangeLog	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/LayoutTests/ChangeLog	2021-03-04 02:31:17 UTC (rev 273869)
@@ -1,3 +1,16 @@
+2021-03-03  Andres Gonzalez  <andresg...@apple.com>
+
+        Replace the multiple WebAccessibilityObjectWrapperIOS postXXXNotification methods with a single postNotification method.
+        https://bugs.webkit.org/show_bug.cgi?id=221707
+
+        Reviewed by Chris Fleizach.
+
+        The name of the notification is now "AXPageScrolled". Adjusted the script
+        and the expected output accordingly.
+
+        * accessibility/ios-simulator/scroll-in-overflow-div-expected.txt:
+        * accessibility/ios-simulator/scroll-in-overflow-div.html:
+
 2021-03-03  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: `RecordCanvasActionVariant` causes a huge symbol to be created in WebCore

Modified: trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div-expected.txt (273868 => 273869)


--- trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div-expected.txt	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div-expected.txt	2021-03-04 02:31:17 UTC (rev 273869)
@@ -3,43 +3,43 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-AXScrollByPage received: data: AXScroll [position: 0.00 220.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 220.00]
 scroll down 0 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 440.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 440.00]
 scroll down 1 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 660.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 660.00]
 scroll down 2 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 716.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 716.00]
 scroll down 3 : success true
 scroll down 4 : success false
-AXScrollByPage received: data: AXScroll [position: 0.00 496.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 496.00]
 scroll up 0 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 276.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 276.00]
 scroll up 1 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 56.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 56.00]
 scroll up 2 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 0.00]
 scroll up 3 : success true
 scroll up 4 : success false
-AXScrollByPage received: data: AXScroll [position: 420.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 420.00 0.00]
 scroll left 0 : success true
-AXScrollByPage received: data: AXScroll [position: 840.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 840.00 0.00]
 scroll left 1 : success true
-AXScrollByPage received: data: AXScroll [position: 1260.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 1260.00 0.00]
 scroll left 2 : success true
-AXScrollByPage received: data: AXScroll [position: 1680.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 1680.00 0.00]
 scroll left 3 : success true
-AXScrollByPage received: data: AXScroll [position: 2100.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 2100.00 0.00]
 scroll left 4 : success true
-AXScrollByPage received: data: AXScroll [position: 1680.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 1680.00 0.00]
 scroll right 0 : success true
-AXScrollByPage received: data: AXScroll [position: 1260.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 1260.00 0.00]
 scroll right 1 : success true
-AXScrollByPage received: data: AXScroll [position: 840.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 840.00 0.00]
 scroll right 2 : success true
-AXScrollByPage received: data: AXScroll [position: 420.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 420.00 0.00]
 scroll right 3 : success true
-AXScrollByPage received: data: AXScroll [position: 0.00 0.00]
+AXPageScrolled received: data: AXScroll [position: 0.00 0.00]
 scroll right 4 : success true
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div.html (273868 => 273869)


--- trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div.html	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div.html	2021-03-04 02:31:17 UTC (rev 273869)
@@ -74,7 +74,7 @@
     window.jsTestIsAsync = true;
     function focusCallback(element, notification, info) {
 
-        if (notification == "AXScrollByPage") {
+        if (notification == "AXPageScrolled") {
             debug(notification + " received: data: " + info.status);
         }
 

Modified: trunk/Source/WebCore/ChangeLog (273868 => 273869)


--- trunk/Source/WebCore/ChangeLog	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/ChangeLog	2021-03-04 02:31:17 UTC (rev 273869)
@@ -1,3 +1,39 @@
+2021-03-03  Andres Gonzalez  <andresg...@apple.com>
+
+        Replace the multiple WebAccessibilityObjectWrapperIOS postXXXNotification methods with a single postNotification method.
+        https://bugs.webkit.org/show_bug.cgi?id=221707
+
+        Reviewed by Chris Fleizach.
+
+        Instead of having a postXXXNotification method per notification in the
+        iOS WebAccessibilitObjectWrapper implementation, we now have a single
+        method that takes the name of the notification. This cleans up the
+        existing notification posting code and simplifies adding new notifications.
+
+        * accessibility/AXLogger.cpp:
+        (WebCore::operator<<): Added a new notification constant AXPageScrolled.
+        * accessibility/AXObjectCache.h:
+        * accessibility/ios/AXObjectCacheIOS.mm:
+        (WebCore::AXObjectCache::notificationPlatformName):
+        Handles all notifications used on iOS.
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityScroll:]):
+        Uses the helper AXObjectCache::notificationPlatformName to get page scrolled notification name.
+        (-[WebAccessibilityObjectWrapper postFocusChangeNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postSelectedTextChangeNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postLayoutChangeNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postLiveRegionChangeNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postLiveRegionCreatedNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postLoadCompleteNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postChildrenChangedNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postInvalidStatusChangedNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postValueChangedNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postExpandedChangedNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postScrollStatusChangeNotification]): Deleted.
+        (-[WebAccessibilityObjectWrapper postCurrentStateChangedNotification]): Deleted.
+
 2021-03-03  Julian Gonzalez  <julian_a_gonza...@apple.com>
 
         Crash in removeSymbolElementsFromSubtree()

Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (273868 => 273869)


--- trunk/Source/WebCore/accessibility/AXLogger.cpp	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp	2021-03-04 02:31:17 UTC (rev 273869)
@@ -384,6 +384,9 @@
     case AXObjectCache::AXNotification::AXNewDocumentLoadComplete:
         stream << "AXNewDocumentLoadComplete";
         break;
+    case AXObjectCache::AXNotification::AXPageScrolled:
+        stream << "AXPageScrolled";
+        break;
     case AXObjectCache::AXNotification::AXSelectedChildrenChanged:
         stream << "AXSelectedChildrenChanged";
         break;

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (273868 => 273869)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2021-03-04 02:31:17 UTC (rev 273869)
@@ -287,6 +287,7 @@
         AXLayoutComplete,
         AXLoadComplete,
         AXNewDocumentLoadComplete,
+        AXPageScrolled,
         AXSelectedChildrenChanged,
         AXSelectedTextChanged,
         AXValueChanged,
@@ -367,6 +368,8 @@
 
     Optional<SimpleRange> rangeMatchesTextNearRange(const SimpleRange&, const String&);
 
+    static String notificationPlatformName(AXNotification);
+
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
     WEBCORE_EXPORT static bool isIsolatedTreeEnabled();
     WEBCORE_EXPORT static bool usedOnAXThread();
@@ -383,7 +386,6 @@
 #endif
 
 protected:
-    static String notificationPlatformName(AXNotification);
     void postPlatformNotification(AXCoreObject*, AXNotification);
     void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
 

Modified: trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm (273868 => 273869)


--- trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm	2021-03-04 02:31:17 UTC (rev 273869)
@@ -51,77 +51,58 @@
     case AXFocusedUIElementChanged:
         name = "AXFocusChanged";
         break;
-    case AXCheckedStateChanged:
-    case AXValueChanged:
-        name = "AXValueChanged";
+    case AXPageScrolled:
+        name = "AXPageScrolled";
         break;
-    case AXCurrentStateChanged:
-        name = "AXCurrentStateChanged";
-        break;
-    case AXSortDirectionChanged:
-        name = "AXSortDirectionChanged";
-        break;
-    default:
-        break;
-    }
-
-    return name;
-}
-
-void AXObjectCache::postPlatformNotification(AXCoreObject* obj, AXNotification notification)
-{
-    if (!obj)
-        return;
-
-    String notificationName = AXObjectCache::notificationPlatformName(notification);
-    switch (notification) {
-    case AXActiveDescendantChanged:
-    case AXFocusedUIElementChanged:
-        [obj->wrapper() postFocusChangeNotification];
-        break;
     case AXSelectedTextChanged:
-        [obj->wrapper() postSelectedTextChangeNotification];
+        name = "AXSelectedTextChanged";
         break;
-    case AXLayoutComplete:
-        [obj->wrapper() postLayoutChangeNotification];
-        break;
     case AXLiveRegionChanged:
-        [obj->wrapper() postLiveRegionChangeNotification];
-        break;
     case AXLiveRegionCreated:
-        [obj->wrapper() postLiveRegionCreatedNotification];
+        name = "AXLiveRegionChanged";
         break;
-    case AXChildrenChanged:
-        [obj->wrapper() postChildrenChangedNotification];
-        break;
-    case AXLoadComplete:
-        [obj->wrapper() postLoadCompleteNotification];
-        break;
     case AXInvalidStatusChanged:
-        [obj->wrapper() postInvalidStatusChangedNotification];
+        name = "AXInvalidStatusChanged";
         break;
     case AXCheckedStateChanged:
     case AXValueChanged:
-        [obj->wrapper() postValueChangedNotification];
+        name = "AXValueChanged";
         break;
     case AXExpandedChanged:
-        [obj->wrapper() postExpandedChangedNotification];
+        name = "AXExpandedChanged";
         break;
     case AXCurrentStateChanged:
-        [obj->wrapper() postCurrentStateChangedNotification];
+        name = "AXCurrentStateChanged";
         break;
     case AXSortDirectionChanged:
-        [obj->wrapper() postNotification:notificationName];
+        name = "AXSortDirectionChanged";
         break;
     default:
         break;
     }
 
-    // Used by DRT to know when notifications are posted.
-    if (!notificationName.isEmpty())
-        [obj->wrapper() accessibilityPostedNotification:notificationName];
+    return name;
 }
 
+void AXObjectCache::postPlatformNotification(AXCoreObject* object, AXNotification notification)
+{
+    if (!object)
+        return;
+
+    // iOS notifications must ultimately call UIKit UIAccessibilityPostNotification.
+    // But WebCore is not linked with UIKit. So a workaround is to override the wrapper's
+    // postNotification method in the system WebKitAccessibility bundle that does link UIKit.
+    String notificationName = notificationPlatformName(notification);
+    if (notificationName.isEmpty())
+        return;
+
+    [object->wrapper() postNotification:notificationName];
+
+    // To simulate AX notifications for LayoutTests on the simulator, call
+    // the wrapper's accessibilityPostedNotification.
+    [object->wrapper() accessibilityPostedNotification:notificationName];
+}
+
 void AXObjectCache::postTextStateChangePlatformNotification(AXCoreObject* object, const AXTextStateChangeIntent&, const VisibleSelection&)
 {
     postPlatformNotification(object, AXSelectedTextChanged);

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h (273868 => 273869)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h	2021-03-04 02:31:17 UTC (rev 273869)
@@ -55,18 +55,6 @@
 
 - (BOOL)isAttachment;
 
-- (void)postFocusChangeNotification;
-- (void)postSelectedTextChangeNotification;
-- (void)postLayoutChangeNotification;
-- (void)postLiveRegionChangeNotification;
-- (void)postLoadCompleteNotification;
-- (void)postChildrenChangedNotification;
-- (void)postInvalidStatusChangedNotification;
-- (void)postLiveRegionCreatedNotification;
-- (void)postScrollStatusChangeNotification;
-- (void)postValueChangedNotification;
-- (void)postExpandedChangedNotification;
-- (void)postCurrentStateChangedNotification;
 - (void)postNotification:(NSString *)notificationName;
 @end
 

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (273868 => 273869)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-04 02:13:28 UTC (rev 273868)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-04 02:31:17 UTC (rev 273869)
@@ -1609,7 +1609,7 @@
 {
     if (![self _prepareAccessibilityCall])
         return NO;
-    
+
     AccessibilityObject::ScrollByPageDirection scrollDirection;
     switch (direction) {
     case UIAccessibilityScrollDirectionRight:
@@ -1629,15 +1629,16 @@
     }
 
     BOOL result = self.axBackingObject->scrollByPage(scrollDirection);
-    
+
     if (result) {
-        [self postScrollStatusChangeNotification];
+        String notificationName = AXObjectCache::notificationPlatformName(AXObjectCache::AXNotification::AXPageScrolled);
+        [self postNotification:notificationName];
 
         CGPoint scrollPos = [self _accessibilityScrollPosition];
         NSString *testString = [NSString stringWithFormat:@"AXScroll [position: %.2f %.2f]", scrollPos.x, scrollPos.y];
-        [self accessibilityPostedNotification:@"AXScrollByPage" userInfo:@{ @"status" : testString }];
+        [self accessibilityPostedNotification:notificationName userInfo:@{ @"status" : testString }];
     }
-    
+
     // This means that this object handled the scroll and no other ancestor should attempt scrolling.
     return result;
 }
@@ -1985,66 +1986,6 @@
     return nil;
 }
 
-- (void)postFocusChangeNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.
-}
-
-- (void)postSelectedTextChangeNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.    
-}
-
-- (void)postLayoutChangeNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.        
-}
-
-- (void)postLiveRegionChangeNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.    
-}
-
-- (void)postLiveRegionCreatedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.    
-}
-
-- (void)postLoadCompleteNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.    
-}
-
-- (void)postChildrenChangedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.    
-}
-
-- (void)postInvalidStatusChangedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.        
-}
-
-- (void)postValueChangedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.
-}
-
-- (void)postExpandedChangedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.
-}
-
-- (void)postScrollStatusChangeNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.
-}
-
-- (void)postCurrentStateChangedNotification
-{
-    // The UIKit accessibility wrapper will override and post appropriate notification.
-}
-
 - (void)postNotification:(NSString *)notificationName
 {
     // The UIKit accessibility wrapper will override and post appropriate notification.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to