Changeset 212211 in webkit
- Timestamp:
- Feb 12, 2017, 2:01:24 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r212207 r212211 1 2017-02-12 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Some -respondsToSelector: checks are unnecessary 4 https://bugs.webkit.org/show_bug.cgi?id=168183 5 6 Reviewed by Tim Horton. 7 8 * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the 9 change to WebKit2/Platform/mac/MenuUtilities.mm. 10 11 * editing/mac/DictionaryLookup.mm: 12 (WebCore::showPopupOrCreateAnimationController): Removed check whether 13 LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:. 14 15 * platform/cocoa/NetworkExtensionContentFilter.mm: 16 (WebCore::NetworkExtensionContentFilter::initialize): Changed to use 17 -[NEFilterSource setSourceAppIdentifier:], without checking, instead of 18 -setSourceAppBundleID:, which does not exist. 19 20 * platform/cocoa/ScrollController.mm: 21 (systemUptime): Deleted. 22 (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly. 23 24 * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: 25 (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check. 26 27 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 28 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto. 29 (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto. 30 (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced 31 -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast. 32 (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary 33 check. 34 35 * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm: 36 (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks. 37 38 * platform/graphics/mac/WebGLLayer.mm: 39 (-[WebGLLayer initWithGraphicsContext3D:]): Ditto. 40 41 * platform/mac/PlatformEventFactoryMac.mm: 42 (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and 43 all code to handle that case that it doesn’t. 44 45 * platform/mac/WebVideoFullscreenController.mm: 46 (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether 47 NSWindow responds to -isOnActiveSpace. 48 (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether 49 NSApplication responds to -setPresentationOptions: 50 51 * platform/mac/WebVideoFullscreenInterfaceMac.mm: 52 (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed 53 unnecessary -respondsToSelector: check. 54 (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto. 55 (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto. 56 57 * platform/spi/cf/CFNetworkSPI.h: Moved declarations of 58 -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and 59 -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section. 60 61 * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’ 62 sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted 63 unconditional declaration of sourceAppBundleID property, which doesn’t exist. 64 65 * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations. 66 67 * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods 68 from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here. 69 Removed an unused declaration. 70 71 * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the 72 !USE(APPLE_INTERNAL_SDK) section. 73 74 * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the 75 Apple internal SDK. Cleaned up the declarations for the other case. 76 77 * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple 78 internal SDK. 79 1 80 2017-02-11 Sam Weinig <sam@webkit.org> 2 81 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r210943 r212211 128 128 "Bulleted list" = "Bulleted list"; 129 129 130 /* menu item title for phone number */131 "Call Using iPhone:" = "Call Using iPhone:";132 133 130 /* Title for Cancel button label in button bar */ 134 131 "Cancel button label in button bar" = "Cancel"; -
trunk/Source/WebCore/editing/mac/DictionaryLookup.mm
r202390 r212211 222 222 [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()]; 223 223 224 if ([getLULookupDefinitionModuleClass() respondsToSelector:@selector(showDefinitionForTerm:relativeToRect:ofView:options:)]) { 225 FloatRect firstTextRectInViewCoordinates = textIndicator.get().textRectsInBoundingRectCoordinates()[0]; 226 FloatRect textBoundingRectInViewCoordinates = textIndicator.get().textBoundingRectInRootViewCoordinates(); 227 if (rootViewToViewConversionCallback) 228 textBoundingRectInViewCoordinates = rootViewToViewConversionCallback(textBoundingRectInViewCoordinates); 229 firstTextRectInViewCoordinates.moveBy(textBoundingRectInViewCoordinates.location()); 230 if (createAnimationController) 231 return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()]; 232 233 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()]; 234 return nil; 235 } 224 FloatRect firstTextRectInViewCoordinates = textIndicator.get().textRectsInBoundingRectCoordinates()[0]; 225 FloatRect textBoundingRectInViewCoordinates = textIndicator.get().textBoundingRectInRootViewCoordinates(); 226 if (rootViewToViewConversionCallback) 227 textBoundingRectInViewCoordinates = rootViewToViewConversionCallback(textBoundingRectInViewCoordinates); 228 firstTextRectInViewCoordinates.moveBy(textBoundingRectInViewCoordinates.location()); 229 if (createAnimationController) 230 return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()]; 231 232 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() relativeToRect:firstTextRectInViewCoordinates ofView:view options:mutableOptions.get()]; 233 return nil; 236 234 } 237 235 -
trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm
r209147 r212211 76 76 m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithDecisionQueue:m_queue.get()]); 77 77 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) 78 // FIXME: Remove the -respondsToSelector: check once -setSourceAppBundleID: is in an SDK (<rdar://problem/29147174>). 79 if ([m_neFilterSource respondsToSelector:@selector(setSourceAppBundleID:)]) 80 [m_neFilterSource setSourceAppBundleID:applicationBundleIdentifier()]; 78 [m_neFilterSource setSourceAppIdentifier:applicationBundleIdentifier()]; 81 79 #endif 82 80 #else -
trunk/Source/WebCore/platform/cocoa/ScrollController.mm
r210560 r212211 42 42 #if ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP) 43 43 44 #if PLATFORM(MAC)45 static NSTimeInterval systemUptime()46 {47 if ([[NSProcessInfo processInfo] respondsToSelector:@selector(systemUptime)])48 return [[NSProcessInfo processInfo] systemUptime];49 50 // Get how long system has been up. Found by looking getting "boottime" from the kernel.51 static struct timeval boottime = {0, 0};52 if (!boottime.tv_sec) {53 int mib[2] = {CTL_KERN, KERN_BOOTTIME};54 size_t size = sizeof(boottime);55 if (-1 == sysctl(mib, 2, &boottime, &size, 0, 0))56 boottime.tv_sec = 0;57 }58 struct timeval now;59 if (boottime.tv_sec && -1 != gettimeofday(&now, 0)) {60 struct timeval uptime;61 timersub(&now, &boottime, &uptime);62 NSTimeInterval result = uptime.tv_sec + (uptime.tv_usec / 1E+6);63 return result;64 }65 return 0;66 }67 #endif68 69 44 namespace WebCore { 70 45 … … 428 403 void ScrollController::snapRubberBand() 429 404 { 430 CFTimeInterval timeDelta = systemUptime()- m_lastMomentumScrollTimestamp;405 CFTimeInterval timeDelta = [NSProcessInfo processInfo].systemUptime - m_lastMomentumScrollTimestamp; 431 406 if (m_lastMomentumScrollTimestamp && timeDelta >= scrollVelocityZeroingTimeout) 432 407 m_momentumVelocity = FloatSize(); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm
r201482 r212211 117 117 LOG(Media, "MediaPlaybackTargetPickerMac::showPlaybackTargetPicker - checkActiveRoute = %i", (int)checkActiveRoute); 118 118 119 AVOutputDeviceMenuControllerType *picker = devicePicker();120 if (![picker respondsToSelector:@selector(showMenuForRect:appearanceName:allowReselectionOfSelectedOutputDevice:)])121 return;122 123 119 m_showingMenu = true; 124 if ([picker showMenuForRect:location appearanceName:NSAppearanceNameVibrantLight allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) { 120 121 if ([devicePicker() showMenuForRect:location appearanceName:NSAppearanceNameVibrantLight allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) { 125 122 if (!checkActiveRoute) 126 123 currentDeviceDidChange(); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r210859 r212211 758 758 759 759 #if PLATFORM(IOS) 760 if ([m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)]) 761 [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)]; 760 [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)]; 762 761 #endif 763 762 #else … … 1258 1257 { 1259 1258 #if PLATFORM(IOS) 1260 if (m_videoLayer && [m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)]) 1261 [m_videoLayer setPIPModeEnabled:(mode & MediaPlayer::VideoFullscreenModePictureInPicture)]; 1259 [m_videoLayer setPIPModeEnabled:(mode & MediaPlayer::VideoFullscreenModePictureInPicture)]; 1262 1260 updateDisableExternalPlayback(); 1263 1261 #else … … 2245 2243 2246 2244 WebCoreNSURLSession *session = (WebCoreNSURLSession *)resourceLoader.URLSession; 2247 if ([session respondsToSelector:@selector(didPassCORSAccessChecks)])2245 if ([session isKindOfClass:[WebCoreNSURLSession class]]) 2248 2246 return session.didPassCORSAccessChecks; 2249 2247 #endif … … 3200 3198 { 3201 3199 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 3202 if (m_avPlayer && [m_avPlayer respondsToSelector:@selector(_setPreventsSleepDuringVideoPlayback:)]) 3203 [m_avPlayer _setPreventsSleepDuringVideoPlayback:flag]; 3200 [m_avPlayer _setPreventsSleepDuringVideoPlayback:flag]; 3204 3201 #else 3205 3202 UNUSED_PARAM(flag); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm
r202350 r212211 113 113 if (oldContext && newContext && oldContext != newContext) { 114 114 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 115 if ([oldContext respondsToSelector:@selector(setCommitPriority:)]) { 116 [oldContext setCommitPriority:0]; 117 [newContext setCommitPriority:1]; 118 } 115 oldContext.commitPriority = 0; 116 newContext.commitPriority = 1; 119 117 #endif 120 118 mach_port_t fencePort = [oldContext createFencePort]; -
trunk/Source/WebCore/platform/graphics/mac/WebGLLayer.mm
r201639 r212211 57 57 self.contentsScale = _devicePixelRatio; 58 58 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 59 if ([self respondsToSelector:@selector(setColorspace:)]) 60 [self setColorspace:sRGBColorSpaceRef()]; 59 self.colorspace = sRGBColorSpaceRef(); 61 60 #endif 62 61 #endif -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
r211663 r212211 672 672 static int typeForEvent(NSEvent *event) 673 673 { 674 if ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)]) 675 return static_cast<int>([NSMenu menuTypeForEvent:event]); 676 677 if (mouseButtonForEvent(event) == RightButton) 678 return static_cast<int>(NSMenuTypeContextMenu); 679 680 if (mouseButtonForEvent(event) == LeftButton && modifiersForEvent(event).contains(PlatformEvent::Modifier::CtrlKey)) 681 return static_cast<int>(NSMenuTypeContextMenu); 682 683 return static_cast<int>(NSMenuTypeNone); 674 return static_cast<int>([NSMenu menuTypeForEvent:event]); 684 675 } 685 676 -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
r210105 r212211 220 220 { 221 221 UNUSED_PARAM(notification); 222 // Check to see if the fullscreenWindow is on the active space; this function is available223 // on 10.6 and later, so default to YES if the function is not available:224 222 NSWindow* fullscreenWindow = [self fullscreenWindow]; 225 BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);226 223 227 224 // Replicate the QuickTime Player (X) behavior when losing active application status: … … 229 226 // single screen is available.) Is the fullscreen screen on the current space? IFF so, 230 227 // then exit fullscreen mode. 231 if ( [fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)228 if (fullscreenWindow.screen == [NSScreen screens][0] && fullscreenWindow.onActiveSpace) 232 229 [self requestExitFullscreenWithAnimation:NO]; 233 230 } … … 354 351 } 355 352 356 if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) 357 [NSApp setPresentationOptions:options]; 358 else 359 SetSystemUIMode(_isEndingFullscreen ? kUIModeNormal : kUIModeAllHidden, 0); 353 NSApp.presentationOptions = options; 360 354 } 361 355 -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm
r206520 r212211 171 171 _playing = isPlaying && playbackRate; 172 172 173 if ([_pipViewController respondsToSelector:@selector(setPlaying:)]) 174 [_pipViewController setPlaying:_playing]; 173 [_pipViewController setPlaying:_playing]; 175 174 } 176 175 … … 179 178 _videoDimensions = videoDimensions; 180 179 181 if ([_pipViewController respondsToSelector:@selector(setAspectRatio:)]) 182 [_pipViewController setAspectRatio:_videoDimensions]; 180 [_pipViewController setAspectRatio:_videoDimensions]; 183 181 } 184 182 … … 191 189 _pipViewController = adoptNS([[getPIPViewControllerClass() alloc] init]); 192 190 [_pipViewController setDelegate:self]; 193 if ([_pipViewController respondsToSelector:@selector(setUserCanResize:)]) 194 [_pipViewController setUserCanResize:YES]; 195 if ([_pipViewController respondsToSelector:@selector(setPlaying:)]) 196 [_pipViewController setPlaying:_playing]; 191 [_pipViewController setUserCanResize:YES]; 192 [_pipViewController setPlaying:_playing]; 197 193 [self setVideoDimensions:NSEqualSizes(_videoDimensions, NSZeroSize) ? frame.size : _videoDimensions]; 198 194 if (_webVideoFullscreenInterfaceMac && _webVideoFullscreenInterfaceMac->webVideoFullscreenModel()) -
trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h
r211835 r212211 84 84 85 85 #if defined(__OBJC__) 86 @interface NSURLCache () 87 -(instancetype)_initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity relativePath:(NSString *)path; 88 - (CFURLCacheRef)_CFURLCache; 89 @end 90 86 91 @interface NSURLRequest () 87 92 + (NSArray *)allowsSpecificHTTPSCertificateForHost:(NSString *)host; … … 191 196 WTF_EXTERN_C_END 192 197 193 // FIXME: We should only forward declare this SPI when building for iOS without the Apple Internal SDK.194 // As a workaround for <rdar://problem/19025016>, we must forward declare this SPI regardless of whether195 // we are building with the Apple Internal SDK.196 #if defined(__OBJC__) && PLATFORM(IOS)197 @interface NSURLCache ()198 -(id)_initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity relativePath:(NSString *)path;199 @end200 #endif201 202 198 #if defined(__OBJC__) && !USE(APPLE_INTERNAL_SDK) 203 199 enum : NSUInteger { -
trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h
r209147 r212211 74 74 - (void)finishedLoadingWithDecisionHandler:(NEFilterSourceDecisionHandler)decisionHandler; 75 75 - (void)remediateWithDecisionHandler:(NEFilterSourceDecisionHandler)decisionHandler; 76 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) 77 @property (copy) NSString *sourceAppIdentifier; 78 #endif 76 79 @end 77 80 … … 79 82 80 83 #endif // !USE(APPLE_INTERNAL_SDK) 81 82 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)83 // FIXME: Confine this to the !USE(APPLE_INTERNAL_SDK) section once this is defined in an SDK (<rdar://problem/29147174>).84 @interface NEFilterSource (WKStaging)85 @property (copy) NSString *sourceAppBundleID;86 @end87 #endif -
trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h
r209369 r212211 34 34 #ifdef __OBJC__ 35 35 36 #import <QuartzCore/CAContext.h> 36 37 #import <QuartzCore/CALayerHost.h> 37 38 #import <QuartzCore/CALayerPrivate.h> … … 40 41 #if PLATFORM(IOS) 41 42 #import <QuartzCore/CADisplay.h> 42 #endif43 44 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10120045 @interface CAContext ()46 - (void)setCommitPriority:(uint32_t)commitPriority;47 @end48 43 #endif 49 44 … … 63 58 - (void)deleteSlot:(uint32_t)name; 64 59 - (void)invalidate; 60 - (void)invalidateFences; 65 61 - (mach_port_t)createFencePort; 66 62 - (void)setFencePort:(mach_port_t)port; … … 199 195 WTF_EXTERN_C_END 200 196 201 // FIXME: Move this into the APPLE_INTERNAL_SDK block once it's in an SDK.202 @interface CAContext (AdditionalDetails)203 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)204 - (void)invalidateFences;205 #endif206 @end207 208 197 extern NSString * const kCATiledLayerRemoveImmediately; 209 198 -
trunk/Source/WebCore/platform/spi/ios/DataDetectorsUISPI.h
r202889 r212211 36 36 #else 37 37 38 #import <WebCore/DataDetectorsCoreSPI.h> 39 38 40 @interface DDAction : NSObject 39 41 @end … … 55 57 + (NSArray *)tapAndHoldSchemes; 56 58 - (void)performAction:(DDAction *)action fromAlertController:(UIAlertController *)alertController interactionDelegate:(id <DDDetectionControllerInteractionDelegate>)interactionDelegate; 59 - (NSArray *)actionsForURL:(NSURL *)url identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *)results context:(NSDictionary *)context; 60 - (DDResultRef)resultForURL:(NSURL *)url identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *)results context:(NSDictionary *)context extendedContext:(NSDictionary **)extendedContext; 57 61 @end 58 62 59 63 #endif 60 61 @interface DDDetectionController (DetailsToBeRemoved)62 // FIXME: This will be removed as soon as <rdar://problem/16346913> is fixed.63 - (NSArray *)actionsForAnchor:(id)anchor url:(NSURL *)targetURL forFrame:(id)frame;64 @end65 64 66 65 SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI) -
trunk/Source/WebCore/platform/spi/mac/LookupSPI.h
r194318 r212211 43 43 + (NSRange)tokenRangeForString:(NSString *)string range:(NSRange)range options:(NSDictionary **)options; 44 44 + (void)showDefinitionForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options; 45 + (void)showDefinitionForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options; 45 46 + (void)hideDefinition; 47 + (id<NSImmediateActionAnimationController>)lookupAnimationControllerForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options; 48 + (id<NSImmediateActionAnimationController>)lookupAnimationControllerForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options; 46 49 47 50 @end … … 49 52 #endif // !USE(APPLE_INTERNAL_SDK) 50 53 51 @interface LULookupDefinitionModule ()52 53 + (id<NSImmediateActionAnimationController>)lookupAnimationControllerForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options;54 55 + (id<NSImmediateActionAnimationController>)lookupAnimationControllerForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options;56 57 @end58 59 @interface LULookupDefinitionModule ()60 61 + (void)showDefinitionForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options;62 63 @end64 65 54 #endif // PLATFORM(MAC) -
trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h
r192481 r212211 28 28 #if PLATFORM(MAC) 29 29 30 // FIXME: We should just include the appropriate internal headers. 30 #if USE(APPLE_INTERNAL_SDK) 31 32 #import <AppKit/NSMenu_Private.h> 33 34 #else 31 35 32 36 typedef NS_ENUM(NSInteger, NSMenuType) { … … 35 39 }; 36 40 37 @interface NSMenu ( Private)41 @interface NSMenu () 38 42 + (NSMenuType)menuTypeForEvent:(NSEvent *)event; 39 43 @end … … 41 45 @class QLPreviewMenuItem; 42 46 43 @interface NSMenuItem ( Private)47 @interface NSMenuItem () <NSUserInterfaceItemIdentification> 44 48 + (QLPreviewMenuItem *)standardQuickLookMenuItem; 45 49 + (NSMenuItem *)standardShareMenuItemWithItems:(NSArray *)items; 46 50 @end 47 51 48 @interface NSMenuItem () <NSUserInterfaceItemIdentification> 49 @end 52 #endif 50 53 51 54 #endif -
trunk/Source/WebCore/platform/spi/mac/TUCallSPI.h
r194318 r212211 27 27 #import <objc/runtime.h> 28 28 29 #if USE(APPLE_INTERNAL_SDK) 30 31 #import <TelephonyUtilities/TUCall_Strings.h> 32 33 #else 34 29 35 @interface TUCall : NSObject 30 36 @end … … 34 40 @end 35 41 42 #endif 43 36 44 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(TelephonyUtilities) 37 45 SOFT_LINK_CLASS(TelephonyUtilities, TUCall) -
trunk/Source/WebKit/mac/ChangeLog
r212173 r212211 1 2017-02-12 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Some -respondsToSelector: checks are unnecessary 4 https://bugs.webkit.org/show_bug.cgi?id=168183 5 6 Reviewed by Tim Horton. 7 8 * WebView/WebFullScreenController.mm: 9 (-[WebFullScreenController applicationDidResignActive:]): Removed check whether NSWindow 10 responds to -isOnActiveSpace. 11 (-[WebFullScreenController exitFullScreen]): Ditto. 12 (-[WebFullScreenController _updateMenuAndDockForFullScreen]): Removed check whether 13 NSApplication responds to -setPresentationOptions. 14 15 * WebView/WebHTMLView.mm: 16 (createShareMenuItem): Removed unnecessary -respondsToSelector: check. 17 (-[WebHTMLView otherMouseDown:]): Ditto. 18 19 * WebView/WebImmediateActionController.mm: 20 (-[WebImmediateActionController _clearImmediateActionState]): Ditto. 21 (-[WebImmediateActionController _animationControllerForDataDetectedText]): Ditto. 22 23 * WebView/WebView.mm: 24 (-[WebView _didStartProvisionalLoadForFrame:]): Removed redundant nil check. 25 (+[WebView _setCacheModel:]): Removed unnecessary -respondsToSelector: check. 26 1 27 2017-02-10 Daniel Bates <dabates@apple.com> 2 28 -
trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm
r210697 r212211 76 76 } 77 77 78 @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)79 - (BOOL)isOnActiveSpace;80 @end81 82 78 @implementation WebFullScreenController 83 79 … … 166 162 - (void)applicationDidResignActive:(NSNotification*)notification 167 163 { 168 // Check to see if the fullscreenWindow is on the active space; this function is available169 // on 10.6 and later, so default to YES if the function is not available:170 164 NSWindow* fullscreenWindow = [self window]; 171 BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);172 165 173 166 // Replicate the QuickTime Player (X) behavior when losing active application status: … … 175 168 // single screen is available.) Is the fullscreen screen on the current space? IFF so, 176 169 // then exit fullscreen mode. 177 if ( [fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)170 if (fullscreenWindow.screen == [NSScreen screens][0] && fullscreenWindow.onActiveSpace) 178 171 [self cancelOperation:self]; 179 172 } … … 326 319 // If the user has moved the fullScreen window into a new space, temporarily change 327 320 // the collectionBehavior of the webView's window so that it is pulled into the active space: 328 if (! ([webWindow respondsToSelector:@selector(isOnActiveSpace)] ? [webWindow isOnActiveSpace] : YES)) {321 if (!webWindow.onActiveSpace) { 329 322 NSWindowCollectionBehavior behavior = [webWindow collectionBehavior]; 330 323 [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; … … 431 424 } 432 425 433 if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) 434 [NSApp setPresentationOptions:options]; 435 else 436 SetSystemUIMode(_isFullScreen ? kUIModeAllHidden : kUIModeNormal, 0); 426 NSApp.presentationOptions = options; 437 427 } 438 428 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r211438 r212211 3873 3873 static RetainPtr<NSMenuItem> createShareMenuItem(const HitTestResult& hitTestResult) 3874 3874 { 3875 if (![[NSMenuItem class] respondsToSelector:@selector(standardShareMenuItemWithItems:)])3876 return nil;3877 3878 3875 auto items = adoptNS([[NSMutableArray alloc] init]); 3879 3876 … … 6105 6102 - (void)otherMouseDown:(NSEvent *)event 6106 6103 { 6107 if ([event buttonNumber] != 2 || ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)] 6108 && [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu)) { 6104 if (event.buttonNumber != 2 || [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu) { 6109 6105 [super otherMouseDown:event]; 6110 6106 return; -
trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm
r208630 r212211 129 129 130 130 DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager]; 131 if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)]) 132 [actionsManager requestBubbleClosureUnanchorOnFailure:YES]; 131 [actionsManager requestBubbleClosureUnanchorOnFailure:YES]; 133 132 134 133 if (_currentActionContext && _hasActivatedActionContext) { … … 440 439 [actionContext setAltMode:YES]; 441 440 [actionContext setImmediate:YES]; 442 if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) { 443 if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[actionContext mainResult] actionContext:actionContext.get()]) 444 return nil; 445 } 441 if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[actionContext mainResult] actionContext:actionContext.get()]) 442 return nil; 446 443 447 444 auto indicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorOptionDefault, TextIndicatorPresentationTransition::FadeIn); -
trunk/Source/WebKit/mac/WebView/WebView.mm
r212173 r212211 507 507 - (void)_updateScreenScaleFromWindow; 508 508 @end 509 510 @interface NSURLCache (WebPrivate)511 - (CFURLCacheRef)_CFURLCache;512 @end513 509 #endif 514 510 … … 3332 3328 if (Element* element = document ? document->webkitCurrentFullScreenElement() : 0) { 3333 3329 SEL selector = @selector(webView:closeFullScreenWithListener:); 3334 if ( _private->UIDelegate &&[_private->UIDelegate respondsToSelector:selector]) {3330 if ([_private->UIDelegate respondsToSelector:selector]) { 3335 3331 WebKitFullScreenListener *listener = [[WebKitFullScreenListener alloc] initWithElement:element]; 3336 3332 CallUIDelegate(self, selector, listener); … … 8584 8580 nsurlCacheMemoryCapacity = std::max(nsurlCacheMemoryCapacity, [nsurlCache memoryCapacity]); 8585 8581 CFURLCacheRef cfCache; 8586 if ( [nsurlCache respondsToSelector:@selector(_CFURLCache)] &&(cfCache = [nsurlCache _CFURLCache]))8582 if ((cfCache = [nsurlCache _CFURLCache])) 8587 8583 CFURLCacheSetMemoryCapacity(cfCache, nsurlCacheMemoryCapacity); 8588 8584 else -
trunk/Source/WebKit2/ChangeLog
r212210 r212211 1 2017-02-12 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Some -respondsToSelector: checks are unnecessary 4 https://bugs.webkit.org/show_bug.cgi?id=168183 5 6 Reviewed by Tim Horton. 7 8 * Platform/mac/LayerHostingContext.mm: 9 (WebKit::LayerHostingContext::setColorMatchUntaggedContent): Removed unnecessary 10 -respondsToSelector: check. 11 (WebKit::LayerHostingContext::colorMatchUntaggedContent): Ditto. 12 13 * Platform/mac/MenuUtilities.mm: 14 (WebKit::menuItemTitleForTelephoneNumberGroup): Ditto. 15 16 * Platform/spi/ios/UIKitSPI.h: Moved declaration of 17 -[UIScrollView _isInterruptingDeceleration] from WKWebView.mm to the 18 !USE(APPLE_INTERNAL_SDK) section here. 19 20 * Shared/mac/ChildProcessMac.mm: 21 (WebKit::ChildProcess::setSharedHTTPCookieStorage): Removed unnecessary -respondsToSelector: 22 check. 23 24 * Shared/mac/WebEventFactory.mm: 25 (WebKit::typeForEvent): Ditto. 26 27 * UIProcess/API/Cocoa/WKWebView.mm: 28 (-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Ditto. 29 30 * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: 31 (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup): Ditto. 32 33 * UIProcess/Cocoa/WebViewImpl.mm: 34 (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly): Ditto. 35 36 * UIProcess/WKImagePreviewViewController.mm: 37 (-[WKImagePreviewViewController previewActions]): Removed check whether _WKElementAction 38 responds to -runActionWithElementInfo:. 39 40 * UIProcess/ios/WKActionSheetAssistant.mm: 41 (-[WKActionSheetAssistant showDataDetectorsSheet]): Ditto. 42 43 * UIProcess/ios/WKContentViewInteraction.mm: 44 (-[WKContentView _lookup:]): Ditto. 45 (-[WKContentView _share:]): Ditto. 46 (-[WKContentView _addShortcut:]): Ditto. 47 (-[WKContentView _promptForReplace:]): Ditto. 48 (-[WKContentView _transliterateChinese:]): Ditto. 49 (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Removed call to 50 -[UIKeyboardImpl didHandleWebKeyEvent], which is a no-op. 51 (-[WKContentView _interpretKeyEvent:isCharEvent:]): Removed unnecessary -respondsToSelector: 52 check. 53 (-[WKContentView _dataForPreviewItemController:atPosition:type:]): Ditto. 54 55 * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: 56 (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): Ditto. 57 58 * UIProcess/mac/WKImmediateActionController.mm: 59 (-[WKImmediateActionController _animationControllerForDataDetectedText]): Ditto. 60 61 * UIProcess/mac/WebContextMenuProxyMac.mm: 62 (WebKit::WebContextMenuProxyMac::createShareMenuItem): Ditto. 63 1 64 2017-02-12 Michael Catanzaro <mcatanzaro@igalia.com> 2 65 -
trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm
r186878 r212211 106 106 void LayerHostingContext::setColorMatchUntaggedContent(bool colorMatchUntaggedContent) 107 107 { 108 if ([m_context respondsToSelector:@selector(setColorMatchUntaggedContent:)]) 109 [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent]; 108 [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent]; 110 109 } 111 110 112 111 bool LayerHostingContext::colorMatchUntaggedContent() const 113 112 { 114 if ([m_context respondsToSelector:@selector(colorMatchUntaggedContent)]) 115 return [m_context colorMatchUntaggedContent]; 116 return false; 113 return [m_context colorMatchUntaggedContent]; 117 114 } 118 115 #endif -
trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm
r205377 r212211 44 44 NSString *menuItemTitleForTelephoneNumberGroup() 45 45 { 46 if ([getTUCallClass() respondsToSelector:@selector(supplementalDialTelephonyCallString)]) 47 return [getTUCallClass() supplementalDialTelephonyCallString]; 48 return WEB_UI_STRING("Call Using iPhone:", "menu item title for phone number"); 46 return [getTUCallClass() supplementalDialTelephonyCallString]; 49 47 } 50 48 -
trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h
r211838 r212211 309 309 @property (nonatomic) CGFloat horizontalScrollDecelerationFactor; 310 310 @property (nonatomic) CGFloat verticalScrollDecelerationFactor; 311 @property (nonatomic, readonly) BOOL _isInterruptingDeceleration; 311 312 @end 312 313 … … 522 523 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 523 524 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 525 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 526 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect; 524 527 @property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer; 525 528 @end … … 559 562 @end 560 563 561 @interface UIWKTextInteractionAssistant ( UIWKTextInteractionAssistantDetails)564 @interface UIWKTextInteractionAssistant () 562 565 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags; 563 566 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; … … 565 568 - (void)showTextStyleOptions; 566 569 - (void)hideTextStyleOptions; 570 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect; 571 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 572 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect; 573 - (void)scheduleReplacementsForText:(NSString *)text; 574 - (void)scheduleChineseTransliterationForText:(NSString *)text; 567 575 568 576 @property (nonatomic, readonly, assign) UILongPressGestureRecognizer *loupeGesture; -
trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm
r208455 r212211 181 181 void ChildProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier) 182 182 { 183 // FIXME: Remove the runtime check when it's not needed (soon).184 if (![NSHTTPCookieStorage respondsToSelector:@selector(_setSharedHTTPCookieStorage:)])185 return;186 187 183 RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, identifier.data(), identifier.size())); 188 184 RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get())); -
trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm
r208455 r212211 329 329 static int typeForEvent(NSEvent *event) 330 330 { 331 if ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)]) 332 return static_cast<int>([NSMenu menuTypeForEvent:event]); 333 334 if (mouseButtonForEvent(event) == WebMouseEvent::RightButton) 335 return static_cast<int>(NSMenuTypeContextMenu); 336 337 if (mouseButtonForEvent(event) == WebMouseEvent::LeftButton && (modifiersForEvent(event) & WebEvent::ControlKey)) 338 return static_cast<int>(NSMenuTypeContextMenu); 339 340 return static_cast<int>(NSMenuTypeNone); 331 return static_cast<int>([NSMenu menuTypeForEvent:event]); 341 332 } 342 333 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r212176 r212211 143 143 - (void)_adjustForAutomaticKeyboardInfo:(NSDictionary*)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment; 144 144 - (BOOL)_isScrollingToTop; 145 - (BOOL)_isInterruptingDeceleration;146 145 - (CGPoint)_animatedTargetOffset; 147 146 @end … … 2182 2181 2183 2182 // FIXME: this can be made static after we stop supporting iOS 8.x. 2184 if (isStableState && [scrollView respondsToSelector:@selector(_isInterruptingDeceleration)])2185 isStableState = ! [scrollView performSelector:@selector(_isInterruptingDeceleration)];2183 if (isStableState) 2184 isStableState = !scrollView._isInterruptingDeceleration; 2186 2185 2187 2186 if (NSNumber *stableOverride = self._stableStateOverride) -
trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
r210933 r212211 228 228 { 229 229 auto passLibrary = adoptNS([allocPKPassLibraryInstance() init]); 230 if (![passLibrary respondsToSelector:@selector(openPaymentSetupForMerchantIdentifier:domain:completion:)]) {231 RunLoop::main().dispatch([completionHandler] {232 completionHandler(false);233 });234 return;235 }236 237 230 [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:[completionHandler](BOOL result) { 238 231 RunLoop::main().dispatch([completionHandler, result] { -
trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm
r211893 r212211 3113 3113 WebCore::DictionaryLookup::hidePopup(); 3114 3114 3115 if (DataDetectorsLibrary()) { 3116 DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager]; 3117 if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)]) 3118 [actionsManager requestBubbleClosureUnanchorOnFailure:YES]; 3119 } 3115 if (DataDetectorsLibrary()) 3116 [[getDDActionsManagerClass() sharedManager] requestBubbleClosureUnanchorOnFailure:YES]; 3120 3117 } 3121 3118 -
trunk/Source/WebKit2/UIProcess/WKImagePreviewViewController.mm
r189877 r212211 98 98 for (_WKElementAction *imageAction in _imageActions.get()) { 99 99 UIViewControllerPreviewAction *previewAction = [UIViewControllerPreviewAction actionWithTitle:imageAction.title handler:^(UIViewControllerPreviewAction *action, UIViewController *previewViewController) { 100 if ([imageAction respondsToSelector:@selector(runActionWithElementInfo:)]) 101 [imageAction runActionWithElementInfo:_activatedElementInfo.get()]; 100 [imageAction runActionWithElementInfo:_activatedElementInfo.get()]; 102 101 }]; 103 102 -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm
r211679 r212211 60 60 SOFT_LINK_CONSTANT(TCC, kTCCServicePhotos, CFStringRef) 61 61 62 @interface DDDetectionController (StagingToRemove)63 - (NSArray *)actionsForURL:(NSURL *)url identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *)results context:(NSDictionary *)context;64 @end65 66 62 using namespace WebKit; 67 63 … … 481 477 482 478 DDDetectionController *controller = [getDDDetectionControllerClass() sharedController]; 483 NSArray *dataDetectorsActions = nil; 484 if ([controller respondsToSelector:@selector(actionsForURL:identifier:selectedText:results:context:)]) { 485 NSDictionary *context = nil; 486 NSString *textAtSelection = nil; 487 RetainPtr<NSMutableDictionary> extendedContext; 488 489 if ([delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)]) 490 context = [delegate dataDetectionContextForActionSheetAssistant:self]; 491 if ([delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)]) 492 textAtSelection = [delegate selectedTextForActionSheetAssistant:self]; 493 if (!positionInformation.textBefore.isEmpty() || !positionInformation.textAfter.isEmpty()) { 494 extendedContext = adoptNS([@{ 495 getkDataDetectorsLeadingText() : positionInformation.textBefore, 496 getkDataDetectorsTrailingText() : positionInformation.textAfter, 497 } mutableCopy]); 498 499 if (context) 500 [extendedContext addEntriesFromDictionary:context]; 501 context = extendedContext.get(); 502 } 503 dataDetectorsActions = [controller actionsForURL:targetURL identifier:positionInformation.dataDetectorIdentifier selectedText:textAtSelection results:positionInformation.dataDetectorResults.get() context:context]; 504 } else 505 dataDetectorsActions = [controller actionsForAnchor:nil url:targetURL forFrame:nil]; 479 NSDictionary *context = nil; 480 NSString *textAtSelection = nil; 481 RetainPtr<NSMutableDictionary> extendedContext; 482 483 if ([delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)]) 484 context = [delegate dataDetectionContextForActionSheetAssistant:self]; 485 if ([delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)]) 486 textAtSelection = [delegate selectedTextForActionSheetAssistant:self]; 487 if (!positionInformation.textBefore.isEmpty() || !positionInformation.textAfter.isEmpty()) { 488 extendedContext = adoptNS([@{ 489 getkDataDetectorsLeadingText() : positionInformation.textBefore, 490 getkDataDetectorsTrailingText() : positionInformation.textAfter, 491 } mutableCopy]); 492 493 if (context) 494 [extendedContext addEntriesFromDictionary:context]; 495 context = extendedContext.get(); 496 } 497 NSArray *dataDetectorsActions = [controller actionsForURL:targetURL identifier:positionInformation.dataDetectorIdentifier selectedText:textAtSelection results:positionInformation.dataDetectorResults.get() context:context]; 506 498 if ([dataDetectorsActions count] == 0) 507 499 return; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r212167 r212211 240 240 @end 241 241 242 @interface UITextInteractionAssistant (StagingToRemove)243 - (void)scheduleReplacementsForText:(NSString *)text;244 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;245 - (void)scheduleChineseTransliterationForText:(NSString *)text;246 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;247 - (void)lookup:(NSString *)textWithContext fromRect:(CGRect)presentationRect;248 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;249 @end250 251 @interface UIWKSelectionAssistant (StagingToRemove)252 - (void)showTextServiceFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;253 - (void)lookup:(NSString *)textWithContext fromRect:(CGRect)presentationRect;254 - (void)lookup:(NSString *)textWithContext withRange:(NSRange)range fromRect:(CGRect)presentationRect;255 @end256 257 @interface UIKeyboardImpl (StagingToRemove)258 - (void)didHandleWebKeyEvent;259 - (void)didHandleWebKeyEvent:(WebIOSEvent *)event;260 - (void)deleteFromInputWithFlags:(NSUInteger)flags;261 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags withInputManagerHint:(NSString *)hint;262 @end263 264 242 @interface UIView (UIViewInternalHack) 265 243 + (BOOL)_addCompletion:(void(^)(BOOL))completion; … … 272 250 @end 273 251 #endif 274 275 @interface DDDetectionController (StagingToRemove)276 - (DDResultRef)resultForURL:(NSURL *)url identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *)results context:(NSDictionary *)context extendedContext:(NSDictionary **)extendedContext;277 @end278 252 279 253 @interface WKFocusedElementInfo : NSObject <_WKFocusedElementInfo> … … 1880 1854 String selectionContext = textBefore + selectedText + textAfter; 1881 1855 if (view->_textSelectionAssistant) { 1882 if ([view->_textSelectionAssistant respondsToSelector:@selector(lookup:withRange:fromRect:)]) 1883 [view->_textSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 1884 else 1885 [view->_textSelectionAssistant lookup:selectedText fromRect:presentationRect]; 1856 [view->_textSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 1886 1857 } else { 1887 if ([view->_webSelectionAssistant respondsToSelector:@selector(lookup:withRange:fromRect:)]) 1888 [view->_webSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 1889 else 1890 [view->_webSelectionAssistant lookup:selectedText fromRect:presentationRect]; 1858 [view->_webSelectionAssistant lookup:selectionContext withRange:NSMakeRange(textBefore.length(), selectedText.length()) fromRect:presentationRect]; 1891 1859 } 1892 1860 }); … … 1904 1872 CGRect presentationRect = view->_page->editorState().postLayoutData().selectionRects[0].rect(); 1905 1873 1906 if (view->_textSelectionAssistant && [view->_textSelectionAssistant respondsToSelector:@selector(showShareSheetFor:fromRect:)])1874 if (view->_textSelectionAssistant) 1907 1875 [view->_textSelectionAssistant showShareSheetFor:string fromRect:presentationRect]; 1908 else if (view->_webSelectionAssistant && [view->_webSelectionAssistant respondsToSelector:@selector(showShareSheetFor:fromRect:)])1876 else if (view->_webSelectionAssistant) 1909 1877 [view->_webSelectionAssistant showShareSheetFor:string fromRect:presentationRect]; 1910 1878 }); … … 1913 1881 - (void)_addShortcut:(id)sender 1914 1882 { 1915 if (_textSelectionAssistant && [_textSelectionAssistant respondsToSelector:@selector(showTextServiceFor:fromRect:)])1883 if (_textSelectionAssistant) 1916 1884 [_textSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()]; 1917 else if (_webSelectionAssistant && [_webSelectionAssistant respondsToSelector:@selector(showTextServiceFor:fromRect:)])1885 else if (_webSelectionAssistant) 1918 1886 [_webSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()]; 1919 1887 } … … 1945 1913 return; 1946 1914 1947 if ([_textSelectionAssistant respondsToSelector:@selector(scheduleReplacementsForText:)]) 1948 [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection]; 1915 [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection]; 1949 1916 } 1950 1917 1951 1918 - (void)_transliterateChinese:(id)sender 1952 1919 { 1953 if ([_textSelectionAssistant respondsToSelector:@selector(scheduleChineseTransliterationForText:)]) 1954 [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection]; 1920 [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection]; 1955 1921 } 1956 1922 … … 3386 3352 } 3387 3353 3388 if (event.type == WebEventKeyDown) {3389 // FIXME: This is only for staging purposes.3390 if ([[UIKeyboardImpl sharedInstance] respondsToSelector:@selector(didHandleWebKeyEvent:)])3391 [[UIKeyboardImpl sharedInstance] didHandleWebKeyEvent:event];3392 else3393 [[UIKeyboardImpl sharedInstance] didHandleWebKeyEvent];3394 }3395 3396 3354 // If we aren't interacting with editable content, we still need to call [super _handleKeyUIEvent:] 3397 3355 // so that keyboard repeat will work correctly. If we are interacting with editable content, … … 3507 3465 case kWebDeleteKey: 3508 3466 if (contentEditable) { 3509 // FIXME: remove deleteFromInput once UIKit adopts deleteFromInputWithFlags 3510 if ([keyboard respondsToSelector:@selector(deleteFromInputWithFlags:)]) 3511 [keyboard deleteFromInputWithFlags:event.keyboardFlags]; 3512 else 3513 [keyboard deleteFromInput]; 3467 [keyboard deleteFromInputWithFlags:event.keyboardFlags]; 3514 3468 return YES; 3515 3469 } … … 3518 3472 case kWebSpaceKey: 3519 3473 if (contentEditable && isCharEvent) { 3520 if ([keyboard respondsToSelector:@selector(addInputString:withFlags:withInputManagerHint:)]) 3521 [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint]; 3522 else 3523 [keyboard addInputString:event.characters withFlags:event.keyboardFlags]; 3474 [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint]; 3524 3475 return YES; 3525 3476 } … … 3541 3492 default: 3542 3493 if (contentEditable && isCharEvent) { 3543 if ([keyboard respondsToSelector:@selector(addInputString:withFlags:withInputManagerHint:)]) 3544 [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint]; 3545 else 3546 [keyboard addInputString:event.characters withFlags:event.keyboardFlags]; 3494 [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint]; 3547 3495 return YES; 3548 3496 } … … 4209 4157 4210 4158 DDDetectionController *controller = [getDDDetectionControllerClass() sharedController]; 4211 if ([controller respondsToSelector:@selector(resultForURL:identifier:selectedText:results:context:extendedContext:)]) { 4212 NSDictionary *newContext = nil; 4213 RetainPtr<NSMutableDictionary> extendedContext; 4214 DDResultRef ddResult = [controller resultForURL:dataForPreview[UIPreviewDataLink] identifier:_positionInformation.dataDetectorIdentifier selectedText:[self selectedText] results:_positionInformation.dataDetectorResults.get() context:context extendedContext:&newContext]; 4215 if (ddResult) 4216 dataForPreview[UIPreviewDataDDResult] = (__bridge id)ddResult; 4217 if (!_positionInformation.textBefore.isEmpty() || !_positionInformation.textAfter.isEmpty()) { 4218 extendedContext = adoptNS([@{ 4219 getkDataDetectorsLeadingText() : _positionInformation.textBefore, 4220 getkDataDetectorsTrailingText() : _positionInformation.textAfter, 4221 } mutableCopy]); 4222 4223 if (newContext) 4224 [extendedContext addEntriesFromDictionary:newContext]; 4225 newContext = extendedContext.get(); 4226 } 4159 NSDictionary *newContext = nil; 4160 RetainPtr<NSMutableDictionary> extendedContext; 4161 DDResultRef ddResult = [controller resultForURL:dataForPreview[UIPreviewDataLink] identifier:_positionInformation.dataDetectorIdentifier selectedText:[self selectedText] results:_positionInformation.dataDetectorResults.get() context:context extendedContext:&newContext]; 4162 if (ddResult) 4163 dataForPreview[UIPreviewDataDDResult] = (__bridge id)ddResult; 4164 if (!_positionInformation.textBefore.isEmpty() || !_positionInformation.textAfter.isEmpty()) { 4165 extendedContext = adoptNS([@{ 4166 getkDataDetectorsLeadingText() : _positionInformation.textBefore, 4167 getkDataDetectorsTrailingText() : _positionInformation.textAfter, 4168 } mutableCopy]); 4169 4227 4170 if (newContext) 4228 dataForPreview[UIPreviewDataDDContext] = newContext; 4171 [extendedContext addEntriesFromDictionary:newContext]; 4172 newContext = extendedContext.get(); 4229 4173 } 4174 if (newContext) 4175 dataForPreview[UIPreviewDataDDContext] = newContext; 4230 4176 } 4231 4177 } else if (canShowImagePreview) { -
trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
r208415 r212211 178 178 // because we won't be able to reply during the fence-wait. 179 179 uint64_t callbackID = m_webPageProxy.process().connection()->installIncomingSyncMessageCallback([rootLayerContext] { 180 if ([rootLayerContext respondsToSelector:@selector(invalidateFences)]) 181 [rootLayerContext invalidateFences]; 180 [rootLayerContext invalidateFences]; 182 181 }); 183 182 RefPtr<WebPageProxy> retainedPage = &m_webPageProxy; -
trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm
r208415 r212211 402 402 actionContext.altMode = YES; 403 403 actionContext.immediate = YES; 404 if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) { 405 if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext]) 406 return nil; 407 } 404 if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext]) 405 return nil; 408 406 409 407 RefPtr<WebPageProxy> page = _page; -
trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
r208455 r212211 267 267 RetainPtr<NSMenuItem> WebContextMenuProxyMac::createShareMenuItem() 268 268 { 269 if (![[NSMenuItem class] respondsToSelector:@selector(standardShareMenuItemWithItems:)])270 return nil;271 272 269 const WebHitTestResultData& hitTestData = m_context.webHitTestResultData(); 273 270
Note:
See TracChangeset
for help on using the changeset viewer.