Changeset 219424 in webkit
- Timestamp:
- Jul 12, 2017 1:57:43 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r219421 r219424 1 2017-07-12 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219409. 4 5 The revision caused the Windows builds to fail. 6 7 Reverted changeset: 8 9 "AX: [iOS] Implement a way to retrieve a text marker range 10 with desired text that is closest to a position" 11 https://bugs.webkit.org/show_bug.cgi?id=174393 12 http://trac.webkit.org/changeset/219409 13 1 14 2017-07-12 Commit Queue <commit-queue@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r219422 r219424 1 2017-07-12 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219409. 4 5 The revision caused the Windows builds to fail. 6 7 Reverted changeset: 8 9 "AX: [iOS] Implement a way to retrieve a text marker range 10 with desired text that is closest to a position" 11 https://bugs.webkit.org/show_bug.cgi?id=174393 12 http://trac.webkit.org/changeset/219409 13 1 14 2017-07-12 Alicia Boya García <aboya@igalia.com> 2 15 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r219409 r219424 1727 1727 return WTFMove(range); 1728 1728 } 1729 1730 static VisiblePosition visiblePositionForPositionWithOffset(const VisiblePosition& position, int32_t offset)1731 {1732 RefPtr<ContainerNode> root;1733 unsigned startIndex = indexForVisiblePosition(position, root);1734 return visiblePositionForIndex(startIndex + offset, root.get());1735 }1736 1737 RefPtr<Range> AXObjectCache::rangeMatchesTextNearRange(RefPtr<Range> originalRange, const String& matchText)1738 {1739 if (!originalRange)1740 return nullptr;1741 1742 // Create a large enough range for searching the text within.1743 unsigned textLength = matchText.length();1744 auto startPosition = visiblePositionForPositionWithOffset(originalRange->startPosition(), -textLength);1745 auto endPosition = visiblePositionForPositionWithOffset(originalRange->startPosition(), 2 * textLength);1746 1747 if (startPosition.isNull())1748 startPosition = firstPositionInOrBeforeNode(&originalRange->startContainer());1749 if (endPosition.isNull())1750 endPosition = lastPositionInOrAfterNode(&originalRange->endContainer());1751 1752 RefPtr<Range> searchRange = Range::create(m_document, startPosition, endPosition);1753 if (!searchRange || searchRange->collapsed())1754 return nullptr;1755 1756 RefPtr<Range> range = Range::create(m_document, startPosition, originalRange->startPosition());1757 unsigned targetOffset = TextIterator::rangeLength(range.get(), true);1758 return findClosestPlainText(*searchRange.get(), matchText, 0, targetOffset);1759 }1760 1729 1761 1730 static bool isReplacedNodeOrBR(Node* node) -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r219409 r219424 333 333 void deferTextChangedIfNeeded(Node*); 334 334 void performDeferredCacheUpdate(); 335 336 RefPtr<Range> rangeMatchesTextNearRange(RefPtr<Range>, const String&);337 338 335 339 336 protected: -
trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
r219409 r219424 53 53 #import "SVGNames.h" 54 54 #import "SVGElement.h" 55 #import "SelectionRect.h"56 55 #import "TextIterator.h" 57 56 #import "WAKScrollView.h" … … 2590 2589 } 2591 2590 2592 - (RefPtr<Range>)rangeFromMarkers:(NSArray *)markers withText:(NSString *)text2593 {2594 RefPtr<Range> originalRange = [self rangeForTextMarkers:markers];2595 if (!originalRange)2596 return nil;2597 2598 AXObjectCache* cache = m_object->axObjectCache();2599 if (!cache)2600 return nil;2601 2602 return cache->rangeMatchesTextNearRange(originalRange, text);2603 }2604 2605 // This is only used in the layout test.2606 - (NSArray *)textMarkerRangeFromMarkers:(NSArray *)markers withText:(NSString *)text2607 {2608 return [self textMarkersForRange:[self rangeFromMarkers:markers withText:text]];2609 }2610 2611 - (NSArray *)textRectsFromMarkers:(NSArray *)markers withText:(NSString *)text2612 {2613 if (![self _prepareAccessibilityCall])2614 return nil;2615 2616 RefPtr<Range> range = [self rangeFromMarkers:markers withText:text];2617 if (!range || range->collapsed())2618 return nil;2619 2620 Vector<WebCore::SelectionRect> selectionRects;2621 range->collectSelectionRectsWithoutUnionInteriorLines(selectionRects);2622 return [self rectsForSelectionRects:selectionRects];2623 }2624 2625 - (NSArray *)rectsForSelectionRects:(const Vector<WebCore::SelectionRect>&)selectionRects2626 {2627 unsigned size = selectionRects.size();2628 if (!size)2629 return nil;2630 2631 NSMutableArray *rects = [NSMutableArray arrayWithCapacity:size];2632 for (unsigned i = 0; i < size; i++) {2633 const WebCore::SelectionRect& coreRect = selectionRects[i];2634 IntRect selectionRect = coreRect.rect();2635 CGRect rect = [self convertRectToScreenSpace:selectionRect];2636 [rects addObject:[NSValue valueWithRect:rect]];2637 }2638 2639 return rects;2640 }2641 2642 2591 - (WebAccessibilityTextMarker *)textMarkerForPoint:(CGPoint)point 2643 2592 { -
trunk/Tools/ChangeLog
r219409 r219424 1 2017-07-12 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219409. 4 5 The revision caused the Windows builds to fail. 6 7 Reverted changeset: 8 9 "AX: [iOS] Implement a way to retrieve a text marker range 10 with desired text that is closest to a position" 11 https://bugs.webkit.org/show_bug.cgi?id=174393 12 http://trac.webkit.org/changeset/219409 13 1 14 2017-07-12 Nan Wang <n_wang@apple.com> 2 15 -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp
r219409 r219424 928 928 static JSValueRef textMarkerRangeForMarkersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 929 929 { 930 AccessibilityTextMarker* startMarker = nullptr;931 AccessibilityTextMarker* endMarker = nullptr;930 AccessibilityTextMarker* startMarker = 0; 931 AccessibilityTextMarker* endMarker = 0; 932 932 if (argumentCount == 2) { 933 933 startMarker = toTextMarker(JSValueToObject(context, arguments[0], exception)); … … 1482 1482 { 1483 1483 return JSValueMakeBoolean(context, toAXElement(thisObject)->hasContainedByFieldsetTrait()); 1484 }1485 1486 static JSValueRef textMarkerRangeMatchesTextNearMarkersCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)1487 {1488 JSStringRef searchText = nullptr;1489 AccessibilityTextMarker* startMarker = nullptr;1490 AccessibilityTextMarker* endMarker = nullptr;1491 if (argumentCount == 3) {1492 searchText = JSValueToStringCopy(context, arguments[0], exception);1493 startMarker = toTextMarker(JSValueToObject(context, arguments[1], exception));1494 endMarker = toTextMarker(JSValueToObject(context, arguments[2], exception));1495 }1496 1497 JSValueRef result = AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)->textMarkerRangeMatchesTextNearMarkers(searchText, startMarker, endMarker));1498 if (searchText)1499 JSStringRelease(searchText);1500 return result;1501 1484 } 1502 1485 … … 1718 1701 1719 1702 AccessibilityTextMarker AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*) 1720 {1721 return nullptr;1722 }1723 1724 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*)1725 1703 { 1726 1704 return nullptr; … … 1943 1921 { "assistiveTechnologySimulatedFocus", assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1944 1922 { "fieldsetAncestorElement", fieldsetAncestorElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1945 { "textMarkerRangeMatchesTextNearMarkers", textMarkerRangeMatchesTextNearMarkersCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },1946 1923 #endif 1947 1924 { 0, 0, 0 } -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.h
r219409 r219424 307 307 bool isSearchField() const; 308 308 309 AccessibilityTextMarkerRange textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*);310 311 309 #endif // PLATFORM(IOS) 312 310 -
trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
r219409 r219424 114 114 - (id)lineStartMarkerForMarker:(id)marker; 115 115 - (id)lineEndMarkerForMarker:(id)marker; 116 - (NSArray *)textMarkerRangeFromMarkers:(NSArray *)markers withText:(NSString *)text;117 116 @end 118 117 … … 622 621 } 623 622 624 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef text, AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)625 {626 NSArray *textMarkers = nil;627 if (startMarker->platformTextMarker() && endMarker->platformTextMarker())628 textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil];629 id textMarkerRange = [m_element textMarkerRangeFromMarkers:textMarkers withText:[NSString stringWithJSStringRef:text]];630 return AccessibilityTextMarkerRange(textMarkerRange);631 }632 633 634 623 #endif // SUPPORTS_AX_TEXTMARKERS && PLATFORM(IOS) 635 624 -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
r219409 r219424 75 75 bool AccessibilityUIElement::isSearchField() const { return false; } 76 76 bool AccessibilityUIElement::isTextArea() const { return false; } 77 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*) { return nullptr; } 77 78 78 #endif 79 79 -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
r219409 r219424 290 290 RefPtr<AccessibilityTextMarker> nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*); 291 291 RefPtr<AccessibilityTextMarker> previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*); 292 RefPtr<AccessibilityTextMarkerRange> textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*);293 292 294 293 // Returns an ordered list of supported actions for an element. -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
r219409 r219424 227 227 AccessibilityTextMarker previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker textMarker); 228 228 AccessibilityTextMarker nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker textMarker); 229 AccessibilityTextMarkerRange textMarkerRangeMatchesTextNearMarkers(DOMString text, AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);230 229 231 230 // Returns an ordered list of supported actions for an element. -
trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
r219409 r219424 92 92 - (id)lineStartMarkerForMarker:(id)marker; 93 93 - (id)lineEndMarkerForMarker:(id)marker; 94 - (NSArray *)textMarkerRangeFromMarkers:(NSArray *)markers withText:(NSString *)text;95 94 @end 96 95 … … 1201 1200 { 1202 1201 return nullptr; 1203 }1204 1205 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef text, AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)1206 {1207 NSArray *textMarkers = nil;1208 if (startMarker->platformTextMarker() && endMarker->platformTextMarker())1209 textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil];1210 id textMarkerRange = [m_element textMarkerRangeFromMarkers:textMarkers withText:[NSString stringWithJSStringRef:text]];1211 return AccessibilityTextMarkerRange::create(textMarkerRange);1212 1202 } 1213 1203
Note: See TracChangeset
for help on using the changeset viewer.