Title: [261687] trunk/Source/WebCore
Revision
261687
Author
andresg...@apple.com
Date
2020-05-14 05:44:28 -0700 (Thu, 14 May 2020)

Log Message

Replacing and inserting text need to be dispatched to the main thread.
https://bugs.webkit.org/show_bug.cgi?id=211863

Reviewed by Chris Fleizach.

Covered by existing tests.

In isolated tree mode WebAccessibilityObjectWrapper accessibilityReplaceRange
and InsertText may be called on the secondary thread. Thus the AXIsolatedObject
implementation of this functionality needs to forward these calls to the
associated AXObject on the main thread.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::replaceTextInRange):
(WebCore::AXIsolatedObject::insertText):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
(-[WebAccessibilityObjectWrapper accessibilityInsertText:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261686 => 261687)


--- trunk/Source/WebCore/ChangeLog	2020-05-14 12:31:01 UTC (rev 261686)
+++ trunk/Source/WebCore/ChangeLog	2020-05-14 12:44:28 UTC (rev 261687)
@@ -1,3 +1,24 @@
+2020-05-14  Andres Gonzalez  <andresg...@apple.com>
+
+        Replacing and inserting text need to be dispatched to the main thread.
+        https://bugs.webkit.org/show_bug.cgi?id=211863
+
+        Reviewed by Chris Fleizach.
+
+        Covered by existing tests.
+
+        In isolated tree mode WebAccessibilityObjectWrapper accessibilityReplaceRange
+        and InsertText may be called on the secondary thread. Thus the AXIsolatedObject
+        implementation of this functionality needs to forward these calls to the
+        associated AXObject on the main thread.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::replaceTextInRange):
+        (WebCore::AXIsolatedObject::insertText):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
+        (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
+
 2020-05-14  Antoine Quint  <grao...@apple.com>
 
         Cursor should not update on a 20ms timer

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (261686 => 261687)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-14 12:31:01 UTC (rev 261686)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-14 12:44:28 UTC (rev 261687)
@@ -927,16 +927,22 @@
     });
 }
 
-bool AXIsolatedObject::replaceTextInRange(const String&, const PlainTextRange&)
+bool AXIsolatedObject::replaceTextInRange(const String& replacementText, const PlainTextRange& textRange)
 {
-    ASSERT_NOT_REACHED();
-    return false;
+    return Accessibility::retrieveValueFromMainThread<bool>([&replacementText, &textRange, this] () -> bool {
+        if (auto* axObject = associatedAXObject())
+            return axObject->replaceTextInRange(replacementText, textRange);
+        return false;
+    });
 }
 
-bool AXIsolatedObject::insertText(const String&)
+bool AXIsolatedObject::insertText(const String& text)
 {
-    ASSERT_NOT_REACHED();
-    return false;
+    return Accessibility::retrieveValueFromMainThread<bool>([&text, this] () -> bool {
+        if (auto* axObject = associatedAXObject())
+            return axObject->insertText(text);
+        return false;
+    });
 }
 
 bool AXIsolatedObject::press()

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (261686 => 261687)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-05-14 12:31:01 UTC (rev 261686)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-05-14 12:44:28 UTC (rev 261687)
@@ -3472,7 +3472,7 @@
     if (!backingObject)
         return NO;
 
-    return backingObject->replaceTextInRange(string, PlainTextRange(range));
+    return backingObject->replaceTextInRange(String(string).isolatedCopy(), PlainTextRange(range));
 }
 
 - (BOOL)accessibilityInsertText:(NSString *)text
@@ -3481,7 +3481,7 @@
     if (!backingObject)
         return NO;
 
-    return backingObject->insertText(text);
+    return backingObject->insertText(String(text).isolatedCopy());
 }
 
 ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to