Title: [234461] trunk/Source/WebKit
- Revision
- 234461
- Author
- [email protected]
- Date
- 2018-08-01 10:26:17 -0700 (Wed, 01 Aug 2018)
Log Message
[iOS] Color picker should have a border when presented in a popover
https://bugs.webkit.org/show_bug.cgi?id=188207
Patch by Aditya Keerthi <[email protected]> on 2018-08-01
Reviewed by Wenson Hsieh.
The color picker should have a border when presented in a popover. This matches
the behavior of color pickers in other parts of iOS.
Since the popover will resize its view to fill its size, we first place the
color picker in a container view. The container view can then fill the popover,
while the smaller color picker is centered in it's container - creating the
appearance of a border.
* UIProcess/ios/forms/WKFormColorControl.mm:
(-[WKColorPopover initWithView:]):
* UIProcess/ios/forms/WKFormColorPicker.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (234460 => 234461)
--- trunk/Source/WebKit/ChangeLog 2018-08-01 16:01:00 UTC (rev 234460)
+++ trunk/Source/WebKit/ChangeLog 2018-08-01 17:26:17 UTC (rev 234461)
@@ -1,3 +1,22 @@
+2018-08-01 Aditya Keerthi <[email protected]>
+
+ [iOS] Color picker should have a border when presented in a popover
+ https://bugs.webkit.org/show_bug.cgi?id=188207
+
+ Reviewed by Wenson Hsieh.
+
+ The color picker should have a border when presented in a popover. This matches
+ the behavior of color pickers in other parts of iOS.
+
+ Since the popover will resize its view to fill its size, we first place the
+ color picker in a container view. The container view can then fill the popover,
+ while the smaller color picker is centered in it's container - creating the
+ appearance of a border.
+
+ * UIProcess/ios/forms/WKFormColorControl.mm:
+ (-[WKColorPopover initWithView:]):
+ * UIProcess/ios/forms/WKFormColorPicker.mm:
+
2018-08-01 Commit Queue <[email protected]>
Unreviewed, rolling out r234443 and r234445.
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm (234460 => 234461)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2018-08-01 16:01:00 UTC (rev 234460)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2018-08-01 17:26:17 UTC (rev 234461)
@@ -35,6 +35,9 @@
#pragma mark - WKColorPopover
+static const CGFloat colorPopoverWidth = 290;
+static const CGFloat colorPopoverCornerRadius = 9;
+
@interface WKColorPopover : WKFormRotatingAccessoryPopover<WKFormControl> {
RetainPtr<NSObject<WKFormControl>> _innerControl;
}
@@ -52,10 +55,17 @@
_innerControl = adoptNS([[WKColorPicker alloc] initWithView:view]);
RetainPtr<UIViewController> popoverViewController = adoptNS([[UIViewController alloc] init]);
+ RetainPtr<UIView> controlContainerView = adoptNS([[UIView alloc] initWithFrame:CGRectMake(0, 0, colorPopoverWidth, colorPopoverWidth)]);
+
UIView *controlView = [_innerControl controlView];
- [popoverViewController setView:controlView];
- [popoverViewController setPreferredContentSize:controlView.frame.size];
+ [controlView setCenter:[controlContainerView center]];
+ [controlView.layer setCornerRadius:colorPopoverCornerRadius];
+ [controlView setClipsToBounds:YES];
+ [controlContainerView addSubview:controlView];
+ [popoverViewController setView:controlContainerView.get()];
+ [popoverViewController setPreferredContentSize:[controlContainerView size]];
+
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
RetainPtr<UIPopoverController> controller = adoptNS([[UIPopoverController alloc] initWithContentViewController:popoverViewController.get()]);
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm (234460 => 234461)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2018-08-01 16:01:00 UTC (rev 234460)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2018-08-01 17:26:17 UTC (rev 234461)
@@ -42,9 +42,9 @@
static const CGFloat additionalKeyboardAffordance = 80;
static const CGFloat colorSelectionIndicatorBorderWidth = 4;
-static const CGFloat colorSelectionIndicatorCornerRadius = 13;
+static const CGFloat colorSelectionIndicatorCornerRadius = 9;
static const CGFloat pickerWidthForPopover = 280;
-static const CGFloat topColorMatrixPadding = 8;
+static const CGFloat topColorMatrixPadding = 5;
using namespace WebKit;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes