Changeset 261687 in webkit


Ignore:
Timestamp:
May 14, 2020 5:44:28 AM (4 years ago)
Author:
Andres Gonzalez
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:]):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261686 r261687  
     12020-05-14  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Replacing and inserting text need to be dispatched to the main thread.
     4        https://bugs.webkit.org/show_bug.cgi?id=211863
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Covered by existing tests.
     9
     10        In isolated tree mode WebAccessibilityObjectWrapper accessibilityReplaceRange
     11        and InsertText may be called on the secondary thread. Thus the AXIsolatedObject
     12        implementation of this functionality needs to forward these calls to the
     13        associated AXObject on the main thread.
     14
     15        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     16        (WebCore::AXIsolatedObject::replaceTextInRange):
     17        (WebCore::AXIsolatedObject::insertText):
     18        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     19        (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
     20        (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
     21
    1222020-05-14  Antoine Quint  <graouts@apple.com>
    223
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r261644 r261687  
    928928}
    929929
    930 bool AXIsolatedObject::replaceTextInRange(const String&, const PlainTextRange&)
    931 {
    932     ASSERT_NOT_REACHED();
    933     return false;
    934 }
    935 
    936 bool AXIsolatedObject::insertText(const String&)
    937 {
    938     ASSERT_NOT_REACHED();
    939     return false;
     930bool AXIsolatedObject::replaceTextInRange(const String& replacementText, const PlainTextRange& textRange)
     931{
     932    return Accessibility::retrieveValueFromMainThread<bool>([&replacementText, &textRange, this] () -> bool {
     933        if (auto* axObject = associatedAXObject())
     934            return axObject->replaceTextInRange(replacementText, textRange);
     935        return false;
     936    });
     937}
     938
     939bool AXIsolatedObject::insertText(const String& text)
     940{
     941    return Accessibility::retrieveValueFromMainThread<bool>([&text, this] () -> bool {
     942        if (auto* axObject = associatedAXObject())
     943            return axObject->insertText(text);
     944        return false;
     945    });
    940946}
    941947
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r261653 r261687  
    34733473        return NO;
    34743474
    3475     return backingObject->replaceTextInRange(string, PlainTextRange(range));
     3475    return backingObject->replaceTextInRange(String(string).isolatedCopy(), PlainTextRange(range));
    34763476}
    34773477
     
    34823482        return NO;
    34833483
    3484     return backingObject->insertText(text);
     3484    return backingObject->insertText(String(text).isolatedCopy());
    34853485}
    34863486
Note: See TracChangeset for help on using the changeset viewer.