Diff
Modified: trunk/LayoutTests/ChangeLog (272596 => 272597)
--- trunk/LayoutTests/ChangeLog 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/LayoutTests/ChangeLog 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,3 +1,25 @@
+2021-02-09 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Use UIColorPickerViewController for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=221572
+ <rdar://problem/72183130>
+
+ Reviewed by Sam Weinig.
+
+ Added a test which displays the new color picker and verifies that
+ selecting a color updates the corresponding input's value.
+
+ * fast/forms/color/color-input-activate-crash.html:
+
+ Replaced call to activateElementAndWaitForInputSession with
+ activateElement and ensurePresentationUpdate, since tapping on a
+ color input no longer presents a keyboard input view.
+
+ * fast/forms/ios/choose-color-from-color-picker-expected.txt: Added.
+ * fast/forms/ios/choose-color-from-color-picker.html: Added.
+ * resources/ui-helper.js:
+ (UIHelper.setSelectedColorForColorPicker):
+
2021-02-09 Wenson Hsieh <[email protected]>
REGRESSION (r271660): Unable to interact with page after long-pressing image on images.google.com
Modified: trunk/LayoutTests/fast/forms/color/color-input-activate-crash.html (272596 => 272597)
--- trunk/LayoutTests/fast/forms/color/color-input-activate-crash.html 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/LayoutTests/fast/forms/color/color-input-activate-crash.html 2021-02-09 19:25:04 UTC (rev 272597)
@@ -14,7 +14,8 @@
return;
var input = document.getElementById('colorInput');
- await UIHelper.activateElementAndWaitForInputSession(input);
+ await UIHelper.activateElement(input);
+ await UIHelper.ensurePresentationUpdate();
document.getElementById('result').innerHTML = 'PASS: Test did not crash';
testRunner.notifyDone();
}
Added: trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker-expected.txt (0 => 272597)
--- trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker-expected.txt 2021-02-09 19:25:04 UTC (rev 272597)
@@ -0,0 +1,11 @@
+This test verifies that tapping a color input and selecting a color using the color picker updates element's value.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.value is "#000000"
+PASS input.value is "#ff0000"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker.html (0 => 272597)
--- trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/choose-color-from-color-picker.html 2021-02-09 19:25:04 UTC (rev 272597)
@@ -0,0 +1,28 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+ <script src=""
+ <script src=""
+ </head>
+<body>
+ <input type="color" id="input"/>
+</body>
+<script>
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+ description("This test verifies that tapping a color input and selecting a color using the color picker updates element's value.");
+
+ shouldBeEqualToString("input.value", "#000000");
+
+ input.addEventListener("change", () => {
+ shouldBeEqualToString("input.value", "#ff0000");
+ finishJSTest();
+ });
+
+ await UIHelper.activateFormControl(input);
+ await UIHelper.setSelectedColorForColorPicker(1, 0, 0);
+});
+</script>
+</html>
Modified: trunk/LayoutTests/resources/ui-helper.js (272596 => 272597)
--- trunk/LayoutTests/resources/ui-helper.js 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/LayoutTests/resources/ui-helper.js 2021-02-09 19:25:04 UTC (rev 272597)
@@ -864,6 +864,12 @@
});
}
+ static setSelectedColorForColorPicker(red, green, blue)
+ {
+ const selectColorScript = `uiController.setSelectedColorForColorPicker(${red}, ${green}, ${blue})`;
+ return new Promise(resolve => testRunner.runUIScript(selectColorScript, resolve));
+ }
+
static enterText(text)
{
const escapedText = text.replace(/`/g, "\\`");
Modified: trunk/Source/WebCore/ChangeLog (272596 => 272597)
--- trunk/Source/WebCore/ChangeLog 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebCore/ChangeLog 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,3 +1,15 @@
+2021-02-09 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Use UIColorPickerViewController for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=221572
+ <rdar://problem/72183130>
+
+ Reviewed by Sam Weinig.
+
+ * html/HTMLInputElement.h:
+
+ Export function so it can be called from WebKit layer.
+
2021-02-09 Eric Carlson <[email protected]>
[Mac] Connect MediaSession with MediaRemote and NowPlaying
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (272596 => 272597)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -289,7 +289,7 @@
void cacheSelectionInResponseToSetValue(int caretOffset) { cacheSelection(caretOffset, caretOffset, SelectionHasNoDirection); }
- Color valueAsColor() const; // Returns transparent color if not type=color.
+ WEBCORE_EXPORT Color valueAsColor() const; // Returns transparent color if not type=color.
WEBCORE_EXPORT void selectColor(StringView); // Does nothing if not type=color. Simulates user selection of color; intended for testing.
WEBCORE_EXPORT Vector<Color> suggestedColors() const;
Modified: trunk/Source/WebKit/ChangeLog (272596 => 272597)
--- trunk/Source/WebKit/ChangeLog 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/ChangeLog 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,3 +1,81 @@
+2021-02-09 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Use UIColorPickerViewController for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=221572
+ <rdar://problem/72183130>
+
+ Reviewed by Sam Weinig.
+
+ UIColorPickerViewController was added in iOS 14, while WebKit still
+ uses a custom color picker. To stay consistent with the rest of the
+ platform, this patch drops the custom color picker and adopts
+ UIColorPickerViewController for <input type=color> on iOS.
+
+ Test: fast/forms/ios/choose-color-from-color-picker.html
+
+ * Platform/spi/ios/UIKitSPI.h:
+
+ Added SPI declarations for _UISheetPresentationController and
+ UIColorPickerViewController.
+
+ * Shared/FocusedElementInformation.cpp:
+ (WebKit::FocusedElementInformation::encode const):
+ (WebKit::FocusedElementInformation::decode):
+ * Shared/FocusedElementInformation.h:
+
+ Added colorValue member to avoid parsing the input's value
+ in the UIProcess.
+
+ * SourcesCocoa.txt:
+ * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+ * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+ (-[WKWebView setSelectedColorForColorPicker:]):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
+ (-[WKContentView _elementTypeRequiresAccessoryView:]):
+
+ The new color picker does not appear as a keyboard input view.
+
+ (-[WKContentView updateFocusedElementValueAsColor:]):
+ (-[WKContentView setSelectedColorForColorPicker:]):
+ * UIProcess/ios/forms/WKFormColorControl.h:
+ * UIProcess/ios/forms/WKFormColorControl.mm:
+ (-[WKColorPicker initWithView:]):
+ (-[WKColorPicker selectColor:]):
+
+ Note that the delegate method is not called when programmatically
+ setting the selected color.
+
+ (-[WKColorPicker focusedElementSuggestedColors]):
+
+ Suggested colors from a <datalist> element are displayed in the
+ favorites view.
+
+ (-[WKColorPicker updateColorPickerState]):
+ (-[WKColorPicker configurePresentation]):
+
+ On iPad, the color picker is displayed a popover. On iPhone, the picker
+ is displayed as a half-sheet, and can be dragged up into a fullscreen
+ view.
+
+ (-[WKColorPicker controlBeginEditing]):
+ (-[WKColorPicker controlEndEditing]):
+ (-[WKColorPicker presentationControllerDidDismiss:]):
+ (-[WKColorPicker colorPickerViewControllerDidSelectColor:]):
+ (-[WKColorPicker colorPickerViewControllerDidFinish:]):
+ (-[WKFormColorControl initWithView:]):
+ (-[WKFormColorControl selectColor:]):
+ * UIProcess/ios/forms/WKFormColorPicker.h: Removed.
+ * UIProcess/ios/forms/WKFormColorPicker.mm: Removed.
+ * UIProcess/ios/forms/WKFormSelectPicker.h:
+
+ Build fix.
+
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::getFocusedElementInformation):
+
2021-02-09 Alex Christensen <[email protected]>
Use CompletionHandler instead of DrawToPDFCallback
Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (272596 => 272597)
--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -93,6 +93,7 @@
#import <UIKit/_UIHighlightView.h>
#import <UIKit/_UINavigationInteractiveTransition.h>
#import <UIKit/_UINavigationParallaxTransition.h>
+#import <UIKit/_UISheetPresentationController.h>
#if HAVE(LINK_PREVIEW)
#import <UIKit/UIPreviewAction_Private.h>
@@ -931,6 +932,17 @@
- (UIPanGestureRecognizer *)gestureRecognizerForInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition WithTarget:(id)target action:(SEL)action;
@end
+@interface _UISheetDetent : NSObject
+@property (class, nonatomic, readonly) _UISheetDetent *_mediumDetent;
+@property (class, nonatomic, readonly) _UISheetDetent *_largeDetent;
+@end
+
+@interface _UISheetPresentationController : UIPresentationController
+@property (nonatomic, copy, setter=_setDetents:) NSArray<_UISheetDetent *> *_detents;
+@property (nonatomic, setter=_setWantsBottomAttachedInCompactHeight:) BOOL _wantsBottomAttachedInCompactHeight;
+@property (nonatomic, setter=_setWidthFollowsPreferredContentSizeWhenBottomAttached:) BOOL _widthFollowsPreferredContentSizeWhenBottomAttached;
+@end
+
@class BKSAnimationFenceHandle;
@interface UIWindow ()
@@ -1399,6 +1411,10 @@
@property (nonatomic, setter=_setBacklightLevel:) float _backlightLevel;
@end
+@interface UIColorPickerViewController ()
+@property (nonatomic, copy, setter=_setSuggestedColors:) NSArray<UIColor *> *_suggestedColors;
+@end
+
WTF_EXTERN_C_BEGIN
BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts(void);
Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.cpp (272596 => 272597)
--- trunk/Source/WebKit/Shared/FocusedElementInformation.cpp 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.cpp 2021-02-09 19:25:04 UTC (rev 272597)
@@ -102,6 +102,7 @@
#if ENABLE(DATALIST_ELEMENT)
encoder << hasSuggestions;
#if ENABLE(INPUT_TYPE_COLOR)
+ encoder << colorValue;
encoder << suggestedColors;
#endif
#endif
@@ -228,6 +229,9 @@
return false;
#if ENABLE(INPUT_TYPE_COLOR)
+ if (!decoder.decode(result.colorValue))
+ return false;
+
if (!decoder.decode(result.suggestedColors))
return false;
#endif
Modified: trunk/Source/WebKit/Shared/FocusedElementInformation.h (272596 => 272597)
--- trunk/Source/WebKit/Shared/FocusedElementInformation.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/Shared/FocusedElementInformation.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -136,6 +136,7 @@
#if ENABLE(DATALIST_ELEMENT)
bool hasSuggestions { false };
#if ENABLE(INPUT_TYPE_COLOR)
+ WebCore::Color colorValue;
Vector<WebCore::Color> suggestedColors;
#endif
#endif
Modified: trunk/Source/WebKit/SourcesCocoa.txt (272596 => 272597)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-02-09 19:25:04 UTC (rev 272597)
@@ -438,7 +438,6 @@
UIProcess/ios/forms/WKFileUploadPanel.mm
UIProcess/ios/forms/WKFocusedFormControlView.mm
UIProcess/ios/forms/WKFormColorControl.mm
-UIProcess/ios/forms/WKFormColorPicker.mm
UIProcess/ios/forms/WKFormPeripheralBase.mm
UIProcess/ios/forms/WKFormPopover.mm
UIProcess/ios/forms/WKFormSelectControl.mm
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -49,6 +49,7 @@
- (void)_dismissFilePicker;
- (void)selectFormAccessoryPickerRow:(int)rowIndex;
- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
+- (void)setSelectedColorForColorPicker:(UIColor *)color;
- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect;
- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void (^)(NSArray<_WKTextInputContext *> *))completionHandler;
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -162,6 +162,11 @@
return [_contentView selectFormPopoverTitle];
}
+- (void)setSelectedColorForColorPicker:(UIColor *)color
+{
+ [_contentView setSelectedColorForColorPicker:color];
+}
+
- (NSString *)textContentTypeForTesting
{
return [_contentView textContentTypeForTesting];
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -616,6 +616,7 @@
- (void)accessoryDone;
- (void)accessoryOpen;
+- (void)updateFocusedElementValueAsColor:(UIColor *)value;
- (void)updateFocusedElementValueAsNumber:(double)value;
- (void)updateFocusedElementValue:(NSString *)value;
@@ -685,6 +686,7 @@
- (void)_simulateTextEntered:(NSString *)text;
- (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
+- (void)setSelectedColorForColorPicker:(UIColor *)color;
- (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
- (double)timePickerValueHour;
- (double)timePickerValueMinute;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -2031,6 +2031,9 @@
switch (_focusedElementInformation.elementType) {
case WebKit::InputType::None:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case WebKit::InputType::Color:
+#endif
case WebKit::InputType::Drawing:
case WebKit::InputType::Date:
case WebKit::InputType::Month:
@@ -2044,10 +2047,6 @@
#endif
return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
}
-#if ENABLE(INPUT_TYPE_COLOR)
- case WebKit::InputType::Color:
-#endif
- return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
default:
return YES;
}
@@ -3090,6 +3089,9 @@
{
switch (type) {
case WebKit::InputType::None:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case WebKit::InputType::Color:
+#endif
case WebKit::InputType::Drawing:
case WebKit::InputType::Date:
case WebKit::InputType::DateTimeLocal:
@@ -3114,9 +3116,6 @@
case WebKit::InputType::ContentEditable:
case WebKit::InputType::TextArea:
case WebKit::InputType::Week:
-#if ENABLE(INPUT_TYPE_COLOR)
- case WebKit::InputType::Color:
-#endif
return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
}
}
@@ -4564,6 +4563,16 @@
_focusedElementInformation.value = value;
}
+- (void)updateFocusedElementValueAsColor:(UIColor *)value
+{
+ WebCore::Color color(value.CGColor);
+ String valueAsString = WebCore::serializationForHTML(color);
+
+ _page->setFocusedElementValue(valueAsString);
+ _focusedElementInformation.value = valueAsString;
+ _focusedElementInformation.colorValue = color;
+}
+
- (void)accessoryTab:(BOOL)isNext
{
// The input peripheral may need to update the focused DOM node before we switch focus. The UI process does
@@ -9308,6 +9317,12 @@
return NO;
}
+- (void)setSelectedColorForColorPicker:(UIColor *)color
+{
+ if ([_inputPeripheral isKindOfClass:[WKFormColorControl class]])
+ [(WKFormColorControl *)_inputPeripheral selectColor:color];
+}
+
- (NSString *)textContentTypeForTesting
{
#if PLATFORM(WATCHOS)
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.h (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -33,4 +33,8 @@
- (instancetype)initWithView:(WKContentView *)view;
@end
+@interface WKFormColorControl (WKTesting)
+- (void)selectColor:(UIColor *)color;
+@end
+
#endif // ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorControl.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -28,53 +28,92 @@
#if ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
+#import "FocusedElementInformation.h"
#import "UIKitSPI.h"
#import "UserInterfaceIdiom.h"
-#import "WKContentView.h"
-#import "WKFormColorPicker.h"
-#import "WKFormPopover.h"
+#import "WKContentViewInteraction.h"
+#import "WebPageProxy.h"
+#import <WebCore/Color.h>
-#pragma mark - WKColorPopover
+#pragma mark - WKColorPicker
-static const CGFloat colorPopoverWidth = 290;
-static const CGFloat colorPopoverCornerRadius = 9;
-
-@interface WKColorPopover : WKFormRotatingAccessoryPopover<WKFormControl> {
- RetainPtr<NSObject<WKFormControl>> _innerControl;
-}
-
+@interface WKColorPicker : NSObject<WKFormControl, UIColorPickerViewControllerDelegate, UIPopoverPresentationControllerDelegate>
- (instancetype)initWithView:(WKContentView *)view;
+- (void)selectColor:(UIColor *)color;
@end
-@implementation WKColorPopover
+@implementation WKColorPicker {
+ __weak WKContentView *_view;
+ RetainPtr<UIColorPickerViewController> _colorPickerViewController;
+}
+
- (instancetype)initWithView:(WKContentView *)view
{
- if (!(self = [super initWithView:view]))
+ if (!(self = [super init]))
return nil;
- _innerControl = adoptNS([[WKColorPicker alloc] initWithView:view inPopover:self]);
+ _view = view;
- RetainPtr<UIViewController> popoverViewController = adoptNS([[UIViewController alloc] init]);
- RetainPtr<UIView> controlContainerView = adoptNS([[UIView alloc] initWithFrame:CGRectMake(0, 0, colorPopoverWidth, colorPopoverWidth)]);
+ _colorPickerViewController = adoptNS([[UIColorPickerViewController alloc] init]);
+ [_colorPickerViewController setDelegate:self];
+ [_colorPickerViewController setSupportsAlpha:NO];
- UIView *controlView = [_innerControl controlView];
- [controlView setCenter:[controlContainerView center]];
- [controlView.layer setCornerRadius:colorPopoverCornerRadius];
- [controlView setClipsToBounds:YES];
- [controlContainerView addSubview:controlView];
+ return self;
+}
- [popoverViewController setView:controlContainerView.get()];
- [popoverViewController setPreferredContentSize:[controlContainerView size]];
+- (void)selectColor:(UIColor *)color
+{
+ [_colorPickerViewController setSelectedColor:color];
+ [self colorPickerViewControllerDidSelectColor:_colorPickerViewController.get()];
+}
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- RetainPtr<UIPopoverController> controller = adoptNS([[UIPopoverController alloc] initWithContentViewController:popoverViewController.get()]);
- ALLOW_DEPRECATED_DECLARATIONS_END
- [self setPopoverController:controller.get()];
+#if ENABLE(DATALIST_ELEMENT)
+- (NSArray<UIColor *> *)focusedElementSuggestedColors
+{
+ size_t numColorSuggestions = _view.focusedElementInformation.suggestedColors.size();
+ if (!numColorSuggestions)
+ return nil;
- return self;
+ NSMutableArray<UIColor *> *colors = [NSMutableArray array];
+ for (const WebCore::Color& color : _view.focusedElementInformation.suggestedColors)
+ [colors addObject:[UIColor colorWithCGColor:cachedCGColor(color)]];
+
+ return colors;
}
+#endif
+- (void)updateColorPickerState
+{
+ [_colorPickerViewController setSelectedColor:[UIColor colorWithCGColor:cachedCGColor(_view.focusedElementInformation.colorValue)]];
+#if ENABLE(DATALIST_ELEMENT)
+ if ([_colorPickerViewController respondsToSelector:@selector(_setSuggestedColors:)])
+ [_colorPickerViewController _setSuggestedColors:[self focusedElementSuggestedColors]];
+#endif
+}
+
+- (void)configurePresentation
+{
+ if (WebKit::currentUserInterfaceIdiomIsPadOrMac()) {
+ [_colorPickerViewController setModalPresentationStyle:UIModalPresentationPopover];
+ UIPopoverPresentationController *presentationController = [_colorPickerViewController popoverPresentationController];
+ presentationController.delegate = self;
+ presentationController.sourceView = _view;
+ presentationController.sourceRect = CGRectIntegral(_view.focusedElementInformation.interactionRect);
+ } else {
+ UIPresentationController *presentationController = [_colorPickerViewController presentationController];
+ presentationController.delegate = self;
+ if ([presentationController isKindOfClass:[_UISheetPresentationController class]]) {
+ _UISheetPresentationController *sheetPresentationController = (_UISheetPresentationController *)presentationController;
+ sheetPresentationController._detents = @[_UISheetDetent._mediumDetent, _UISheetDetent._largeDetent];
+ sheetPresentationController._widthFollowsPreferredContentSizeWhenBottomAttached = YES;
+ sheetPresentationController._wantsBottomAttachedInCompactHeight = YES;
+ }
+ }
+}
+
+#pragma mark WKFormControl
+
- (UIView *)controlView
{
return nil;
@@ -82,14 +121,40 @@
- (void)controlBeginEditing
{
- [self presentPopoverAnimated:NO];
+ [_view startRelinquishingFirstResponderToFocusedElement];
+
+ [self updateColorPickerState];
+ [self configurePresentation];
+
+ UIViewController *presentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:_view];
+ [presentingViewController presentViewController:_colorPickerViewController.get() animated:YES completion:nil];
}
- (void)controlEndEditing
{
- [self dismissPopoverAnimated:NO];
+ [_view stopRelinquishingFirstResponderToFocusedElement];
+ [_colorPickerViewController dismissViewControllerAnimated:NO completion:nil];
}
+#pragma mark UIPopoverPresentationControllerDelegate
+
+- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController
+{
+ [_view accessoryDone];
+}
+
+#pragma mark UIColorPickerViewControllerDelegate
+
+- (void)colorPickerViewControllerDidSelectColor:(UIColorPickerViewController *)viewController
+{
+ [_view updateFocusedElementValueAsColor:viewController.selectedColor];
+}
+
+- (void)colorPickerViewControllerDidFinish:(UIColorPickerViewController *)viewController
+{
+ [_view accessoryDone];
+}
+
@end
#pragma mark - WKFormColorControl
@@ -98,14 +163,20 @@
- (instancetype)initWithView:(WKContentView *)view
{
- RetainPtr<NSObject <WKFormControl>> control;
- if (WebKit::currentUserInterfaceIdiomIsPadOrMac())
- control = adoptNS([[WKColorPopover alloc] initWithView:view]);
- else
- control = adoptNS([[WKColorPicker alloc] initWithView:view]);
+ RetainPtr<NSObject <WKFormControl>> control = adoptNS([[WKColorPicker alloc] initWithView:view]);
return [super initWithView:view control:WTFMove(control)];
}
@end
+@implementation WKFormColorControl (WKTesting)
+
+- (void)selectColor:(UIColor *)color
+{
+ if ([self.control isKindOfClass:WKColorPicker.class])
+ [(WKColorPicker *)self.control selectColor:color];
+}
+
+@end
+
#endif // ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
-
-#import "WKFormPeripheral.h"
-
-OBJC_CLASS UIColor;
-OBJC_CLASS WKColorButton;
-OBJC_CLASS WKColorMatrixView;
-OBJC_CLASS WKContentView;
-OBJC_CLASS WKColorPopover;
-
-@protocol WKColorMatrixViewDelegate
-- (void)colorMatrixView:(WKColorMatrixView *)matrixView didTapColorButton:(WKColorButton *)colorButton;
-- (void)colorMatrixViewDidLayoutSubviews:(WKColorMatrixView *)matrixView;
-@end
-
-@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)
Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WKFormColorPicker.h"
-
-#if ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
-
-#import "FocusedElementInformation.h"
-#import "UserInterfaceIdiom.h"
-#import "WKContentViewInteraction.h"
-#import "WKFormPopover.h"
-#import "WebPageProxy.h"
-
-#import <WebCore/Color.h>
-#import <WebCore/ColorSerialization.h>
-#import <wtf/SoftLinking.h>
-
-SOFT_LINK_PRIVATE_FRAMEWORK(PencilKit)
-SOFT_LINK_CLASS(PencilKit, PKColorMatrixView)
-
-static const CGFloat additionalKeyboardAffordance = 80;
-static const CGFloat colorSelectionIndicatorBorderWidth = 4;
-static const CGFloat colorSelectionIndicatorCornerRadius = 9;
-static const CGFloat pickerWidthForPopover = 280;
-static const CGFloat topColorMatrixPadding = 5;
-#if ENABLE(DATALIST_ELEMENT)
-static const size_t maxColorSuggestions = 12;
-#endif
-
-using namespace WebKit;
-
-#pragma mark - PKColorMatrixView
-
-@interface PKColorMatrixView
-+ (NSArray<NSArray<UIColor *> *> *)defaultColorMatrix;
-@end
-
-#pragma mark - WKColorButton
-
-@interface WKColorButton : UIButton
-@property (nonatomic, strong) UIColor *color;
-
-+ (instancetype)colorButtonWithColor:(UIColor *)color;
-@end
-
-@implementation WKColorButton
-
-+ (instancetype)colorButtonWithColor:(UIColor *)color
-{
- WKColorButton *colorButton = [WKColorButton buttonWithType:UIButtonTypeCustom];
- colorButton.color = color;
- colorButton.backgroundColor = color;
- return colorButton;
-}
-
-- (void)dealloc
-{
- [_color release];
- _color = nil;
-
- [super dealloc];
-}
-
-@end
-
-#pragma mark - WKColorMatrixView
-
-@interface WKColorMatrixView : UIView {
- RetainPtr<NSArray<NSArray<UIColor *> *>> _colorMatrix;
- RetainPtr<NSArray<NSArray<WKColorButton *> *>> _colorButtons;
-}
-
-@property (nonatomic, weak) id<WKColorMatrixViewDelegate> delegate;
-
-- (instancetype)initWithFrame:(CGRect)frame colorMatrix:(NSArray<NSArray<UIColor *> *> *)matrix;
-@end
-
-@implementation WKColorMatrixView
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
- return [self initWithFrame:frame colorMatrix:[getPKColorMatrixViewClass() defaultColorMatrix]];
-}
-
-- (instancetype)initWithFrame:(CGRect)frame colorMatrix:(NSArray<NSArray<UIColor *> *> *)matrix
-{
- if (!(self = [super initWithFrame:frame]))
- return nil;
-
- _colorMatrix = matrix;
-
- NSMutableArray *colorButtons = [NSMutableArray array];
- for (NSUInteger row = 0; row < [_colorMatrix count]; row++) {
- NSMutableArray *buttons = [NSMutableArray array];
- for (NSUInteger col = 0; col < [_colorMatrix.get()[0] count]; col++) {
- WKColorButton *button = [WKColorButton colorButtonWithColor:_colorMatrix.get()[row][col]];
- [button addTarget:self action:@selector(colorButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
- [buttons addObject:button];
- [self addSubview:button];
- }
- [colorButtons addObject:buttons];
- }
- _colorButtons = colorButtons;
-
- return self;
-}
-
-- (void)layoutSubviews
-{
- [super layoutSubviews];
-
- CGSize matrixSize = self.bounds.size;
- CGFloat numRows = [_colorMatrix count];
- CGFloat numCols = [_colorMatrix.get()[0] count];
- CGFloat buttonHeight = matrixSize.height / numRows;
- CGFloat buttonWidth = matrixSize.width / numCols;
-
- for (NSUInteger row = 0; row < numRows; row++) {
- for (NSUInteger col = 0; col < numCols; col++) {
- WKColorButton *button = _colorButtons.get()[row][col];
- button.frame = CGRectMake(col * buttonWidth, row * buttonHeight, buttonWidth, buttonHeight);
- }
- }
-
- [self.delegate colorMatrixViewDidLayoutSubviews:self];
-}
-
-- (void)colorButtonTapped:(WKColorButton *)colorButton
-{
- [self.delegate colorMatrixView:self didTapColorButton:colorButton];
-}
-
-@end
-
-#pragma mark - WKFormColorPicker
-
-@implementation WKColorPicker {
- WKContentView *_view;
- __weak WKColorPopover *_popover;
- RetainPtr<UIView> _colorPicker;
-
- RetainPtr<UIView> _colorSelectionIndicator;
- RetainPtr<CAShapeLayer> _colorSelectionIndicatorBorder;
-
- RetainPtr<WKColorMatrixView> _topColorMatrix;
- RetainPtr<WKColorMatrixView> _mainColorMatrix;
- WeakObjCPtr<WKColorButton> _selectedColorButton;
-
- RetainPtr<UIPanGestureRecognizer> _colorPanGR;
-}
-
-+ (NSArray<NSArray<UIColor *> *> *)defaultTopColorMatrix
-{
- return @[ @[ UIColor.redColor, UIColor.orangeColor, UIColor.yellowColor, UIColor.greenColor, UIColor.cyanColor, UIColor.blueColor, UIColor.magentaColor, UIColor.purpleColor, UIColor.brownColor, UIColor.whiteColor, UIColor.grayColor, UIColor.blackColor ] ];
-}
-
-- (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 (currentUserInterfaceIdiomIsPadOrMac())
- colorPickerSize = CGSizeMake(pickerWidthForPopover, pickerWidthForPopover);
- else {
- auto keyboardSize = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
- colorPickerSize = CGSizeMake(keyboardSize.width, keyboardSize.height + additionalKeyboardAffordance);
- }
-
- _colorPicker = adoptNS([[UIView alloc] initWithFrame:CGRectMake(0, 0, colorPickerSize.width, colorPickerSize.height)]);
-
- CGFloat totalRows = [[getPKColorMatrixViewClass() defaultColorMatrix] count] + 1;
- CGFloat swatchHeight = (colorPickerSize.height - topColorMatrixPadding) / totalRows;
-
- _mainColorMatrix = adoptNS([[WKColorMatrixView alloc] initWithFrame:CGRectMake(0, swatchHeight + topColorMatrixPadding, colorPickerSize.width, swatchHeight * (totalRows - 1))]);
- [_mainColorMatrix setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
- [_mainColorMatrix setDelegate:self];
- [_colorPicker addSubview:_mainColorMatrix.get()];
-
- NSArray<NSArray<UIColor *> *> *topColorMatrix = [[self class] defaultTopColorMatrix];
-
-#if ENABLE(DATALIST_ELEMENT)
- size_t numColorSuggestions = view.focusedElementInformation.suggestedColors.size();
- if (numColorSuggestions) {
- NSMutableArray<UIColor *> *colors = [NSMutableArray array];
- for (size_t i = 0; i < std::min(numColorSuggestions, maxColorSuggestions); i++) {
- WebCore::Color color = view.focusedElementInformation.suggestedColors[i];
- [colors addObject:[UIColor colorWithCGColor:cachedCGColor(color)]];
- }
- topColorMatrix = @[ colors ];
- }
-#endif
-
- _topColorMatrix = adoptNS([[WKColorMatrixView alloc] initWithFrame:CGRectMake(0, 0, colorPickerSize.width, swatchHeight) colorMatrix:topColorMatrix]);
- [_topColorMatrix setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
- [_topColorMatrix setDelegate:self];
- [_colorPicker addSubview:_topColorMatrix.get()];
-
- _colorSelectionIndicator = adoptNS([[UIView alloc] initWithFrame:CGRectZero]);
- [_colorSelectionIndicator setClipsToBounds:YES];
- [_colorPicker addSubview:_colorSelectionIndicator.get()];
-
- _colorSelectionIndicatorBorder = adoptNS([[CAShapeLayer alloc] init]);
- [_colorSelectionIndicatorBorder setLineWidth:colorSelectionIndicatorBorderWidth];
- [_colorSelectionIndicatorBorder setStrokeColor:[UIColor whiteColor].CGColor];
- [_colorSelectionIndicatorBorder setFillColor:[UIColor clearColor].CGColor];
- [[_colorSelectionIndicator layer] addSublayer:_colorSelectionIndicatorBorder.get()];
-
- _colorPanGR = adoptNS([[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPanColors:)]);
- [_colorPicker addGestureRecognizer:_colorPanGR.get()];
-
- return self;
-}
-
-- (void)drawSelectionIndicatorForColorButton:(WKColorButton *)colorButton
-{
- _selectedColorButton = colorButton;
-
- CGRect frame = [_colorPicker convertRect:colorButton.bounds fromView:colorButton];
- [_colorSelectionIndicator setFrame:frame];
-
- UIRectCorner roundCorner = 0;
- if (currentUserInterfaceIdiomIsPadOrMac()) {
- CGRect colorPickerBounds = [_colorPicker bounds];
-
- bool minXEqual = std::abs(CGRectGetMinX(frame) - CGRectGetMinX(colorPickerBounds)) < FLT_EPSILON;
- bool minYEqual = std::abs(CGRectGetMinY(frame) - CGRectGetMinY(colorPickerBounds)) < FLT_EPSILON;
- bool maxXEqual = std::abs(CGRectGetMaxX(frame) - CGRectGetMaxX(colorPickerBounds)) < FLT_EPSILON;
- bool maxYEqual = std::abs(CGRectGetMaxY(frame) - CGRectGetMaxY(colorPickerBounds)) < FLT_EPSILON;
-
- // On iPad, round the corners of the indicator that border the corners of the picker, to match the popover.
- if (minXEqual && minYEqual)
- roundCorner |= UIRectCornerTopLeft;
- if (maxXEqual && minYEqual)
- roundCorner |= UIRectCornerTopRight;
- if (minXEqual && maxYEqual)
- roundCorner |= UIRectCornerBottomLeft;
- if (maxXEqual && maxYEqual)
- roundCorner |= UIRectCornerBottomRight;
- }
-
- UIBezierPath *cornerMaskPath = [UIBezierPath bezierPathWithRoundedRect:colorButton.bounds byRoundingCorners:roundCorner cornerRadii:CGSizeMake(colorSelectionIndicatorCornerRadius, colorSelectionIndicatorCornerRadius)];
- [_colorSelectionIndicatorBorder setFrame:colorButton.bounds];
- [_colorSelectionIndicatorBorder setPath:cornerMaskPath.CGPath];
-}
-
-- (void)setControlValueFromUIColor:(UIColor *)uiColor
-{
- WebCore::Color color(uiColor.CGColor);
- [_view page]->setFocusedElementValue(WebCore::serializationForHTML(color));
-}
-
-#pragma mark WKFormControl
-
-- (UIView *)controlView
-{
- return _colorPicker.get();
-}
-
-- (void)controlBeginEditing
-{
-}
-
-- (void)controlEndEditing
-{
-}
-
-#pragma mark WKColorMatrixViewDelegate
-
-- (void)colorMatrixViewDidLayoutSubviews:(WKColorMatrixView *)matrixView
-{
- if ([_selectedColorButton superview] == matrixView)
- [self drawSelectionIndicatorForColorButton:_selectedColorButton.get().get()];
-}
-
-- (void)colorMatrixView:(WKColorMatrixView *)matrixView didTapColorButton:(WKColorButton *)colorButton
-{
- if (_selectedColorButton.get().get() == colorButton)
- return;
-
- [self drawSelectionIndicatorForColorButton:colorButton];
- [self setControlValueFromUIColor:colorButton.color];
-#if PLATFORM(MACCATALYST)
- [_popover dismissPopoverAnimated:NO];
- [_view accessoryDone];
-#endif
-}
-
-#pragma mark UIPanGestureRecognizer
-
-- (void)didPanColors:(UIGestureRecognizer *)gestureRecognizer
-{
- CGPoint location = [gestureRecognizer locationInView:gestureRecognizer.view];
- UIView *view = [gestureRecognizer.view hitTest:location withEvent:nil];
- if ([view isKindOfClass:[WKColorButton class]]) {
- WKColorButton *colorButton = (WKColorButton *)view;
- if (_selectedColorButton.get().get() == colorButton)
- return;
-
- [self drawSelectionIndicatorForColorButton:colorButton];
- [self setControlValueFromUIColor:colorButton.color];
- }
-}
-
-@end
-
-#endif // ENABLE(INPUT_TYPE_COLOR) && PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.h (272596 => 272597)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -28,6 +28,10 @@
#import "WKFormPeripheral.h"
#import <UIKit/UIPickerView.h>
+#if USE(UICONTEXTMENU)
+#import <UIKit/UIContextMenuInteraction.h>
+#endif
+
@class WKContentView;
@interface WKSelectSinglePicker : UIPickerView <WKFormControl, UIPickerViewDataSource, UIPickerViewDelegate>
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (272596 => 272597)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1961,7 +1961,6 @@
E4E57F6B21A83B1200345F3C /* RemoteLayerTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E57F6A21A83B1100345F3C /* RemoteLayerTreeNode.h */; };
E50620922542102000C43091 /* ContactsUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E50620912542102000C43091 /* ContactsUISPI.h */; };
E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; };
- E548EBD121015F0E00BE3C32 /* WKFormColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */; };
E55CD1F524CF747D0042DB9C /* WebDateTimeChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */; };
E55CD20024D08D8F0042DB9C /* WebDateTimePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1FC24D0880B0042DB9C /* WebDateTimePicker.h */; };
E55CD20324D09F1F0042DB9C /* WebDateTimePickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */; };
@@ -5773,8 +5772,6 @@
E50620912542102000C43091 /* ContactsUISPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContactsUISPI.h; sourceTree = "<group>"; };
E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionPicker.h; sourceTree = "<group>"; };
E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionPicker.cpp; sourceTree = "<group>"; };
- E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFormColorPicker.h; path = ios/forms/WKFormColorPicker.h; sourceTree = "<group>"; };
- E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormColorPicker.mm; path = ios/forms/WKFormColorPicker.mm; sourceTree = "<group>"; };
E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionsDropdown.cpp; sourceTree = "<group>"; };
E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimeChooser.h; sourceTree = "<group>"; };
E55CD1F424CF747D0042DB9C /* WebDateTimeChooser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDateTimeChooser.cpp; sourceTree = "<group>"; };
@@ -11059,8 +11056,6 @@
2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */,
E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */,
E5CB07DB20E1678F0022C183 /* WKFormColorControl.mm */,
- E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */,
- E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */,
C54256B118BEC18B00DE4179 /* WKFormPeripheral.h */,
CE70EE5C22442BD000E0AF0F /* WKFormPeripheralBase.h */,
CE70EE5A22442BB300E0AF0F /* WKFormPeripheralBase.mm */,
@@ -12425,7 +12420,6 @@
51489CC7237237800044E68A /* WKFindResultInternal.h in Headers */,
2E16B6CF2017B7AD008996D6 /* WKFocusedFormControlView.h in Headers */,
E5CB07DC20E1678F0022C183 /* WKFormColorControl.h in Headers */,
- E548EBD121015F0E00BE3C32 /* WKFormColorPicker.h in Headers */,
C54256B718BEC18C00DE4179 /* WKFormPeripheral.h in Headers */,
CE70EE5D22442BD000E0AF0F /* WKFormPeripheralBase.h in Headers */,
C54256B818BEC18C00DE4179 /* WKFormPopover.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (272596 => 272597)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -3196,6 +3196,7 @@
#if ENABLE(INPUT_TYPE_COLOR)
else if (element.isColorControl()) {
information.elementType = InputType::Color;
+ information.colorValue = element.valueAsColor();
#if ENABLE(DATALIST_ELEMENT)
information.suggestedColors = element.suggestedColors();
#endif
Modified: trunk/Tools/ChangeLog (272596 => 272597)
--- trunk/Tools/ChangeLog 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Tools/ChangeLog 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1,3 +1,21 @@
+2021-02-09 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Use UIColorPickerViewController for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=221572
+ <rdar://problem/72183130>
+
+ Reviewed by Sam Weinig.
+
+ Added UIScriptController hooks to simulate selecting a color on the
+ new color picker.
+
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ (WTR::UIScriptController::setSelectedColorForColorPicker):
+ * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptControllerIOS::setSelectedColorForColorPicker):
+
2021-02-09 Jonathan Bedard <[email protected]>
[webkitscmpy] Correctly parse branch commits
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (272596 => 272597)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2021-02-09 19:25:04 UTC (rev 272597)
@@ -235,6 +235,9 @@
readonly attribute boolean isShowingDataListSuggestions;
undefined activateDataListSuggestion(unsigned long index, object callback);
+ // <input type=color>
+ undefined setSelectedColorForColorPicker(double red, double green, double blue);
+
undefined keyboardAccessoryBarNext();
undefined keyboardAccessoryBarPrevious();
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (272596 => 272597)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -229,6 +229,7 @@
virtual void setDefaultCalendarType(JSStringRef, JSStringRef) { notImplemented(); }
virtual JSObjectRef inputViewBounds() const { notImplemented(); return nullptr; }
virtual void activateDataListSuggestion(unsigned, JSValueRef) { notImplemented(); }
+ virtual void setSelectedColorForColorPicker(double, double, double) { notImplemented(); }
// Find in Page
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h (272596 => 272597)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h 2021-02-09 19:25:04 UTC (rev 272597)
@@ -129,6 +129,7 @@
void completeBackSwipe(JSValueRef) override;
bool isShowingDataListSuggestions() const override;
void activateDataListSuggestion(unsigned, JSValueRef) override;
+ void setSelectedColorForColorPicker(double, double, double) override;
void setKeyboardInputModeIdentifier(JSStringRef) override;
void toggleCapsLock(JSValueRef) override;
bool keyboardIsAutomaticallyShifted() const override;
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (272596 => 272597)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2021-02-09 18:50:28 UTC (rev 272596)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2021-02-09 19:25:04 UTC (rev 272597)
@@ -1143,6 +1143,12 @@
return foundDataListSuggestionsPickerView;
}
+void UIScriptControllerIOS::setSelectedColorForColorPicker(double red, double green, double blue)
+{
+ UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];
+ [webView() setSelectedColorForColorPicker:color];
+}
+
void UIScriptControllerIOS::setKeyboardInputModeIdentifier(JSStringRef identifier)
{
TestController::singleton().setKeyboardInputModeIdentifier(toWTFString(identifier));