[Datalist][iOS] Display suggestions for input[type=color]
authorakeerthi@apple.com <akeerthi@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Aug 2018 00:43:23 +0000 (00:43 +0000)
committerakeerthi@apple.com <akeerthi@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Aug 2018 00:43:23 +0000 (00:43 +0000)
commit30f0f034a703de2bc5bb06510b746f213fb48a43
treecc9a205c19c5cf2ff0fb20ec0daa485501f8a6d9
parentafb3452eac43c89fc4c346316ac5b0950be1cf17
[Datalist][iOS] Display suggestions for input[type=color]
https://bugs.webkit.org/show_bug.cgi?id=188669

Reviewed by Tim Horton.

Source/WebCore:

Expose suggestedColors() in HTMLInputElement in order to allow the UIProcess to
access the list of suggested colors from a <datalist> element.

* html/ColorInputType.cpp:
(WebCore::ColorInputType::suggestedColors const):
* html/ColorInputType.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::suggestedColors const):
* html/HTMLInputElement.h:
* html/InputType.cpp:
(WebCore::InputType::suggestedColors const):
* html/InputType.h:
* platform/ColorChooserClient.h:

Source/WebKit:

An input[type=color] element that has an associated datalist element should
display the color values provided on iOS. Similar to macOS, we now support 1-12
suggested colors, that will be displayed at the top of the color picker.

Also ensured that we get rounded corners on both sides of a color swatch if it is
the only one in its row.

* Shared/AssistedNodeInformation.cpp: Added suggestedColors field.
(WebKit::AssistedNodeInformation::encode const):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* UIProcess/ios/forms/WKFormColorPicker.mm:
(+[WKColorPicker defaultTopColorMatrix]):
(-[WKColorPicker initWithView:]): Use the list of suggestedColors if it exists.
(-[WKColorPicker drawSelectionIndicatorForColorButton:]):
* WebProcess/WebCoreSupport/WebColorChooser.cpp:
(WebKit::WebColorChooser::WebColorChooser):
(WebKit::WebColorChooser::reattachColorChooser):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/ColorInputType.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/platform/ColorChooserClient.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/AssistedNodeInformation.cpp
Source/WebKit/Shared/AssistedNodeInformation.h
Source/WebKit/UIProcess/ios/forms/WKFormColorPicker.mm
Source/WebKit/WebProcess/WebCoreSupport/WebColorChooser.cpp
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm