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

Changeset 286102 in webkit


Ignore:
Timestamp:
Nov 21, 2021, 10:35:21 AM (5 years ago)
Author:
Andres Gonzalez
Message:

Dispatch all AccessibilityUIElement parameterized attribute requests to the AX thread for isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=233377
<rdar://problem/85613334>

Reviewed by Chris Fleizach.

To simulate AT client requests in isolated tree mode, all parameterized
attribute requests should be dispatched to the AX thread.
This patch adds AccessibilityUIElement::attributeValueForParameter that
does the appropriate dispatch to the AX thread.

  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

(WTR::attributeValue):
(WTR::AccessibilityUIElement::attributeValue const):
(WTR::AccessibilityUIElement::attributeValueForParameter const):
(WTR::AccessibilityUIElement::lineForIndex):
(WTR::AccessibilityUIElement::rangeForLine):
(WTR::AccessibilityUIElement::rangeForPosition):
(WTR::AccessibilityUIElement::boundsForRange):
(WTR::AccessibilityUIElement::stringForRange):
(WTR::AccessibilityUIElement::attributedStringForRange):
(WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled):
(WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
(WTR::AccessibilityUIElement::uiElementForSearchPredicate):
(WTR::AccessibilityUIElement::selectTextWithCriteria):
(WTR::AccessibilityUIElement::searchTextWithCriteria):
(WTR::AccessibilityUIElement::cellForColumnAndRow):
(WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker):
(WTR::AccessibilityUIElement::lineIndexForTextMarker const):
(WTR::AccessibilityUIElement::misspellingTextMarkerRange):
(WTR::AccessibilityUIElement::textMarkerRangeForElement):
(WTR::AccessibilityUIElement::textMarkerRangeLength):
(WTR::AccessibilityUIElement::previousTextMarker):
(WTR::AccessibilityUIElement::nextTextMarker):
(WTR::AccessibilityUIElement::stringForTextMarkerRange):
(WTR::AccessibilityUIElement::textMarkerRangeForMarkers):
(WTR::AccessibilityUIElement::textMarkerRangeForRange):
(WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange):
(WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange):
(WTR::AccessibilityUIElement::endTextMarkerForBounds):
(WTR::AccessibilityUIElement::startTextMarkerForBounds):
(WTR::AccessibilityUIElement::textMarkerForPoint):
(WTR::AccessibilityUIElement::accessibilityElementForTextMarker):
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRange):
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions):
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute):
(WTR::AccessibilityUIElement::indexForTextMarker):
(WTR::AccessibilityUIElement::isTextMarkerValid):
(WTR::AccessibilityUIElement::textMarkerForIndex):
(WTR::AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker):
(WTR::AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker):
(WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker):
(WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker):
(WTR::AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker):
(WTR::AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker):
(WTR::AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker):
(WTR::AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker):
(WTR::AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker):
(WTR::AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker):
(WTR::_convertMathMultiscriptPairsToString):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r286093 r286102  
     12021-11-21  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Dispatch all AccessibilityUIElement parameterized attribute requests to the AX thread for isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=233377
     5        <rdar://problem/85613334>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        To simulate AT client requests in isolated tree mode, all parameterized
     10        attribute requests should be dispatched to the AX thread.
     11        This patch adds AccessibilityUIElement::attributeValueForParameter that
     12        does the appropriate dispatch to the AX thread.
     13
     14        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
     15        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     16        (WTR::attributeValue):
     17        (WTR::AccessibilityUIElement::attributeValue const):
     18        (WTR::AccessibilityUIElement::attributeValueForParameter const):
     19        (WTR::AccessibilityUIElement::lineForIndex):
     20        (WTR::AccessibilityUIElement::rangeForLine):
     21        (WTR::AccessibilityUIElement::rangeForPosition):
     22        (WTR::AccessibilityUIElement::boundsForRange):
     23        (WTR::AccessibilityUIElement::stringForRange):
     24        (WTR::AccessibilityUIElement::attributedStringForRange):
     25        (WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled):
     26        (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
     27        (WTR::AccessibilityUIElement::uiElementForSearchPredicate):
     28        (WTR::AccessibilityUIElement::selectTextWithCriteria):
     29        (WTR::AccessibilityUIElement::searchTextWithCriteria):
     30        (WTR::AccessibilityUIElement::cellForColumnAndRow):
     31        (WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker):
     32        (WTR::AccessibilityUIElement::lineIndexForTextMarker const):
     33        (WTR::AccessibilityUIElement::misspellingTextMarkerRange):
     34        (WTR::AccessibilityUIElement::textMarkerRangeForElement):
     35        (WTR::AccessibilityUIElement::textMarkerRangeLength):
     36        (WTR::AccessibilityUIElement::previousTextMarker):
     37        (WTR::AccessibilityUIElement::nextTextMarker):
     38        (WTR::AccessibilityUIElement::stringForTextMarkerRange):
     39        (WTR::AccessibilityUIElement::textMarkerRangeForMarkers):
     40        (WTR::AccessibilityUIElement::textMarkerRangeForRange):
     41        (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
     42        (WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange):
     43        (WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange):
     44        (WTR::AccessibilityUIElement::endTextMarkerForBounds):
     45        (WTR::AccessibilityUIElement::startTextMarkerForBounds):
     46        (WTR::AccessibilityUIElement::textMarkerForPoint):
     47        (WTR::AccessibilityUIElement::accessibilityElementForTextMarker):
     48        (WTR::AccessibilityUIElement::attributedStringForTextMarkerRange):
     49        (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions):
     50        (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute):
     51        (WTR::AccessibilityUIElement::indexForTextMarker):
     52        (WTR::AccessibilityUIElement::isTextMarkerValid):
     53        (WTR::AccessibilityUIElement::textMarkerForIndex):
     54        (WTR::AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker):
     55        (WTR::AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker):
     56        (WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker):
     57        (WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker):
     58        (WTR::AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker):
     59        (WTR::AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker):
     60        (WTR::AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker):
     61        (WTR::AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker):
     62        (WTR::AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker):
     63        (WTR::AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker):
     64        (WTR::_convertMathMultiscriptPairsToString):
     65
    1662021-11-19  Carlos Garcia Campos  <cgarcia@igalia.com>
    267
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

    r285996 r286102  
    6565    // Helper functions that dispatch the corresponding AccessibilityObjectWrapper method to the AX secondary thread when appropriate.
    6666    friend RetainPtr<NSArray> supportedAttributes(id);
    67     friend RetainPtr<id> attributeValue(id, NSString *);
    6867    friend void setAttributeValue(id, NSString *, id, bool synchronous);
    6968#endif
     
    134133    bool boolAttributeValue(JSStringRef attribute);
    135134#if PLATFORM(MAC)
     135    RetainPtr<id> attributeValue(NSString *) const;
    136136    void attributeValueAsync(JSStringRef attribute, JSValueRef callback);
    137137#else
     
    402402
    403403#if PLATFORM(MAC)
    404     RetainPtr<id> attributeValue(NSString *) const;
     404    RetainPtr<id> attributeValueForParameter(NSString *, id) const;
    405405    NSString *descriptionOfValue(id valueObject) const;
    406406#endif
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r285872 r286102  
    140140}
    141141
    142 RetainPtr<id> attributeValue(id element, NSString *attribute)
    143 {
    144     RetainPtr<id> value;
    145 
    146     BEGIN_AX_OBJC_EXCEPTIONS
    147     AccessibilityUIElement::s_controller->executeOnAXThreadAndWait([&element, &attribute, &value] {
    148         // The given `element` may not respond to `accessibilityAttributeValue`, so first check to see if it responds to the attribute-specific selector.
    149         if ([attribute isEqual:NSAccessibilityChildrenAttribute] && [element respondsToSelector:@selector(accessibilityChildren)])
    150             value = [element accessibilityChildren];
    151         else if ([attribute isEqual:NSAccessibilityDescriptionAttribute] && [element respondsToSelector:@selector(accessibilityLabel)])
    152             value = [element accessibilityLabel];
    153         else if ([attribute isEqual:NSAccessibilityParentAttribute] && [element respondsToSelector:@selector(accessibilityParent)])
    154             value = [element accessibilityParent];
    155         else if ([attribute isEqual:NSAccessibilityRoleAttribute] && [element respondsToSelector:@selector(accessibilityRole)])
    156             value = [element accessibilityRole];
    157         else if ([attribute isEqual:NSAccessibilityValueAttribute] && [element respondsToSelector:@selector(accessibilityValue)])
    158             value = [element accessibilityValue];
    159         else if ([attribute isEqual:NSAccessibilityFocusedUIElementAttribute] && [element respondsToSelector:@selector(accessibilityFocusedUIElement)])
    160             value = [element accessibilityFocusedUIElement];
    161         else
    162             value = [element accessibilityAttributeValue:attribute];
    163     });
    164     END_AX_OBJC_EXCEPTIONS
    165 
    166     return value;
     142static id attributeValue(id element, NSString *attribute)
     143{
     144    // The given `element` may not respond to `accessibilityAttributeValue`, so first check to see if it responds to the attribute-specific selector.
     145    if ([attribute isEqual:NSAccessibilityChildrenAttribute] && [element respondsToSelector:@selector(accessibilityChildren)])
     146        return [element accessibilityChildren];
     147    if ([attribute isEqual:NSAccessibilityDescriptionAttribute] && [element respondsToSelector:@selector(accessibilityLabel)])
     148        return [element accessibilityLabel];
     149    if ([attribute isEqual:NSAccessibilityParentAttribute] && [element respondsToSelector:@selector(accessibilityParent)])
     150        return [element accessibilityParent];
     151    if ([attribute isEqual:NSAccessibilityRoleAttribute] && [element respondsToSelector:@selector(accessibilityRole)])
     152        return [element accessibilityRole];
     153    if ([attribute isEqual:NSAccessibilityValueAttribute] && [element respondsToSelector:@selector(accessibilityValue)])
     154        return [element accessibilityValue];
     155    if ([attribute isEqual:NSAccessibilityFocusedUIElementAttribute] && [element respondsToSelector:@selector(accessibilityFocusedUIElement)])
     156        return [element accessibilityFocusedUIElement];
     157
     158    return [element accessibilityAttributeValue:attribute];
    167159}
    168160
     
    316308}
    317309
    318 inline RetainPtr<id> AccessibilityUIElement::attributeValue(NSString *attributeName) const
    319 {
    320     return WTR::attributeValue(m_element.get(), attributeName);
     310RetainPtr<id> AccessibilityUIElement::attributeValue(NSString *attributeName) const
     311{
     312    RetainPtr<id> value;
     313
     314    BEGIN_AX_OBJC_EXCEPTIONS
     315    s_controller->executeOnAXThreadAndWait([this, &attributeName, &value] {
     316        value = WTR::attributeValue(m_element.get(), attributeName);
     317    });
     318    END_AX_OBJC_EXCEPTIONS
     319
     320    return value;
     321}
     322
     323RetainPtr<id> AccessibilityUIElement::attributeValueForParameter(NSString *attributeName, id parameter) const
     324{
     325    RetainPtr<id> value;
     326
     327    BEGIN_AX_OBJC_EXCEPTIONS
     328    s_controller->executeOnAXThreadAndWait([this, &attributeName, &parameter, &value] {
     329        value = [m_element accessibilityAttributeValue:attributeName forParameter:parameter];
     330    });
     331    END_AX_OBJC_EXCEPTIONS
     332
     333    return value;
    321334}
    322335
     
    11321145{
    11331146    BEGIN_AX_OBJC_EXCEPTIONS
    1134     id value = [m_element accessibilityAttributeValue:NSAccessibilityLineForIndexParameterizedAttribute forParameter:@(index)];
     1147    auto value = attributeValueForParameter(NSAccessibilityLineForIndexParameterizedAttribute, @(index));
    11351148    if ([value isKindOfClass:[NSNumber class]])
    11361149        return [(NSNumber *)value intValue];
     
    11431156{
    11441157    BEGIN_AX_OBJC_EXCEPTIONS
    1145     id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForLineParameterizedAttribute forParameter:@(line)];
     1158    auto value = attributeValueForParameter(NSAccessibilityRangeForLineParameterizedAttribute, @(line));
    11461159    if ([value isKindOfClass:[NSValue class]])
    11471160        return [NSStringFromRange([value rangeValue]) createJSStringRef];
    11481161    END_AX_OBJC_EXCEPTIONS
    1149    
     1162
    11501163    return nullptr;
    11511164}
     
    11541167{
    11551168    BEGIN_AX_OBJC_EXCEPTIONS
    1156     id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForPositionParameterizedAttribute forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]];
     1169    auto value = attributeValueForParameter(NSAccessibilityRangeForPositionParameterizedAttribute, [NSValue valueWithPoint:NSMakePoint(x, y)]);
    11571170    if ([value isKindOfClass:[NSValue class]])
    11581171        return [NSStringFromRange([value rangeValue]) createJSStringRef];
     
    11661179    NSRange range = NSMakeRange(location, length);
    11671180    BEGIN_AX_OBJC_EXCEPTIONS
    1168     id value = [m_element accessibilityAttributeValue:NSAccessibilityBoundsForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
     1181    auto value = attributeValueForParameter(NSAccessibilityBoundsForRangeParameterizedAttribute, [NSValue valueWithRange:range]);
    11691182    NSRect rect = NSMakeRect(0,0,0,0);
    11701183    if ([value isKindOfClass:[NSValue class]])
    11711184        rect = [value rectValue];
    1172    
     1185
    11731186    // don't return position information because it is platform dependent
    11741187    NSMutableString* boundsDescription = [NSMutableString stringWithFormat:@"{{%f, %f}, {%f, %f}}",-1.0f,-1.0f,rect.size.width,rect.size.height];
    11751188    return [boundsDescription createJSStringRef];
    11761189    END_AX_OBJC_EXCEPTIONS
     1190
     1191    return nullptr;
     1192}
     1193
     1194JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned location, unsigned length)
     1195{
     1196    NSRange range = NSMakeRange(location, length);
     1197    BEGIN_AX_OBJC_EXCEPTIONS
     1198    auto string = attributeValueForParameter(NSAccessibilityStringForRangeParameterizedAttribute, [NSValue valueWithRange:range]);
     1199    if (![string isKindOfClass:[NSString class]])
     1200        return nullptr;
     1201
     1202    return [string createJSStringRef];
     1203    END_AX_OBJC_EXCEPTIONS
    11771204   
    11781205    return nullptr;
    11791206}
    11801207
    1181 JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned location, unsigned length)
     1208JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
    11821209{
    11831210    NSRange range = NSMakeRange(location, length);
    11841211    BEGIN_AX_OBJC_EXCEPTIONS
    1185     id string = [m_element accessibilityAttributeValue:NSAccessibilityStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
    1186     if (![string isKindOfClass:[NSString class]])
    1187         return nullptr;
    1188    
    1189     return [string createJSStringRef];
    1190     END_AX_OBJC_EXCEPTIONS
    1191    
    1192     return nullptr;
    1193 }
    1194 
    1195 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
    1196 {
    1197     NSRange range = NSMakeRange(location, length);
    1198     BEGIN_AX_OBJC_EXCEPTIONS
    1199     NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
     1212    auto string = attributeValueForParameter(NSAccessibilityAttributedStringForRangeParameterizedAttribute, [NSValue valueWithRange:range]);
    12001213    if (![string isKindOfClass:[NSAttributedString class]])
    12011214        return nullptr;
    1202    
     1215
    12031216    NSString* stringWithAttrs = [string description];
    12041217    return [stringWithAttrs createJSStringRef];
    12051218    END_AX_OBJC_EXCEPTIONS
    1206    
     1219
    12071220    return nullptr;
    12081221}
     
    12121225    NSRange range = NSMakeRange(location, length);
    12131226    BEGIN_AX_OBJC_EXCEPTIONS
    1214     NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]];
     1227    auto string = attributeValueForParameter(NSAccessibilityAttributedStringForRangeParameterizedAttribute, [NSValue valueWithRange:range]);
    12151228    if (![string isKindOfClass:[NSAttributedString class]])
    12161229        return false;
     
    12241237    return misspelled;
    12251238    END_AX_OBJC_EXCEPTIONS
    1226    
     1239
    12271240    return false;
    12281241}
     
    12321245    BEGIN_AX_OBJC_EXCEPTIONS
    12331246    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, UINT_MAX, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
    1234     id value = [m_element accessibilityAttributeValue:@"AXUIElementCountForSearchPredicate" forParameter:parameterizedAttribute];
     1247    auto value = attributeValueForParameter(@"AXUIElementCountForSearchPredicate", parameterizedAttribute);
    12351248    if ([value isKindOfClass:[NSNumber class]])
    12361249        return [value unsignedIntValue];
     
    12441257    BEGIN_AX_OBJC_EXCEPTIONS
    12451258    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
    1246     id searchResults = [m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameterizedAttribute];
     1259    auto searchResults = attributeValueForParameter(@"AXUIElementsForSearchPredicate", parameterizedAttribute);
    12471260    if ([searchResults isKindOfClass:[NSArray class]]) {
    12481261        if (id lastResult = [searchResults lastObject])
     
    12501263    }
    12511264    END_AX_OBJC_EXCEPTIONS
    1252    
     1265
    12531266    return nullptr;
    12541267}
     
    12581271    BEGIN_AX_OBJC_EXCEPTIONS
    12591272    NSDictionary *parameterizedAttribute = selectTextParameterizedAttributeForCriteria(context, ambiguityResolution, searchStrings, replacementString, activity);
    1260     RetainPtr<id> result;
    1261     s_controller->executeOnAXThreadAndWait([&parameterizedAttribute, &result, this] {
    1262         result = [m_element accessibilityAttributeValue:@"AXSelectTextWithCriteria" forParameter:parameterizedAttribute];
    1263     });
    1264     if ([result.get() isKindOfClass:[NSString class]])
     1273    auto result = attributeValueForParameter(@"AXSelectTextWithCriteria", parameterizedAttribute);
     1274    if ([result isKindOfClass:[NSString class]])
    12651275        return [result.get() createJSStringRef];
    12661276    END_AX_OBJC_EXCEPTIONS
     
    12741284    BEGIN_AX_OBJC_EXCEPTIONS
    12751285    NSDictionary *parameterizedAttribute = searchTextParameterizedAttributeForCriteria(context, searchStrings, startFrom, direction);
    1276     id result = [m_element accessibilityAttributeValue:@"AXSearchTextWithCriteria" forParameter:parameterizedAttribute];
     1286    auto result = attributeValueForParameter(@"AXSearchTextWithCriteria", parameterizedAttribute);
    12771287    if ([result isKindOfClass:[NSArray class]])
    1278         return makeJSArray(makeVector<RefPtr<AccessibilityTextMarkerRange>>(result));
     1288        return makeJSArray(makeVector<RefPtr<AccessibilityTextMarkerRange>>(result.get()));
    12791289    END_AX_OBJC_EXCEPTIONS
    12801290
     
    14151425    NSArray *colRowArray = @[@(col), @(row)];
    14161426    BEGIN_AX_OBJC_EXCEPTIONS
    1417     if (id cell = [m_element accessibilityAttributeValue:@"AXCellForColumnAndRow" forParameter:colRowArray])
    1418         return AccessibilityUIElement::create(cell);
     1427    if (auto cell = attributeValueForParameter(@"AXCellForColumnAndRow", colRowArray))
     1428        return AccessibilityUIElement::create(cell.get());
    14191429    END_AX_OBJC_EXCEPTIONS   
    14201430
     
    18511861
    18521862    BEGIN_AX_OBJC_EXCEPTIONS
    1853     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLineTextMarkerRangeForTextMarker" forParameter:textMarker->platformTextMarker()];
    1854     return AccessibilityTextMarkerRange::create(textMarkerRange);
    1855     END_AX_OBJC_EXCEPTIONS
    1856    
     1863    auto textMarkerRange = attributeValueForParameter(@"AXLineTextMarkerRangeForTextMarker", textMarker->platformTextMarker());
     1864    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     1865    END_AX_OBJC_EXCEPTIONS
     1866
    18571867    return nullptr;
    18581868}
     
    18641874
    18651875    BEGIN_AX_OBJC_EXCEPTIONS
    1866     return [[m_element accessibilityAttributeValue:@"AXLineForTextMarker" forParameter:marker->platformTextMarker()] intValue];
     1876    return [attributeValueForParameter(@"AXLineForTextMarker", marker->platformTextMarker()) intValue];
    18671877    END_AX_OBJC_EXCEPTIONS
    18681878
     
    18741884    BEGIN_AX_OBJC_EXCEPTIONS
    18751885    NSDictionary *parameters = misspellingSearchParameterizedAttributeForCriteria(start, forward);
    1876     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXMisspellingTextMarkerRange" forParameter:parameters];
    1877     return AccessibilityTextMarkerRange::create(textMarkerRange);
     1886    auto textMarkerRange = attributeValueForParameter(@"AXMisspellingTextMarkerRange", parameters);
     1887    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
    18781888    END_AX_OBJC_EXCEPTIONS
    18791889
     
    18841894{
    18851895    BEGIN_AX_OBJC_EXCEPTIONS
    1886     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUIElement" forParameter:element->platformUIElement()];
    1887     return AccessibilityTextMarkerRange::create(textMarkerRange);
    1888     END_AX_OBJC_EXCEPTIONS
    1889    
     1896    auto textMarkerRange = attributeValueForParameter(@"AXTextMarkerRangeForUIElement", element->platformUIElement());
     1897    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     1898    END_AX_OBJC_EXCEPTIONS
     1899
    18901900    return nullptr;
    18911901}
     
    18971907
    18981908    BEGIN_AX_OBJC_EXCEPTIONS
    1899     NSNumber* lengthValue = [m_element accessibilityAttributeValue:@"AXLengthForTextMarkerRange" forParameter:range->platformTextMarkerRange()];
     1909    auto lengthValue = attributeValueForParameter(@"AXLengthForTextMarkerRange", range->platformTextMarkerRange());
    19001910    return [lengthValue intValue];
    19011911    END_AX_OBJC_EXCEPTIONS
    1902    
     1912
    19031913    return 0;
    19041914}
     
    19101920
    19111921    BEGIN_AX_OBJC_EXCEPTIONS
    1912     id previousMarker = [m_element accessibilityAttributeValue:@"AXPreviousTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    1913     return AccessibilityTextMarker::create(previousMarker);
    1914     END_AX_OBJC_EXCEPTIONS
    1915    
     1922    auto previousMarker = attributeValueForParameter(@"AXPreviousTextMarkerForTextMarker", textMarker->platformTextMarker());
     1923    return AccessibilityTextMarker::create(previousMarker.get());
     1924    END_AX_OBJC_EXCEPTIONS
     1925
    19161926    return nullptr;
    19171927}
     
    19231933
    19241934    BEGIN_AX_OBJC_EXCEPTIONS
    1925     id nextMarker = [m_element accessibilityAttributeValue:@"AXNextTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    1926     return AccessibilityTextMarker::create(nextMarker);
    1927     END_AX_OBJC_EXCEPTIONS
    1928    
     1935    auto nextMarker = attributeValueForParameter(@"AXNextTextMarkerForTextMarker", textMarker->platformTextMarker());
     1936    return AccessibilityTextMarker::create(nextMarker.get());
     1937    END_AX_OBJC_EXCEPTIONS
     1938
    19291939    return nullptr;
    19301940}
     
    19361946
    19371947    BEGIN_AX_OBJC_EXCEPTIONS
    1938     id textString = [m_element accessibilityAttributeValue:@"AXStringForTextMarkerRange" forParameter:markerRange->platformTextMarkerRange()];
     1948    auto textString = attributeValueForParameter(@"AXStringForTextMarkerRange", markerRange->platformTextMarkerRange());
    19391949    return [textString createJSStringRef];
    19401950    END_AX_OBJC_EXCEPTIONS
    1941    
     1951
    19421952    return nullptr;
    19431953}
     
    19531963    BEGIN_AX_OBJC_EXCEPTIONS
    19541964    NSArray *textMarkers = @[startMarker->platformTextMarker(), endMarker->platformTextMarker()];
    1955     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForTextMarkers" forParameter:textMarkers];
    1956     return AccessibilityTextMarkerRange::create(textMarkerRange);
     1965    auto textMarkerRange = attributeValueForParameter(@"AXTextMarkerRangeForTextMarkers", textMarkers);
     1966    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
    19571967    END_AX_OBJC_EXCEPTIONS
    19581968
     
    19631973{
    19641974    BEGIN_AX_OBJC_EXCEPTIONS
    1965     return AccessibilityTextMarkerRange::create([m_element accessibilityAttributeValue:@"AXTextMarkerRangeForNSRange"
    1966         forParameter:[NSValue valueWithRange:NSMakeRange(location, length)]]);
     1975    return AccessibilityTextMarkerRange::create(attributeValueForParameter(@"AXTextMarkerRangeForNSRange",
     1976        [NSValue valueWithRange:NSMakeRange(location, length)]).get());
    19671977    END_AX_OBJC_EXCEPTIONS
    19681978
     
    19871997
    19881998    NSArray *textMarkers = @[start.get(), start.get()];
    1989     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers];
     1999    auto textMarkerRange = attributeValueForParameter(@"AXTextMarkerRangeForUnorderedTextMarkers", textMarkers);
    19902000    if (!textMarkerRange)
    19912001        return;
    19922002
    1993     setAttributeValue(m_element.get(), NSAccessibilitySelectedTextMarkerRangeAttribute, textMarkerRange, true);
     2003    setAttributeValue(m_element.get(), NSAccessibilitySelectedTextMarkerRangeAttribute, textMarkerRange.get(), true);
    19942004}
    19952005
     
    20002010
    20012011    BEGIN_AX_OBJC_EXCEPTIONS
    2002     id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarkerForTextMarkerRange" forParameter:range->platformTextMarkerRange()];
    2003     return AccessibilityTextMarker::create(textMarker);
    2004     END_AX_OBJC_EXCEPTIONS
    2005    
     2012    auto textMarker = attributeValueForParameter(@"AXStartTextMarkerForTextMarkerRange", range->platformTextMarkerRange());
     2013    return AccessibilityTextMarker::create(textMarker.get());
     2014    END_AX_OBJC_EXCEPTIONS
     2015
    20062016    return nullptr;
    20072017}
     
    20132023
    20142024    BEGIN_AX_OBJC_EXCEPTIONS
    2015     id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarkerForTextMarkerRange" forParameter:range->platformTextMarkerRange()];
    2016     return AccessibilityTextMarker::create(textMarker);
    2017     END_AX_OBJC_EXCEPTIONS
    2018    
     2025    auto textMarker = attributeValueForParameter(@"AXEndTextMarkerForTextMarkerRange", range->platformTextMarkerRange());
     2026    return AccessibilityTextMarker::create(textMarker.get());
     2027    END_AX_OBJC_EXCEPTIONS
     2028
    20192029    return nullptr;
    20202030}
     
    20232033{
    20242034    BEGIN_AX_OBJC_EXCEPTIONS
    2025     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
    2026     return AccessibilityTextMarker::create(textMarker);
    2027     END_AX_OBJC_EXCEPTIONS
    2028    
     2035    auto textMarker = attributeValueForParameter(NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute,
     2036        [NSValue valueWithRect:NSMakeRect(x, y, width, height)]);
     2037    return AccessibilityTextMarker::create(textMarker.get());
     2038    END_AX_OBJC_EXCEPTIONS
     2039
    20292040    return nullptr;
    20302041}
     
    20542065{
    20552066    BEGIN_AX_OBJC_EXCEPTIONS
    2056     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
    2057     return AccessibilityTextMarker::create(textMarker);
    2058     END_AX_OBJC_EXCEPTIONS
    2059    
     2067    auto textMarker = attributeValueForParameter(NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute,
     2068        [NSValue valueWithRect:NSMakeRect(x, y, width, height)]);
     2069    return AccessibilityTextMarker::create(textMarker.get());
     2070    END_AX_OBJC_EXCEPTIONS
     2071
    20602072    return nullptr;
    20612073}
     
    20642076{
    20652077    BEGIN_AX_OBJC_EXCEPTIONS
    2066     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForPosition" forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]];
    2067     return AccessibilityTextMarker::create(textMarker);
    2068     END_AX_OBJC_EXCEPTIONS
    2069    
     2078    auto textMarker = attributeValueForParameter(@"AXTextMarkerForPosition", [NSValue valueWithPoint:NSMakePoint(x, y)]);
     2079    return AccessibilityTextMarker::create(textMarker.get());
     2080    END_AX_OBJC_EXCEPTIONS
     2081
    20702082    return nullptr;
    20712083}
     
    20772089
    20782090    BEGIN_AX_OBJC_EXCEPTIONS
    2079     id uiElement = [m_element accessibilityAttributeValue:@"AXUIElementForTextMarker" forParameter:marker->platformTextMarker()];
     2091    auto uiElement = attributeValueForParameter(@"AXUIElementForTextMarker", marker->platformTextMarker());
    20802092    if (uiElement)
    2081         return AccessibilityUIElement::create(uiElement);
    2082     END_AX_OBJC_EXCEPTIONS
    2083    
     2093        return AccessibilityUIElement::create(uiElement.get());
     2094    END_AX_OBJC_EXCEPTIONS
     2095
    20842096    return nullptr;
    20852097}
     
    21092121        return nullptr;
    21102122
    2111     NSAttributedString* string = nil;
    2112 
    2113     BEGIN_AX_OBJC_EXCEPTIONS
    2114     string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:markerRange->platformTextMarkerRange()];
    2115     END_AX_OBJC_EXCEPTIONS
    2116 
    2117     if (![string isKindOfClass:[NSAttributedString class]])
    2118         return nil;
    2119 
    2120     return createJSStringRef(string);
     2123    BEGIN_AX_OBJC_EXCEPTIONS
     2124    auto string = attributeValueForParameter(@"AXAttributedStringForTextMarkerRange", markerRange->platformTextMarkerRange());
     2125    if ([string isKindOfClass:[NSAttributedString class]])
     2126        return createJSStringRef(string.get());
     2127    END_AX_OBJC_EXCEPTIONS
     2128
     2129    return nil;
    21212130}
    21222131
     
    21252134    if (!markerRange || !markerRange->platformTextMarkerRange())
    21262135        return nullptr;
    2127 
    2128     NSAttributedString* string = nil;
    21292136
    21302137    id parameter = nil;
     
    21352142
    21362143    BEGIN_AX_OBJC_EXCEPTIONS
    2137     string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRangeWithOptions" forParameter:parameter];
    2138     END_AX_OBJC_EXCEPTIONS
    2139 
    2140     if (![string isKindOfClass:[NSAttributedString class]])
    2141         return nil;
    2142 
    2143     return createJSStringRef(string);
     2144    auto string = attributeValueForParameter(@"AXAttributedStringForTextMarkerRangeWithOptions", parameter);
     2145    if ([string isKindOfClass:[NSAttributedString class]])
     2146        return createJSStringRef(string.get());
     2147    END_AX_OBJC_EXCEPTIONS
     2148
     2149    return nil;
    21442150}
    21452151
     
    21502156
    21512157    BEGIN_AX_OBJC_EXCEPTIONS
    2152     NSAttributedString* string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:range->platformTextMarkerRange()];
     2158    auto string = attributeValueForParameter(@"AXAttributedStringForTextMarkerRange", range->platformTextMarkerRange());
    21532159    if (![string isKindOfClass:[NSAttributedString class]])
    21542160        return false;
    2155    
     2161
    21562162    NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil];
    21572163    if ([attrs objectForKey:[NSString stringWithJSStringRef:attribute]])
    21582164        return true;   
    21592165    END_AX_OBJC_EXCEPTIONS
    2160    
     2166
    21612167    return false;
    21622168}
     
    21682174
    21692175    BEGIN_AX_OBJC_EXCEPTIONS
    2170     NSNumber* indexNumber = [m_element accessibilityAttributeValue:@"AXIndexForTextMarker" forParameter:marker->platformTextMarker()];
     2176    auto indexNumber = attributeValueForParameter(@"AXIndexForTextMarker", marker->platformTextMarker());
    21712177    return [indexNumber intValue];
    21722178    END_AX_OBJC_EXCEPTIONS
    2173    
     2179
    21742180    return -1;
    21752181}
     
    21812187
    21822188    BEGIN_AX_OBJC_EXCEPTIONS
    2183     NSNumber* validNumber = [m_element accessibilityAttributeValue:@"AXTextMarkerIsValid" forParameter:textMarker->platformTextMarker()];
    2184     return [validNumber boolValue];
    2185     END_AX_OBJC_EXCEPTIONS
    2186    
     2189    auto value = attributeValueForParameter(@"AXTextMarkerIsValid", textMarker->platformTextMarker());
     2190    return [value boolValue];
     2191    END_AX_OBJC_EXCEPTIONS
     2192
    21872193    return false;
    21882194}
     
    21912197{
    21922198    BEGIN_AX_OBJC_EXCEPTIONS
    2193     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForIndex" forParameter:[NSNumber numberWithInteger:textIndex]];
    2194     return AccessibilityTextMarker::create(textMarker);
    2195     END_AX_OBJC_EXCEPTIONS
    2196    
     2199    auto textMarker = attributeValueForParameter(@"AXTextMarkerForIndex", [NSNumber numberWithInteger:textIndex]);
     2200    return AccessibilityTextMarker::create(textMarker.get());
     2201    END_AX_OBJC_EXCEPTIONS
     2202
    21972203    return nullptr;
    21982204}
     
    22242230
    22252231    BEGIN_AX_OBJC_EXCEPTIONS
    2226     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLeftWordTextMarkerRangeForTextMarker" forParameter:textMarker->platformTextMarker()];
    2227     return AccessibilityTextMarkerRange::create(textMarkerRange);
    2228     END_AX_OBJC_EXCEPTIONS
    2229    
     2232    auto textMarkerRange = attributeValueForParameter(@"AXLeftWordTextMarkerRangeForTextMarker", textMarker->platformTextMarker());
     2233    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     2234    END_AX_OBJC_EXCEPTIONS
     2235
    22302236    return nullptr;
    22312237}
     
    22372243
    22382244    BEGIN_AX_OBJC_EXCEPTIONS
    2239     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXRightWordTextMarkerRangeForTextMarker" forParameter:textMarker->platformTextMarker()];
    2240     return AccessibilityTextMarkerRange::create(textMarkerRange);
    2241     END_AX_OBJC_EXCEPTIONS
    2242    
     2245    auto textMarkerRange = attributeValueForParameter(@"AXRightWordTextMarkerRangeForTextMarker", textMarker->platformTextMarker());
     2246    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     2247    END_AX_OBJC_EXCEPTIONS
     2248
    22432249    return nullptr;
    22442250}
     
    22502256
    22512257    BEGIN_AX_OBJC_EXCEPTIONS
    2252     id previousWordStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousWordStartTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2253     return AccessibilityTextMarker::create(previousWordStartMarker);
    2254     END_AX_OBJC_EXCEPTIONS
    2255    
     2258    auto previousWordStartMarker = attributeValueForParameter(@"AXPreviousWordStartTextMarkerForTextMarker", textMarker->platformTextMarker());
     2259    return AccessibilityTextMarker::create(previousWordStartMarker.get());
     2260    END_AX_OBJC_EXCEPTIONS
     2261
    22562262    return nullptr;
    22572263}
     
    22632269
    22642270    BEGIN_AX_OBJC_EXCEPTIONS
    2265     id nextWordEndMarker = [m_element accessibilityAttributeValue:@"AXNextWordEndTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2266     return AccessibilityTextMarker::create(nextWordEndMarker);
    2267     END_AX_OBJC_EXCEPTIONS
    2268    
     2271    auto nextWordEndMarker = attributeValueForParameter(@"AXNextWordEndTextMarkerForTextMarker", textMarker->platformTextMarker());
     2272    return AccessibilityTextMarker::create(nextWordEndMarker.get());
     2273    END_AX_OBJC_EXCEPTIONS
     2274
    22692275    return nullptr;
    22702276}
     
    22762282
    22772283    BEGIN_AX_OBJC_EXCEPTIONS
    2278     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXParagraphTextMarkerRangeForTextMarker" forParameter:textMarker->platformTextMarker()];
    2279     return AccessibilityTextMarkerRange::create(textMarkerRange);
    2280     END_AX_OBJC_EXCEPTIONS
    2281    
     2284    auto textMarkerRange = attributeValueForParameter(@"AXParagraphTextMarkerRangeForTextMarker", textMarker->platformTextMarker());
     2285    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     2286    END_AX_OBJC_EXCEPTIONS
     2287
    22822288    return nullptr;
    22832289}
     
    22892295
    22902296    BEGIN_AX_OBJC_EXCEPTIONS
    2291     id previousParagraphStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousParagraphStartTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2292     return AccessibilityTextMarker::create(previousParagraphStartMarker);
    2293     END_AX_OBJC_EXCEPTIONS
    2294    
     2297    auto previousParagraphStartMarker = attributeValueForParameter(@"AXPreviousParagraphStartTextMarkerForTextMarker", textMarker->platformTextMarker());
     2298    return AccessibilityTextMarker::create(previousParagraphStartMarker.get());
     2299    END_AX_OBJC_EXCEPTIONS
     2300
    22952301    return nullptr;
    22962302}
     
    23022308
    23032309    BEGIN_AX_OBJC_EXCEPTIONS
    2304     id nextParagraphEndMarker = [m_element accessibilityAttributeValue:@"AXNextParagraphEndTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2305     return AccessibilityTextMarker::create(nextParagraphEndMarker);
    2306     END_AX_OBJC_EXCEPTIONS
    2307    
     2310    auto nextParagraphEndMarker = attributeValueForParameter(@"AXNextParagraphEndTextMarkerForTextMarker", textMarker->platformTextMarker());
     2311    return AccessibilityTextMarker::create(nextParagraphEndMarker.get());
     2312    END_AX_OBJC_EXCEPTIONS
     2313
    23082314    return nullptr;
    23092315}
     
    23152321
    23162322    BEGIN_AX_OBJC_EXCEPTIONS
    2317     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXSentenceTextMarkerRangeForTextMarker" forParameter:textMarker->platformTextMarker()];
    2318     return AccessibilityTextMarkerRange::create(textMarkerRange);
    2319     END_AX_OBJC_EXCEPTIONS
    2320    
     2323    auto textMarkerRange = attributeValueForParameter(@"AXSentenceTextMarkerRangeForTextMarker", textMarker->platformTextMarker());
     2324    return AccessibilityTextMarkerRange::create(textMarkerRange.get());
     2325    END_AX_OBJC_EXCEPTIONS
     2326
    23212327    return nullptr;
    23222328}
     
    23282334
    23292335    BEGIN_AX_OBJC_EXCEPTIONS
    2330     id previousParagraphStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousSentenceStartTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2331     return AccessibilityTextMarker::create(previousParagraphStartMarker);
    2332     END_AX_OBJC_EXCEPTIONS
    2333    
     2336    auto previousParagraphStartMarker = attributeValueForParameter(@"AXPreviousSentenceStartTextMarkerForTextMarker", textMarker->platformTextMarker());
     2337    return AccessibilityTextMarker::create(previousParagraphStartMarker.get());
     2338    END_AX_OBJC_EXCEPTIONS
     2339
    23342340    return nullptr;
    23352341}
     
    23412347
    23422348    BEGIN_AX_OBJC_EXCEPTIONS
    2343     id nextParagraphEndMarker = [m_element accessibilityAttributeValue:@"AXNextSentenceEndTextMarkerForTextMarker" forParameter:textMarker->platformTextMarker()];
    2344     return AccessibilityTextMarker::create(nextParagraphEndMarker);
    2345     END_AX_OBJC_EXCEPTIONS
    2346    
     2349    auto nextParagraphEndMarker = attributeValueForParameter(@"AXNextSentenceEndTextMarkerForTextMarker", textMarker->platformTextMarker());
     2350    return AccessibilityTextMarker::create(nextParagraphEndMarker.get());
     2351    END_AX_OBJC_EXCEPTIONS
     2352
    23472353    return nullptr;
    23482354}
     
    23522358    __block NSMutableString *result = [NSMutableString string];
    23532359    [pairs enumerateObjectsUsingBlock:^(id pair, NSUInteger index, BOOL *stop) {
    2354         for (NSString *key in pair)
    2355             [result appendFormat:@"\t%lu. %@ = %@\n", (unsigned long)index, key, [[pair objectForKey:key] accessibilityAttributeValue:NSAccessibilitySubroleAttribute]];
     2360        for (NSString *key in pair) {
     2361            auto element = AccessibilityUIElement::create([pair objectForKey:key]);
     2362            auto subrole = element->attributeValue(NSAccessibilitySubroleAttribute);
     2363            [result appendFormat:@"\t%lu. %@ = %@\n", (unsigned long)index, key, subrole.get()];
     2364        }
    23562365    }];
    23572366
Note: See TracChangeset for help on using the changeset viewer.