Changeset 267628 in webkit
- Timestamp:
- Sep 26, 2020, 2:08:24 PM (6 years ago)
- Location:
- branches/safari-610-branch/Source/WebKit
- Files:
-
- 16 edited
-
ChangeLog (modified) (1 diff)
-
Shared/UserInterfaceIdiom.h (modified) (1 diff)
-
Shared/UserInterfaceIdiom.mm (modified) (2 diffs)
-
Shared/ios/WebPreferencesDefaultValuesIOS.mm (modified) (1 diff)
-
UIProcess/API/Cocoa/WKWebViewConfiguration.mm (modified) (1 diff)
-
UIProcess/Cocoa/WebProcessPoolCocoa.mm (modified) (1 diff)
-
UIProcess/ios/SmartMagnificationController.mm (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (8 diffs)
-
UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm (modified) (1 diff)
-
UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
UIProcess/ios/forms/WKAirPlayRoutePicker.mm (modified) (1 diff)
-
UIProcess/ios/forms/WKFileUploadPanel.mm (modified) (2 diffs)
-
UIProcess/ios/forms/WKFormColorControl.mm (modified) (1 diff)
-
UIProcess/ios/forms/WKFormColorPicker.mm (modified) (2 diffs)
-
UIProcess/ios/forms/WKFormSelectControl.mm (modified) (1 diff)
-
WebProcess/cocoa/WebProcessCocoa.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/Source/WebKit/ChangeLog
r267627 r267628 1 2020-09-25 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r266804. rdar://problem/69583164 4 5 macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps 6 https://bugs.webkit.org/show_bug.cgi?id=216326 7 8 Reviewed by Wenson Hsieh. 9 10 * Shared/UserInterfaceIdiom.h: 11 * Shared/UserInterfaceIdiom.mm: 12 (WebKit::userInterfaceIdiomIsPad): 13 (WebKit::currentUserInterfaceIdiomIsPadOrMac): 14 (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): 15 (WebKit::currentUserInterfaceIdiomIsPad): Deleted. 16 (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted. 17 * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 18 (WebKit::defaultTextAutosizingUsesIdempotentMode): 19 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 20 (-[WKWebViewConfiguration init]): 21 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 22 (WebKit::WebProcessPool::platformInitializeWebProcess): 23 * UIProcess/ios/SmartMagnificationController.mm: 24 (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture): 25 * UIProcess/ios/WKContentViewInteraction.mm: 26 (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): 27 (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): 28 (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): 29 (-[WKContentView _zoomToRevealFocusedElement]): 30 (-[WKContentView requiresAccessoryView]): 31 (-[WKContentView _updateAccessory]): 32 (shouldShowKeyboardForElement): 33 (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): 34 * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: 35 (WebKit::WebDataListSuggestionsDropdownIOS::show): 36 * UIProcess/ios/WebPageProxyIOS.mm: 37 (WebKit::desktopClassBrowsingSupported): 38 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 39 (-[WKAirPlayRoutePicker show:fromRect:]): 40 * UIProcess/ios/forms/WKFileUploadPanel.mm: 41 (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): 42 (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): 43 * UIProcess/ios/forms/WKFormColorControl.mm: 44 (-[WKFormColorControl initWithView:]): 45 * UIProcess/ios/forms/WKFormColorPicker.mm: 46 (-[WKColorPicker initWithView:inPopover:]): 47 (-[WKColorPicker drawSelectionIndicatorForColorButton:]): 48 * UIProcess/ios/forms/WKFormSelectControl.mm: 49 (-[WKFormSelectControl initWithView:]): 50 * WebProcess/cocoa/WebProcessCocoa.mm: 51 (WebKit::WebProcess::platformInitializeWebProcess): 52 Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac, 53 and force it to YES on macCatalyst since internally we use it to distinguish 54 between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst 55 should always follow iPad. 56 57 We should clean this up, and make all callers make their 58 iPhone vs. iPad vs. macOS decisions more explicit. 59 60 61 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266804 268f45cc-cd09-0410-ab3c-d52691b4dbfc 62 63 2020-09-09 Tim Horton <timothy_horton@apple.com> 64 65 macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps 66 https://bugs.webkit.org/show_bug.cgi?id=216326 67 68 Reviewed by Wenson Hsieh. 69 70 * Shared/UserInterfaceIdiom.h: 71 * Shared/UserInterfaceIdiom.mm: 72 (WebKit::userInterfaceIdiomIsPad): 73 (WebKit::currentUserInterfaceIdiomIsPadOrMac): 74 (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): 75 (WebKit::currentUserInterfaceIdiomIsPad): Deleted. 76 (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted. 77 * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 78 (WebKit::defaultTextAutosizingUsesIdempotentMode): 79 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 80 (-[WKWebViewConfiguration init]): 81 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 82 (WebKit::WebProcessPool::platformInitializeWebProcess): 83 * UIProcess/ios/SmartMagnificationController.mm: 84 (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture): 85 * UIProcess/ios/WKContentViewInteraction.mm: 86 (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): 87 (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): 88 (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): 89 (-[WKContentView _zoomToRevealFocusedElement]): 90 (-[WKContentView requiresAccessoryView]): 91 (-[WKContentView _updateAccessory]): 92 (shouldShowKeyboardForElement): 93 (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): 94 * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: 95 (WebKit::WebDataListSuggestionsDropdownIOS::show): 96 * UIProcess/ios/WebPageProxyIOS.mm: 97 (WebKit::desktopClassBrowsingSupported): 98 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 99 (-[WKAirPlayRoutePicker show:fromRect:]): 100 * UIProcess/ios/forms/WKFileUploadPanel.mm: 101 (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): 102 (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): 103 * UIProcess/ios/forms/WKFormColorControl.mm: 104 (-[WKFormColorControl initWithView:]): 105 * UIProcess/ios/forms/WKFormColorPicker.mm: 106 (-[WKColorPicker initWithView:inPopover:]): 107 (-[WKColorPicker drawSelectionIndicatorForColorButton:]): 108 * UIProcess/ios/forms/WKFormSelectControl.mm: 109 (-[WKFormSelectControl initWithView:]): 110 * WebProcess/cocoa/WebProcessCocoa.mm: 111 (WebKit::WebProcess::platformInitializeWebProcess): 112 Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac, 113 and force it to YES on macCatalyst since internally we use it to distinguish 114 between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst 115 should always follow iPad. 116 117 We should clean this up, and make all callers make their 118 iPhone vs. iPad vs. macOS decisions more explicit. 119 1 120 2020-09-25 Alan Coon <alancoon@apple.com> 2 121 -
branches/safari-610-branch/Source/WebKit/Shared/UserInterfaceIdiom.h
r253663 r267628 30 30 namespace WebKit { 31 31 32 bool currentUserInterfaceIdiomIsPad ();33 void setCurrentUserInterfaceIdiomIsPad (bool);32 bool currentUserInterfaceIdiomIsPadOrMac(); 33 void setCurrentUserInterfaceIdiomIsPadOrMac(bool); 34 34 35 35 } -
branches/safari-610-branch/Source/WebKit/Shared/UserInterfaceIdiom.mm
r261157 r267628 44 44 static inline bool userInterfaceIdiomIsPad() 45 45 { 46 #if PLATFORM(MACCATALYST) 47 // UIKit varies the UIUserInterfaceIdiom between iPad and macOS in macCatalyst, depending on various settings, 48 // but for the purposes of WebKit we always want to use iPad behavior (vs. iPhone) in macCatalyst. 49 // FIXME: We should get rid of this function and have callers make explicit decisions for all of iPhone/iPad/macOS. 50 return true; 51 #else 46 52 // If we are in a daemon, we cannot use UIDevice. Fall back to checking the hardware itself. 47 53 // Since daemons don't ever run in an iPhone-app-on-iPad jail, this will be accurate in the daemon case, … … 53 59 // detection on platforms where UICurrentUserInterfaceIdiomIsPad 54 60 // is defined directly to false. 55 #if USE(APPLE_INTERNAL_SDK) && !PLATFORM(MACCATALYST)61 #if USE(APPLE_INTERNAL_SDK) 56 62 return UICurrentUserInterfaceIdiomIsPad(); 57 63 #else 58 64 return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad; 59 65 #endif 66 #endif 60 67 } 61 68 62 bool currentUserInterfaceIdiomIsPad ()69 bool currentUserInterfaceIdiomIsPadOrMac() 63 70 { 64 71 if (userInterfaceIdiomIsPadState == UserInterfaceIdiomState::Unknown) 65 setCurrentUserInterfaceIdiomIsPad (userInterfaceIdiomIsPad());72 setCurrentUserInterfaceIdiomIsPadOrMac(userInterfaceIdiomIsPad()); 66 73 67 74 return userInterfaceIdiomIsPadState == UserInterfaceIdiomState::IsPad; 68 75 } 69 76 70 void setCurrentUserInterfaceIdiomIsPad (bool isPad)77 void setCurrentUserInterfaceIdiomIsPadOrMac(bool isPad) 71 78 { 72 79 userInterfaceIdiomIsPadState = isPad ? UserInterfaceIdiomState::IsPad : UserInterfaceIdiomState::IsNotPad; -
branches/safari-610-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm
r255376 r267628 39 39 bool defaultTextAutosizingUsesIdempotentMode() 40 40 { 41 return currentUserInterfaceIdiomIsPad ();41 return currentUserInterfaceIdiomIsPadOrMac(); 42 42 } 43 43 -
branches/safari-610-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r266002 r267628 195 195 #endif 196 196 197 #if PLATFORM(MACCATALYST) 198 _allowsInlineMediaPlayback = YES; 199 #else 200 _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPad(); 201 #endif 197 _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPadOrMac(); 202 198 _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback; 203 199 _allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback; -
branches/safari-610-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r267273 r267628 442 442 443 443 #if PLATFORM(IOS_FAMILY) 444 parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad ();444 parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPadOrMac(); 445 445 parameters.supportsPictureInPicture = supportsPictureInPicture(); 446 446 parameters.cssValueToSystemColorMap = RenderThemeIOS::cssValueToSystemColorMap(); -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm
r261299 r267628 120 120 if ([m_contentView bounds].size.width <= m_webPageProxy.unobscuredContentRect().width()) 121 121 minimumScrollDistance = smartMagnificationPanScrollThresholdZoomedOut; 122 else if (currentUserInterfaceIdiomIsPad ())122 else if (currentUserInterfaceIdiomIsPadOrMac()) 123 123 minimumScrollDistance = smartMagnificationPanScrollThresholdIPad; 124 124 else -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r266864 r267628 394 394 else 395 395 [[_contentView formAccessoryView] hideAutoFillButton]; 396 if (WebKit::currentUserInterfaceIdiomIsPad ())396 if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) 397 397 [_contentView reloadInputViews]; 398 398 } … … 1401 1401 return true; 1402 1402 1403 if (!WebKit::currentUserInterfaceIdiomIsPad ())1403 if (!WebKit::currentUserInterfaceIdiomIsPadOrMac()) 1404 1404 return true; 1405 1405 } … … 1972 1972 case WebKit::InputType::Color: 1973 1973 #endif 1974 return !WebKit::currentUserInterfaceIdiomIsPad ();1974 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 1975 1975 default: 1976 1976 return YES; … … 2016 2016 minimumScale:_focusedElementInformation.minimumScaleFactor 2017 2017 maximumScale:_focusedElementInformation.maximumScaleFactorIgnoringAlwaysScalable 2018 allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPad ()2018 allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPadOrMac() 2019 2019 forceScroll:[self requiresAccessoryView]]; 2020 2020 } … … 3003 3003 case WebKit::InputType::Color: 3004 3004 #endif 3005 return !WebKit::currentUserInterfaceIdiomIsPad ();3005 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 3006 3006 } 3007 3007 } … … 4486 4486 [accessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode]; 4487 4487 4488 if (WebKit::currentUserInterfaceIdiomIsPad ()) {4488 if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) { 4489 4489 [accessoryView setClearVisible:NO]; 4490 4490 return; … … 5858 5858 return true; 5859 5859 5860 return !WebKit::currentUserInterfaceIdiomIsPad ();5860 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 5861 5861 } 5862 5862 … … 7169 7169 - (BOOL)_shouldUseLegacySelectPopoverDismissalBehavior 7170 7170 { 7171 if (!WebKit::currentUserInterfaceIdiomIsPad ())7171 if (!WebKit::currentUserInterfaceIdiomIsPadOrMac()) 7172 7172 return NO; 7173 7173 -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm
r260366 r267628 103 103 WebCore::DataListSuggestionActivationType type = information.activationType; 104 104 105 if (currentUserInterfaceIdiomIsPad ())105 if (currentUserInterfaceIdiomIsPadOrMac()) 106 106 m_suggestionsControl = adoptNS([[WKDataListSuggestionsPopover alloc] initWithInformation:WTFMove(information) inView:m_contentView]); 107 107 else -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r265882 r267628 1350 1350 static dispatch_once_t onceToken; 1351 1351 dispatch_once(&onceToken, ^{ 1352 #if PLATFORM(MACCATALYST) 1353 supportsDesktopClassBrowsing = true; 1354 #else 1355 supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPad(); 1356 #endif 1352 supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPadOrMac(); 1357 1353 }); 1358 1354 return supportsDesktopClassBrowsing; -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm
r253889 r267628 155 155 156 156 MPAVItemType itemType = hasVideo ? MPAVItemTypeVideo : MPAVItemTypeAudio; 157 if (currentUserInterfaceIdiomIsPad ())157 if (currentUserInterfaceIdiomIsPadOrMac()) 158 158 [self showAirPlayPickerIPad:itemType fromRect:elementRect]; 159 159 else -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm
r264785 r267628 561 561 // Use a popover on the iPad if the source type is not the camera. 562 562 // The camera will use a fullscreen, modal view controller. 563 BOOL usePopover = currentUserInterfaceIdiomIsPad () && sourceType != UIImagePickerControllerSourceTypeCamera;563 BOOL usePopover = currentUserInterfaceIdiomIsPadOrMac() && sourceType != UIImagePickerControllerSourceTypeCamera; 564 564 if (usePopover) 565 565 [self _presentPopoverWithContentViewController:_imagePicker.get() animated:YES]; … … 583 583 - (void)_presentMenuOptionForCurrentInterfaceIdiom:(UIViewController *)viewController 584 584 { 585 if (currentUserInterfaceIdiomIsPad ())585 if (currentUserInterfaceIdiomIsPadOrMac()) 586 586 [self _presentPopoverWithContentViewController:viewController animated:YES]; 587 587 else -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm
r259336 r267628 100 100 { 101 101 RetainPtr<NSObject <WKFormControl>> control; 102 if (WebKit::currentUserInterfaceIdiomIsPad ())102 if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) 103 103 control = adoptNS([[WKColorPopover alloc] initWithView:view]); 104 104 else -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm
r263788 r267628 193 193 194 194 CGSize colorPickerSize; 195 if (currentUserInterfaceIdiomIsPad ())195 if (currentUserInterfaceIdiomIsPadOrMac()) 196 196 colorPickerSize = CGSizeMake(pickerWidthForPopover, pickerWidthForPopover); 197 197 else { … … 253 253 254 254 UIRectCorner roundCorner = 0; 255 if (currentUserInterfaceIdiomIsPad ()) {255 if (currentUserInterfaceIdiomIsPadOrMac()) { 256 256 CGRect colorPickerBounds = [_colorPicker bounds]; 257 257 -
branches/safari-610-branch/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm
r261815 r267628 75 75 76 76 RetainPtr<NSObject <WKFormControl>> control; 77 if (currentUserInterfaceIdiomIsPad ())77 if (currentUserInterfaceIdiomIsPadOrMac()) 78 78 control = adoptNS([[WKSelectPopover alloc] initWithView:view hasGroups:hasGroups]); 79 79 else if (view.focusedElementInformation.isMultiSelect || hasGroups) -
branches/safari-610-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r267273 r267628 254 254 255 255 #if PLATFORM(IOS_FAMILY) 256 setCurrentUserInterfaceIdiomIsPad (parameters.currentUserInterfaceIdiomIsPad);256 setCurrentUserInterfaceIdiomIsPadOrMac(parameters.currentUserInterfaceIdiomIsPad); 257 257 setLocalizedDeviceModel(parameters.localizedDeviceModel); 258 258 #if ENABLE(VIDEO_PRESENTATION_MODE)
Note:
See TracChangeset
for help on using the changeset viewer.