⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285872 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 10:14:09 AM (5 years ago)
Author:
Andres Gonzalez
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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285867 r285872  
     12021-11-16  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=233160
     5        <rdar://problem/85436385>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Test: accessibility/mac/replace-text-with-range-on-webarea-element.html
     10
     11        The replacement and insertion text string is now properly isolatedCopied
     12        in the AXIsolatedObject method instead of in the wrapper.
     13
     14        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     15        (WebCore::AXIsolatedObject::replaceTextInRange):
     16        (WebCore::AXIsolatedObject::insertText):
     17        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     18        (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
     19        (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
     20
    1212021-11-16  Youenn Fablet  <youenn@apple.com>
    222
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r285589 r285872  
    11971197bool AXIsolatedObject::replaceTextInRange(const String& replacementText, const PlainTextRange& textRange)
    11981198{
    1199     return Accessibility::retrieveValueFromMainThread<bool>([&replacementText, &textRange, this] () -> bool {
     1199    return Accessibility::retrieveValueFromMainThread<bool>([text = replacementText.isolatedCopy(), &textRange, this] () -> bool {
    12001200        if (auto* axObject = associatedAXObject())
    1201             return axObject->replaceTextInRange(replacementText, textRange);
     1201            return axObject->replaceTextInRange(text, textRange);
    12021202        return false;
    12031203    });
     
    12061206bool AXIsolatedObject::insertText(const String& text)
    12071207{
    1208     return Accessibility::retrieveValueFromMainThread<bool>([&text, this] () -> bool {
     1208    return Accessibility::retrieveValueFromMainThread<bool>([text = text.isolatedCopy(), this] () -> bool {
    12091209        if (auto* axObject = associatedAXObject())
    12101210            return axObject->insertText(text);
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r285589 r285872  
    32783278{
    32793279    auto* backingObject = self.updateObjectBackingStore;
    3280     if (!backingObject)
    3281         return NO;
    3282 
    3283     return backingObject->replaceTextInRange(String(string).isolatedCopy(), PlainTextRange(range));
     3280    return backingObject ? backingObject->replaceTextInRange(String(string), PlainTextRange(range)) : NO;
    32843281}
    32853282
     
    32873284{
    32883285    auto* backingObject = self.updateObjectBackingStore;
    3289     if (!backingObject)
    3290         return NO;
    3291 
    3292     return backingObject->insertText(String(text).isolatedCopy());
     3286    return backingObject ? backingObject->insertText(String(text)) : NO;
    32933287}
    32943288
  • trunk/Tools/ChangeLog

    r285870 r285872  
     12021-11-16  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=233160
     5        <rdar://problem/85436385>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     10        (WTR::AccessibilityUIElement::stringValue):
     11        (WTR::AccessibilityUIElement::replaceTextInRange):
     12        Dispatches to the AX thread the call to the wrapper's
     13        [accessibilityReplaceRange withText:] method.
     14
    1152021-11-16  Brady Eidson  <beidson@apple.com>
    216
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r285859 r285872  
    767767{
    768768    BEGIN_AX_OBJC_EXCEPTIONS
    769     NSString *description = descriptionOfValue(attributeValue(NSAccessibilityValueAttribute).get());
     769    auto value = attributeValue(NSAccessibilityValueAttribute);
     770    NSString *description = descriptionOfValue(value.get());
    770771    if (description)
    771772        return concatenateAttributeAndValue(@"AXValue", description);
     
    20312032bool AccessibilityUIElement::replaceTextInRange(JSStringRef string, int location, int length)
    20322033{
    2033     BEGIN_AX_OBJC_EXCEPTIONS
    2034     return [m_element accessibilityReplaceRange:NSMakeRange(location, length) withText:[NSString stringWithJSStringRef:string]];
    2035     END_AX_OBJC_EXCEPTIONS
    2036     return false;
     2034    bool result = false;
     2035
     2036    BEGIN_AX_OBJC_EXCEPTIONS
     2037    AccessibilityUIElement::s_controller->executeOnAXThreadAndWait([text = [NSString stringWithJSStringRef:string], range = NSMakeRange(location, length), this, &result] {
     2038        result = [m_element accessibilityReplaceRange:range withText:text];
     2039    });
     2040    END_AX_OBJC_EXCEPTIONS
     2041
     2042    return result;
    20372043}
    20382044
Note: See TracChangeset for help on using the changeset viewer.