Diff
Modified: trunk/Source/WebKit/ChangeLog (266803 => 266804)
--- trunk/Source/WebKit/ChangeLog 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/ChangeLog 2020-09-09 22:54:40 UTC (rev 266804)
@@ -1,3 +1,60 @@
+2020-09-09 Tim Horton <[email protected]>
+
+ macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps
+ https://bugs.webkit.org/show_bug.cgi?id=216326
+
+ Reviewed by Wenson Hsieh.
+
+ * Shared/UserInterfaceIdiom.h:
+ * Shared/UserInterfaceIdiom.mm:
+ (WebKit::userInterfaceIdiomIsPad):
+ (WebKit::currentUserInterfaceIdiomIsPadOrMac):
+ (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac):
+ (WebKit::currentUserInterfaceIdiomIsPad): Deleted.
+ (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted.
+ * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
+ (WebKit::defaultTextAutosizingUsesIdempotentMode):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration init]):
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess):
+ * UIProcess/ios/SmartMagnificationController.mm:
+ (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
+ (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
+ (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
+ (-[WKContentView _zoomToRevealFocusedElement]):
+ (-[WKContentView requiresAccessoryView]):
+ (-[WKContentView _updateAccessory]):
+ (shouldShowKeyboardForElement):
+ (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]):
+ * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
+ (WebKit::WebDataListSuggestionsDropdownIOS::show):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::desktopClassBrowsingSupported):
+ * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
+ (-[WKAirPlayRoutePicker show:fromRect:]):
+ * UIProcess/ios/forms/WKFileUploadPanel.mm:
+ (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
+ (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
+ * UIProcess/ios/forms/WKFormColorControl.mm:
+ (-[WKFormColorControl initWithView:]):
+ * UIProcess/ios/forms/WKFormColorPicker.mm:
+ (-[WKColorPicker initWithView:inPopover:]):
+ (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
+ * UIProcess/ios/forms/WKFormSelectControl.mm:
+ (-[WKFormSelectControl initWithView:]):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac,
+ and force it to YES on macCatalyst since internally we use it to distinguish
+ between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst
+ should always follow iPad.
+
+ We should clean this up, and make all callers make their
+ iPhone vs. iPad vs. macOS decisions more explicit.
+
2020-09-09 Wenson Hsieh <[email protected]>
Text copied and pasted from Mac Catalyst apps appears larger than expected
Modified: trunk/Source/WebKit/Shared/UserInterfaceIdiom.h (266803 => 266804)
--- trunk/Source/WebKit/Shared/UserInterfaceIdiom.h 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/Shared/UserInterfaceIdiom.h 2020-09-09 22:54:40 UTC (rev 266804)
@@ -29,8 +29,8 @@
namespace WebKit {
-bool currentUserInterfaceIdiomIsPad();
-void setCurrentUserInterfaceIdiomIsPad(bool);
+bool currentUserInterfaceIdiomIsPadOrMac();
+void setCurrentUserInterfaceIdiomIsPadOrMac(bool);
}
Modified: trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm (266803 => 266804)
--- trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -43,6 +43,12 @@
static inline bool userInterfaceIdiomIsPad()
{
+#if PLATFORM(MACCATALYST)
+ // UIKit varies the UIUserInterfaceIdiom between iPad and macOS in macCatalyst, depending on various settings,
+ // but for the purposes of WebKit we always want to use iPad behavior (vs. iPhone) in macCatalyst.
+ // FIXME: We should get rid of this function and have callers make explicit decisions for all of iPhone/iPad/macOS.
+ return true;
+#else
// If we are in a daemon, we cannot use UIDevice. Fall back to checking the hardware itself.
// Since daemons don't ever run in an iPhone-app-on-iPad jail, this will be accurate in the daemon case,
// but is not sufficient in the application case.
@@ -52,22 +58,23 @@
// This inline function exists to thwart unreachable code
// detection on platforms where UICurrentUserInterfaceIdiomIsPad
// is defined directly to false.
-#if USE(APPLE_INTERNAL_SDK) && !PLATFORM(MACCATALYST)
+#if USE(APPLE_INTERNAL_SDK)
return UICurrentUserInterfaceIdiomIsPad();
#else
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
#endif
+#endif
}
-bool currentUserInterfaceIdiomIsPad()
+bool currentUserInterfaceIdiomIsPadOrMac()
{
if (userInterfaceIdiomIsPadState == UserInterfaceIdiomState::Unknown)
- setCurrentUserInterfaceIdiomIsPad(userInterfaceIdiomIsPad());
+ setCurrentUserInterfaceIdiomIsPadOrMac(userInterfaceIdiomIsPad());
return userInterfaceIdiomIsPadState == UserInterfaceIdiomState::IsPad;
}
-void setCurrentUserInterfaceIdiomIsPad(bool isPad)
+void setCurrentUserInterfaceIdiomIsPadOrMac(bool isPad)
{
userInterfaceIdiomIsPadState = isPad ? UserInterfaceIdiomState::IsPad : UserInterfaceIdiomState::IsNotPad;
}
Modified: trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm (266803 => 266804)
--- trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -38,7 +38,7 @@
bool defaultTextAutosizingUsesIdempotentMode()
{
- return currentUserInterfaceIdiomIsPad();
+ return currentUserInterfaceIdiomIsPadOrMac();
}
#endif
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -193,11 +193,7 @@
_allowsPictureInPictureMediaPlayback = YES;
#endif
-#if PLATFORM(MACCATALYST)
- _allowsInlineMediaPlayback = YES;
-#else
- _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPad();
-#endif
+ _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPadOrMac();
_inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
_allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -441,7 +441,7 @@
}
#if PLATFORM(IOS_FAMILY)
- parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad();
+ parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPadOrMac();
parameters.supportsPictureInPicture = supportsPictureInPicture();
parameters.cssValueToSystemColorMap = RenderThemeIOS::cssValueToSystemColorMap();
#if ENABLE(FULL_KEYBOARD_ACCESS)
Modified: trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -119,7 +119,7 @@
float minimumScrollDistance;
if ([m_contentView bounds].size.width <= m_webPageProxy.unobscuredContentRect().width())
minimumScrollDistance = smartMagnificationPanScrollThresholdZoomedOut;
- else if (currentUserInterfaceIdiomIsPad())
+ else if (currentUserInterfaceIdiomIsPadOrMac())
minimumScrollDistance = smartMagnificationPanScrollThresholdIPad;
else
minimumScrollDistance = smartMagnificationPanScrollThresholdIPhone;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -388,7 +388,7 @@
[[_contentView formAccessoryView] showAutoFillButtonWithTitle:title];
else
[[_contentView formAccessoryView] hideAutoFillButton];
- if (WebKit::currentUserInterfaceIdiomIsPad())
+ if (WebKit::currentUserInterfaceIdiomIsPadOrMac())
[_contentView reloadInputViews];
}
@@ -1380,7 +1380,7 @@
if (_focusRequiresStrongPasswordAssistance)
return true;
- if (!WebKit::currentUserInterfaceIdiomIsPad())
+ if (!WebKit::currentUserInterfaceIdiomIsPadOrMac())
return true;
}
@@ -1951,7 +1951,7 @@
#if ENABLE(INPUT_TYPE_COLOR)
case WebKit::InputType::Color:
#endif
- return !WebKit::currentUserInterfaceIdiomIsPad();
+ return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
default:
return YES;
}
@@ -1995,7 +1995,7 @@
fontSize:_focusedElementInformation.nodeFontSize
minimumScale:_focusedElementInformation.minimumScaleFactor
maximumScale:_focusedElementInformation.maximumScaleFactorIgnoringAlwaysScalable
- allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPad()
+ allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPadOrMac()
forceScroll:[self requiresAccessoryView]];
}
@@ -2965,7 +2965,7 @@
#if ENABLE(INPUT_TYPE_COLOR)
case WebKit::InputType::Color:
#endif
- return !WebKit::currentUserInterfaceIdiomIsPad();
+ return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
}
}
@@ -4448,7 +4448,7 @@
[accessoryView setNextEnabled:_focusedElementInformation.hasNextNode];
[accessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode];
- if (WebKit::currentUserInterfaceIdiomIsPad()) {
+ if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) {
[accessoryView setClearVisible:NO];
return;
}
@@ -5820,7 +5820,7 @@
if (mayContainSelectableText(information.elementType))
return true;
- return !WebKit::currentUserInterfaceIdiomIsPad();
+ return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
}
static WebCore::FloatRect rectToRevealWhenZoomingToFocusedElement(const WebKit::FocusedElementInformation& elementInfo, const WebKit::EditorState& editorState)
@@ -7115,7 +7115,7 @@
- (BOOL)_shouldUseLegacySelectPopoverDismissalBehavior
{
- if (!WebKit::currentUserInterfaceIdiomIsPad())
+ if (!WebKit::currentUserInterfaceIdiomIsPadOrMac())
return NO;
if (_focusedElementInformation.elementType != WebKit::InputType::Select)
Modified: trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -102,7 +102,7 @@
WebCore::DataListSuggestionActivationType type = information.activationType;
- if (currentUserInterfaceIdiomIsPad())
+ if (currentUserInterfaceIdiomIsPadOrMac())
m_suggestionsControl = adoptNS([[WKDataListSuggestionsPopover alloc] initWithInformation:WTFMove(information) inView:m_contentView]);
else
m_suggestionsControl = adoptNS([[WKDataListSuggestionsPicker alloc] initWithInformation:WTFMove(information) inView:m_contentView]);
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -1339,11 +1339,7 @@
static bool supportsDesktopClassBrowsing = false;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
-#if PLATFORM(MACCATALYST)
- supportsDesktopClassBrowsing = true;
-#else
- supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPad();
-#endif
+ supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPadOrMac();
});
return supportsDesktopClassBrowsing;
}
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -154,7 +154,7 @@
[_routingController setDiscoveryMode:MPRouteDiscoveryModeDetailed];
MPAVItemType itemType = hasVideo ? MPAVItemTypeVideo : MPAVItemTypeAudio;
- if (currentUserInterfaceIdiomIsPad())
+ if (currentUserInterfaceIdiomIsPadOrMac())
[self showAirPlayPickerIPad:itemType fromRect:elementRect];
else
[self showAirPlayPickerIPhone:itemType];
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -568,7 +568,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 = currentUserInterfaceIdiomIsPad() && sourceType != UIImagePickerControllerSourceTypeCamera;
+ BOOL usePopover = currentUserInterfaceIdiomIsPadOrMac() && sourceType != UIImagePickerControllerSourceTypeCamera;
if (usePopover)
[self _presentPopoverWithContentViewController:_imagePicker.get() animated:YES];
else
@@ -579,7 +579,7 @@
- (void)_presentMenuOptionForCurrentInterfaceIdiom:(UIViewController *)viewController
{
- if (currentUserInterfaceIdiomIsPad())
+ if (currentUserInterfaceIdiomIsPadOrMac())
[self _presentPopoverWithContentViewController:viewController animated:YES];
else
[self _presentFullscreenViewController:viewController animated:YES];
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -99,7 +99,7 @@
- (instancetype)initWithView:(WKContentView *)view
{
RetainPtr<NSObject <WKFormControl>> control;
- if (WebKit::currentUserInterfaceIdiomIsPad())
+ if (WebKit::currentUserInterfaceIdiomIsPadOrMac())
control = adoptNS([[WKColorPopover alloc] initWithView:view]);
else
control = adoptNS([[WKColorPicker alloc] initWithView:view]);
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -192,7 +192,7 @@
_popover = popover;
CGSize colorPickerSize;
- if (currentUserInterfaceIdiomIsPad())
+ if (currentUserInterfaceIdiomIsPadOrMac())
colorPickerSize = CGSizeMake(pickerWidthForPopover, pickerWidthForPopover);
else {
auto keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
@@ -252,7 +252,7 @@
[_colorSelectionIndicator setFrame:frame];
UIRectCorner roundCorner = 0;
- if (currentUserInterfaceIdiomIsPad()) {
+ if (currentUserInterfaceIdiomIsPadOrMac()) {
CGRect colorPickerBounds = [_colorPicker bounds];
bool minXEqual = std::abs(CGRectGetMinX(frame) - CGRectGetMinX(colorPickerBounds)) < FLT_EPSILON;
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm (266803 => 266804)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -74,7 +74,7 @@
}
RetainPtr<NSObject <WKFormControl>> control;
- if (currentUserInterfaceIdiomIsPad())
+ if (currentUserInterfaceIdiomIsPadOrMac())
control = adoptNS([[WKSelectPopover alloc] initWithView:view hasGroups:hasGroups]);
else if (view.focusedElementInformation.isMultiSelect || hasGroups)
control = adoptNS([[WKMultipleSelectPicker alloc] initWithView:view]);
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (266803 => 266804)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-09-09 22:45:45 UTC (rev 266803)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-09-09 22:54:40 UTC (rev 266804)
@@ -252,7 +252,7 @@
setEnhancedAccessibility(parameters.accessibilityEnhancedUserInterfaceEnabled);
#if PLATFORM(IOS_FAMILY)
- setCurrentUserInterfaceIdiomIsPad(parameters.currentUserInterfaceIdiomIsPad);
+ setCurrentUserInterfaceIdiomIsPadOrMac(parameters.currentUserInterfaceIdiomIsPad);
setLocalizedDeviceModel(parameters.localizedDeviceModel);
#if ENABLE(VIDEO_PRESENTATION_MODE)
setSupportsPictureInPicture(parameters.supportsPictureInPicture);