Diff
Modified: trunk/LayoutTests/ChangeLog (275424 => 275425)
--- trunk/LayoutTests/ChangeLog 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/LayoutTests/ChangeLog 2021-04-02 17:41:48 UTC (rev 275425)
@@ -1,3 +1,14 @@
+2021-04-02 Chris Fleizach <[email protected]>
+
+ AX: textRectsFromMarkers always fails
+ https://bugs.webkit.org/show_bug.cgi?id=223556
+ <rdar://74256003>
+
+ Reviewed by Zalan Bujtas.
+
+ * accessibility/ios-simulator/text-rects-for-range-matches-expected.txt: Added.
+ * accessibility/ios-simulator/text-rects-for-range-matches.html: Added.
+
2021-04-02 Chris Gambrell <[email protected]>
[LayoutTests] Convert http/tests/multipart convert PHP to Python
Added: trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches-expected.txt (0 => 275425)
--- trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches-expected.txt 2021-04-02 17:41:48 UTC (rev 275425)
@@ -0,0 +1,12 @@
+This is some testing content.
+This tests that we are able to get the rects for a range correctly with matching text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Rect for range should not be empty: width > 0: true
+Rect for range should not be empty: height > 0: true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches.html (0 => 275425)
--- trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches.html (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/text-rects-for-range-matches.html 2021-04-02 17:41:48 UTC (rev 275425)
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <script src=""
+ <body id="body" tabindex="0">
+ <div tabindex="0" id="text">
+ This is some testing content.
+ </div>
+
+ <p id="description"></p>
+ <div id="console"></div>
+
+ <script>
+
+ description("This tests that we are able to get the rects for a range correctly with matching text.");
+
+ if (window.accessibilityController) {
+ accessibilityController.enableEnhancedAccessibility(true);
+ var text = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+
+ var rectsForRange = text.rectsForTextMarkerRange(text.textMarkerRangeForElement(text), "testing");
+ var size = rectsForRange.match(/{[\d]+, [\d]+}, {([\d]+), ([\d]+)}/);
+ debug("Rect for range should not be empty: width > 0: " + (size[1] > 0));
+ debug("Rect for range should not be empty: height > 0: " + (size[2] > 0));
+ }
+
+ </script>
+
+ <script src=""
+
+ </body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (275424 => 275425)
--- trunk/Source/WebCore/ChangeLog 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Source/WebCore/ChangeLog 2021-04-02 17:41:48 UTC (rev 275425)
@@ -1,3 +1,19 @@
+2021-04-02 Chris Fleizach <[email protected]>
+
+ AX: textRectsFromMarkers always fails
+ https://bugs.webkit.org/show_bug.cgi?id=223556
+ <rdar://74256003>
+
+ Reviewed by Zalan Bujtas.
+
+ The textRectsFromMarkers:text: method is always failing to return a valid answer because when we try to extend
+ the search range of text to search, we're creating a range that can't be iterated with a CharacterIterator.
+
+ Test: accessibility/ios-simulator/text-rects-for-range-matches.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::rangeMatchesTextNearRange):
+
2021-04-02 Tyler Wilcock <[email protected]>
Non-unified build fixes, early April 2021
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (275424 => 275425)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2021-04-02 17:41:48 UTC (rev 275425)
@@ -2033,15 +2033,24 @@
Optional<SimpleRange> AXObjectCache::rangeMatchesTextNearRange(const SimpleRange& originalRange, const String& matchText)
{
- // Create a large enough range for searching the text within.
+ // Create a large enough range to find the text within it that's being searched for.
unsigned textLength = matchText.length();
- auto startPosition = visiblePositionForPositionWithOffset(makeContainerOffsetPosition(originalRange.start), -textLength);
- auto endPosition = visiblePositionForPositionWithOffset(makeContainerOffsetPosition(originalRange.start), 2 * textLength);
- if (startPosition.isNull())
- startPosition = firstPositionInOrBeforeNode(originalRange.start.container.ptr());
- if (endPosition.isNull())
- endPosition = lastPositionInOrAfterNode(originalRange.end.container.ptr());
+ auto startPosition = VisiblePosition(makeContainerOffsetPosition(originalRange.start));
+ for (unsigned k = 0; k < textLength; k++) {
+ auto testPosition = startPosition.previous();
+ if (testPosition.isNull())
+ break;
+ startPosition = testPosition;
+ }
+ auto endPosition = VisiblePosition(makeContainerOffsetPosition(originalRange.end));
+ for (unsigned k = 0; k < textLength; k++) {
+ auto testPosition = endPosition.next();
+ if (testPosition.isNull())
+ break;
+ endPosition = testPosition;
+ }
+
auto searchRange = makeSimpleRange(startPosition, endPosition);
if (!searchRange || searchRange->collapsed())
return WTF::nullopt;
Modified: trunk/Tools/ChangeLog (275424 => 275425)
--- trunk/Tools/ChangeLog 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/ChangeLog 2021-04-02 17:41:48 UTC (rev 275425)
@@ -1,3 +1,22 @@
+2021-04-02 Chris Fleizach <[email protected]>
+
+ AX: textRectsFromMarkers always fails
+ https://bugs.webkit.org/show_bug.cgi?id=223556
+ <rdar://74256003>
+
+ Reviewed by Zalan Bujtas.
+
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+ (WTR::AccessibilityUIElement::rectsForTextMarkerRange):
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (WTR::AccessibilityUIElement::rectsForTextMarkerRange):
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::rectsForTextMarkerRange):
+ * WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp:
+ (WTR::AccessibilityUIElement::rectsForTextMarkerRange):
+
2021-04-02 Youenn Fablet <[email protected]>
[MacOS] Enable NSURLSession WebSocket code path in WebKitTestRunner
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2021-04-02 17:41:48 UTC (rev 275425)
@@ -318,6 +318,7 @@
RefPtr<AccessibilityTextMarker> nextTextMarker(AccessibilityTextMarker*);
RefPtr<AccessibilityUIElement> accessibilityElementForTextMarker(AccessibilityTextMarker*);
JSRetainPtr<JSStringRef> stringForTextMarkerRange(AccessibilityTextMarkerRange*);
+ JSRetainPtr<JSStringRef> rectsForTextMarkerRange(AccessibilityTextMarkerRange*, JSStringRef);
JSRetainPtr<JSStringRef> attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*);
JSRetainPtr<JSStringRef> attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool);
int textMarkerRangeLength(AccessibilityTextMarkerRange*);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2021-04-02 17:41:48 UTC (rev 275425)
@@ -235,6 +235,7 @@
AccessibilityTextMarker nextTextMarker(AccessibilityTextMarker marker);
AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker marker);
DOMString stringForTextMarkerRange(AccessibilityTextMarkerRange range);
+ DOMString rectsForTextMarkerRange(AccessibilityTextMarkerRange range, DOMString searchText);
DOMString attributedStringForTextMarkerRange(AccessibilityTextMarkerRange range);
DOMString attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange range, boolean includeSpellCheck);
long textMarkerRangeLength(AccessibilityTextMarkerRange range);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2021-04-02 17:41:48 UTC (rev 275425)
@@ -2126,6 +2126,12 @@
return JSStringCreateWithCharacters(0, 0);
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::rectsForTextMarkerRange(AccessibilityTextMarkerRange* markerRange, JSStringRef searchText)
+{
+ // FIXME: implement
+ return JSStringCreateWithCharacters(0, 0);
+}
+
RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)
{
// FIXME: implement
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2021-04-02 17:41:48 UTC (rev 275425)
@@ -107,6 +107,7 @@
- (NSArray *)textMarkerRange;
- (NSInteger)lengthForTextMarkers:(NSArray *)textMarkers;
- (NSString *)stringForTextMarkers:(NSArray *)markers;
+- (NSArray *)textRectsFromMarkers:(NSArray *)markers withText:(NSString *)text;
- (id)startOrEndTextMarkerForTextMarkers:(NSArray*)textMarkers isStart:(BOOL)isStart;
- (NSArray *)textMarkerRangeForMarkers:(NSArray *)textMarkers;
- (NSInteger)positionForTextMarker:(id)marker;
@@ -1195,6 +1196,14 @@
return [[m_element stringForTextMarkers:textMarkers] createJSStringRef];
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::rectsForTextMarkerRange(AccessibilityTextMarkerRange* markerRange, JSStringRef text)
+{
+ id textMarkers = markerRange->platformTextMarkerRange();
+ if (![textMarkers isKindOfClass:[NSArray class]])
+ return createJSString();
+ return [[[m_element textRectsFromMarkers:textMarkers withText:[NSString stringWithJSStringRef:text]] componentsJoinedByString:@","] createJSStringRef];
+}
+
RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)
{
NSArray *textMarkers = @[startMarker->platformTextMarker(), endMarker->platformTextMarker()];
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-04-02 17:41:48 UTC (rev 275425)
@@ -1819,6 +1819,12 @@
return nullptr;
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::rectsForTextMarkerRange(AccessibilityTextMarkerRange*, JSStringRef)
+{
+ // Not implemented on macOS
+ return nullptr;
+}
+
RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)
{
BEGIN_AX_OBJC_EXCEPTIONS
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp (275424 => 275425)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp 2021-04-02 17:01:06 UTC (rev 275424)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp 2021-04-02 17:41:48 UTC (rev 275425)
@@ -814,6 +814,12 @@
return nullptr;
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::rectsForTextMarkerRange(AccessibilityTextMarkerRange*, JSStringRef)
+{
+ notImplemented();
+ return nullptr;
+}
+
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForTextMarkerRange(AccessibilityTextMarkerRange*)
{
notImplemented();