Changeset 234105 in webkit
- Timestamp:
- Jul 23, 2018 12:13:08 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r234098 r234105 1 2018-07-23 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Add support for input[type=color] 4 https://bugs.webkit.org/show_bug.cgi?id=187871 5 6 Reviewed by Tim Horton. 7 8 * css/html.css: Remove unwanted styling for color inputs with a list attribute. 9 * html/ColorInputType.cpp: Make the element focusable. 10 (WebCore::ColorInputType::isMouseFocusable const): 11 (WebCore::ColorInputType::isKeyboardFocusable const): 12 * html/ColorInputType.h: 13 * html/HTMLInputElement.h: Expose isColorControl() to WebKit. 14 * page/Chrome.cpp: 15 (WebCore::Chrome::createColorChooser): 16 1 17 2018-07-22 Dean Jackson <dino@apple.com> 2 18 -
trunk/Source/WebCore/css/html.css
r232806 r234105 864 864 865 865 input[type="color"] { 866 #if !(defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS) 866 867 -webkit-appearance: square-button; 868 #endif 867 869 width: 44px; 868 870 height: 23px; … … 881 883 border: 1px solid #777777; 882 884 flex: 1; 883 }884 885 #if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT886 887 input[type="color"][list] {888 -webkit-appearance: menulist;889 width: 88px;890 height: 23px;891 }892 893 input[type="color"][list]::-webkit-color-swatch-wrapper {894 padding-left: 8px;895 padding-right: 24px;896 }897 898 input[type="color"][list]::-webkit-color-swatch {899 border-color: #000000;900 885 } 901 886 -
trunk/Source/WebCore/html/ColorInputType.cpp
r233122 r234105 82 82 } 83 83 84 bool ColorInputType::isMouseFocusable() const 85 { 86 ASSERT(element()); 87 return element()->isTextFormControlFocusable(); 88 } 89 90 bool ColorInputType::isKeyboardFocusable(KeyboardEvent*) const 91 { 92 ASSERT(element()); 93 #if PLATFORM(IOS) 94 if (element()->isReadOnly()) 95 return false; 96 97 return element()->isTextFormControlFocusable(); 98 #endif 99 return false; 100 } 101 84 102 bool ColorInputType::isColorControl() const 85 103 { -
trunk/Source/WebCore/html/ColorInputType.h
r225680 r234105 52 52 bool shouldShowSuggestions() const final; 53 53 Vector<Color> suggestions() const final; 54 bool isMouseFocusable() const final; 55 bool isKeyboardFocusable(KeyboardEvent*) const final; 54 56 bool isColorControl() const final; 55 57 const AtomicString& formControlType() const final; -
trunk/Source/WebCore/html/HTMLInputElement.h
r233578 r234105 108 108 109 109 #if ENABLE(INPUT_TYPE_COLOR) 110 bool isColorControl() const;110 WEBCORE_EXPORT bool isColorControl() const; 111 111 #endif 112 112 -
trunk/Source/WebCore/page/Chrome.cpp
r234074 r234105 425 425 std::unique_ptr<ColorChooser> Chrome::createColorChooser(ColorChooserClient& client, const Color& initialColor) 426 426 { 427 #if PLATFORM(IOS) 428 return nullptr; 429 #endif 427 430 notifyPopupOpeningObservers(); 428 431 return m_client.createColorChooser(client, initialColor); -
trunk/Source/WebKit/ChangeLog
r234103 r234105 1 2018-07-23 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS] Add support for input[type=color] 4 https://bugs.webkit.org/show_bug.cgi?id=187871 5 6 Reviewed by Tim Horton. 7 8 Created WKFormColorControl to display a color picker once a color input gains 9 focus. The control is presented as an inputView on iPhone and as a popover on 10 iPad. The picker itself consists of two color matrices. The first is a set of 12 11 default colors, displayed on the top row of the picker. In a subsequent patch, 12 this top row will be made customizable through the use of the datalist element. 13 The second matrix is a grid of 120 colors, provided by the system. Colors can be 14 selected from either matrix by tapping or with a pan gesture. 15 16 WKColorMatrixView represents a single color matrix and is comprised of 17 WKColorButtons that represent each color in the matrix. 18 19 * Shared/AssistedNodeInformation.h: 20 * UIProcess/API/Cocoa/_WKFocusedElementInfo.h: 21 * UIProcess/ios/PageClientImplIOS.h: 22 * UIProcess/ios/PageClientImplIOS.mm: 23 (WebKit::PageClientImpl::createColorPicker): 24 * UIProcess/ios/WKContentViewInteraction.mm: 25 (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]): 26 (-[WKContentView _requiresKeyboardWhenFirstResponder]): 27 (-[WKContentView inputView]): 28 (-[WKContentView requiresAccessoryView]): 29 (isAssistableInputType): 30 (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): 31 (-[WKContentView actionNameForFocusedFormControlView:]): 32 * UIProcess/ios/forms/WKFormColorControl.h: Added. 33 * UIProcess/ios/forms/WKFormColorControl.mm: Added. 34 (-[WKColorPopover initWithView:]): 35 (-[WKColorPopover controlView]): 36 (-[WKColorPopover controlBeginEditing]): 37 (-[WKColorPopover controlEndEditing]): 38 (-[WKFormColorControl initWithView:]): 39 (-[WKFormColorControl assistantView]): 40 (-[WKFormColorControl beginEditing]): 41 (-[WKFormColorControl endEditing]): 42 * UIProcess/ios/forms/WKFormColorPicker.h: Added. 43 * UIProcess/ios/forms/WKFormColorPicker.mm: Added. 44 (+[WKColorButton colorButtonWithColor:]): 45 (-[WKColorMatrixView initWithFrame:]): 46 (-[WKColorMatrixView initWithFrame:colorMatrix:]): 47 (-[WKColorMatrixView layoutSubviews]): 48 (-[WKColorMatrixView colorButtonTapped:]): 49 (+[WKColorPicker defaultTopColorMatrix]): 50 (-[WKColorPicker initWithView:]): 51 (-[WKColorPicker setControlValueFromUIColor:]): 52 (-[WKColorPicker controlView]): 53 (-[WKColorPicker controlBeginEditing]): 54 (-[WKColorPicker controlEndEditing]): 55 (-[WKColorPicker colorMatrixView:didTapColorButton:]): 56 (-[WKColorPicker didPanColors:]): 57 * WebKit.xcodeproj/project.pbxproj: 58 * WebProcess/WebPage/ios/WebPageIOS.mm: 59 (WebKit::isAssistableElement): 60 (WebKit::WebPage::getAssistedNodeInformation): 61 1 62 2018-07-23 Stephan Szabo <stephan.szabo@sony.com> 2 63 -
trunk/Source/WebKit/Shared/AssistedNodeInformation.h
r232968 r234105 53 53 Week, 54 54 Time, 55 Select 55 Select, 56 #if ENABLE(INPUT_TYPE_COLOR) 57 Color 58 #endif 56 59 }; 57 60 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKFocusedElementInfo.h
r230121 r234105 53 53 WKInputTypeWeek, 54 54 WKInputTypeTime, 55 WKInputTypeSelect 55 WKInputTypeSelect, 56 WKInputTypeColor 56 57 }; 57 58 -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h
r233866 r234105 101 101 Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final; 102 102 103 #if ENABLE(INPUT_TYPE_COLOR) 104 RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) final; 105 #endif 106 103 107 #if ENABLE(DATALIST_ELEMENT) 104 108 RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) final; -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r233866 r234105 765 765 } 766 766 767 #if ENABLE(INPUT_TYPE_COLOR) 768 RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) 769 { 770 return nullptr; 771 } 772 #endif 773 767 774 #if ENABLE(DATALIST_ELEMENT) 768 775 RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page) -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r234067 r234105 112 112 #endif 113 113 114 #if ENABLE(INPUT_TYPE_COLOR) 115 #import "WKFormColorControl.h" 116 #endif 117 114 118 @interface UIEvent(UIEventInternal) 115 119 @property (nonatomic, assign) UIKeyboardInputFlags _inputFlags; … … 478 482 _type = WKInputTypeSelect; 479 483 break; 484 #if ENABLE(INPUT_TYPE_COLOR) 485 case WebKit::InputType::Color: 486 _type = WKInputTypeColor; 487 break; 488 #endif 480 489 case WebKit::InputType::None: 481 490 _type = WKInputTypeNone; … … 1257 1266 return NO; 1258 1267 case InputType::Select: 1268 #if ENABLE(INPUT_TYPE_COLOR) 1269 case InputType::Color: 1270 #endif 1259 1271 return !currentUserInterfaceIdiomIsPad(); 1260 1272 case InputType::Date: … … 1297 1309 return nil; 1298 1310 1299 if (!_inputPeripheral) 1300 _inputPeripheral = adoptNS(_assistedNodeInformation.elementType == InputType::Select ? [[WKFormSelectControl alloc] initWithView:self] : [[WKFormInputControl alloc] initWithView:self]); 1301 else 1311 if (!_inputPeripheral) { 1312 switch (_assistedNodeInformation.elementType) { 1313 case InputType::Select: 1314 _inputPeripheral = adoptNS([[WKFormSelectControl alloc] initWithView:self]); 1315 break; 1316 #if ENABLE(INPUT_TYPE_COLOR) 1317 case InputType::Color: 1318 _inputPeripheral = adoptNS([[WKFormColorControl alloc] initWithView:self]); 1319 break; 1320 #endif 1321 default: 1322 _inputPeripheral = adoptNS([[WKFormInputControl alloc] initWithView:self]); 1323 break; 1324 } 1325 } else 1302 1326 [self _displayFormNodeInputView]; 1303 1327 … … 2035 2059 case InputType::Week: 2036 2060 case InputType::Time: 2061 #if ENABLE(INPUT_TYPE_COLOR) 2062 case InputType::Color: 2063 #endif 2037 2064 return !currentUserInterfaceIdiomIsPad(); 2038 2065 } … … 4036 4063 case InputType::Time: 4037 4064 case InputType::Select: 4065 #if ENABLE(INPUT_TYPE_COLOR) 4066 case InputType::Color: 4067 #endif 4038 4068 return true; 4039 4069 … … 4141 4171 case InputType::Month: 4142 4172 case InputType::Date: 4173 #if ENABLE(INPUT_TYPE_COLOR) 4174 case InputType::Color: 4175 #endif 4143 4176 break; 4144 4177 default: … … 4397 4430 case InputType::Time: 4398 4431 case InputType::Date: 4432 #if ENABLE(INPUT_TYPE_COLOR) 4433 case InputType::Color: 4434 #endif 4399 4435 return nil; 4400 4436 case InputType::Search: -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r234009 r234105 2184 2184 E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; }; 2185 2185 E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */; }; 2186 E548EBD121015F0E00BE3C32 /* WKFormColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */; }; 2187 E548EBD221015F0E00BE3C32 /* WKFormColorPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */; }; 2186 2188 E54A14CF20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */; }; 2187 2189 E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */; }; 2188 2190 E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */; }; 2189 2191 E568B92320A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */; }; 2192 E5CB07DC20E1678F0022C183 /* WKFormColorControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */; }; 2193 E5CB07DD20E1678F0022C183 /* WKFormColorControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5CB07DB20E1678F0022C183 /* WKFormColorControl.mm */; }; 2190 2194 ECA680D81E690E2500731D20 /* WebProcessCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = ECA680D71E690DF800731D20 /* WebProcessCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2191 2195 ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 4825 4829 E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionPicker.h; sourceTree = "<group>"; }; 4826 4830 E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionPicker.cpp; sourceTree = "<group>"; }; 4831 E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFormColorPicker.h; path = ios/forms/WKFormColorPicker.h; sourceTree = "<group>"; }; 4832 E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormColorPicker.mm; path = ios/forms/WKFormColorPicker.mm; sourceTree = "<group>"; }; 4827 4833 E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionsDropdown.cpp; sourceTree = "<group>"; }; 4828 4834 E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdown.h; sourceTree = "<group>"; }; 4829 4835 E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdownMac.h; sourceTree = "<group>"; }; 4830 4836 E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = WebDataListSuggestionsDropdownMac.mm; sourceTree = "<group>"; }; 4837 E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFormColorControl.h; path = ios/forms/WKFormColorControl.h; sourceTree = "<group>"; }; 4838 E5CB07DB20E1678F0022C183 /* WKFormColorControl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormColorControl.mm; path = ios/forms/WKFormColorControl.mm; sourceTree = "<group>"; }; 4831 4839 ECA680D31E6904B500731D20 /* ExtraPrivateSymbolsForTAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtraPrivateSymbolsForTAPI.h; sourceTree = "<group>"; }; 4832 4840 ECA680D71E690DF800731D20 /* WebProcessCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebProcessCocoa.h; sourceTree = "<group>"; }; … … 8654 8662 2E16B6CD2017B7AC008996D6 /* WKFocusedFormControlView.h */, 8655 8663 2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */, 8664 E5CB07DA20E1678F0022C183 /* WKFormColorControl.h */, 8665 E5CB07DB20E1678F0022C183 /* WKFormColorControl.mm */, 8666 E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */, 8667 E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */, 8656 8668 C54256AF18BEC18B00DE4179 /* WKFormInputControl.h */, 8657 8669 C54256B018BEC18B00DE4179 /* WKFormInputControl.mm */, … … 9729 9741 37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */, 9730 9742 2E16B6CF2017B7AD008996D6 /* WKFocusedFormControlView.h in Headers */, 9743 E5CB07DC20E1678F0022C183 /* WKFormColorControl.h in Headers */, 9744 E548EBD121015F0E00BE3C32 /* WKFormColorPicker.h in Headers */, 9731 9745 C54256B518BEC18C00DE4179 /* WKFormInputControl.h in Headers */, 9732 9746 C54256B718BEC18C00DE4179 /* WKFormPeripheral.h in Headers */, … … 11538 11552 A58B6F0918FCA733008CBA53 /* WKFileUploadPanel.mm in Sources */, 11539 11553 2E16B6CE2017B7AD008996D6 /* WKFocusedFormControlView.mm in Sources */, 11554 E5CB07DD20E1678F0022C183 /* WKFormColorControl.mm in Sources */, 11555 E548EBD221015F0E00BE3C32 /* WKFormColorPicker.mm in Sources */, 11540 11556 C54256B618BEC18C00DE4179 /* WKFormInputControl.mm in Sources */, 11541 11557 C54256B918BEC18C00DE4179 /* WKFormPopover.mm in Sources */, -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r234023 r234105 2019 2019 HTMLInputElement& inputElement = downcast<HTMLInputElement>(node); 2020 2020 // FIXME: This laundry list of types is not a good way to factor this. Need a suitable function on HTMLInputElement itself. 2021 #if ENABLE(INPUT_TYPE_COLOR) 2022 if (inputElement.isColorControl()) 2023 return true; 2024 #endif 2021 2025 return inputElement.isTextField() || inputElement.isDateField() || inputElement.isDateTimeLocalField() || inputElement.isMonthField() || inputElement.isTimeField(); 2022 2026 } … … 2445 2449 } 2446 2450 } 2451 #if ENABLE(INPUT_TYPE_COLOR) 2452 else if (element.isColorControl()) 2453 information.elementType = InputType::Color; 2454 #endif 2447 2455 2448 2456 information.isReadOnly = element.isReadOnly();
Note: See TracChangeset
for help on using the changeset viewer.