Changeset 229080 in webkit
- Timestamp:
- Feb 27, 2018 2:57:14 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r229070 r229080 1 2018-02-27 Doug Russell <doug@getitdownonpaper.com> 2 3 AX: Spell check and style attributes should be optional when fetching attributed string 4 https://bugs.webkit.org/show_bug.cgi?id=160744 5 6 Reviewed by Chris Fleizach. 7 8 The overhead of fetching a spell checked attributed string via AX API is substantial. 9 In some cases on the order of 7/8 of the total time spent fetching the string. 10 11 This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)). 12 13 AXAttributedStringForTextMarkerRange will remain unchanged. 14 15 * accessibility/mac/attributed-string: Added. 16 * accessibility/mac/attributed-string/attributed-string-for-range-expected.txt: Added. 17 * accessibility/mac/attributed-string/attributed-string-for-range-with-options-expected.txt: Added. 18 * accessibility/mac/attributed-string/attributed-string-for-range-with-options.html: Added. 19 * accessibility/mac/attributed-string/attributed-string-for-range.html: Added. 20 * accessibility/mac/bounds-for-range-expected.txt: 21 1 22 2018-02-27 Antoine Quint <graouts@apple.com> 2 23 -
trunk/LayoutTests/accessibility/mac/bounds-for-range-expected.txt
r198356 r229080 38 38 AXBoundsForTextMarkerRange 39 39 AXAttributedStringForTextMarkerRange 40 AXAttributedStringForTextMarkerRangeWithOptions 40 41 AXTextMarkerRangeForUnorderedTextMarkers 41 42 AXNextTextMarkerForTextMarker -
trunk/Source/WebCore/ChangeLog
r229079 r229080 1 2018-02-27 Doug Russell <doug@getitdownonpaper.com> 2 3 AX: Spell check and style attributes should be optional when fetching attributed string 4 https://bugs.webkit.org/show_bug.cgi?id=160744 5 6 Reviewed by Chris Fleizach. 7 8 The overhead of fetching a spell checked attributed string via AX API is substantial. 9 In some cases on the order of 7/8 of the total time spent fetching the string. 10 11 This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)). 12 13 AXAttributedStringForTextMarkerRange will remain unchanged. 14 15 Tests: accessibility/mac/attributed-string/attributed-string-for-range-with-options.html 16 accessibility/mac/attributed-string/attributed-string-for-range.html 17 18 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 19 (AXAttributedStringAppendText): 20 (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): 21 (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): 22 (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): 23 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): 24 (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Deleted. 25 1 26 2018-02-27 Daniel Bates <dabates@apple.com> 2 27 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r228857 r229080 1019 1019 } 1020 1020 1021 static void AXAttributedStringAppendText(NSMutableAttributedString* attrString, Node* node, StringView text )1021 static void AXAttributedStringAppendText(NSMutableAttributedString* attrString, Node* node, StringView text, bool spellCheck) 1022 1022 { 1023 1023 // skip invisible text … … 1039 1039 // remove inherited attachment from prior AXAttributedStringAppendReplaced 1040 1040 [attrString removeAttribute:NSAccessibilityAttachmentTextAttribute range:attrStringRange]; 1041 if (spellCheck) { 1041 1042 #if PLATFORM(MAC) 1042 [attrString removeAttribute:NSAccessibilityMarkedMisspelledTextAttribute range:attrStringRange]; 1043 #endif 1044 [attrString removeAttribute:NSAccessibilityMisspelledTextAttribute range:attrStringRange]; 1043 [attrString removeAttribute:NSAccessibilityMarkedMisspelledTextAttribute range:attrStringRange]; 1044 #endif 1045 [attrString removeAttribute:NSAccessibilityMisspelledTextAttribute range:attrStringRange]; 1046 } 1045 1047 1046 1048 // set new attributes … … 1052 1054 1053 1055 // do spelling last because it tends to break up the range 1054 AXAttributeStringSetSpelling(attrString, node, text, attrStringRange); 1056 if (spellCheck) 1057 AXAttributeStringSetSpelling(attrString, node, text, attrStringRange); 1055 1058 } 1056 1059 … … 1074 1077 } 1075 1078 1076 - (NSAttributedString*)doAXAttributedStringForTextMarkerRange:(id)textMarkerRange 1079 - (NSAttributedString*)doAXAttributedStringForTextMarkerRange:(id)textMarkerRange spellCheck:(BOOL)spellCheck 1077 1080 { 1078 1081 if (!m_object) … … 1093 1096 String listMarkerText = m_object->listMarkerTextForNodeAndPosition(&node, VisiblePosition(it.range()->startPosition())); 1094 1097 if (!listMarkerText.isEmpty()) 1095 AXAttributedStringAppendText(attrString, &node, listMarkerText );1096 AXAttributedStringAppendText(attrString, &node, it.text() );1098 AXAttributedStringAppendText(attrString, &node, listMarkerText, spellCheck); 1099 AXAttributedStringAppendText(attrString, &node, it.text(), spellCheck); 1097 1100 } else { 1098 1101 Node* replacedNode = node.traverseToChildAt(offset); … … 1114 1117 it.advance(); 1115 1118 } 1116 1119 1117 1120 return [attrString autorelease]; 1118 1121 } … … 3381 3384 if (paramAttrs == nil) { 3382 3385 paramAttrs = [[NSArray alloc] initWithObjects: 3383 @"AXUIElementForTextMarker", 3384 @"AXTextMarkerRangeForUIElement", 3385 @"AXLineForTextMarker", 3386 @"AXTextMarkerRangeForLine", 3387 @"AXStringForTextMarkerRange", 3388 @"AXTextMarkerForPosition", 3389 @"AXBoundsForTextMarkerRange", 3390 @"AXAttributedStringForTextMarkerRange", 3391 @"AXTextMarkerRangeForUnorderedTextMarkers", 3392 @"AXNextTextMarkerForTextMarker", 3393 @"AXPreviousTextMarkerForTextMarker", 3394 @"AXLeftWordTextMarkerRangeForTextMarker", 3395 @"AXRightWordTextMarkerRangeForTextMarker", 3396 @"AXLeftLineTextMarkerRangeForTextMarker", 3397 @"AXRightLineTextMarkerRangeForTextMarker", 3398 @"AXSentenceTextMarkerRangeForTextMarker", 3399 @"AXParagraphTextMarkerRangeForTextMarker", 3400 @"AXNextWordEndTextMarkerForTextMarker", 3401 @"AXPreviousWordStartTextMarkerForTextMarker", 3402 @"AXNextLineEndTextMarkerForTextMarker", 3403 @"AXPreviousLineStartTextMarkerForTextMarker", 3404 @"AXNextSentenceEndTextMarkerForTextMarker", 3405 @"AXPreviousSentenceStartTextMarkerForTextMarker", 3406 @"AXNextParagraphEndTextMarkerForTextMarker", 3407 @"AXPreviousParagraphStartTextMarkerForTextMarker", 3408 @"AXStyleTextMarkerRangeForTextMarker", 3409 @"AXLengthForTextMarkerRange", 3410 NSAccessibilityBoundsForRangeParameterizedAttribute, 3411 NSAccessibilityStringForRangeParameterizedAttribute, 3412 NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute, 3413 NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute, 3414 NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute, 3415 NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute, 3416 NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute, 3417 NSAccessibilitySelectTextWithCriteriaParameterizedAttribute, 3418 nil]; 3386 @"AXUIElementForTextMarker", 3387 @"AXTextMarkerRangeForUIElement", 3388 @"AXLineForTextMarker", 3389 @"AXTextMarkerRangeForLine", 3390 @"AXStringForTextMarkerRange", 3391 @"AXTextMarkerForPosition", 3392 @"AXBoundsForTextMarkerRange", 3393 @"AXAttributedStringForTextMarkerRange", 3394 @"AXAttributedStringForTextMarkerRangeWithOptions", 3395 @"AXTextMarkerRangeForUnorderedTextMarkers", 3396 @"AXNextTextMarkerForTextMarker", 3397 @"AXPreviousTextMarkerForTextMarker", 3398 @"AXLeftWordTextMarkerRangeForTextMarker", 3399 @"AXRightWordTextMarkerRangeForTextMarker", 3400 @"AXLeftLineTextMarkerRangeForTextMarker", 3401 @"AXRightLineTextMarkerRangeForTextMarker", 3402 @"AXSentenceTextMarkerRangeForTextMarker", 3403 @"AXParagraphTextMarkerRangeForTextMarker", 3404 @"AXNextWordEndTextMarkerForTextMarker", 3405 @"AXPreviousWordStartTextMarkerForTextMarker", 3406 @"AXNextLineEndTextMarkerForTextMarker", 3407 @"AXPreviousLineStartTextMarkerForTextMarker", 3408 @"AXNextSentenceEndTextMarkerForTextMarker", 3409 @"AXPreviousSentenceStartTextMarkerForTextMarker", 3410 @"AXNextParagraphEndTextMarkerForTextMarker", 3411 @"AXPreviousParagraphStartTextMarkerForTextMarker", 3412 @"AXStyleTextMarkerRangeForTextMarker", 3413 @"AXLengthForTextMarkerRange", 3414 NSAccessibilityBoundsForRangeParameterizedAttribute, 3415 NSAccessibilityStringForRangeParameterizedAttribute, 3416 NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute, 3417 NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute, 3418 NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute, 3419 NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute, 3420 NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute, 3421 NSAccessibilitySelectTextWithCriteriaParameterizedAttribute, 3422 nil]; 3419 3423 } 3420 3424 … … 3750 3754 PlainTextRange textRange = PlainTextRange(range.location, range.length); 3751 3755 RefPtr<Range> webRange = m_object->rangeForPlainTextRange(textRange); 3752 return [self doAXAttributedStringForTextMarkerRange:[self textMarkerRangeFromRange:webRange] ];3756 return [self doAXAttributedStringForTextMarkerRange:[self textMarkerRangeFromRange:webRange] spellCheck:YES]; 3753 3757 } 3754 3758 … … 4039 4043 return m_object->stringForRange(range); 4040 4044 } 4041 4045 4042 4046 if ([attribute isEqualToString:@"AXAttributedStringForTextMarkerRange"]) 4043 return [self doAXAttributedStringForTextMarkerRange:textMarkerRange]; 4044 4047 return [self doAXAttributedStringForTextMarkerRange:textMarkerRange spellCheck:YES]; 4048 4049 if ([attribute isEqualToString:@"AXAttributedStringForTextMarkerRangeWithOptions"]) { 4050 if (textMarkerRange) 4051 return [self doAXAttributedStringForTextMarkerRange:textMarkerRange spellCheck:NO]; 4052 if (dictionary) { 4053 id textMarkerRange = nil; 4054 id parameter = [dictionary objectForKey:@"AXTextMarkerRange"]; 4055 if (AXObjectIsTextMarkerRange(parameter)) 4056 textMarkerRange = parameter; 4057 BOOL spellCheck = NO; 4058 parameter = [dictionary objectForKey:@"AXSpellCheck"]; 4059 if ([parameter isKindOfClass:[NSNumber class]]) 4060 spellCheck = [parameter boolValue]; 4061 return [self doAXAttributedStringForTextMarkerRange:textMarkerRange spellCheck:spellCheck]; 4062 } 4063 return nil; 4064 } 4065 4045 4066 if ([attribute isEqualToString:@"AXTextMarkerRangeForUnorderedTextMarkers"]) { 4046 4067 if ([array count] < 2) -
trunk/Tools/ChangeLog
r229079 r229080 1 2018-02-27 Doug Russell <doug@getitdownonpaper.com> 2 3 AX: Spell check and style attributes should be optional when fetching attributed string 4 https://bugs.webkit.org/show_bug.cgi?id=160744 5 6 Reviewed by Chris Fleizach. 7 8 The overhead of fetching a spell checked attributed string via AX API is substantial. 9 In some cases on the order of 7/8 of the total time spent fetching the string. 10 11 This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)). 12 13 AXAttributedStringForTextMarkerRange will remain unchanged. 14 15 * DumpRenderTree/AccessibilityUIElement.cpp: 16 (attributedStringForTextMarkerRangeCallback): 17 (attributedStringForTextMarkerRangeWithOptionsCallback): 18 (AccessibilityUIElement::attributedStringForTextMarkerRange): 19 (AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 20 (AccessibilityUIElement::getJSClass): 21 * DumpRenderTree/AccessibilityUIElement.h: 22 * DumpRenderTree/ios/AccessibilityUIElementIOS.mm: 23 (AccessibilityUIElement::attributedStringForTextMarkerRange): 24 (AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 25 * DumpRenderTree/mac/AccessibilityUIElementMac.mm: 26 (createJSStringRef): 27 (AccessibilityUIElement::attributedStringForTextMarkerRange): 28 (AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 29 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: 30 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: 31 * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: 32 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRange): 33 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 34 * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: 35 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRange): 36 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 37 * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: 38 (WTR::createJSStringRef): 39 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRange): 40 (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): 41 1 42 2018-02-27 Daniel Bates <dabates@apple.com> 2 43 -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp
r226450 r229080 882 882 } 883 883 884 static JSValueRef attributedStringForTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 885 { 886 AccessibilityTextMarkerRange* markerRange = 0; 887 if (argumentCount == 1) 888 markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception)); 889 890 JSRetainPtr<JSStringRef> markerRangeString(Adopt, toAXElement(thisObject)->attributedStringForTextMarkerRange(markerRange)); 891 return JSValueMakeString(context, markerRangeString.get()); 892 } 893 894 static JSValueRef attributedStringForTextMarkerRangeWithOptionsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 895 { 896 AccessibilityTextMarkerRange* markerRange = nullptr; 897 bool includeSpellCheck = false; 898 if (argumentCount == 2) { 899 markerRange = toTextMarkerRange(JSValueToObject(context, arguments[0], exception)); 900 includeSpellCheck = JSValueToBoolean(context, arguments[1]); 901 } 902 903 JSRetainPtr<JSStringRef> markerRangeString(Adopt, toAXElement(thisObject)->attributedStringForTextMarkerRangeWithOptions(markerRange, includeSpellCheck)); 904 return JSValueMakeString(context, markerRangeString.get()); 905 } 906 884 907 static JSValueRef endTextMarkerForBoundsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 885 908 { … … 958 981 static JSValueRef accessibilityElementForTextMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 959 982 { 960 AccessibilityTextMarker* marker = 0;983 AccessibilityTextMarker* marker = nullptr; 961 984 if (argumentCount == 1) 962 985 marker = toTextMarker(JSValueToObject(context, arguments[0], exception)); … … 1635 1658 { 1636 1659 return 0; 1660 } 1661 1662 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*) 1663 { 1664 return nullptr; 1665 } 1666 1667 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool includeSpellCheck) 1668 { 1669 return nullptr; 1637 1670 } 1638 1671 … … 1909 1942 { "previousTextMarker", previousTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1910 1943 { "stringForTextMarkerRange", stringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1944 { "attributedStringForTextMarkerRange", attributedStringForTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1945 { "attributedStringForTextMarkerRangeWithOptions", attributedStringForTextMarkerRangeWithOptionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1911 1946 { "leftWordTextMarkerRangeForTextMarker", leftWordTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1912 1947 { "rightWordTextMarkerRangeForTextMarker", rightWordTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.h
r226432 r229080 279 279 280 280 JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*); 281 JSStringRef attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*); 282 JSStringRef attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool includeSpellCheck); 281 283 int textMarkerRangeLength(AccessibilityTextMarkerRange*); 282 284 bool attributedStringForTextMarkerRangeContainsAttribute(JSStringRef, AccessibilityTextMarkerRange*); -
trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
r226432 r229080 543 543 } 544 544 545 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*) 546 { 547 return nullptr; 548 } 549 550 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool) 551 { 552 return nullptr; 553 } 554 545 555 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef, AccessibilityTextMarkerRange*) 546 556 { -
trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
r226432 r229080 1712 1712 } 1713 1713 1714 static JSStringRef createJSStringRef(id string) 1715 { 1716 if (!string) 1717 return nullptr; 1718 id mutableString = [[[NSMutableString alloc] init] autorelease]; 1719 id attributes = [string attributesAtIndex:0 effectiveRange:nil]; 1720 id attributeEnumerationBlock = ^(NSDictionary<NSString *, id> *attrs, NSRange range, BOOL *stop) { 1721 BOOL misspelled = [[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue]; 1722 if (misspelled) 1723 misspelled = [[attrs objectForKey:NSAccessibilityMarkedMisspelledTextAttribute] boolValue]; 1724 if (misspelled) 1725 [mutableString appendString:@"Misspelled, "]; 1726 id font = [attributes objectForKey:(id)kAXFontTextAttribute]; 1727 if (font) 1728 [mutableString appendFormat:@"%@ - %@, ", (id)kAXFontTextAttribute, font]; 1729 }; 1730 [string enumerateAttributesInRange:NSMakeRange(0, [string length]) options:(NSAttributedStringEnumerationOptions)0 usingBlock:attributeEnumerationBlock]; 1731 [mutableString appendString:[string string]]; 1732 return [mutableString createJSStringRef]; 1733 } 1734 1735 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange) 1736 { 1737 id string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(id)markerRange->platformTextMarkerRange()]; 1738 return createJSStringRef(string); 1739 } 1740 1741 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange* markerRange, bool includeSpellCheck) 1742 { 1743 id parameter = nil; 1744 if (includeSpellCheck) 1745 parameter = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:includeSpellCheck], @"AXSpellCheck", (id)markerRange->platformTextMarkerRange(), @"AXTextMarkerRange", nil]; 1746 else 1747 parameter = (id)markerRange->platformTextMarkerRange(); 1748 id string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRangeWithOptions" forParameter:parameter]; 1749 return createJSStringRef(string); 1750 } 1751 1714 1752 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker) 1715 1753 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
r228827 r229080 281 281 RefPtr<AccessibilityUIElement> accessibilityElementForTextMarker(AccessibilityTextMarker*); 282 282 JSRetainPtr<JSStringRef> stringForTextMarkerRange(AccessibilityTextMarkerRange*); 283 JSRetainPtr<JSStringRef> attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*); 284 JSRetainPtr<JSStringRef> attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool); 283 285 int textMarkerRangeLength(AccessibilityTextMarkerRange*); 284 286 bool attributedStringForTextMarkerRangeContainsAttribute(JSStringRef, AccessibilityTextMarkerRange*); -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
r228827 r229080 210 210 AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker marker); 211 211 DOMString stringForTextMarkerRange(AccessibilityTextMarkerRange range); 212 DOMString attributedStringForTextMarkerRange(AccessibilityTextMarkerRange range); 213 DOMString attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange range, boolean includeSpellCheck); 212 214 long textMarkerRangeLength(AccessibilityTextMarkerRange range); 213 215 boolean attributedStringForTextMarkerRangeContainsAttribute(DOMString attr, AccessibilityTextMarkerRange range); -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
r228879 r229080 2216 2216 } 2217 2217 2218 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*) 2219 { 2220 return nullptr; 2221 } 2222 2223 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool) 2224 { 2225 return nullptr; 2226 } 2227 2218 2228 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range) 2219 2229 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
r226432 r229080 1124 1124 } 1125 1125 1126 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange) 1127 { 1128 return nullptr; 1129 } 1130 1131 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange* markerRange, bool) 1132 { 1133 return nullptr; 1134 } 1135 1126 1136 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range) 1127 1137 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
r228827 r229080 1807 1807 return nullptr; 1808 1808 } 1809 1809 1810 static JSStringRef createJSStringRef(id string) 1811 { 1812 id mutableString = [[[NSMutableString alloc] init] autorelease]; 1813 id attributes = [string attributesAtIndex:0 effectiveRange:nil]; 1814 id attributeEnumerationBlock = ^(NSDictionary<NSString *, id> *attrs, NSRange range, BOOL *stop) { 1815 BOOL misspelled = [[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue]; 1816 if (misspelled) 1817 misspelled = [[attrs objectForKey:NSAccessibilityMarkedMisspelledTextAttribute] boolValue]; 1818 if (misspelled) 1819 [mutableString appendString:@"Misspelled, "]; 1820 id font = [attributes objectForKey:(id)kAXFontTextAttribute]; 1821 if (font) 1822 [mutableString appendFormat:@"%@ - %@, ", (id)kAXFontTextAttribute, font]; 1823 }; 1824 [string enumerateAttributesInRange:NSMakeRange(0, [string length]) options:(NSAttributedStringEnumerationOptions)0 usingBlock:attributeEnumerationBlock]; 1825 [mutableString appendString:[string string]]; 1826 return [mutableString createJSStringRef]; 1827 } 1828 1829 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange) 1830 { 1831 NSAttributedString* string = nil; 1832 1833 BEGIN_AX_OBJC_EXCEPTIONS 1834 string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(id)markerRange->platformTextMarkerRange()]; 1835 END_AX_OBJC_EXCEPTIONS 1836 1837 if (![string isKindOfClass:[NSAttributedString class]]) 1838 return nil; 1839 1840 return createJSStringRef(string); 1841 } 1842 1843 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange* markerRange, bool includeSpellCheck) 1844 { 1845 NSAttributedString* string = nil; 1846 1847 id parameter = nil; 1848 if (includeSpellCheck) 1849 parameter = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:includeSpellCheck], @"AXSpellCheck", (id)markerRange->platformTextMarkerRange(), @"AXTextMarkerRange", nil]; 1850 else 1851 parameter = (id)markerRange->platformTextMarkerRange(); 1852 1853 BEGIN_AX_OBJC_EXCEPTIONS 1854 string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRangeWithOptions" forParameter:parameter]; 1855 END_AX_OBJC_EXCEPTIONS 1856 1857 if (![string isKindOfClass:[NSAttributedString class]]) 1858 return nil; 1859 1860 return createJSStringRef(string); 1861 } 1862 1810 1863 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range) 1811 1864 {
Note: See TracChangeset
for help on using the changeset viewer.