Title: [257740] trunk/Source
Revision
257740
Author
[email protected]
Date
2020-03-02 14:50:52 -0800 (Mon, 02 Mar 2020)

Log Message

Add date/time style to macCatalyst
https://bugs.webkit.org/show_bug.cgi?id=208456

Reviewed by Wenson Hsieh.

Source/WebKit:

Add style flag for date/time pickers on macCatalyst.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/forms/WKFormInputControl.mm:
(-[WKDateTimePicker datePickerStyle]):
(-[WKDateTimePicker initWithView:datePickerMode:]):

Source/WTF:

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (257739 => 257740)


--- trunk/Source/WTF/ChangeLog	2020-03-02 22:50:30 UTC (rev 257739)
+++ trunk/Source/WTF/ChangeLog	2020-03-02 22:50:52 UTC (rev 257740)
@@ -1,3 +1,12 @@
+2020-03-02  Megan Gardner  <[email protected]>
+
+        Add date/time style to macCatalyst
+        https://bugs.webkit.org/show_bug.cgi?id=208456
+
+        Reviewed by Wenson Hsieh.
+
+        * wtf/PlatformHave.h:
+
 2020-03-02  Paulo Matos  <[email protected]>
 
         Fix JSC 32bit alignment increase gcc warning

Modified: trunk/Source/WTF/wtf/PlatformHave.h (257739 => 257740)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-03-02 22:50:30 UTC (rev 257739)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-03-02 22:50:52 UTC (rev 257740)
@@ -479,6 +479,7 @@
 #if PLATFORM(MACCATALYST)
 #define HAVE_HOVER_GESTURE_RECOGNIZER 1
 #define HAVE_LOOKUP_GESTURE_RECOGNIZER 1
+#define HAVE_UIDATEPICKER_STYLE 1
 #endif
 
 #if PLATFORM(MACCATALYST)

Modified: trunk/Source/WebKit/ChangeLog (257739 => 257740)


--- trunk/Source/WebKit/ChangeLog	2020-03-02 22:50:30 UTC (rev 257739)
+++ trunk/Source/WebKit/ChangeLog	2020-03-02 22:50:52 UTC (rev 257740)
@@ -1,3 +1,17 @@
+2020-03-02  Megan Gardner  <[email protected]>
+
+        Add date/time style to macCatalyst
+        https://bugs.webkit.org/show_bug.cgi?id=208456
+
+        Reviewed by Wenson Hsieh.
+
+        Add style flag for date/time pickers on macCatalyst.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/forms/WKFormInputControl.mm:
+        (-[WKDateTimePicker datePickerStyle]):
+        (-[WKDateTimePicker initWithView:datePickerMode:]):
+
 2020-03-02  Said Abou-Hallawa  <[email protected]>
 
         Implement the remote ImageBuffer

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


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-03-02 22:50:30 UTC (rev 257739)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-03-02 22:50:52 UTC (rev 257740)
@@ -189,8 +189,17 @@
     UIDatePickerModeYearAndMonth = 4269,
 };
 
+#if HAVE(UIDATEPICKER_STYLE)
+typedef NS_ENUM(NSInteger, UIDatePickerStyle) {
+    UIDatePickerStyleAutomatic = 0
+}
+#endif
+
 @interface UIDatePicker ()
 @property (nonatomic, readonly, getter=_contentWidth) CGFloat contentWidth;
+#if HAVE(UIDATEPICKER_STYLE)
+@property (nonatomic, readwrite, assign) UIDatePickerStyle preferredDatePickerStyle;
+#endif
 @end
 
 @interface UIDevice ()

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


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2020-03-02 22:50:30 UTC (rev 257739)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2020-03-02 22:50:52 UTC (rev 257740)
@@ -68,6 +68,10 @@
 
 @end
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WKFormInputControlAdditions.mm>
+#endif
+
 @implementation WKDateTimePicker
 
 static NSString * const kDateFormatString = @"yyyy-MM-dd"; // "2011-01-27".
@@ -80,6 +84,13 @@
     return _datePicker.get();
 }
 
+#if !USE(APPLE_INTERNAL_SDK) && HAVE(UIDATEPICKER_STYLE)
+- (UIDatePickerStyle)datePickerStyle
+{
+    return UIDatePickerStyleAutomatic;
+}
+#endif
+
 - (id)initWithView:(WKContentView *)view datePickerMode:(UIDatePickerMode)mode
 {
     if (!(self = [super init]))
@@ -109,6 +120,9 @@
     auto size = currentUserInterfaceIdiomIsPad() ? [UIPickerView defaultSizeForCurrentOrientation] : [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
 
     _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]);
+#if HAVE(UIDATEPICKER_STYLE)
+    [_datePicker setPreferredDatePickerStyle:[self datePickerStyle]];
+#endif
     _datePicker.get().datePickerMode = mode;
     _datePicker.get().hidden = NO;
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to