Followup to r245267: fix some more deprecated uses of -[UIApplication interfaceOrient...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 04:14:59 +0000 (04:14 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 04:14:59 +0000 (04:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197867
<rdar://problem/50743963>

Reviewed by Simon Fraser.

Add a helper method on WKContentView that asks the view's window's scene for an interface orientation; then,
use this helper from various places in WebKit instead of invoking -[UIApplication interfaceOrientation]
directly. No change in behavior.

* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView interfaceOrientation]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsPicker initWithInformation:inView:]):
* UIProcess/ios/forms/WKFormColorPicker.mm:
(-[WKColorPicker initWithView:]):
* UIProcess/ios/forms/WKFormInputControl.mm:
(-[WKDateTimePicker initWithView:datePickerMode:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker initWithView:]):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover initWithView:hasGroups:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245272 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentView.h
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm
Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm
Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm
Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm
Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm

index 447dc47..db42021 100644 (file)
@@ -1,5 +1,31 @@
 2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
 
+        Followup to r245267: fix some more deprecated uses of -[UIApplication interfaceOrientation]
+        https://bugs.webkit.org/show_bug.cgi?id=197867
+        <rdar://problem/50743963>
+
+        Reviewed by Simon Fraser.
+
+        Add a helper method on WKContentView that asks the view's window's scene for an interface orientation; then,
+        use this helper from various places in WebKit instead of invoking -[UIApplication interfaceOrientation]
+        directly. No change in behavior.
+
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView interfaceOrientation]):
+        * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
+        (-[WKDataListSuggestionsPicker initWithInformation:inView:]):
+        * UIProcess/ios/forms/WKFormColorPicker.mm:
+        (-[WKColorPicker initWithView:]):
+        * UIProcess/ios/forms/WKFormInputControl.mm:
+        (-[WKDateTimePicker initWithView:datePickerMode:]):
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKMultipleSelectPicker initWithView:]):
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectPopover initWithView:hasGroups:]):
+
+2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
+
         [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
         https://bugs.webkit.org/show_bug.cgi?id=197821
         <rdar://problem/50700512>
index daa3910..2d5101b 100644 (file)
@@ -67,6 +67,7 @@ class WebProcessPool;
 @property (nonatomic, getter=isShowingInspectorIndication) BOOL showingInspectorIndication;
 @property (nonatomic, readonly, getter=isResigningFirstResponder) BOOL resigningFirstResponder;
 @property (nonatomic) BOOL sizeChangedSinceLastVisibleContentRectUpdate;
+@property (nonatomic, readonly) UIInterfaceOrientation interfaceOrientation;
 
 - (instancetype)initWithFrame:(CGRect)frame processPool:(WebKit::WebProcessPool&)processPool configuration:(Ref<API::PageConfiguration>&&)configuration webView:(WKWebView *)webView;
 
index ab68809..55d80ca 100644 (file)
@@ -545,6 +545,15 @@ static WebCore::FloatBoxExtent floatBoxExtent(UIEdgeInsets insets)
     return _undoManager.get();
 }
 
+- (UIInterfaceOrientation)interfaceOrientation
+{
+#if HAVE(UISCENE)
+    return self.window.windowScene.interfaceOrientation;
+#else
+    return UIApp.interfaceOrientation;
+#endif
+}
+
 #pragma mark Internal
 
 - (void)_windowDidMoveToScreenNotification:(NSNotification *)notification
index 5005ae6..d11a96d 100644 (file)
@@ -211,12 +211,7 @@ void WebDataListSuggestionsDropdownIOS::didSelectOption(const String& selectedOp
     [_pickerView setDataSource:self];
     [_pickerView setDelegate:self];
     [_pickerView setControl:self];
-#if HAVE(UISCENE)
-    auto interfaceOrientation = view.window.windowScene.interfaceOrientation;
-#else
-    auto interfaceOrientation = UIApp.interfaceOrientation;
-#endif
-    [_pickerView setSize:[UIKeyboard defaultSizeForInterfaceOrientation:interfaceOrientation]];
+    [_pickerView setSize:[UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation]];
 
     return self;
 }
index daac90a..45bb846 100644 (file)
@@ -179,7 +179,7 @@ using namespace WebKit;
     if (currentUserInterfaceIdiomIsPad())
         colorPickerSize = CGSizeMake(pickerWidthForPopover, pickerWidthForPopover);
     else {
-        CGSize keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]];
+        auto keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
         colorPickerSize = CGSizeMake(keyboardSize.width, keyboardSize.height + additionalKeyboardAffordance);
     }
 
index f57866a..8384ace 100644 (file)
@@ -106,7 +106,7 @@ static const NSTimeInterval kMillisecondsPerSecond = 1000;
         break;
    }
 
-    CGSize size = currentUserInterfaceIdiomIsPad() ? [UIPickerView defaultSizeForCurrentOrientation] : [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]];
+    auto size = currentUserInterfaceIdiomIsPad() ? [UIPickerView defaultSizeForCurrentOrientation] : [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
 
     _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]);
     _datePicker.get().datePickerMode = mode;
index 520aa14..d032d45 100644 (file)
@@ -161,7 +161,7 @@ static const float GroupOptionTextColorAlpha = 0.5;
     ALLOW_DEPRECATED_DECLARATIONS_END
 
     [self setAllowsMultipleSelection:_allowsMultipleSelection];
-    [self setSize:[UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]]];
+    [self setSize:[UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation]];
     [self reloadAllComponents];
 
     if (!_allowsMultipleSelection) {
index 5549690..891a546 100644 (file)
@@ -395,7 +395,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     
     CGRect frame;
     frame.origin = CGPointZero;
-    frame.size = [UIKeyboard defaultSizeForInterfaceOrientation:[UIApp interfaceOrientation]];
+    frame.size = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
 
     _tableViewController = adoptNS([[WKSelectTableViewController alloc] initWithView:view hasGroups:hasGroups]);
     [_tableViewController setPopover:self];