Changeset 234461 in webkit


Ignore:
Timestamp:
Aug 1, 2018 10:26:17 AM (6 years ago)
Author:
commit-queue@webkit.org
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 <Aditya Keerthi> 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:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r234459 r234461  
     12018-08-01  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [iOS] Color picker should have a border when presented in a popover
     4        https://bugs.webkit.org/show_bug.cgi?id=188207
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        The color picker should have a border when presented in a popover. This matches
     9        the behavior of color pickers in other parts of iOS.
     10
     11        Since the popover will resize its view to fill its size, we first place the
     12        color picker in a container view. The container view can then fill the popover,
     13        while the smaller color picker is centered in it's container - creating the
     14        appearance of a border.
     15
     16        * UIProcess/ios/forms/WKFormColorControl.mm:
     17        (-[WKColorPopover initWithView:]):
     18        * UIProcess/ios/forms/WKFormColorPicker.mm:
     19
    1202018-08-01  Commit Queue  <commit-queue@webkit.org>
    221
  • trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm

    r234105 r234461  
    3636#pragma mark - WKColorPopover
    3737
     38static const CGFloat colorPopoverWidth = 290;
     39static const CGFloat colorPopoverCornerRadius = 9;
     40
    3841@interface WKColorPopover : WKFormRotatingAccessoryPopover<WKFormControl> {
    3942    RetainPtr<NSObject<WKFormControl>> _innerControl;
     
    5356
    5457    RetainPtr<UIViewController> popoverViewController = adoptNS([[UIViewController alloc] init]);
     58    RetainPtr<UIView> controlContainerView = adoptNS([[UIView alloc] initWithFrame:CGRectMake(0, 0, colorPopoverWidth, colorPopoverWidth)]);
     59
    5560    UIView *controlView = [_innerControl controlView];
    56     [popoverViewController setView:controlView];
    57     [popoverViewController setPreferredContentSize:controlView.frame.size];
     61    [controlView setCenter:[controlContainerView center]];
     62    [controlView.layer setCornerRadius:colorPopoverCornerRadius];
     63    [controlView setClipsToBounds:YES];
     64    [controlContainerView addSubview:controlView];
     65
     66    [popoverViewController setView:controlContainerView.get()];
     67    [popoverViewController setPreferredContentSize:[controlContainerView size]];
    5868
    5969#pragma clang diagnostic push
  • trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm

    r234458 r234461  
    4343static const CGFloat additionalKeyboardAffordance = 80;
    4444static const CGFloat colorSelectionIndicatorBorderWidth = 4;
    45 static const CGFloat colorSelectionIndicatorCornerRadius = 13;
     45static const CGFloat colorSelectionIndicatorCornerRadius = 9;
    4646static const CGFloat pickerWidthForPopover = 280;
    47 static const CGFloat topColorMatrixPadding = 8;
     47static const CGFloat topColorMatrixPadding = 5;
    4848
    4949using namespace WebKit;
Note: See TracChangeset for help on using the changeset viewer.