Title: [273583] trunk
Revision
273583
Author
andresg...@apple.com
Date
2021-02-26 13:02:38 -0800 (Fri, 26 Feb 2021)

Log Message

Add AXTextMarkerRangeForNSRange attribute so that Mac clients can access this functionality.
https://bugs.webkit.org/show_bug.cgi?id=222477
Source/WebCore:

<rdar://problem/74793445>

Reviewed by Chris Fleizach.

This is a follow up to: https://bugs.webkit.org/show_bug.cgi?id=222154.
As Chris Fleizach pointed out in the above review, it is necessary to
add a handler in accessibilityAttributeValue:forParameter: for a new AX
attribute in order for clients to access this functionality.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
(-[WebAccessibilityObjectWrapper textMarkerRangeForNSRange:]): Deleted.

Tools:

Reviewed by Chris Fleizach.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::textMarkerRangeForRange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273582 => 273583)


--- trunk/Source/WebCore/ChangeLog	2021-02-26 20:44:05 UTC (rev 273582)
+++ trunk/Source/WebCore/ChangeLog	2021-02-26 21:02:38 UTC (rev 273583)
@@ -1,3 +1,20 @@
+2021-02-26  Andres Gonzalez  <andresg...@apple.com>
+
+        Add AXTextMarkerRangeForNSRange attribute so that Mac clients can access this functionality.
+        https://bugs.webkit.org/show_bug.cgi?id=222477
+        <rdar://problem/74793445>
+
+        Reviewed by Chris Fleizach.
+
+        This is a follow up to: https://bugs.webkit.org/show_bug.cgi?id=222154.
+        As Chris Fleizach pointed out in the above review, it is necessary to
+        add a handler in accessibilityAttributeValue:forParameter: for a new AX
+        attribute in order for clients to access this functionality.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+        (-[WebAccessibilityObjectWrapper textMarkerRangeForNSRange:]): Deleted.
+
 2021-02-26  Jer Noble  <jer.no...@apple.com>
 
         [GPUP] Allow painting of GPUP hosted video from the WebContent process

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (273582 => 273583)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-02-26 20:44:05 UTC (rev 273582)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-02-26 21:02:38 UTC (rev 273583)
@@ -3452,12 +3452,6 @@
     });
 }
 
-- (AXTextMarkerRangeRef)textMarkerRangeForNSRange:(const NSRange&)range
-{
-    auto* backingObject = self.updateObjectBackingStore;
-    return backingObject ? backingObject->textMarkerRangeForNSRange(range) : nil;
-}
-
 // FIXME: No reason for this to be a method instead of a function; can get document from range.
 - (NSRange)_convertToNSRange:(const SimpleRange&)range
 {
@@ -3834,6 +3828,8 @@
         return convertToNSArray(results);
     }
 
+    // TextMarker attributes.
+
     if ([attribute isEqualToString:NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute]) {
         return Accessibility::retrieveAutoreleasedValueFromMainThread<id>([&rect, protectedSelf = retainPtr(self)] () -> RetainPtr<id> {
             auto* backingObject = protectedSelf.get().axBackingObject;
@@ -3868,6 +3864,10 @@
         });
     }
 
+    // TextMarkerRange attributes.
+    if ([attribute isEqualToString:@"AXTextMarkerRangeForNSRange"])
+        return (id)backingObject->textMarkerRangeForNSRange(range);
+
     if ([attribute isEqualToString:NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute])
         return (id)[self lineTextMarkerRangeForTextMarker:textMarker forUnit:TextUnit::Line];
 

Modified: trunk/Tools/ChangeLog (273582 => 273583)


--- trunk/Tools/ChangeLog	2021-02-26 20:44:05 UTC (rev 273582)
+++ trunk/Tools/ChangeLog	2021-02-26 21:02:38 UTC (rev 273583)
@@ -1,3 +1,13 @@
+2021-02-26  Andres Gonzalez  <andresg...@apple.com>
+
+        Add AXTextMarkerRangeForNSRange attribute so that Mac clients can access this functionality.
+        https://bugs.webkit.org/show_bug.cgi?id=222477
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::textMarkerRangeForRange):
+
 2021-02-26  Aakash Jain  <aakash_j...@apple.com>
 
         [ews] Commit queue should show commit identifier every time it updates local checkout

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (273582 => 273583)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-26 20:44:05 UTC (rev 273582)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-26 21:02:38 UTC (rev 273583)
@@ -83,7 +83,6 @@
 - (BOOL)isIsolatedObject;
 - (BOOL)accessibilityReplaceRange:(NSRange)range withText:(NSString *)string;
 - (BOOL)accessibilityInsertText:(NSString *)text;
-- (id)textMarkerRangeForNSRange:(const NSRange&)nsRange;
 - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
 - (NSUInteger)accessibilityIndexOfChild:(id)child;
 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
@@ -1828,7 +1827,8 @@
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForRange(unsigned location, unsigned length)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    return AccessibilityTextMarkerRange::create([m_element textMarkerRangeForNSRange:NSMakeRange(location, length)]);
+    return AccessibilityTextMarkerRange::create([m_element accessibilityAttributeValue:@"AXTextMarkerRangeForNSRange"
+        forParameter:[NSValue valueWithRange:NSMakeRange(location, length)]]);
     END_AX_OBJC_EXCEPTIONS
 
     return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to