Title: [276447] trunk/Source
Revision
276447
Author
[email protected]
Date
2021-04-22 11:05:23 -0700 (Thu, 22 Apr 2021)

Log Message

Fix the tvOS build after r276325
https://bugs.webkit.org/show_bug.cgi?id=224929
<rdar://problem/77003408>

Reviewed by Wenson Hsieh.

Source/WebKit:

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:

[UIColor systemBackgroundColor] is SPI on tvOS.

(-[WKDateTimePickerViewController viewDidLoad]):

UIBlurEffectStyleSystemMaterial is not available on tvOS. Instead, use
a UIView with a system background color as the background view.

Source/WTF:

Fix the tvOS build after r276325

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (276446 => 276447)


--- trunk/Source/WTF/ChangeLog	2021-04-22 18:00:50 UTC (rev 276446)
+++ trunk/Source/WTF/ChangeLog	2021-04-22 18:05:23 UTC (rev 276447)
@@ -1,3 +1,15 @@
+2021-04-22  Aditya Keerthi  <[email protected]>
+
+        Fix the tvOS build after r276325
+        https://bugs.webkit.org/show_bug.cgi?id=224929
+        <rdar://problem/77003408>
+
+        Reviewed by Wenson Hsieh.
+
+        Fix the tvOS build after r276325
+
+        * wtf/PlatformHave.h:
+
 2021-04-21  Aditya Keerthi  <[email protected]>
 
         [iOS] Fix internal builds after r276325

Modified: trunk/Source/WTF/wtf/PlatformHave.h (276446 => 276447)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-04-22 18:00:50 UTC (rev 276446)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-04-22 18:05:23 UTC (rev 276447)
@@ -958,3 +958,7 @@
 #define HAVE_UICONTEXTMENU_STYLE_CUSTOM_PRESENTATION 1
 #define HAVE_UIDATEPICKER_INSETS 1
 #endif
+
+#if PLATFORM(IOS) || PLATFORM(MACCATALYST)
+#define HAVE_UIBLUREFFECT_STYLE_SYSTEM_MATERIAL 1
+#endif

Modified: trunk/Source/WebKit/ChangeLog (276446 => 276447)


--- trunk/Source/WebKit/ChangeLog	2021-04-22 18:00:50 UTC (rev 276446)
+++ trunk/Source/WebKit/ChangeLog	2021-04-22 18:05:23 UTC (rev 276447)
@@ -1,3 +1,21 @@
+2021-04-22  Aditya Keerthi  <[email protected]>
+
+        Fix the tvOS build after r276325
+        https://bugs.webkit.org/show_bug.cgi?id=224929
+        <rdar://problem/77003408>
+
+        Reviewed by Wenson Hsieh.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/forms/WKDateTimeInputControl.mm:
+
+        [UIColor systemBackgroundColor] is SPI on tvOS.
+
+        (-[WKDateTimePickerViewController viewDidLoad]):
+
+        UIBlurEffectStyleSystemMaterial is not available on tvOS. Instead, use
+        a UIView with a system background color as the background view.
+
 2021-04-20  BJ Burg  <[email protected]>
 
         v2: Web Inspector: exempt API::SharedJSContext from remote inspection and automatic inspection

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


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-04-22 18:00:50 UTC (rev 276446)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-04-22 18:05:23 UTC (rev 276447)
@@ -200,6 +200,10 @@
 - (BOOL)_appAdoptsUISceneLifecycle;
 @end
 
+@interface UIColor ()
++ (UIColor *)systemBackgroundColor;
+@end
+
 typedef NS_ENUM(NSInteger, UIDatePickerPrivateMode)  {
     UIDatePickerModeYearAndMonth = 4269,
 };

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm (276446 => 276447)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm	2021-04-22 18:00:50 UTC (rev 276446)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm	2021-04-22 18:05:23 UTC (rev 276447)
@@ -90,19 +90,29 @@
     [super viewDidLoad];
 
     CGSize contentSize = self.preferredContentSize;
+    CGRect contentFrame = CGRectMake(0, 0, contentSize.width, contentSize.height);
 
+    UIView *contentView = nil;
+#if HAVE(UIBLUREFFECT_STYLE_SYSTEM_MATERIAL)
     auto backgroundView = adoptNS([[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemMaterial]]);
-    [backgroundView setFrame:CGRectMake(0, 0, contentSize.width, contentSize.height)];
+    [backgroundView setFrame:contentFrame];
     [self.view addSubview:backgroundView.get()];
+    contentView = [backgroundView contentView];
+#else
+    auto backgroundView = adoptNS([[UIView alloc] initWithFrame:contentFrame]);
+    [backgroundView setBackgroundColor:UIColor.systemBackgroundColor];
+    [self.view addSubview:backgroundView.get()];
+    contentView = backgroundView.get();
+#endif
 
-    [[backgroundView contentView] addSubview:_datePicker.get()];
+    [contentView addSubview:_datePicker.get()];
 
     CGSize datePickerSize = self.preferredDatePickerSize;
     UIEdgeInsets datePickerInsets = [self datePickerInsets];
 
     [NSLayoutConstraint activateConstraints:@[
-        [[_datePicker topAnchor] constraintEqualToAnchor:[backgroundView contentView].topAnchor constant:datePickerInsets.top],
-        [[_datePicker leadingAnchor] constraintEqualToAnchor:[backgroundView contentView].leadingAnchor constant:datePickerInsets.left],
+        [[_datePicker topAnchor] constraintEqualToAnchor:contentView.topAnchor constant:datePickerInsets.top],
+        [[_datePicker leadingAnchor] constraintEqualToAnchor:contentView.leadingAnchor constant:datePickerInsets.left],
         [[_datePicker widthAnchor] constraintEqualToConstant:datePickerSize.width],
         [[_datePicker heightAnchor] constraintEqualToConstant:datePickerSize.height],
     ]];
@@ -109,13 +119,13 @@
 
     auto toolbarView = adoptNS([[UIView alloc] init]);
     [toolbarView setTranslatesAutoresizingMaskIntoConstraints:NO];
-    [[backgroundView contentView] addSubview:toolbarView.get()];
+    [contentView addSubview:toolbarView.get()];
 
     [NSLayoutConstraint activateConstraints:@[
-        [[toolbarView bottomAnchor] constraintEqualToAnchor:[backgroundView contentView].bottomAnchor],
-        [[toolbarView leadingAnchor] constraintEqualToAnchor:[backgroundView contentView].leadingAnchor],
+        [[toolbarView bottomAnchor] constraintEqualToAnchor:contentView.bottomAnchor],
+        [[toolbarView leadingAnchor] constraintEqualToAnchor:contentView.leadingAnchor],
         [[toolbarView heightAnchor] constraintEqualToConstant:kDateTimePickerToolbarHeight],
-        [[toolbarView widthAnchor] constraintEqualToAnchor:[backgroundView contentView].widthAnchor],
+        [[toolbarView widthAnchor] constraintEqualToAnchor:contentView.widthAnchor],
     ]];
 
     auto separatorView = adoptNS([[UIView alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to