Changeset 266804 in webkit
- Timestamp:
- Sep 9, 2020, 3:54:40 PM (6 years ago)
- Location:
- trunk/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
-
trunk/Source/WebKit/ChangeLog
r266802 r266804 1 2020-09-09 Tim Horton <timothy_horton@apple.com> 2 3 macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps 4 https://bugs.webkit.org/show_bug.cgi?id=216326 5 6 Reviewed by Wenson Hsieh. 7 8 * Shared/UserInterfaceIdiom.h: 9 * Shared/UserInterfaceIdiom.mm: 10 (WebKit::userInterfaceIdiomIsPad): 11 (WebKit::currentUserInterfaceIdiomIsPadOrMac): 12 (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): 13 (WebKit::currentUserInterfaceIdiomIsPad): Deleted. 14 (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted. 15 * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 16 (WebKit::defaultTextAutosizingUsesIdempotentMode): 17 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 18 (-[WKWebViewConfiguration init]): 19 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 20 (WebKit::WebProcessPool::platformInitializeWebProcess): 21 * UIProcess/ios/SmartMagnificationController.mm: 22 (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture): 23 * UIProcess/ios/WKContentViewInteraction.mm: 24 (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): 25 (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): 26 (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): 27 (-[WKContentView _zoomToRevealFocusedElement]): 28 (-[WKContentView requiresAccessoryView]): 29 (-[WKContentView _updateAccessory]): 30 (shouldShowKeyboardForElement): 31 (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): 32 * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: 33 (WebKit::WebDataListSuggestionsDropdownIOS::show): 34 * UIProcess/ios/WebPageProxyIOS.mm: 35 (WebKit::desktopClassBrowsingSupported): 36 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 37 (-[WKAirPlayRoutePicker show:fromRect:]): 38 * UIProcess/ios/forms/WKFileUploadPanel.mm: 39 (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): 40 (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): 41 * UIProcess/ios/forms/WKFormColorControl.mm: 42 (-[WKFormColorControl initWithView:]): 43 * UIProcess/ios/forms/WKFormColorPicker.mm: 44 (-[WKColorPicker initWithView:inPopover:]): 45 (-[WKColorPicker drawSelectionIndicatorForColorButton:]): 46 * UIProcess/ios/forms/WKFormSelectControl.mm: 47 (-[WKFormSelectControl initWithView:]): 48 * WebProcess/cocoa/WebProcessCocoa.mm: 49 (WebKit::WebProcess::platformInitializeWebProcess): 50 Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac, 51 and force it to YES on macCatalyst since internally we use it to distinguish 52 between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst 53 should always follow iPad. 54 55 We should clean this up, and make all callers make their 56 iPhone vs. iPad vs. macOS decisions more explicit. 57 1 58 2020-09-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 59 -
trunk/Source/WebKit/Shared/UserInterfaceIdiom.h
r253663 r266804 30 30 namespace WebKit { 31 31 32 bool currentUserInterfaceIdiomIsPad ();33 void setCurrentUserInterfaceIdiomIsPad (bool);32 bool currentUserInterfaceIdiomIsPadOrMac(); 33 void setCurrentUserInterfaceIdiomIsPadOrMac(bool); 34 34 35 35 } -
trunk/Source/WebKit/Shared/UserInterfaceIdiom.mm
r261157 r266804 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; -
trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm
r255376 r266804 39 39 bool defaultTextAutosizingUsesIdempotentMode() 40 40 { 41 return currentUserInterfaceIdiomIsPad ();41 return currentUserInterfaceIdiomIsPadOrMac(); 42 42 } 43 43 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r266342 r266804 194 194 #endif 195 195 196 #if PLATFORM(MACCATALYST) 197 _allowsInlineMediaPlayback = YES; 198 #else 199 _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPad(); 200 #endif 196 _allowsInlineMediaPlayback = WebKit::currentUserInterfaceIdiomIsPadOrMac(); 201 197 _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback; 202 198 _allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback; -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r266802 r266804 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(); -
trunk/Source/WebKit/UIProcess/ios/SmartMagnificationController.mm
r261299 r266804 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 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r266766 r266804 389 389 else 390 390 [[_contentView formAccessoryView] hideAutoFillButton]; 391 if (WebKit::currentUserInterfaceIdiomIsPad ())391 if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) 392 392 [_contentView reloadInputViews]; 393 393 } … … 1381 1381 return true; 1382 1382 1383 if (!WebKit::currentUserInterfaceIdiomIsPad ())1383 if (!WebKit::currentUserInterfaceIdiomIsPadOrMac()) 1384 1384 return true; 1385 1385 } … … 1952 1952 case WebKit::InputType::Color: 1953 1953 #endif 1954 return !WebKit::currentUserInterfaceIdiomIsPad ();1954 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 1955 1955 default: 1956 1956 return YES; … … 1996 1996 minimumScale:_focusedElementInformation.minimumScaleFactor 1997 1997 maximumScale:_focusedElementInformation.maximumScaleFactorIgnoringAlwaysScalable 1998 allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPad ()1998 allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !WebKit::currentUserInterfaceIdiomIsPadOrMac() 1999 1999 forceScroll:[self requiresAccessoryView]]; 2000 2000 } … … 2966 2966 case WebKit::InputType::Color: 2967 2967 #endif 2968 return !WebKit::currentUserInterfaceIdiomIsPad ();2968 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 2969 2969 } 2970 2970 } … … 4449 4449 [accessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode]; 4450 4450 4451 if (WebKit::currentUserInterfaceIdiomIsPad ()) {4451 if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) { 4452 4452 [accessoryView setClearVisible:NO]; 4453 4453 return; … … 5821 5821 return true; 5822 5822 5823 return !WebKit::currentUserInterfaceIdiomIsPad ();5823 return !WebKit::currentUserInterfaceIdiomIsPadOrMac(); 5824 5824 } 5825 5825 … … 7116 7116 - (BOOL)_shouldUseLegacySelectPopoverDismissalBehavior 7117 7117 { 7118 if (!WebKit::currentUserInterfaceIdiomIsPad ())7118 if (!WebKit::currentUserInterfaceIdiomIsPadOrMac()) 7119 7119 return NO; 7120 7120 -
trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm
r260366 r266804 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 -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r266654 r266804 1340 1340 static dispatch_once_t onceToken; 1341 1341 dispatch_once(&onceToken, ^{ 1342 #if PLATFORM(MACCATALYST) 1343 supportsDesktopClassBrowsing = true; 1344 #else 1345 supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPad(); 1346 #endif 1342 supportsDesktopClassBrowsing = currentUserInterfaceIdiomIsPadOrMac(); 1347 1343 }); 1348 1344 return supportsDesktopClassBrowsing; -
trunk/Source/WebKit/UIProcess/ios/forms/WKAirPlayRoutePicker.mm
r253889 r266804 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 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm
r266361 r266804 569 569 // Use a popover on the iPad if the source type is not the camera. 570 570 // The camera will use a fullscreen, modal view controller. 571 BOOL usePopover = currentUserInterfaceIdiomIsPad () && sourceType != UIImagePickerControllerSourceTypeCamera;571 BOOL usePopover = currentUserInterfaceIdiomIsPadOrMac() && sourceType != UIImagePickerControllerSourceTypeCamera; 572 572 if (usePopover) 573 573 [self _presentPopoverWithContentViewController:_imagePicker.get() animated:YES]; … … 580 580 - (void)_presentMenuOptionForCurrentInterfaceIdiom:(UIViewController *)viewController 581 581 { 582 if (currentUserInterfaceIdiomIsPad ())582 if (currentUserInterfaceIdiomIsPadOrMac()) 583 583 [self _presentPopoverWithContentViewController:viewController animated:YES]; 584 584 else -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm
r259336 r266804 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 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm
r263788 r266804 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 -
trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm
r261815 r266804 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) -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r266802 r266804 253 253 254 254 #if PLATFORM(IOS_FAMILY) 255 setCurrentUserInterfaceIdiomIsPad (parameters.currentUserInterfaceIdiomIsPad);255 setCurrentUserInterfaceIdiomIsPadOrMac(parameters.currentUserInterfaceIdiomIsPad); 256 256 setLocalizedDeviceModel(parameters.localizedDeviceModel); 257 257 #if ENABLE(VIDEO_PRESENTATION_MODE)
Note:
See TracChangeset
for help on using the changeset viewer.