Title: [285872] trunk
- Revision
- 285872
- Author
- [email protected]
- Date
- 2021-11-16 10:14:09 -0800 (Tue, 16 Nov 2021)
Log Message
Fix for accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=233160
<rdar://problem/85436385>
Reviewed by Chris Fleizach.
Source/WebCore:
Test: accessibility/mac/replace-text-with-range-on-webarea-element.html
The replacement and insertion text string is now properly isolatedCopied
in the AXIsolatedObject method instead of in the wrapper.
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::replaceTextInRange):
(WebCore::AXIsolatedObject::insertText):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
(-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
Tools:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::stringValue):
(WTR::AccessibilityUIElement::replaceTextInRange):
Dispatches to the AX thread the call to the wrapper's
[accessibilityReplaceRange withText:] method.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285871 => 285872)
--- trunk/Source/WebCore/ChangeLog 2021-11-16 17:47:29 UTC (rev 285871)
+++ trunk/Source/WebCore/ChangeLog 2021-11-16 18:14:09 UTC (rev 285872)
@@ -1,3 +1,23 @@
+2021-11-16 Andres Gonzalez <[email protected]>
+
+ Fix for accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=233160
+ <rdar://problem/85436385>
+
+ Reviewed by Chris Fleizach.
+
+ Test: accessibility/mac/replace-text-with-range-on-webarea-element.html
+
+ The replacement and insertion text string is now properly isolatedCopied
+ in the AXIsolatedObject method instead of in the wrapper.
+
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::replaceTextInRange):
+ (WebCore::AXIsolatedObject::insertText):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
+ (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
+
2021-11-16 Youenn Fablet <[email protected]>
Remove unused Xcode references to ServiceWorkerGlobalScopePushAPI files
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (285871 => 285872)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2021-11-16 17:47:29 UTC (rev 285871)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2021-11-16 18:14:09 UTC (rev 285872)
@@ -1196,9 +1196,9 @@
bool AXIsolatedObject::replaceTextInRange(const String& replacementText, const PlainTextRange& textRange)
{
- return Accessibility::retrieveValueFromMainThread<bool>([&replacementText, &textRange, this] () -> bool {
+ return Accessibility::retrieveValueFromMainThread<bool>([text = replacementText.isolatedCopy(), &textRange, this] () -> bool {
if (auto* axObject = associatedAXObject())
- return axObject->replaceTextInRange(replacementText, textRange);
+ return axObject->replaceTextInRange(text, textRange);
return false;
});
}
@@ -1205,7 +1205,7 @@
bool AXIsolatedObject::insertText(const String& text)
{
- return Accessibility::retrieveValueFromMainThread<bool>([&text, this] () -> bool {
+ return Accessibility::retrieveValueFromMainThread<bool>([text = text.isolatedCopy(), this] () -> bool {
if (auto* axObject = associatedAXObject())
return axObject->insertText(text);
return false;
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (285871 => 285872)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2021-11-16 17:47:29 UTC (rev 285871)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2021-11-16 18:14:09 UTC (rev 285872)
@@ -3277,19 +3277,13 @@
- (BOOL)accessibilityReplaceRange:(NSRange)range withText:(NSString *)string
{
auto* backingObject = self.updateObjectBackingStore;
- if (!backingObject)
- return NO;
-
- return backingObject->replaceTextInRange(String(string).isolatedCopy(), PlainTextRange(range));
+ return backingObject ? backingObject->replaceTextInRange(String(string), PlainTextRange(range)) : NO;
}
- (BOOL)accessibilityInsertText:(NSString *)text
{
auto* backingObject = self.updateObjectBackingStore;
- if (!backingObject)
- return NO;
-
- return backingObject->insertText(String(text).isolatedCopy());
+ return backingObject ? backingObject->insertText(String(text)) : NO;
}
ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
Modified: trunk/Tools/ChangeLog (285871 => 285872)
--- trunk/Tools/ChangeLog 2021-11-16 17:47:29 UTC (rev 285871)
+++ trunk/Tools/ChangeLog 2021-11-16 18:14:09 UTC (rev 285872)
@@ -1,3 +1,17 @@
+2021-11-16 Andres Gonzalez <[email protected]>
+
+ Fix for accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
+ https://bugs.webkit.org/show_bug.cgi?id=233160
+ <rdar://problem/85436385>
+
+ Reviewed by Chris Fleizach.
+
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::stringValue):
+ (WTR::AccessibilityUIElement::replaceTextInRange):
+ Dispatches to the AX thread the call to the wrapper's
+ [accessibilityReplaceRange withText:] method.
+
2021-11-16 Brady Eidson <[email protected]>
Enable webpushd tests in the iOS simulator.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (285871 => 285872)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-11-16 17:47:29 UTC (rev 285871)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2021-11-16 18:14:09 UTC (rev 285872)
@@ -766,7 +766,8 @@
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringValue()
{
BEGIN_AX_OBJC_EXCEPTIONS
- NSString *description = descriptionOfValue(attributeValue(NSAccessibilityValueAttribute).get());
+ auto value = attributeValue(NSAccessibilityValueAttribute);
+ NSString *description = descriptionOfValue(value.get());
if (description)
return concatenateAttributeAndValue(@"AXValue", description);
END_AX_OBJC_EXCEPTIONS
@@ -2030,10 +2031,15 @@
bool AccessibilityUIElement::replaceTextInRange(JSStringRef string, int location, int length)
{
+ bool result = false;
+
BEGIN_AX_OBJC_EXCEPTIONS
- return [m_element accessibilityReplaceRange:NSMakeRange(location, length) withText:[NSString stringWithJSStringRef:string]];
+ AccessibilityUIElement::s_controller->executeOnAXThreadAndWait([text = [NSString stringWithJSStringRef:string], range = NSMakeRange(location, length), this, &result] {
+ result = [m_element accessibilityReplaceRange:range withText:text];
+ });
END_AX_OBJC_EXCEPTIONS
- return false;
+
+ return result;
}
bool AccessibilityUIElement::insertText(JSStringRef text)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes