Title: [226335] trunk/Source/WebKit
Revision
226335
Author
timothy_hor...@apple.com
Date
2018-01-02 13:06:46 -0800 (Tue, 02 Jan 2018)

Log Message

Fix the build on platforms where UICurrentUserInterfaceIdiomIsPad is defined to false
https://bugs.webkit.org/show_bug.cgi?id=181218

Reviewed by Alex Christensen.

* Platform/spi/ios/UIKitSPI.h:
(currentUserInterfaceIdiomIsPad):
* UIProcess/ios/SmartMagnificationController.mm:
(WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView _displayFormNodeInputView]):
(-[WKContentView requiresAccessoryView]):
(-[WKContentView _updateAccessory]):
* UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
(-[WKAirPlayRoutePicker show:fromRect:]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
(-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
* UIProcess/ios/forms/WKFormInputControl.mm:
(-[WKDateTimePicker initWithView:datePickerMode:]):
(-[WKFormInputControl initWithView:]):
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl initWithView:]):
On platforms where UICurrentUserInterfaceIdiomIsPad is defined to false,
blocks that conditionally execute based on its value are unreachable.
This causes the compiler to complain. Hide it away inside an inline function
and make use of that everywhere we used to use the macro.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (226334 => 226335)


--- trunk/Source/WebKit/ChangeLog	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/ChangeLog	2018-01-02 21:06:46 UTC (rev 226335)
@@ -1,3 +1,35 @@
+2018-01-02  Tim Horton  <timothy_hor...@apple.com>
+
+        Fix the build on platforms where UICurrentUserInterfaceIdiomIsPad is defined to false
+        https://bugs.webkit.org/show_bug.cgi?id=181218
+
+        Reviewed by Alex Christensen.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        (currentUserInterfaceIdiomIsPad):
+        * UIProcess/ios/SmartMagnificationController.mm:
+        (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
+        (-[WKContentView _requiresKeyboardWhenFirstResponder]):
+        (-[WKContentView _displayFormNodeInputView]):
+        (-[WKContentView requiresAccessoryView]):
+        (-[WKContentView _updateAccessory]):
+        * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
+        (-[WKAirPlayRoutePicker show:fromRect:]):
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
+        (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
+        * UIProcess/ios/forms/WKFormInputControl.mm:
+        (-[WKDateTimePicker initWithView:datePickerMode:]):
+        (-[WKFormInputControl initWithView:]):
+        * UIProcess/ios/forms/WKFormSelectControl.mm:
+        (-[WKFormSelectControl initWithView:]):
+        On platforms where UICurrentUserInterfaceIdiomIsPad is defined to false,
+        blocks that conditionally execute based on its value are unreachable.
+        This causes the compiler to complain. Hide it away inside an inline function
+        and make use of that everywhere we used to use the macro.
+
 2018-01-02  Alex Christensen  <achristen...@webkit.org>
 
         Remove SVN file accidentally added in r226160

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (226334 => 226335)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-01-02 21:06:46 UTC (rev 226335)
@@ -168,8 +168,6 @@
 @property (nonatomic, readonly, getter=_contentWidth) CGFloat contentWidth;
 @end
 
-#define UICurrentUserInterfaceIdiomIsPad() ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
-
 @interface UIDevice ()
 @property (nonatomic, readonly, retain) NSString *buildVersion;
 @end
@@ -981,6 +979,18 @@
 @end
 #endif
 
+static inline bool currentUserInterfaceIdiomIsPad()
+{
+    // This inline function exists to thwart unreachable code
+    // detection on platforms where UICurrentUserInterfaceIdiomIsPad
+    // is defined directly to false.
+#if USE(APPLE_INTERNAL_SDK)
+    return UICurrentUserInterfaceIdiomIsPad();
+#else
+    return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
+#endif
+}
+
 WTF_EXTERN_C_BEGIN
 
 BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts(void);

Modified: trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -107,7 +107,7 @@
     float minimumScrollDistance;
     if ([m_contentView bounds].size.width <= m_webPageProxy.unobscuredContentRect().width())
         minimumScrollDistance = smartMagnificationPanScrollThresholdZoomedOut;
-    else if (UICurrentUserInterfaceIdiomIsPad())
+    else if (currentUserInterfaceIdiomIsPad())
         minimumScrollDistance = smartMagnificationPanScrollThresholdIPad;
     else
         minimumScrollDistance = smartMagnificationPanScrollThresholdIPhone;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -310,7 +310,7 @@
         [[_contentView formAccessoryView] showAutoFillButtonWithTitle:title];
     else
         [[_contentView formAccessoryView] hideAutoFillButton];
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         [_contentView reloadInputViews];
 }
 
@@ -1128,12 +1128,12 @@
     case InputType::None:
         return NO;
     case InputType::Select:
-        return !UICurrentUserInterfaceIdiomIsPad();
+        return !currentUserInterfaceIdiomIsPad();
     case InputType::Date:
     case InputType::Month:
     case InputType::DateTimeLocal:
     case InputType::Time:
-        return !UICurrentUserInterfaceIdiomIsPad();
+        return !currentUserInterfaceIdiomIsPad();
     default:
         return !_assistedNodeInformation.isReadOnly;
     }
@@ -1155,7 +1155,7 @@
                   fontSize:_assistedNodeInformation.nodeFontSize
               minimumScale:_assistedNodeInformation.minimumScaleFactor
               maximumScale:_assistedNodeInformation.maximumScaleFactorIgnoringAlwaysScalable
-              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringAlwaysScalable && !UICurrentUserInterfaceIdiomIsPad())
+              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringAlwaysScalable && !currentUserInterfaceIdiomIsPad())
                forceScroll:[self requiresAccessoryView]];
 
     _didAccessoryTabInitiateFocus = NO;
@@ -1873,7 +1873,7 @@
     case InputType::Month:
     case InputType::Week:
     case InputType::Time:
-        return !UICurrentUserInterfaceIdiomIsPad();
+        return !currentUserInterfaceIdiomIsPad();
     }
 }
 
@@ -2951,7 +2951,7 @@
     [_formAccessoryView setNextEnabled:_assistedNodeInformation.hasNextNode];
     [_formAccessoryView setPreviousEnabled:_assistedNodeInformation.hasPreviousNode];
 
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         [_formAccessoryView setClearVisible:NO];
     else {
         switch (_assistedNodeInformation.elementType) {

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -151,7 +151,7 @@
     [_routingController setDiscoveryMode:MPRouteDiscoveryModeDetailed];
 
     MPAVItemType itemType = hasVideo ? MPAVItemTypeVideo : MPAVItemTypeAudio;
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         [self showAirPlayPickerIPad:itemType fromRect:elementRect];
     else
         [self showAirPlayPickerIPhone:itemType];

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -423,7 +423,7 @@
     
     // Use a popover on the iPad if the source type is not the camera.
     // The camera will use a fullscreen, modal view controller.
-    BOOL usePopover = UICurrentUserInterfaceIdiomIsPad() && sourceType != UIImagePickerControllerSourceTypeCamera;
+    BOOL usePopover = currentUserInterfaceIdiomIsPad() && sourceType != UIImagePickerControllerSourceTypeCamera;
     if (usePopover)
         [self _presentPopoverWithContentViewController:_imagePicker.get() animated:YES];
     else
@@ -434,7 +434,7 @@
 
 - (void)_presentMenuOptionForCurrentInterfaceIdiom:(UIViewController *)viewController
 {
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         [self _presentPopoverWithContentViewController:viewController animated:YES];
     else
         [self _presentFullscreenViewController:viewController animated:YES];

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -104,7 +104,7 @@
         break;
    }
 
-    CGSize size = UICurrentUserInterfaceIdiomIsPad() ? [UIPickerView defaultSizeForCurrentOrientation] : [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]];
+    CGSize size = currentUserInterfaceIdiomIsPad() ? [UIPickerView defaultSizeForCurrentOrientation] : [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]];
 
     _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]);
     _datePicker.get().datePickerMode = mode;
@@ -254,7 +254,7 @@
         return nil;
     }
 
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         _control = adoptNS([[WKDateTimePopover alloc] initWithView:view datePickerMode:mode]);
     else
         _control = adoptNS([[WKDateTimePicker alloc] initWithView:view datePickerMode:mode]);

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm (226334 => 226335)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2018-01-02 20:50:30 UTC (rev 226334)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2018-01-02 21:06:46 UTC (rev 226335)
@@ -76,7 +76,7 @@
         }
     }
 
-    if (UICurrentUserInterfaceIdiomIsPad())
+    if (currentUserInterfaceIdiomIsPad())
         _control = adoptNS([[WKSelectPopover alloc] initWithView:view hasGroups:hasGroups]);
     else if (view.assistedNodeInformation.isMultiSelect || hasGroups)
         _control = adoptNS([[WKMultipleSelectPicker alloc] initWithView:view]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to