Changeset 212211 in webkit


Ignore:
Timestamp:
Feb 12, 2017, 2:01:24 PM (8 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] Some -respondsToSelector: checks are unnecessary
https://bugs.webkit.org/show_bug.cgi?id=168183

Reviewed by Tim Horton.

Source/WebCore:

  • English.lproj/Localizable.strings: Removed a string that’s no longer needed after the change to WebKit2/Platform/mac/MenuUtilities.mm.
  • editing/mac/DictionaryLookup.mm:

(WebCore::showPopupOrCreateAnimationController): Removed check whether

LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.

  • platform/cocoa/NetworkExtensionContentFilter.mm:

(WebCore::NetworkExtensionContentFilter::initialize): Changed to use

-[NEFilterSource setSourceAppIdentifier:], without checking, instead of
-setSourceAppBundleID:, which does not exist.

  • platform/cocoa/ScrollController.mm:

(systemUptime): Deleted.
(WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.

  • platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:

(WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced

-respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.

(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary

check.

  • platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:

(WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.

  • platform/graphics/mac/WebGLLayer.mm:

(-[WebGLLayer initWithGraphicsContext3D:]): Ditto.

  • platform/mac/PlatformEventFactoryMac.mm:

(WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and

all code to handle that case that it doesn’t.

  • platform/mac/WebVideoFullscreenController.mm:

(-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether

NSWindow responds to -isOnActiveSpace.

(-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether

NSApplication responds to -setPresentationOptions:

  • platform/mac/WebVideoFullscreenInterfaceMac.mm:

(-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed

unnecessary -respondsToSelector: check.

(-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
(-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.

  • platform/spi/cf/CFNetworkSPI.h: Moved declarations of -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
  • platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’ sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted unconditional declaration of sourceAppBundleID property, which doesn’t exist.
  • platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
  • platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here. Removed an unused declaration.
  • platform/spi/mac/LookupSPI.h: Moved redundant declarations into the !USE(APPLE_INTERNAL_SDK) section.
  • platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the Apple internal SDK. Cleaned up the declarations for the other case.
  • platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple internal SDK.

Source/WebKit/mac:

  • WebView/WebFullScreenController.mm:

(-[WebFullScreenController applicationDidResignActive:]): Removed check whether NSWindow

responds to -isOnActiveSpace.

(-[WebFullScreenController exitFullScreen]): Ditto.
(-[WebFullScreenController _updateMenuAndDockForFullScreen]): Removed check whether

NSApplication responds to -setPresentationOptions.

  • WebView/WebHTMLView.mm:

(createShareMenuItem): Removed unnecessary -respondsToSelector: check.
(-[WebHTMLView otherMouseDown:]): Ditto.

  • WebView/WebImmediateActionController.mm:

(-[WebImmediateActionController _clearImmediateActionState]): Ditto.
(-[WebImmediateActionController _animationControllerForDataDetectedText]): Ditto.

  • WebView/WebView.mm:

(-[WebView _didStartProvisionalLoadForFrame:]): Removed redundant nil check.
(+[WebView _setCacheModel:]): Removed unnecessary -respondsToSelector: check.

Source/WebKit2:

  • Platform/mac/LayerHostingContext.mm:

(WebKit::LayerHostingContext::setColorMatchUntaggedContent): Removed unnecessary

-respondsToSelector: check.

(WebKit::LayerHostingContext::colorMatchUntaggedContent): Ditto.

  • Platform/mac/MenuUtilities.mm:

(WebKit::menuItemTitleForTelephoneNumberGroup): Ditto.

  • Platform/spi/ios/UIKitSPI.h: Moved declaration of -[UIScrollView _isInterruptingDeceleration] from WKWebView.mm to the !USE(APPLE_INTERNAL_SDK) section here.
  • Shared/mac/ChildProcessMac.mm:

(WebKit::ChildProcess::setSharedHTTPCookieStorage): Removed unnecessary -respondsToSelector:

check.

  • Shared/mac/WebEventFactory.mm:

(WebKit::typeForEvent): Ditto.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Ditto.

  • UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:

(WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup): Ditto.

  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly): Ditto.

  • UIProcess/WKImagePreviewViewController.mm:

(-[WKImagePreviewViewController previewActions]): Removed check whether _WKElementAction

responds to -runActionWithElementInfo:.

  • UIProcess/ios/WKActionSheetAssistant.mm:

(-[WKActionSheetAssistant showDataDetectorsSheet]): Ditto.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _lookup:]): Ditto.
(-[WKContentView _share:]): Ditto.
(-[WKContentView _addShortcut:]): Ditto.
(-[WKContentView _promptForReplace:]): Ditto.
(-[WKContentView _transliterateChinese:]): Ditto.
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Removed call to

-[UIKeyboardImpl didHandleWebKeyEvent], which is a no-op.

(-[WKContentView _interpretKeyEvent:isCharEvent:]): Removed unnecessary -respondsToSelector:

check.

(-[WKContentView _dataForPreviewItemController:atPosition:type:]): Ditto.

  • UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:

(WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): Ditto.

  • UIProcess/mac/WKImmediateActionController.mm:

(-[WKImmediateActionController _animationControllerForDataDetectedText]): Ditto.

  • UIProcess/mac/WebContextMenuProxyMac.mm:

(WebKit::WebContextMenuProxyMac::createShareMenuItem): Ditto.

Location:
trunk/Source
Files:
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r212207 r212211  
     12017-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
    1802017-02-11  Sam Weinig  <sam@webkit.org>
    281
  • trunk/Source/WebCore/English.lproj/Localizable.strings

    r210943 r212211  
    128128"Bulleted list" = "Bulleted list";
    129129
    130 /* menu item title for phone number */
    131 "Call Using iPhone:" = "Call Using iPhone:";
    132 
    133130/* Title for Cancel button label in button bar */
    134131"Cancel button label in button bar" = "Cancel";
  • trunk/Source/WebCore/editing/mac/DictionaryLookup.mm

    r202390 r212211  
    222222        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
    223223
    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;
    236234    }
    237235
  • trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm

    r209147 r212211  
    7676    m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithDecisionQueue:m_queue.get()]);
    7777#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()];
    8179#endif
    8280#else
  • trunk/Source/WebCore/platform/cocoa/ScrollController.mm

    r210560 r212211  
    4242#if ENABLE(RUBBER_BANDING) || ENABLE(CSS_SCROLL_SNAP)
    4343
    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 #endif
    68 
    6944namespace WebCore {
    7045
     
    428403void ScrollController::snapRubberBand()
    429404{
    430     CFTimeInterval timeDelta = systemUptime() - m_lastMomentumScrollTimestamp;
     405    CFTimeInterval timeDelta = [NSProcessInfo processInfo].systemUptime - m_lastMomentumScrollTimestamp;
    431406    if (m_lastMomentumScrollTimestamp && timeDelta >= scrollVelocityZeroingTimeout)
    432407        m_momentumVelocity = FloatSize();
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm

    r201482 r212211  
    117117    LOG(Media, "MediaPlaybackTargetPickerMac::showPlaybackTargetPicker - checkActiveRoute = %i", (int)checkActiveRoute);
    118118
    119     AVOutputDeviceMenuControllerType *picker = devicePicker();
    120     if (![picker respondsToSelector:@selector(showMenuForRect:appearanceName:allowReselectionOfSelectedOutputDevice:)])
    121         return;
    122 
    123119    m_showingMenu = true;
    124     if ([picker showMenuForRect:location appearanceName:NSAppearanceNameVibrantLight allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) {
     120
     121    if ([devicePicker() showMenuForRect:location appearanceName:NSAppearanceNameVibrantLight allowReselectionOfSelectedOutputDevice:!checkActiveRoute]) {
    125122        if (!checkActiveRoute)
    126123            currentDeviceDidChange();
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r210859 r212211  
    758758
    759759#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)];
    762761#endif
    763762#else
     
    12581257{
    12591258#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)];
    12621260    updateDisableExternalPlayback();
    12631261#else
     
    22452243
    22462244    WebCoreNSURLSession *session = (WebCoreNSURLSession *)resourceLoader.URLSession;
    2247     if ([session respondsToSelector:@selector(didPassCORSAccessChecks)])
     2245    if ([session isKindOfClass:[WebCoreNSURLSession class]])
    22482246        return session.didPassCORSAccessChecks;
    22492247#endif
     
    32003198{
    32013199#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];
    32043201#else
    32053202    UNUSED_PARAM(flag);
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm

    r202350 r212211  
    113113        if (oldContext && newContext && oldContext != newContext) {
    114114#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;
    119117#endif
    120118            mach_port_t fencePort = [oldContext createFencePort];
  • trunk/Source/WebCore/platform/graphics/mac/WebGLLayer.mm

    r201639 r212211  
    5757    self.contentsScale = _devicePixelRatio;
    5858#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
    59     if ([self respondsToSelector:@selector(setColorspace:)])
    60         [self setColorspace:sRGBColorSpaceRef()];
     59    self.colorspace = sRGBColorSpaceRef();
    6160#endif
    6261#endif
  • trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm

    r211663 r212211  
    672672static int typeForEvent(NSEvent *event)
    673673{
    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]);
    684675}
    685676   
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm

    r210105 r212211  
    220220{   
    221221    UNUSED_PARAM(notification);
    222     // Check to see if the fullscreenWindow is on the active space; this function is available
    223     // on 10.6 and later, so default to YES if the function is not available:
    224222    NSWindow* fullscreenWindow = [self fullscreenWindow];
    225     BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);
    226223
    227224    // Replicate the QuickTime Player (X) behavior when losing active application status:
     
    229226    // single screen is available.)  Is the fullscreen screen on the current space? IFF so,
    230227    // then exit fullscreen mode.   
    231     if ([fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)
     228    if (fullscreenWindow.screen == [NSScreen screens][0] && fullscreenWindow.onActiveSpace)
    232229         [self requestExitFullscreenWithAnimation:NO];
    233230}
     
    354351    }
    355352
    356     if ([NSApp respondsToSelector:@selector(setPresentationOptions:)])
    357         [NSApp setPresentationOptions:options];
    358     else
    359         SetSystemUIMode(_isEndingFullscreen ? kUIModeNormal : kUIModeAllHidden, 0);
     353    NSApp.presentationOptions = options;
    360354}
    361355
  • trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm

    r206520 r212211  
    171171    _playing = isPlaying && playbackRate;
    172172
    173     if ([_pipViewController respondsToSelector:@selector(setPlaying:)])
    174         [_pipViewController setPlaying:_playing];
     173    [_pipViewController setPlaying:_playing];
    175174}
    176175
     
    179178    _videoDimensions = videoDimensions;
    180179
    181     if ([_pipViewController respondsToSelector:@selector(setAspectRatio:)])
    182         [_pipViewController setAspectRatio:_videoDimensions];
     180    [_pipViewController setAspectRatio:_videoDimensions];
    183181}
    184182
     
    191189    _pipViewController = adoptNS([[getPIPViewControllerClass() alloc] init]);
    192190    [_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];
    197193    [self setVideoDimensions:NSEqualSizes(_videoDimensions, NSZeroSize) ? frame.size : _videoDimensions];
    198194    if (_webVideoFullscreenInterfaceMac && _webVideoFullscreenInterfaceMac->webVideoFullscreenModel())
  • trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h

    r211835 r212211  
    8484
    8585#if defined(__OBJC__)
     86@interface NSURLCache ()
     87-(instancetype)_initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity relativePath:(NSString *)path;
     88- (CFURLCacheRef)_CFURLCache;
     89@end
     90
    8691@interface NSURLRequest ()
    8792+ (NSArray *)allowsSpecificHTTPSCertificateForHost:(NSString *)host;
     
    191196WTF_EXTERN_C_END
    192197
    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 whether
    195 // 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 @end
    200 #endif
    201 
    202198#if defined(__OBJC__) && !USE(APPLE_INTERNAL_SDK)
    203199enum : NSUInteger {
  • trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h

    r209147 r212211  
    7474- (void)finishedLoadingWithDecisionHandler:(NEFilterSourceDecisionHandler)decisionHandler;
    7575- (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
    7679@end
    7780
     
    7982
    8083#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 @end
    87 #endif
  • trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h

    r209369 r212211  
    3434#ifdef __OBJC__
    3535
     36#import <QuartzCore/CAContext.h>
    3637#import <QuartzCore/CALayerHost.h>
    3738#import <QuartzCore/CALayerPrivate.h>
     
    4041#if PLATFORM(IOS)
    4142#import <QuartzCore/CADisplay.h>
    42 #endif
    43 
    44 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
    45 @interface CAContext ()
    46 - (void)setCommitPriority:(uint32_t)commitPriority;
    47 @end
    4843#endif
    4944
     
    6358- (void)deleteSlot:(uint32_t)name;
    6459- (void)invalidate;
     60- (void)invalidateFences;
    6561- (mach_port_t)createFencePort;
    6662- (void)setFencePort:(mach_port_t)port;
     
    199195WTF_EXTERN_C_END
    200196
    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 #endif
    206 @end
    207 
    208197extern NSString * const kCATiledLayerRemoveImmediately;
    209198
  • trunk/Source/WebCore/platform/spi/ios/DataDetectorsUISPI.h

    r202889 r212211  
    3636#else
    3737
     38#import <WebCore/DataDetectorsCoreSPI.h>
     39
    3840@interface DDAction : NSObject
    3941@end
     
    5557+ (NSArray *)tapAndHoldSchemes;
    5658- (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;
    5761@end
    5862
    5963#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 @end
    6564
    6665SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI)
  • trunk/Source/WebCore/platform/spi/mac/LookupSPI.h

    r194318 r212211  
    4343+ (NSRange)tokenRangeForString:(NSString *)string range:(NSRange)range options:(NSDictionary **)options;
    4444+ (void)showDefinitionForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options;
     45+ (void)showDefinitionForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options;
    4546+ (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;
    4649
    4750@end
     
    4952#endif // !USE(APPLE_INTERNAL_SDK)
    5053
    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 @end
    58 
    59 @interface LULookupDefinitionModule ()
    60 
    61 + (void)showDefinitionForTerm:(NSAttributedString *)term relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView options:(NSDictionary *)options;
    62 
    63 @end
    64 
    6554#endif // PLATFORM(MAC)
  • trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h

    r192481 r212211  
    2828#if PLATFORM(MAC)
    2929
    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
    3135
    3236typedef NS_ENUM(NSInteger, NSMenuType) {
     
    3539};
    3640
    37 @interface NSMenu (Private)
     41@interface NSMenu ()
    3842+ (NSMenuType)menuTypeForEvent:(NSEvent *)event;
    3943@end
     
    4145@class QLPreviewMenuItem;
    4246
    43 @interface NSMenuItem (Private)
     47@interface NSMenuItem () <NSUserInterfaceItemIdentification>
    4448+ (QLPreviewMenuItem *)standardQuickLookMenuItem;
    4549+ (NSMenuItem *)standardShareMenuItemWithItems:(NSArray *)items;
    4650@end
    4751
    48 @interface NSMenuItem () <NSUserInterfaceItemIdentification>
    49 @end
     52#endif
    5053
    5154#endif
  • trunk/Source/WebCore/platform/spi/mac/TUCallSPI.h

    r194318 r212211  
    2727#import <objc/runtime.h>
    2828
     29#if USE(APPLE_INTERNAL_SDK)
     30
     31#import <TelephonyUtilities/TUCall_Strings.h>
     32
     33#else
     34
    2935@interface TUCall : NSObject
    3036@end
     
    3440@end
    3541
     42#endif
     43
    3644SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(TelephonyUtilities)
    3745SOFT_LINK_CLASS(TelephonyUtilities, TUCall)
  • trunk/Source/WebKit/mac/ChangeLog

    r212173 r212211  
     12017-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
    1272017-02-10  Daniel Bates  <dabates@apple.com>
    228
  • trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm

    r210697 r212211  
    7676}
    7777
    78 @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
    79 - (BOOL)isOnActiveSpace;
    80 @end
    81 
    8278@implementation WebFullScreenController
    8379
     
    166162- (void)applicationDidResignActive:(NSNotification*)notification
    167163{   
    168     // Check to see if the fullscreenWindow is on the active space; this function is available
    169     // on 10.6 and later, so default to YES if the function is not available:
    170164    NSWindow* fullscreenWindow = [self window];
    171     BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);
    172165
    173166    // Replicate the QuickTime Player (X) behavior when losing active application status:
     
    175168    // single screen is available.)  Is the fullscreen screen on the current space? IFF so,
    176169    // then exit fullscreen mode.
    177     if ([fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)
     170    if (fullscreenWindow.screen == [NSScreen screens][0] && fullscreenWindow.onActiveSpace)
    178171         [self cancelOperation:self];
    179172}
     
    326319    // If the user has moved the fullScreen window into a new space, temporarily change
    327320    // 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) {
    329322        NSWindowCollectionBehavior behavior = [webWindow collectionBehavior];
    330323        [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
     
    431424    }
    432425   
    433     if ([NSApp respondsToSelector:@selector(setPresentationOptions:)])
    434         [NSApp setPresentationOptions:options];
    435     else
    436         SetSystemUIMode(_isFullScreen ? kUIModeAllHidden : kUIModeNormal, 0);
     426    NSApp.presentationOptions = options;
    437427}
    438428
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r211438 r212211  
    38733873static RetainPtr<NSMenuItem> createShareMenuItem(const HitTestResult& hitTestResult)
    38743874{
    3875     if (![[NSMenuItem class] respondsToSelector:@selector(standardShareMenuItemWithItems:)])
    3876         return nil;
    3877 
    38783875    auto items = adoptNS([[NSMutableArray alloc] init]);
    38793876
     
    61056102- (void)otherMouseDown:(NSEvent *)event
    61066103{
    6107     if ([event buttonNumber] != 2 || ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)]
    6108         && [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu)) {
     6104    if (event.buttonNumber != 2 || [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu) {
    61096105        [super otherMouseDown:event];
    61106106        return;
  • trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm

    r208630 r212211  
    129129
    130130    DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
    131     if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
    132         [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
     131    [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
    133132
    134133    if (_currentActionContext && _hasActivatedActionContext) {
     
    440439    [actionContext setAltMode:YES];
    441440    [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;
    446443
    447444    auto indicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorOptionDefault, TextIndicatorPresentationTransition::FadeIn);
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r212173 r212211  
    507507- (void)_updateScreenScaleFromWindow;
    508508@end
    509 
    510 @interface NSURLCache (WebPrivate)
    511 - (CFURLCacheRef)_CFURLCache;
    512 @end
    513509#endif
    514510
     
    33323328    if (Element* element = document ? document->webkitCurrentFullScreenElement() : 0) {
    33333329        SEL selector = @selector(webView:closeFullScreenWithListener:);
    3334         if (_private->UIDelegate && [_private->UIDelegate respondsToSelector:selector]) {
     3330        if ([_private->UIDelegate respondsToSelector:selector]) {
    33353331            WebKitFullScreenListener *listener = [[WebKitFullScreenListener alloc] initWithElement:element];
    33363332            CallUIDelegate(self, selector, listener);
     
    85848580    nsurlCacheMemoryCapacity = std::max(nsurlCacheMemoryCapacity, [nsurlCache memoryCapacity]);
    85858581    CFURLCacheRef cfCache;
    8586     if ([nsurlCache respondsToSelector:@selector(_CFURLCache)] && (cfCache = [nsurlCache _CFURLCache]))
     8582    if ((cfCache = [nsurlCache _CFURLCache]))
    85878583        CFURLCacheSetMemoryCapacity(cfCache, nsurlCacheMemoryCapacity);
    85888584    else
  • trunk/Source/WebKit2/ChangeLog

    r212210 r212211  
     12017-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
    1642017-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
    265
  • trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm

    r186878 r212211  
    106106void LayerHostingContext::setColorMatchUntaggedContent(bool colorMatchUntaggedContent)
    107107{
    108     if ([m_context respondsToSelector:@selector(setColorMatchUntaggedContent:)])
    109         [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent];
     108    [m_context setColorMatchUntaggedContent:colorMatchUntaggedContent];
    110109}
    111110
    112111bool LayerHostingContext::colorMatchUntaggedContent() const
    113112{
    114     if ([m_context respondsToSelector:@selector(colorMatchUntaggedContent)])
    115         return [m_context colorMatchUntaggedContent];
    116     return false;
     113    return [m_context colorMatchUntaggedContent];
    117114}
    118115#endif
  • trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm

    r205377 r212211  
    4444NSString *menuItemTitleForTelephoneNumberGroup()
    4545{
    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];
    4947}
    5048
  • trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h

    r211838 r212211  
    309309@property (nonatomic) CGFloat horizontalScrollDecelerationFactor;
    310310@property (nonatomic) CGFloat verticalScrollDecelerationFactor;
     311@property (nonatomic, readonly) BOOL _isInterruptingDeceleration;
    311312@end
    312313
     
    522523- (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
    523524- (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;
    524527@property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer;
    525528@end
     
    559562@end
    560563
    561 @interface UIWKTextInteractionAssistant (UIWKTextInteractionAssistantDetails)
     564@interface UIWKTextInteractionAssistant ()
    562565- (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
    563566- (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
     
    565568- (void)showTextStyleOptions;
    566569- (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;
    567575
    568576@property (nonatomic, readonly, assign) UILongPressGestureRecognizer *loupeGesture;
  • trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm

    r208455 r212211  
    181181void ChildProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier)
    182182{
    183     // FIXME: Remove the runtime check when it's not needed (soon).
    184     if (![NSHTTPCookieStorage respondsToSelector:@selector(_setSharedHTTPCookieStorage:)])
    185         return;
    186 
    187183    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, identifier.data(), identifier.size()));
    188184    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
  • trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm

    r208455 r212211  
    329329static int typeForEvent(NSEvent *event)
    330330{
    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]);
    341332}
    342333
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r212176 r212211  
    143143- (void)_adjustForAutomaticKeyboardInfo:(NSDictionary*)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment;
    144144- (BOOL)_isScrollingToTop;
    145 - (BOOL)_isInterruptingDeceleration;
    146145- (CGPoint)_animatedTargetOffset;
    147146@end
     
    21822181
    21832182    // 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;
    21862185
    21872186    if (NSNumber *stableOverride = self._stableStateOverride)
  • trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm

    r210933 r212211  
    228228{
    229229    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 
    237230    [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:[completionHandler](BOOL result) {
    238231        RunLoop::main().dispatch([completionHandler, result] {
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm

    r211893 r212211  
    31133113        WebCore::DictionaryLookup::hidePopup();
    31143114
    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];
    31203117    }
    31213118
  • trunk/Source/WebKit2/UIProcess/WKImagePreviewViewController.mm

    r189877 r212211  
    9898    for (_WKElementAction *imageAction in _imageActions.get()) {
    9999        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()];
    102101        }];
    103102
  • trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm

    r211679 r212211  
    6060SOFT_LINK_CONSTANT(TCC, kTCCServicePhotos, CFStringRef)
    6161
    62 @interface DDDetectionController (StagingToRemove)
    63 - (NSArray *)actionsForURL:(NSURL *)url identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *)results context:(NSDictionary *)context;
    64 @end
    65 
    6662using namespace WebKit;
    6763
     
    481477
    482478    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];
    506498    if ([dataDetectorsActions count] == 0)
    507499        return;
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r212167 r212211  
    240240@end
    241241
    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 @end
    250 
    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 @end
    256 
    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 @end
    263 
    264242@interface UIView (UIViewInternalHack)
    265243+ (BOOL)_addCompletion:(void(^)(BOOL))completion;
     
    272250@end
    273251#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 @end
    278252
    279253@interface WKFocusedElementInfo : NSObject <_WKFocusedElementInfo>
     
    18801854        String selectionContext = textBefore + selectedText + textAfter;
    18811855        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];
    18861857        } 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];
    18911859        }
    18921860    });
     
    19041872        CGRect presentationRect = view->_page->editorState().postLayoutData().selectionRects[0].rect();
    19051873
    1906         if (view->_textSelectionAssistant && [view->_textSelectionAssistant respondsToSelector:@selector(showShareSheetFor:fromRect:)])
     1874        if (view->_textSelectionAssistant)
    19071875            [view->_textSelectionAssistant showShareSheetFor:string fromRect:presentationRect];
    1908         else if (view->_webSelectionAssistant && [view->_webSelectionAssistant respondsToSelector:@selector(showShareSheetFor:fromRect:)])
     1876        else if (view->_webSelectionAssistant)
    19091877            [view->_webSelectionAssistant showShareSheetFor:string fromRect:presentationRect];
    19101878    });
     
    19131881- (void)_addShortcut:(id)sender
    19141882{
    1915     if (_textSelectionAssistant && [_textSelectionAssistant respondsToSelector:@selector(showTextServiceFor:fromRect:)])
     1883    if (_textSelectionAssistant)
    19161884        [_textSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
    1917     else if (_webSelectionAssistant && [_webSelectionAssistant respondsToSelector:@selector(showTextServiceFor:fromRect:)])
     1885    else if (_webSelectionAssistant)
    19181886        [_webSelectionAssistant showTextServiceFor:[self selectedText] fromRect:_page->editorState().postLayoutData().selectionRects[0].rect()];
    19191887}
     
    19451913        return;
    19461914
    1947     if ([_textSelectionAssistant respondsToSelector:@selector(scheduleReplacementsForText:)])
    1948         [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection];
     1915    [_textSelectionAssistant scheduleReplacementsForText:wordAtSelection];
    19491916}
    19501917
    19511918- (void)_transliterateChinese:(id)sender
    19521919{
    1953     if ([_textSelectionAssistant respondsToSelector:@selector(scheduleChineseTransliterationForText:)])
    1954         [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
     1920    [_textSelectionAssistant scheduleChineseTransliterationForText:_page->editorState().postLayoutData().wordAtSelection];
    19551921}
    19561922
     
    33863352    }
    33873353       
    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         else
    3393             [[UIKeyboardImpl sharedInstance] didHandleWebKeyEvent];
    3394     }
    3395 
    33963354    // If we aren't interacting with editable content, we still need to call [super _handleKeyUIEvent:]
    33973355    // so that keyboard repeat will work correctly. If we are interacting with editable content,
     
    35073465    case kWebDeleteKey:
    35083466        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];
    35143468            return YES;
    35153469        }
     
    35183472    case kWebSpaceKey:
    35193473        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];
    35243475            return YES;
    35253476        }
     
    35413492    default:
    35423493        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];
    35473495            return YES;
    35483496        }
     
    42094157
    42104158            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               
    42274170                if (newContext)
    4228                     dataForPreview[UIPreviewDataDDContext] = newContext;
     4171                    [extendedContext addEntriesFromDictionary:newContext];
     4172                newContext = extendedContext.get();
    42294173            }
     4174            if (newContext)
     4175                dataForPreview[UIPreviewDataDDContext] = newContext;
    42304176        }
    42314177    } else if (canShowImagePreview) {
  • trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm

    r208415 r212211  
    178178    // because we won't be able to reply during the fence-wait.
    179179    uint64_t callbackID = m_webPageProxy.process().connection()->installIncomingSyncMessageCallback([rootLayerContext] {
    180         if ([rootLayerContext respondsToSelector:@selector(invalidateFences)])
    181             [rootLayerContext invalidateFences];
     180        [rootLayerContext invalidateFences];
    182181    });
    183182    RefPtr<WebPageProxy> retainedPage = &m_webPageProxy;
  • trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm

    r208415 r212211  
    402402    actionContext.altMode = YES;
    403403    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;
    408406
    409407    RefPtr<WebPageProxy> page = _page;
  • trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm

    r208455 r212211  
    267267RetainPtr<NSMenuItem> WebContextMenuProxyMac::createShareMenuItem()
    268268{
    269     if (![[NSMenuItem class] respondsToSelector:@selector(standardShareMenuItemWithItems:)])
    270         return nil;
    271 
    272269    const WebHitTestResultData& hitTestData = m_context.webHitTestResultData();
    273270
Note: See TracChangeset for help on using the changeset viewer.