Changeset 286823 in webkit
- Timestamp:
- Dec 9, 2021, 6:16:28 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/ios/UIKitSPI.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (modified) (3 diffs)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r286816 r286823 1 2021-12-09 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Add SPI to enable find interactions on WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=234017 5 rdar://86140542 6 7 Reviewed by Wenson Hsieh. 8 9 * Platform/spi/ios/UIKitSPI.h: 10 * UIProcess/API/Cocoa/WKWebView.mm: 11 (-[WKWebView _initializeWithConfiguration:]): 12 * UIProcess/API/Cocoa/WKWebViewInternal.h: 13 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 14 * UIProcess/API/ios/WKWebViewIOS.mm: 15 (-[WKWebView _findInteractionEnabled]): 16 (-[WKWebView _setFindInteractionEnabled:]): 17 18 Make the contentView the searchableObject, rather than self (the WKWebView) 19 to avoid a retain cycle. 20 21 (-[WKWebView _findInteraction]): 22 (-[WKWebView offsetFromPosition:toPosition:inDocument:]): 23 (-[WKWebView decorateFoundTextRange:inDocument:usingStyle:]): 24 * UIProcess/ios/WKContentViewInteraction.h: 25 26 Make WKContentView conform to _UITextSearching so that it can be set as 27 the interaction's searchableObject. 28 29 * UIProcess/ios/WKContentViewInteraction.mm: 30 (-[WKContentView decorateFoundTextRange:inDocument:usingStyle:]): 31 (-[WKContentView offsetFromPosition:toPosition:inDocument:]): 32 (-[WKContentView decorateFoundTextRange:usingStyle:]): Deleted. 33 1 34 2021-12-09 Alex Christensen <achristensen@webkit.org> 2 35 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r286641 r286823 132 132 133 133 #if HAVE(UIFINDINTERACTION) 134 #import <UIKit/_UIFindInteraction.h> 134 135 #import <UIKit/_UITextSearching.h> 135 136 #endif … … 327 328 - (void)clearAllDecoratedFoundText; 328 329 330 @end 331 332 @interface _UIFindInteraction : NSObject <UIInteraction> 333 @property (nonatomic, strong) id<_UITextSearching> searchableObject; 329 334 @end 330 335 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r286815 r286823 368 368 _allowsLinkPreview = linkedOnOrAfter(WebCore::SDKVersion::FirstWithLinkPreviewEnabledByDefault); 369 369 370 #if HAVE(UIFINDINTERACTION) 371 _findInteractionEnabled = NO; 372 #endif 373 370 374 auto fastClickingEnabled = []() { 371 375 if (NSNumber *enabledValue = [[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitFastClickingDisabled"]) -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
r284628 r286823 152 152 #endif 153 153 154 #if HAVE(UIFINDINTERACTION) 155 RetainPtr<_UIFindInteraction> _findInteraction; 156 BOOL _findInteractionEnabled; 157 #endif 158 154 159 RetainPtr<_WKRemoteObjectRegistry> _remoteObjectRegistry; 155 160 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r286751 r286823 25 25 26 26 #if TARGET_OS_IPHONE 27 #if __has_include(<UIKit/_UIFindInteraction.h>) 28 #import <UIKit/_UIFindInteraction.h> 29 #endif 27 30 #if __has_include(<UIKit/_UITextSearching.h>) 28 31 #import <UIKit/_UITextSearching.h> … … 439 442 @property (nonatomic, copy, setter=_setEphemeralUIEventAttribution:) UIEventAttribution *_ephemeralUIEventAttribution WK_API_AVAILABLE(ios(WK_IOS_TBA)); 440 443 - (void)_setEphemeralUIEventAttribution:(UIEventAttribution *)attribution forApplicationWithBundleID:(NSString *)bundleID WK_API_AVAILABLE(ios(WK_IOS_TBA)); 444 445 #if __has_include(<UIKit/_UIFindInteraction.h>) 446 @property (nonatomic, readonly) _UIFindInteraction *_findInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA)); 447 @property (nonatomic, readwrite, setter=_setFindInteractionEnabled:) BOOL _findInteractionEnabled WK_API_AVAILABLE(ios(WK_IOS_TBA)); 448 #endif 449 441 450 #endif 442 451 -
trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
r286641 r286823 3484 3484 #if HAVE(UIFINDINTERACTION) 3485 3485 3486 - (BOOL)_findInteractionEnabled 3487 { 3488 return _findInteractionEnabled; 3489 } 3490 3491 - (void)_setFindInteractionEnabled:(BOOL)enabled 3492 { 3493 if (_findInteractionEnabled != enabled) { 3494 _findInteractionEnabled = enabled; 3495 3496 if (enabled) { 3497 if (!_findInteraction) { 3498 _findInteraction = adoptNS([[_UIFindInteraction alloc] init]); 3499 [_findInteraction setSearchableObject:_contentView.get()]; 3500 } 3501 3502 [self addInteraction:_findInteraction.get()]; 3503 } else { 3504 [self removeInteraction:_findInteraction.get()]; 3505 _findInteraction = nil; 3506 } 3507 } 3508 } 3509 3510 - (_UIFindInteraction *)_findInteraction 3511 { 3512 return _findInteraction.get(); 3513 } 3514 3486 3515 - (UITextRange *)selectedTextRange 3487 3516 { … … 3491 3520 - (NSInteger)offsetFromPosition:(UITextPosition *)from toPosition:(UITextPosition *)toPosition inDocument:(_UITextSearchDocumentIdentifier)document 3492 3521 { 3493 return [_contentView offsetFromPosition:from toPosition:toPosition ];3522 return [_contentView offsetFromPosition:from toPosition:toPosition inDocument:document]; 3494 3523 } 3495 3524 … … 3501 3530 - (void)decorateFoundTextRange:(UITextRange *)range inDocument:(_UITextSearchDocumentIdentifier)document usingStyle:(_UIFoundTextStyle)style 3502 3531 { 3503 [_contentView decorateFoundTextRange:range usingStyle:style];3532 [_contentView decorateFoundTextRange:range inDocument:document usingStyle:style]; 3504 3533 } 3505 3534 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r286705 r286823 538 538 , WKHoverPlatterDelegate 539 539 #endif 540 #if HAVE(UIFINDINTERACTION) 541 , _UITextSearching 542 #endif 540 543 > 541 544 … … 715 718 - (void)clearTextIndicator:(WebCore::TextIndicatorDismissalAnimation)animation; 716 719 717 #if HAVE(UIFINDINTERACTION)718 - (void)performTextSearchWithQueryString:(NSString *)string usingOptions:(_UITextSearchOptions *)options resultAggregator:(id<_UITextSearchAggregator>)aggregator;719 - (void)decorateFoundTextRange:(UITextRange *)range usingStyle:(_UIFoundTextStyle)style;720 - (void)clearAllDecoratedFoundText;721 #endif722 723 720 @property (nonatomic, readonly) BOOL _shouldUseContextMenus; 724 721 @property (nonatomic, readonly) BOOL _shouldUseContextMenusForFormControls; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r286705 r286823 9988 9988 } 9989 9989 9990 - (void)decorateFoundTextRange:(UITextRange *)range usingStyle:(_UIFoundTextStyle)style9990 - (void)decorateFoundTextRange:(UITextRange *)range inDocument:(_UITextSearchDocumentIdentifier)document usingStyle:(_UIFoundTextStyle)style 9991 9991 { 9992 9992 if (![range isKindOfClass:[WKFoundTextRange class]]) … … 10005 10005 _foundHighlightedTextRange = nil; 10006 10006 _page->hideFindUI(); 10007 } 10008 10009 - (NSInteger)offsetFromPosition:(UITextPosition *)from toPosition:(UITextPosition *)toPosition inDocument:(_UITextSearchDocumentIdentifier)document 10010 { 10011 return [self offsetFromPosition:from toPosition:toPosition]; 10007 10012 } 10008 10013 -
trunk/Tools/ChangeLog
r286817 r286823 1 2021-12-09 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Add SPI to enable find interactions on WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=234017 5 rdar://86140542 6 7 Reviewed by Wenson Hsieh. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm: 10 (TEST): 11 12 Test that the new SPI installs a _UIFindInteraction on the web view. 13 1 14 2021-12-09 Lauro Moura <lmoura@igalia.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm
r286660 r286823 453 453 } 454 454 455 TEST(WebKit, FindInteraction) 456 { 457 RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]); 458 459 EXPECT_NULL([webView _findInteraction]); 460 461 [webView _setFindInteractionEnabled:YES]; 462 EXPECT_NOT_NULL([webView _findInteraction]); 463 464 [webView _setFindInteractionEnabled:NO]; 465 EXPECT_NULL([webView _findInteraction]); 466 } 467 455 468 #endif // HAVE(UIFINDINTERACTION)
Note:
See TracChangeset
for help on using the changeset viewer.