Title: [213771] trunk/Source/WebKit2
Revision
213771
Author
[email protected]
Date
2017-03-12 11:47:35 -0700 (Sun, 12 Mar 2017)

Log Message

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

Reviewed by Tim Horton.

* Platform/spi/ios/UIKitSPI.h: Moved redeclarations of methods that are declared in the
  Apple internal SDK into the #if !USE(APPLE_INTERNAL_SDK) section.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]): Replaced unnecessary -respondsToSelector:
  check with compile-time check for the deployment target.
(-[WKWebView _computedContentInset]): Ditto.
(activeMinimumLayoutSize): Ditto.
(-[WKWebView safeAreaInsetsDidChange]): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (213770 => 213771)


--- trunk/Source/WebKit2/ChangeLog	2017-03-12 17:27:48 UTC (rev 213770)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-12 18:47:35 UTC (rev 213771)
@@ -1,3 +1,20 @@
+2017-03-12  Dan Bernstein  <[email protected]>
+
+        [iOS] Some more -respondsToSelector: checks are unnecessary
+        https://bugs.webkit.org/show_bug.cgi?id=169525
+
+        Reviewed by Tim Horton.
+
+        * Platform/spi/ios/UIKitSPI.h: Moved redeclarations of methods that are declared in the
+          Apple internal SDK into the #if !USE(APPLE_INTERNAL_SDK) section.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]): Replaced unnecessary -respondsToSelector:
+          check with compile-time check for the deployment target.
+        (-[WKWebView _computedContentInset]): Ditto.
+        (activeMinimumLayoutSize): Ditto.
+        (-[WKWebView safeAreaInsetsDidChange]): Ditto.
+
 2017-03-11  Said Abou-Hallawa  <[email protected]>
 
         Enable async image decoding for large images

Modified: trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h (213770 => 213771)


--- trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h	2017-03-12 17:27:48 UTC (rev 213770)
+++ trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h	2017-03-12 18:47:35 UTC (rev 213771)
@@ -314,6 +314,10 @@
 @property (nonatomic) CGFloat horizontalScrollDecelerationFactor;
 @property (nonatomic) CGFloat verticalScrollDecelerationFactor;
 @property (nonatomic, readonly) BOOL _isInterruptingDeceleration;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
+@property (nonatomic, setter=_setEdgesScrollingContentIntoSafeArea:) UIRectEdge _edgesScrollingContentIntoSafeArea;
+@property (nonatomic, readonly) UIEdgeInsets _systemContentInset;
+#endif
 @end
 
 @interface NSString (UIKitDetails)
@@ -455,6 +459,9 @@
 - (void)setSize:(CGSize)size;
 @property (nonatomic, assign, setter=_setBackdropMaskViewFlags:) NSInteger _backdropMaskViewFlags;
 - (void)_populateArchivedSubviews:(NSMutableSet *)encodedViews;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
+- (void)safeAreaInsetsDidChange;
+#endif
 @end
 
 @interface UIWebSelectionView : UIView
@@ -873,15 +880,6 @@
 - (UIResponder *)firstResponder;
 @end
 
-@interface UIView ()
-- (void)safeAreaInsetsDidChange;
-@end
-
-@interface UIScrollView ()
-@property (nonatomic, setter=_setEdgesScrollingContentIntoSafeArea:) UIRectEdge _edgesScrollingContentIntoSafeArea;
-@property (nonatomic, readonly) UIEdgeInsets _systemContentInset;
-@end
-
 WTF_EXTERN_C_BEGIN
 
 BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts();

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (213770 => 213771)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-03-12 17:27:48 UTC (rev 213770)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-03-12 18:47:35 UTC (rev 213771)
@@ -508,8 +508,9 @@
     [_scrollView setInternalDelegate:self];
     [_scrollView setBouncesZoom:YES];
 
-    if ([_scrollView respondsToSelector:@selector(_setEdgesScrollingContentIntoSafeArea:)])
-        [_scrollView _setEdgesScrollingContentIntoSafeArea:UIRectEdgeAll];
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+    [_scrollView _setEdgesScrollingContentIntoSafeArea:UIRectEdgeAll];
+#endif
 
     [self addSubview:_scrollView.get()];
 
@@ -1352,13 +1353,13 @@
 
     UIEdgeInsets insets = [_scrollView contentInset];
 
-    if ([_scrollView respondsToSelector:@selector(_systemContentInset)]) {
-        UIEdgeInsets systemInsets = [_scrollView _systemContentInset];
-        insets.top += systemInsets.top;
-        insets.bottom += systemInsets.bottom;
-        insets.left += systemInsets.left;
-        insets.right += systemInsets.right;
-    }
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+    UIEdgeInsets systemInsets = [_scrollView _systemContentInset];
+    insets.top += systemInsets.top;
+    insets.bottom += systemInsets.bottom;
+    insets.left += systemInsets.left;
+    insets.right += systemInsets.right;
+#endif
 
     return insets;
 }
@@ -2215,12 +2216,12 @@
     if (webView->_overridesMinimumLayoutSize)
         return WebCore::FloatSize(webView->_minimumLayoutSizeOverride);
 
-    if ([webView->_scrollView respondsToSelector:@selector(_systemContentInset)]) {
-        UIEdgeInsets systemContentInset = [webView->_scrollView _systemContentInset];
-        return WebCore::FloatSize(UIEdgeInsetsInsetRect(CGRectMake(0, 0, bounds.size.width, bounds.size.height), systemContentInset).size);
-    }
-
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+    UIEdgeInsets systemContentInset = [webView->_scrollView _systemContentInset];
+    return WebCore::FloatSize(UIEdgeInsetsInsetRect(CGRectMake(0, 0, bounds.size.width, bounds.size.height), systemContentInset).size);
+#else
     return WebCore::FloatSize(bounds.size);
+#endif
 }
 
 - (void)_frameOrBoundsChanged
@@ -2266,13 +2267,14 @@
     return !pointsEqualInDevicePixels(contentOffset, boundedOffset, deviceScaleFactor);
 }
 
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
 - (void)safeAreaInsetsDidChange
 {
-    if ([super respondsToSelector:@selector(safeAreaInsetsDidChange)])
-        [super safeAreaInsetsDidChange];
+    [super safeAreaInsetsDidChange];
 
     [self _scheduleVisibleContentRectUpdate];
 }
+#endif
 
 - (void)_scheduleVisibleContentRectUpdate
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to