Title: [259336] trunk/Source/WebKit
Revision
259336
Author
megan_gard...@apple.com
Date
2020-03-31 20:19:45 -0700 (Tue, 31 Mar 2020)

Log Message

Dismiss color picker on color selection on MacCatalyst
https://bugs.webkit.org/show_bug.cgi?id=209840
<rdar://problem/46793808>

Reviewed by Darin Adler.

To have correct behavior on mac, we need to dismiss the color picker popover once
a color has been selected.

* UIProcess/ios/forms/WKFormColorControl.mm:
(-[WKColorPopover initWithView:]):
* UIProcess/ios/forms/WKFormColorPicker.h:
* UIProcess/ios/forms/WKFormColorPicker.mm:
(-[WKColorPicker initWithView:]):
(-[WKColorPicker initWithView:inPopover:]):
(-[WKColorPicker colorMatrixView:didTapColorButton:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259335 => 259336)


--- trunk/Source/WebKit/ChangeLog	2020-04-01 02:49:32 UTC (rev 259335)
+++ trunk/Source/WebKit/ChangeLog	2020-04-01 03:19:45 UTC (rev 259336)
@@ -1,3 +1,22 @@
+2020-03-31  Megan Gardner  <megan_gard...@apple.com>
+
+        Dismiss color picker on color selection on MacCatalyst
+        https://bugs.webkit.org/show_bug.cgi?id=209840
+        <rdar://problem/46793808>
+
+        Reviewed by Darin Adler.
+
+        To have correct behavior on mac, we need to dismiss the color picker popover once
+        a color has been selected.
+
+        * UIProcess/ios/forms/WKFormColorControl.mm:
+        (-[WKColorPopover initWithView:]):
+        * UIProcess/ios/forms/WKFormColorPicker.h:
+        * UIProcess/ios/forms/WKFormColorPicker.mm:
+        (-[WKColorPicker initWithView:]):
+        (-[WKColorPicker initWithView:inPopover:]):
+        (-[WKColorPicker colorMatrixView:didTapColorButton:]):
+
 2020-03-31  Simon Fraser  <simon.fra...@apple.com>
 
         Add type traits for ScrollableArea, and other cleanup

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm (259335 => 259336)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm	2020-04-01 02:49:32 UTC (rev 259335)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm	2020-04-01 03:19:45 UTC (rev 259336)
@@ -53,7 +53,7 @@
     if (!(self = [super initWithView:view]))
         return nil;
 
-    _innerControl = adoptNS([[WKColorPicker alloc] initWithView:view]);
+    _innerControl = adoptNS([[WKColorPicker alloc] initWithView:view inPopover:self]);
 
     RetainPtr<UIViewController> popoverViewController = adoptNS([[UIViewController alloc] init]);
     RetainPtr<UIView> controlContainerView = adoptNS([[UIView alloc] initWithFrame:CGRectMake(0, 0, colorPopoverWidth, colorPopoverWidth)]);

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h (259335 => 259336)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h	2020-04-01 02:49:32 UTC (rev 259335)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h	2020-04-01 03:19:45 UTC (rev 259336)
@@ -31,6 +31,7 @@
 OBJC_CLASS WKColorButton;
 OBJC_CLASS WKColorMatrixView;
 OBJC_CLASS WKContentView;
+OBJC_CLASS WKColorPopover;
 
 @protocol WKColorMatrixViewDelegate
 - (void)colorMatrixView:(WKColorMatrixView *)matrixView didTapColorButton:(WKColorButton *)colorButton;
@@ -39,6 +40,7 @@
 
 @interface WKColorPicker : NSObject<WKFormControl, WKColorMatrixViewDelegate>
 - (instancetype)initWithView:(WKContentView *)view;
+- (instancetype)initWithView:(WKContentView *)view inPopover:(WKColorPopover *)popover;
 @end
 
 #endif // ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm (259335 => 259336)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm	2020-04-01 02:49:32 UTC (rev 259335)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm	2020-04-01 03:19:45 UTC (rev 259336)
@@ -151,6 +151,7 @@
 
 @implementation WKColorPicker {
     WKContentView *_view;
+    __weak WKColorPopover *_popover;
     RetainPtr<UIView> _colorPicker;
 
     RetainPtr<UIView> _colorSelectionIndicator;
@@ -170,10 +171,17 @@
 
 - (instancetype)initWithView:(WKContentView *)view
 {
+    return [self initWithView:view inPopover:nil];
+}
+
+- (instancetype)initWithView:(WKContentView *)view inPopover:(WKColorPopover *)popover
+{
     if (!(self = [super init]))
         return nil;
 
     _view = view;
+    
+    _popover = popover;
 
     CGSize colorPickerSize;
     if (currentUserInterfaceIdiomIsPad())
@@ -296,6 +304,9 @@
 
     [self drawSelectionIndicatorForColorButton:colorButton];
     [self setControlValueFromUIColor:colorButton.color];
+#if PLATFORM(MACCATALYST)
+    [_popover dismissPopoverAnimated:NO];
+#endif
 }
 
 #pragma mark UIPanGestureRecognizer
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to