Title: [273227] trunk
Revision
273227
Author
[email protected]
Date
2021-02-21 18:13:13 -0800 (Sun, 21 Feb 2021)

Log Message

Add [WebAccessibilityObjectWrapper textMarkerRangeForNSRange] to allow clients to efficiently get a TextMarkerRange from an NSRange.
https://bugs.webkit.org/show_bug.cgi?id=222154

Reviewed by Chris Fleizach and Darin Adler.

Source/WebCore:

Test: accessibility/mac/textmarker-range-for-range.html

Clients like VoiceOver often need the ability to convert a text range
into an accessibility TextMarkerRange.
This patch adds [WebAccessibilityObjectWrapper textMarkerRangeForNSRange]
to allow clients to efficiently perform this conversion.
This is the Mac implementation, iOS implementation is pending.

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::allowsTextRanges const):
* accessibility/AccessibilityObjectInterface.h:
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::textMarkerRangeForNSRange const):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::textMarkerRangeForNSRange const):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper textMarkerRangeForNSRange:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):
Only advance the CharacterIterator if not atEnd yet.

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::textMarkerRangeForRange):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::textMarkerRangeForRange):

LayoutTests:

* accessibility/mac/textmarker-range-for-range-expected.txt: Added.
* accessibility/mac/textmarker-range-for-range.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273226 => 273227)


--- trunk/LayoutTests/ChangeLog	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/LayoutTests/ChangeLog	2021-02-22 02:13:13 UTC (rev 273227)
@@ -1,3 +1,13 @@
+2021-02-21  Andres Gonzalez  <[email protected]>
+
+        Add [WebAccessibilityObjectWrapper textMarkerRangeForNSRange] to allow clients to efficiently get a TextMarkerRange from an NSRange.
+        https://bugs.webkit.org/show_bug.cgi?id=222154
+
+        Reviewed by Chris Fleizach and Darin Adler.
+
+        * accessibility/mac/textmarker-range-for-range-expected.txt: Added.
+        * accessibility/mac/textmarker-range-for-range.html: Added.
+
 2021-02-20  Chris Fleizach  <[email protected]>
 
         AX: Image should report the embedded accessibility description if available

Added: trunk/LayoutTests/accessibility/mac/textmarker-range-for-range-expected.txt (0 => 273227)


--- trunk/LayoutTests/accessibility/mac/textmarker-range-for-range-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/textmarker-range-for-range-expected.txt	2021-02-22 02:13:13 UTC (rev 273227)
@@ -0,0 +1,297 @@
+Think different Apple
+
+bold italic
+underline last!
+
+Hello World!
+This test that textMarkerRangeForRange works properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+content length: 65
+All ranges from index 0 to each character in the text:
+0
+''
+1
+'T'
+2
+'Th'
+3
+'Thi'
+4
+'Thin'
+5
+'Think'
+6
+'Think '
+7
+'Think d'
+8
+'Think di'
+9
+'Think dif'
+10
+'Think diff'
+11
+'Think diffe'
+12
+'Think differ'
+13
+'Think differe'
+14
+'Think differen'
+15
+'Think different'
+16
+'Think different '
+17
+'Think different A'
+18
+'Think different Ap'
+19
+'Think different App'
+20
+'Think different Appl'
+21
+'Think different Apple'
+22
+'Think different Apple'
+23
+'Think different Apple
+
+'
+24
+'Think different Apple
+
+b'
+25
+'Think different Apple
+
+bo'
+26
+'Think different Apple
+
+bol'
+27
+'Think different Apple
+
+bold'
+28
+'Think different Apple
+
+bold '
+29
+'Think different Apple
+
+bold i'
+30
+'Think different Apple
+
+bold it'
+31
+'Think different Apple
+
+bold ita'
+32
+'Think different Apple
+
+bold ital'
+33
+'Think different Apple
+
+bold itali'
+34
+'Think different Apple
+
+bold italic'
+35
+'Think different Apple
+
+bold italic
+'
+36
+'Think different Apple
+
+bold italic
+u'
+37
+'Think different Apple
+
+bold italic
+un'
+38
+'Think different Apple
+
+bold italic
+und'
+39
+'Think different Apple
+
+bold italic
+unde'
+40
+'Think different Apple
+
+bold italic
+under'
+41
+'Think different Apple
+
+bold italic
+underl'
+42
+'Think different Apple
+
+bold italic
+underli'
+43
+'Think different Apple
+
+bold italic
+underlin'
+44
+'Think different Apple
+
+bold italic
+underline'
+45
+'Think different Apple
+
+bold italic
+underline '
+46
+'Think different Apple
+
+bold italic
+underline l'
+47
+'Think different Apple
+
+bold italic
+underline la'
+48
+'Think different Apple
+
+bold italic
+underline las'
+49
+'Think different Apple
+
+bold italic
+underline last'
+50
+'Think different Apple
+
+bold italic
+underline last!'
+51
+'Think different Apple
+
+bold italic
+underline last!'
+52
+'Think different Apple
+
+bold italic
+underline last!
+
+'
+53
+'Think different Apple
+
+bold italic
+underline last!
+
+H'
+54
+'Think different Apple
+
+bold italic
+underline last!
+
+He'
+55
+'Think different Apple
+
+bold italic
+underline last!
+
+Hel'
+56
+'Think different Apple
+
+bold italic
+underline last!
+
+Hell'
+57
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello'
+58
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello '
+59
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello W'
+60
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello Wo'
+61
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello Wor'
+62
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello Worl'
+63
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello World'
+64
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello World!'
+Get the range for the word Apple:
+'Apple'
+Out of range values:
+'Think different Apple
+
+bold italic
+underline last!
+
+Hello World!'
+''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/textmarker-range-for-range.html (0 => 273227)


--- trunk/LayoutTests/accessibility/mac/textmarker-range-for-range.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/textmarker-range-for-range.html	2021-02-22 02:13:13 UTC (rev 273227)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="content" role="group">
+    <p>Think <em>different</em> <a href=""
+    <p><b>bold</b> <i>italic</i><br><u>underline</u> <em>last!</em></p>
+    <button>Hello World!</button>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This test that textMarkerRangeForRange works properly.");
+
+    if (window.accessibilityController) {
+        axElement = accessibilityController.accessibleElementById("content");
+        contentTextMarkerRange = axElement.textMarkerRangeForElement(axElement);
+        textLength = axElement.stringForTextMarkerRange(contentTextMarkerRange).length;
+        debug("content length: " + textLength);
+
+        debug("All ranges from index 0 to each character in the text:");
+        for (i = 0; i < textLength; ++i) {
+            debug(i);
+            textMarkerRange = axElement.textMarkerRangeForRange(0, i);
+            debug("'" + axElement.stringForTextMarkerRange(textMarkerRange) + "'");
+        }
+
+        debug("Get the range for the word Apple:");
+        textMarkerRange = axElement.textMarkerRangeForRange(16, 5);
+        debug("'" + axElement.stringForTextMarkerRange(textMarkerRange) + "'");
+
+        debug("Out of range values:");
+        textMarkerRange = axElement.textMarkerRangeForRange(0, 100);
+        debug("'" + axElement.stringForTextMarkerRange(textMarkerRange) + "'");
+        textMarkerRange = axElement.textMarkerRangeForRange(70, 100);
+        debug("'" + axElement.stringForTextMarkerRange(textMarkerRange) + "'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (273226 => 273227)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-02-22 02:13:13 UTC (rev 273227)
@@ -966,6 +966,7 @@
 webkit.org/b/210198 webgl/2.0.0/conformance2/attribs/gl-vertexattribipointer.html [ Slow ]
 
 webkit.org/b/208477 accessibility/mac/text-marker-for-index.html [ Skip ]
+accessibility/mac/textmarker-range-for-range.html [ Skip ]
 accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
 accessibility/aria-current-state-changed-notification.html [ Skip ]
 accessibility/aria-current.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (273226 => 273227)


--- trunk/Source/WebCore/ChangeLog	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/ChangeLog	2021-02-22 02:13:13 UTC (rev 273227)
@@ -1,3 +1,33 @@
+2021-02-21  Andres Gonzalez  <[email protected]>
+
+        Add [WebAccessibilityObjectWrapper textMarkerRangeForNSRange] to allow clients to efficiently get a TextMarkerRange from an NSRange.
+        https://bugs.webkit.org/show_bug.cgi?id=222154
+
+        Reviewed by Chris Fleizach and Darin Adler.
+
+        Test: accessibility/mac/textmarker-range-for-range.html
+
+        Clients like VoiceOver often need the ability to convert a text range
+        into an accessibility TextMarkerRange.
+        This patch adds [WebAccessibilityObjectWrapper textMarkerRangeForNSRange]
+        to allow clients to efficiently perform this conversion.
+        This is the Mac implementation, iOS implementation is pending.
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::allowsTextRanges const):
+        * accessibility/AccessibilityObjectInterface.h:
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
+        (WebCore::AXIsolatedObject::textMarkerRangeForNSRange const):
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::textMarkerRangeForNSRange const):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper textMarkerRangeForNSRange:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+        * editing/Editing.cpp:
+        (WebCore::visiblePositionForIndexUsingCharacterIterator):
+        Only advance the CharacterIterator if not atEnd yet.
+
 2021-02-21  Keith Miller  <[email protected]>
 
         Implement the Top-level await proposal

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (273226 => 273227)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-02-22 02:13:13 UTC (rev 273227)
@@ -540,6 +540,9 @@
     VisiblePositionRange lineRangeForPosition(const VisiblePosition&) const override;
 
     Optional<SimpleRange> rangeForPlainTextRange(const PlainTextRange&) const override;
+#if PLATFORM(MAC)
+    AXTextMarkerRangeRef textMarkerRangeForNSRange(const NSRange&) const override;
+#endif
 
     static String stringForVisiblePositionRange(const VisiblePositionRange&);
     String stringForRange(const SimpleRange&) const override;
@@ -824,7 +827,7 @@
 #endif
 
 #if !(ENABLE(ACCESSIBILITY) && USE(ATK))
-inline bool AccessibilityObject::allowsTextRanges() const { return isTextControl(); }
+inline bool AccessibilityObject::allowsTextRanges() const { return true; }
 inline unsigned AccessibilityObject::getLengthForTextRange() const { return text().length(); }
 #endif
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (273226 => 273227)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-02-22 02:13:13 UTC (rev 273227)
@@ -49,6 +49,8 @@
 OBJC_CLASS WebAccessibilityObjectWrapper;
 typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
 typedef struct _NSRange NSRange;
+typedef const struct __AXTextMarker* AXTextMarkerRef;
+typedef const struct __AXTextMarkerRange* AXTextMarkerRangeRef;
 #elif USE(ATK)
 typedef struct _WebKitAccessible WebKitAccessible;
 typedef struct _WebKitAccessible AccessibilityObjectWrapper;
@@ -1275,6 +1277,10 @@
     virtual VisiblePositionRange lineRangeForPosition(const VisiblePosition&) const = 0;
 
     virtual Optional<SimpleRange> rangeForPlainTextRange(const PlainTextRange&) const = 0;
+#if PLATFORM(MAC)
+    // FIXME: make this a COCOA method.
+    virtual AXTextMarkerRangeRef textMarkerRangeForNSRange(const NSRange&) const = 0;
+#endif
 
     virtual String stringForRange(const SimpleRange&) const = 0;
     virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const = 0;

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (273226 => 273227)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-02-22 02:13:13 UTC (rev 273227)
@@ -403,6 +403,9 @@
     VisiblePositionRange visiblePositionRangeForRange(const PlainTextRange&) const override;
     VisiblePositionRange lineRangeForPosition(const VisiblePosition&) const override;
     Optional<SimpleRange> rangeForPlainTextRange(const PlainTextRange&) const override;
+#if PLATFORM(MAC)
+    AXTextMarkerRangeRef textMarkerRangeForNSRange(const NSRange&) const override;
+#endif
     String stringForRange(const SimpleRange&) const override;
     IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const override;
     IntRect boundsForRange(const SimpleRange&) const override;

Modified: trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm (273226 => 273227)


--- trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm	2021-02-22 02:13:13 UTC (rev 273227)
@@ -59,6 +59,14 @@
     [wrapper() detachIsolatedObject:detachmentType];
 }
 
+AXTextMarkerRangeRef AXIsolatedObject::textMarkerRangeForNSRange(const NSRange& range) const
+{
+    return Accessibility::retrieveValueFromMainThread<AXTextMarkerRangeRef>([&range, this] () -> AXTextMarkerRangeRef {
+        auto* axObject = associatedAXObject();
+        return axObject ? axObject->textMarkerRangeForNSRange(range) : nullptr;
+    });
+}
+
 } // WebCore
 
 #endif // ENABLE(ACCESSIBILITY_ISOLATED_TREE) && PLATFORM(MAC)

Modified: trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm (273226 => 273227)


--- trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm	2021-02-22 02:13:13 UTC (rev 273227)
@@ -280,6 +280,13 @@
     return String();
 }
 
+AXTextMarkerRangeRef AccessibilityObject::textMarkerRangeForNSRange(const NSRange& range) const
+{
+    return textMarkerRangeFromVisiblePositions(axObjectCache(),
+        visiblePositionForIndex(range.location),
+        visiblePositionForIndex(range.location + range.length));
+}
+
 namespace Accessibility {
 
 PlatformRoleMap createPlatformRoleMap()

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (273226 => 273227)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-02-22 02:13:13 UTC (rev 273227)
@@ -3478,6 +3478,12 @@
     });
 }
 
+- (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
 {
@@ -4022,15 +4028,14 @@
             auto* backingObject = protectedSelf.get().axBackingObject;
             if (!backingObject)
                 return CGRectZero;
-            auto* cache = backingObject->axObjectCache();
-            if (!cache)
+
+            auto start = backingObject->visiblePositionForIndex(range.location);
+            auto end = backingObject->visiblePositionForIndex(range.location + range.length);
+            auto webRange = makeSimpleRange({ start, end });
+            if (!webRange)
                 return CGRectZero;
-            CharacterOffset start = cache->characterOffsetForIndex(range.location, backingObject);
-            CharacterOffset end = cache->characterOffsetForIndex(range.location+range.length, backingObject);
-            auto range = cache->rangeForUnorderedCharacterOffsets(start, end);
-            if (!range)
-                return CGRectZero;
-            auto bounds = FloatRect(backingObject->boundsForRange(*range));
+
+            auto bounds = FloatRect(backingObject->boundsForRange(*webRange));
             return [protectedSelf convertRectToSpace:bounds space:AccessibilityConversionSpace::Screen];
         });
         return [NSValue valueWithRect:rect];

Modified: trunk/Source/WebCore/editing/Editing.cpp (273226 => 273227)


--- trunk/Source/WebCore/editing/Editing.cpp	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Source/WebCore/editing/Editing.cpp	2021-02-22 02:13:13 UTC (rev 273227)
@@ -1101,7 +1101,8 @@
 
     auto range = makeRangeSelectingNodeContents(node);
     CharacterIterator it(range);
-    it.advance(index - 1);
+    if (!it.atEnd())
+        it.advance(index - 1);
 
     if (!it.atEnd() && it.text().length() == 1 && it.text()[0] == '\n') {
         // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines.

Modified: trunk/Tools/ChangeLog (273226 => 273227)


--- trunk/Tools/ChangeLog	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Tools/ChangeLog	2021-02-22 02:13:13 UTC (rev 273227)
@@ -1,3 +1,17 @@
+2021-02-21  Andres Gonzalez  <[email protected]>
+
+        Add [WebAccessibilityObjectWrapper textMarkerRangeForNSRange] to allow clients to efficiently get a TextMarkerRange from an NSRange.
+        https://bugs.webkit.org/show_bug.cgi?id=222154
+
+        Reviewed by Chris Fleizach and Darin Adler.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::textMarkerRangeForRange):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::textMarkerRangeForRange):
+
 2021-02-20  Chris Fleizach  <[email protected]>
 
         AX: Image should report the embedded accessibility description if available

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (273226 => 273227)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-02-22 02:13:13 UTC (rev 273227)
@@ -102,6 +102,7 @@
 #endif
 
 #if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY)
+RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForRange(unsigned, unsigned) { return nullptr; }
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; }
 void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (273226 => 273227)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-02-22 02:13:13 UTC (rev 273227)
@@ -303,6 +303,7 @@
     RefPtr<AccessibilityTextMarkerRange> misspellingTextMarkerRange(AccessibilityTextMarkerRange* start, bool forward);
     RefPtr<AccessibilityTextMarkerRange> textMarkerRangeForElement(AccessibilityUIElement*);
     RefPtr<AccessibilityTextMarkerRange> textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker);
+    RefPtr<AccessibilityTextMarkerRange> textMarkerRangeForRange(unsigned location, unsigned length);
     RefPtr<AccessibilityTextMarkerRange> selectedTextMarkerRange();
     void resetSelectedTextMarkerRange();
     bool replaceTextInRange(JSStringRef, int position, int length);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (273226 => 273227)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-02-22 02:13:13 UTC (rev 273227)
@@ -220,6 +220,7 @@
     AccessibilityTextMarkerRange misspellingTextMarkerRange(AccessibilityTextMarkerRange start, boolean forward);
     AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element);
     AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);
+    AccessibilityTextMarkerRange textMarkerRangeForRange(unsigned long location, unsigned long length);
     AccessibilityTextMarkerRange selectedTextMarkerRange();
     undefined resetSelectedTextMarkerRange();
     boolean replaceTextInRange(DOMString string, long position, long length);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (273226 => 273227)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-22 01:04:24 UTC (rev 273226)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-22 02:13:13 UTC (rev 273227)
@@ -83,6 +83,7 @@
 - (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;
@@ -1824,6 +1825,15 @@
     return nullptr;
 }
 
+RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForRange(unsigned location, unsigned length)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    return AccessibilityTextMarkerRange::create([m_element textMarkerRangeForNSRange:NSMakeRange(location, length)]);
+    END_AX_OBJC_EXCEPTIONS
+
+    return nullptr;
+}
+
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to