WebKit Bugzilla
Attachment 342186 Details for
Bug 186151
: [Datalist] Allow TextFieldInputType to show and hide suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186151-20180607104029.patch (text/plain), 46.95 KB, created by
Aditya Keerthi
on 2018-06-07 10:40:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Aditya Keerthi
Created:
2018-06-07 10:40:30 PDT
Size:
46.95 KB
patch
obsolete
>Subversion Revision: 232512 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7da680db0ab07b54663a52d5fd589e24d7d1f117..625cfd9b0c004ecf60d78327c4f4b0c9c3ff8831 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,54 @@ >+2018-06-05 Aditya Keerthi <akeerthi@apple.com> >+ >+ [Datalist] Allow TextFieldInputType to show and hide suggestions >+ https://bugs.webkit.org/show_bug.cgi?id=186151 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ TextFieldInputTypes with a list attribute should be able to display suggestions as the user >+ interacts with the input field. In order to display suggestions for an input field with a list >+ attribute, we need provide certain information - including the items to suggest and the location >+ to present the suggestions. TextFieldInputType can now provide this information by conforming to >+ the DataListSuggestionsClient interface. >+ >+ In this initial patch, the suggestions can be shown in two ways. The first is by clicking on the >+ input field. The other is by typing text in the field. In a later patch, we will add a third way >+ to display suggestions, using a button. These ways to activate the suggestions are enumerated in >+ DataListSuggestionInformation. >+ >+ We hide the suggestions if there are no more to show, or if the input has blurred. >+ >+ Tests to be added once work has been done in the UIProcess. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * html/DataListSuggestionInformation.h: Added. Contains the information necessary to display suggestions. >+ * html/TextFieldInputType.cpp: >+ (WebCore::TextFieldInputType::~TextFieldInputType): >+ (WebCore::TextFieldInputType::handleClickEvent): Show suggestions when the element is clicked. >+ (WebCore::TextFieldInputType::handleKeydownEvent): Allow users to interact with the suggestions using the keyboard. >+ (WebCore::TextFieldInputType::elementDidBlur): Hide the suggestions. >+ (WebCore::TextFieldInputType::shouldRespectListAttribute): >+ (WebCore::TextFieldInputType::didSetValueByUserEdit): Update the suggestions if the text has changed. >+ (WebCore::TextFieldInputType::elementRectRelativeToRootView const): Provide the location where the suggestions should be shown. >+ (WebCore::TextFieldInputType::suggestions const): Provide the list of suggestions. >+ (WebCore::TextFieldInputType::didSelectDataListOption): Update the text once an suggestion has been selected. >+ (WebCore::TextFieldInputType::didCloseSuggestions): >+ (WebCore::TextFieldInputType::displaySuggestions): >+ (WebCore::TextFieldInputType::closeSuggestions): >+ * html/TextFieldInputType.h: >+ * loader/EmptyClients.cpp: >+ (WebCore::EmptyChromeClient::createDataListSuggestionPicker): >+ * loader/EmptyClients.h: >+ * page/Chrome.cpp: >+ (WebCore::Chrome::createDataListSuggestionPicker): >+ * page/Chrome.h: >+ * page/ChromeClient.h: >+ * platform/DataListSuggestionPicker.h: Added. >+ (WebCore::DataListSuggestionPicker::close): >+ (WebCore::DataListSuggestionPicker::handleKeydownWithIdentifier): >+ (WebCore::DataListSuggestionPicker::displayWithActivationType): >+ * platform/DataListSuggestionsClient.h: Added. >+ > 2018-06-05 Brent Fulgham <bfulgham@apple.com> > > Unreviewed build fix after r232511. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5c1e8c05b198ac7901020974bdcaf62c418f7bea..246cce358e4b9f6cf90a622d1f66a9ba476fda62 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,35 @@ >+2018-06-05 Aditya Keerthi <akeerthi@apple.com> >+ >+ [Datalist] Allow TextFieldInputType to show and hide suggestions >+ https://bugs.webkit.org/show_bug.cgi?id=186151 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added WebDataListSuggestionPicker to send messages to the UIProcess in order to update the suggestions view. >+ This object is also responsible for forwarding messages from WebKit into the DataListSuggestionsClient, which >+ is the TextFieldInputType in this case. The client needs to know when the suggestions are hidden or if an >+ suggestion has been selected. >+ >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::createDataListSuggestionPicker): Responsible for creating WebDataListSuggestionPicker to send/receive messages. >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp: Added. Responsible for sending messages to UIProcess and updating the DataListSuggestionsClient. >+ (WebKit::WebDataListSuggestionPicker::WebDataListSuggestionPicker): >+ (WebKit::WebDataListSuggestionPicker::~WebDataListSuggestionPicker): >+ (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier): >+ (WebKit::WebDataListSuggestionPicker::didSelectOption): >+ (WebKit::WebDataListSuggestionPicker::didCloseSuggestions): >+ (WebKit::WebDataListSuggestionPicker::close): >+ (WebKit::WebDataListSuggestionPicker::displayWithActivationType): >+ * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h: Added. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::setActiveDataListSuggestionPicker): >+ (WebKit::WebPage::didSelectDataListOption): Called by UIProcess when option selected. >+ (WebKit::WebPage::didCloseSuggestions): Called by UIProcess if the suggestions view is closed. >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2018-06-04 Chris Dumez <cdumez@apple.com> > > Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy" >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index b76f32f378872d2bad199b550a302ff9400c83eb..69296aa11b944afda20726f787aecea539030527 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,14 @@ >+2018-06-05 Aditya Keerthi <akeerthi@apple.com> >+ >+ [Datalist] Allow TextFieldInputType to show and hide suggestions >+ https://bugs.webkit.org/show_bug.cgi?id=186151 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebChromeClient.h: >+ * WebCoreSupport/WebChromeClient.mm: >+ (WebChromeClient::createDataListSuggestionPicker): >+ > 2018-06-03 Darin Adler <darin@apple.com> > > Simplify and remove some unused video element code (helpful for ARC-compatibility) >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 1673aa9a530ca3d2e91685fa1c4051a2ee5910db..cc3ce5b49bbc5239fcd690a82e8bfc6eebc00d8d 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -4770,6 +4770,9 @@ > E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */; }; > E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */; }; > E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E517670220B88C1400D41167 /* DataListSuggestionInformation.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; }; > EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */; }; > EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF5121B1696496C0056BD25 /* JSTypeConversions.h */; }; >@@ -14452,8 +14455,11 @@ > E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFunctions.h; sourceTree = "<group>"; }; > E4F9EEF0156D84C400D23E7E /* StyleSheetContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheetContents.cpp; sourceTree = "<group>"; }; > E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSheetContents.h; sourceTree = "<group>"; }; >+ E517670220B88C1400D41167 /* DataListSuggestionInformation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionInformation.h; sourceTree = "<group>"; }; > E51A81DE17298D7700BFCA61 /* JSPerformance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformance.cpp; sourceTree = "<group>"; }; > E526AF3E1727F8F200E41781 /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; }; >+ E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionsClient.h; sourceTree = "<group>"; }; >+ E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListSuggestionPicker.h; sourceTree = "<group>"; }; > E55F4979151B888000BB67DB /* LengthFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthFunctions.cpp; sourceTree = "<group>"; }; > E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthFunctions.h; sourceTree = "<group>"; }; > EB081CD81696084400553730 /* TypeConversions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeConversions.h; sourceTree = "<group>"; }; >@@ -20337,6 +20343,7 @@ > 93C441FF0F813AE100C1A634 /* CollectionType.h */, > BC29935C17A1DD5800BCE880 /* ColorInputType.cpp */, > F55B3D801251F12D003EF269 /* ColorInputType.h */, >+ E517670220B88C1400D41167 /* DataListSuggestionInformation.h */, > F55B3D811251F12D003EF269 /* DateInputType.cpp */, > F55B3D821251F12D003EF269 /* DateInputType.h */, > F55B3D831251F12D003EF269 /* DateTimeInputType.cpp */, >@@ -24350,6 +24357,8 @@ > 46C696C91E7205E400597937 /* CPUMonitor.h */, > E11AF15011B9A1A300805103 /* Cursor.cpp */, > F587868402DE3B8601EA4122 /* Cursor.h */, >+ E52CF54E20A35A2800DADA27 /* DataListSuggestionPicker.h */, >+ E52CF54C20A268AC00DADA27 /* DataListSuggestionsClient.h */, > A5732B08136A161D005C8D7C /* DateComponents.cpp */, > A5732B09136A161D005C8D7C /* DateComponents.h */, > 37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */, >@@ -27571,6 +27580,9 @@ > BE23480D18A9871400E4B6E8 /* DataCue.h in Headers */, > C5227DF11C3C6DF100F5ED54 /* DataDetection.h in Headers */, > 7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */, >+ E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */, >+ E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */, >+ E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */, > BC22746F0E83664500E7F975 /* DataRef.h in Headers */, > BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */, > 85031B3E0A44EFC700F992E0 /* DataTransfer.h in Headers */, >diff --git a/Source/WebCore/html/DataListSuggestionInformation.h b/Source/WebCore/html/DataListSuggestionInformation.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8c449ef9994c603cc4f5ec8a5ad993950a0559fe >--- /dev/null >+++ b/Source/WebCore/html/DataListSuggestionInformation.h >@@ -0,0 +1,46 @@ >+/* >+ * 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. >+ */ >+ >+#pragma once >+ >+#include "IntRect.h" >+ >+#if ENABLE(DATALIST_ELEMENT) >+namespace WebCore { >+ >+enum class DataListSuggestionActivationType { >+ ControlClicked, >+ IndicatorClicked, >+ TextChanged, >+}; >+ >+struct DataListSuggestionInformation { >+ DataListSuggestionActivationType activationType; >+ Vector<String> suggestions; >+ IntRect elementRect; >+}; >+ >+} >+#endif >diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp >index dc054fe7d0cd419909d54d000dbe3f051bab5db7..4ab5b39fc2c69a6695be898c5f153cdafc855a43 100644 >--- a/Source/WebCore/html/TextFieldInputType.cpp >+++ b/Source/WebCore/html/TextFieldInputType.cpp >@@ -58,6 +58,11 @@ > #include "TextNodeTraversal.h" > #include "WheelEvent.h" > >+#if ENABLE(DATALIST_ELEMENT) >+#include "HTMLDataListElement.h" >+#include "HTMLOptionElement.h" >+#endif >+ > namespace WebCore { > > using namespace HTMLNames; >@@ -71,6 +76,9 @@ TextFieldInputType::~TextFieldInputType() > { > if (m_innerSpinButton) > m_innerSpinButton->removeSpinButtonOwner(); >+#if ENABLE(DATALIST_ELEMENT) >+ closeSuggestions(); >+#endif > } > > bool TextFieldInputType::isKeyboardFocusable(KeyboardEvent*) const >@@ -161,11 +169,24 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange > input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); > } > >+#if ENABLE(DATALIST_ELEMENT) >+void TextFieldInputType::handleClickEvent(MouseEvent&) >+{ >+ if (element()->focused() && element()->list()) >+ displaySuggestions(DataListSuggestionActivationType::ControlClicked); >+} >+#endif >+ > void TextFieldInputType::handleKeydownEvent(KeyboardEvent& event) > { > ASSERT(element()); > if (!element()->focused()) > return; >+#if ENABLE(DATALIST_ELEMENT) >+ const String& key = event.keyIdentifier(); >+ if (m_suggestionPicker && (key == "Enter" || key == "Up" || key == "Down")) >+ m_suggestionPicker->handleKeydownWithIdentifier(key); >+#endif > RefPtr<Frame> frame = element()->document().frame(); > if (!frame || !frame->editor().doTextFieldCommandFromEvent(element(), &event)) > return; >@@ -223,6 +244,10 @@ void TextFieldInputType::elementDidBlur() > bool isLeftToRightDirection = downcast<RenderTextControlSingleLine>(*renderer).style().isLeftToRightDirection(); > ScrollOffset scrollOffset(isLeftToRightDirection ? 0 : innerLayer->scrollWidth(), 0); > innerLayer->scrollToOffset(scrollOffset); >+ >+#if ENABLE(DATALIST_ELEMENT) >+ closeSuggestions(); >+#endif > } > > void TextFieldInputType::handleFocusEvent(Node* oldFocusedNode, FocusDirection) >@@ -536,7 +561,11 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent& > > bool TextFieldInputType::shouldRespectListAttribute() > { >+#if ENABLE(DATALIST_ELEMENT) >+ return true; >+#else > return InputType::themeSupportsDataListUI(this); >+#endif > } > > void TextFieldInputType::updatePlaceholderText() >@@ -607,6 +636,10 @@ void TextFieldInputType::didSetValueByUserEdit() > return; > if (RefPtr<Frame> frame = element()->document().frame()) > frame->editor().textDidChangeInTextField(element()); >+#if ENABLE(DATALIST_ELEMENT) >+ if (element()->list()) >+ displaySuggestions(DataListSuggestionActivationType::TextChanged); >+#endif > } > > void TextFieldInputType::spinButtonStepDown() >@@ -751,4 +784,67 @@ void TextFieldInputType::updateAutoFillButton() > m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true); > } > >+#if ENABLE(DATALIST_ELEMENT) >+ >+IntRect TextFieldInputType::elementRectInRootViewCoordinates() const >+{ >+ if (!element()->renderer()) >+ return IntRect(); >+ return element()->document().view()->contentsToRootView(element()->renderer()->absoluteBoundingBoxRect()); >+} >+ >+Vector<String> TextFieldInputType::suggestions() const >+{ >+ Vector<String> suggestions; >+ >+ if (auto dataList = element()->dataList()) { >+ Ref<HTMLCollection> options = dataList->options(); >+ for (unsigned i = 0; auto* option = downcast<HTMLOptionElement>(options->item(i)); ++i) { >+ if (!element()->isValidValue(option->value())) >+ continue; >+ >+ String value = sanitizeValue(option->value()); >+ if (!suggestions.contains(value) && (element()->value().isEmpty() || value.containsIgnoringASCIICase(element()->value()))) >+ suggestions.append(value); >+ } >+ } >+ >+ return suggestions; >+} >+ >+void TextFieldInputType::didSelectDataListOption(const String& selectedOption) >+{ >+ element()->setValue(selectedOption, DispatchInputAndChangeEvent); >+} >+ >+void TextFieldInputType::didCloseSuggestions() >+{ >+ m_suggestionPicker = nullptr; >+} >+ >+void TextFieldInputType::displaySuggestions(DataListSuggestionActivationType type) >+{ >+ if (element()->isDisabledFormControl() || !element()->renderer()) >+ return; >+ >+ if (!UserGestureIndicator::processingUserGesture()) >+ return; >+ >+ if (!m_suggestionPicker && suggestions().size() > 0) >+ m_suggestionPicker = chrome()->createDataListSuggestionPicker(*this); >+ >+ if (!m_suggestionPicker) >+ return; >+ >+ m_suggestionPicker->displayWithActivationType(type); >+} >+ >+void TextFieldInputType::closeSuggestions() >+{ >+ if (m_suggestionPicker) >+ m_suggestionPicker->close(); >+} >+ >+#endif >+ > } // namespace WebCore >diff --git a/Source/WebCore/html/TextFieldInputType.h b/Source/WebCore/html/TextFieldInputType.h >index a8954b5a3110e89ef6bdaed4cc6c9eed02c30634..34081bb799724cd2cc69170e43a7b4bd52b6e928 100644 >--- a/Source/WebCore/html/TextFieldInputType.h >+++ b/Source/WebCore/html/TextFieldInputType.h >@@ -32,6 +32,8 @@ > #pragma once > > #include "AutoFillButtonElement.h" >+#include "DataListSuggestionPicker.h" >+#include "DataListSuggestionsClient.h" > #include "InputType.h" > #include "SpinButtonElement.h" > >@@ -42,12 +44,19 @@ class TextControlInnerTextElement; > > // The class represents types of which UI contain text fields. > // It supports not only the types for BaseTextInputType but also type=number. >-class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner, protected AutoFillButtonElement::AutoFillButtonOwner { >+class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner, protected AutoFillButtonElement::AutoFillButtonOwner >+#if ENABLE(DATALIST_ELEMENT) >+ , private DataListSuggestionsClient >+#endif >+{ > protected: > explicit TextFieldInputType(HTMLInputElement&); > virtual ~TextFieldInputType(); > void handleKeydownEvent(KeyboardEvent&) override; > void handleKeydownEventForSpinButton(KeyboardEvent&); >+#if ENABLE(DATALIST_ELEMENT) >+ void handleClickEvent(MouseEvent&) final; >+#endif > > HTMLElement* containerElement() const final; > HTMLElement* innerBlockElement() const final; >@@ -110,6 +119,19 @@ private: > void createContainer(); > void createAutoFillButton(AutoFillButtonType); > >+#if ENABLE(DATALIST_ELEMENT) >+ void displaySuggestions(DataListSuggestionActivationType); >+ void closeSuggestions(); >+ >+ // DataListSuggestionsClient >+ IntRect elementRectInRootViewCoordinates() const final; >+ Vector<String> suggestions() const final; >+ void didSelectDataListOption(const String&) final; >+ void didCloseSuggestions() final; >+ >+ std::unique_ptr<DataListSuggestionPicker> m_suggestionPicker; >+#endif >+ > RefPtr<HTMLElement> m_container; > RefPtr<HTMLElement> m_innerBlock; > RefPtr<TextControlInnerTextElement> m_innerText; >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index c6e5eeefa6294bf4dd759103ef51710ed5849a8b..6053b878b2f0454003df14701ea8cba4d039dac7 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -32,6 +32,7 @@ > #include "BackForwardClient.h" > #include "ColorChooser.h" > #include "ContextMenuClient.h" >+#include "DataListSuggestionPicker.h" > #include "DatabaseProvider.h" > #include "DiagnosticLoggingClient.h" > #include "DocumentFragment.h" >@@ -423,6 +424,15 @@ std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooser > > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ >+std::unique_ptr<DataListSuggestionPicker> EmptyChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient&) >+{ >+ return nullptr; >+} >+ >+#endif >+ > void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&) > { > } >diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h >index e285f639e0d87bd586dc3ffade5fce9c87efc0fc..9d052b0b9523fbc846693f22dc5fc78aa380765c 100644 >--- a/Source/WebCore/loader/EmptyClients.h >+++ b/Source/WebCore/loader/EmptyClients.h >@@ -132,6 +132,10 @@ class EmptyChromeClient : public ChromeClient { > std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color&) final; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&) final; >+#endif >+ > void runOpenPanel(Frame&, FileChooser&) final; > void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { } > >diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp >index 770a96b1003b233902430d9fd20f645bd6e30369..ff69edef1c0086b63bc55d234b1cf262b559edff 100644 >--- a/Source/WebCore/page/Chrome.cpp >+++ b/Source/WebCore/page/Chrome.cpp >@@ -56,6 +56,10 @@ > #include "ColorChooser.h" > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+#include "DataListSuggestionPicker.h" >+#endif >+ > namespace WebCore { > > using namespace HTMLNames; >@@ -422,6 +426,16 @@ std::unique_ptr<ColorChooser> Chrome::createColorChooser(ColorChooserClient& cli > > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ >+std::unique_ptr<DataListSuggestionPicker> Chrome::createDataListSuggestionPicker(DataListSuggestionsClient& client) >+{ >+ notifyPopupOpeningObservers(); >+ return m_client.createDataListSuggestionPicker(client); >+} >+ >+#endif >+ > void Chrome::runOpenPanel(Frame& frame, FileChooser& fileChooser) > { > notifyPopupOpeningObservers(); >diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h >index 2174cbe126df5f34c02329726faf625d6a211135..ccbce93556ea94b5c110c5dc357c35d98831a9ff 100644 >--- a/Source/WebCore/page/Chrome.h >+++ b/Source/WebCore/page/Chrome.h >@@ -37,6 +37,8 @@ namespace WebCore { > class ChromeClient; > class ColorChooser; > class ColorChooserClient; >+class DataListSuggestionPicker; >+class DataListSuggestionsClient; > class DateTimeChooser; > class DateTimeChooserClient; > class FileChooser; >@@ -152,6 +154,10 @@ public: > std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color& initialColor); > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&); >+#endif >+ > void runOpenPanel(Frame&, FileChooser&); > void loadIconForFiles(const Vector<String>&, FileIconLoader&); > >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index e2422370e7edef4459edef0091b1ef6dfb3efbd2..bea0d8f4cb8ad34b1e996ebf318cffb0fb968be7 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -68,6 +68,8 @@ namespace WebCore { > class AccessibilityObject; > class ColorChooser; > class ColorChooserClient; >+class DataListSuggestionPicker; >+class DataListSuggestionsClient; > class DateTimeChooser; > class DateTimeChooserClient; > class Element; >@@ -275,6 +277,10 @@ public: > virtual std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color&) = 0; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ virtual std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&) = 0; >+#endif >+ > virtual void runOpenPanel(Frame&, FileChooser&) = 0; > // Asynchronous request to load an icon for specified filenames. > virtual void loadIconForFiles(const Vector<String>&, FileIconLoader&) = 0; >diff --git a/Source/WebCore/platform/DataListSuggestionPicker.h b/Source/WebCore/platform/DataListSuggestionPicker.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9ce192ae90fcc91c9a549c0089e521249c0e233c >--- /dev/null >+++ b/Source/WebCore/platform/DataListSuggestionPicker.h >@@ -0,0 +1,48 @@ >+/* >+ * 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. >+ */ >+ >+#pragma once >+ >+#if ENABLE(DATALIST_ELEMENT) >+ >+#import "DataListSuggestionInformation.h" >+#import "IntRect.h" >+ >+#import <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class DataListSuggestionPicker { >+public: >+ virtual ~DataListSuggestionPicker() = default; >+ >+ virtual void close() { } >+ virtual void handleKeydownWithIdentifier(const String&) { } >+ virtual void displayWithActivationType(DataListSuggestionActivationType) { } >+}; >+ >+} // namespace WebCore >+ >+#endif >diff --git a/Source/WebCore/platform/DataListSuggestionsClient.h b/Source/WebCore/platform/DataListSuggestionsClient.h >new file mode 100644 >index 0000000000000000000000000000000000000000..abf5c6b0cc35014b8588162bf6b0c3afb2422b68 >--- /dev/null >+++ b/Source/WebCore/platform/DataListSuggestionsClient.h >@@ -0,0 +1,48 @@ >+/* >+ * 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. >+ */ >+ >+#pragma once >+ >+#if ENABLE(DATALIST_ELEMENT) >+ >+#include "IntRect.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class DataListSuggestionsClient { >+public: >+ virtual ~DataListSuggestionsClient() = default; >+ >+ virtual IntRect elementRectInRootViewCoordinates() const = 0; >+ virtual Vector<String> suggestions() const = 0; >+ >+ virtual void didSelectDataListOption(const String&) = 0; >+ virtual void didCloseSuggestions() = 0; >+}; >+ >+} >+ >+#endif // ENABLE(DATALIST_ELEMENT) >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 2d311754c212eb3bb0cb241ff69f6f23aedc84a4..fad93ded8dafca0731e151e1aabba78155f05718 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -2160,6 +2160,8 @@ > E49D40D91AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49D40D81AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp */; }; > E4E864921B16750100C82F40 /* VersionChecks.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4E8648F1B1673FB00C82F40 /* VersionChecks.mm */; }; > E4E864931B16750700C82F40 /* VersionChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E8648E1B1673FB00C82F40 /* VersionChecks.h */; }; >+ E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; }; >+ E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */; }; > ECA680D81E690E2500731D20 /* WebProcessCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = ECA680D71E690DF800731D20 /* WebProcessCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; }; > ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; }; > EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A22F1001289FCD90085E74F /* WKBundlePageOverlay.cpp */; }; >@@ -4706,6 +4708,8 @@ > E49D40D81AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheBlobStorage.cpp; sourceTree = "<group>"; }; > E4E8648E1B1673FB00C82F40 /* VersionChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionChecks.h; sourceTree = "<group>"; }; > E4E8648F1B1673FB00C82F40 /* VersionChecks.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VersionChecks.mm; 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>"; }; > ECA680D31E6904B500731D20 /* ExtraPrivateSymbolsForTAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtraPrivateSymbolsForTAPI.h; sourceTree = "<group>"; }; > ECA680D71E690DF800731D20 /* WebProcessCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebProcessCocoa.h; sourceTree = "<group>"; }; > ECBFC1DB1E6A4D66000300C7 /* ExtraPublicSymbolsForTAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtraPublicSymbolsForTAPI.h; sourceTree = "<group>"; }; >@@ -7133,6 +7137,8 @@ > 3F87B9BB15893F630090FF62 /* WebColorChooser.h */, > BC111A54112F4FBB00337BAB /* WebContextMenuClient.cpp */, > BC032D6210F4378D0058C15A /* WebContextMenuClient.h */, >+ E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */, >+ E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */, > CD19A2691A13E820008D650E /* WebDiagnosticLoggingClient.cpp */, > CD19A26A1A13E821008D650E /* WebDiagnosticLoggingClient.h */, > BC111A56112F4FBB00337BAB /* WebDragClient.cpp */, >@@ -9303,6 +9309,7 @@ > 5760829D202D2C4000116678 /* WebCredentialsMessengerMessages.h in Headers */, > 5760829F202D2C4600116678 /* WebCredentialsMessengerProxyMessages.h in Headers */, > 1AA83F6D1A5B63FF00026EC6 /* WebDatabaseProvider.h in Headers */, >+ E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */, > CD19A26E1A13E834008D650E /* WebDiagnosticLoggingClient.h in Headers */, > 1A5B1C5518987EDF004FCF9B /* WebDocumentLoader.h in Headers */, > BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */, >@@ -11133,6 +11140,7 @@ > 57608298202BD8BA00116678 /* WebCredentialsMessengerProxy.cpp in Sources */, > 5760829E202D2C4300116678 /* WebCredentialsMessengerProxyMessageReceiver.cpp in Sources */, > 1AA83F6C1A5B63FF00026EC6 /* WebDatabaseProvider.cpp in Sources */, >+ E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */, > CD19A26D1A13E82A008D650E /* WebDiagnosticLoggingClient.cpp in Sources */, > 1A5B1C5418987EDF004FCF9B /* WebDocumentLoader.cpp in Sources */, > BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */, >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 64ef63e11c72e58452fcad7eacdb45801b33335b..0c955f6771beccbe568f0242479f16301f5d1f4c 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -40,6 +40,7 @@ > #include "UserData.h" > #include "WebColorChooser.h" > #include "WebCoreArgumentCoders.h" >+#include "WebDataListSuggestionPicker.h" > #include "WebFrame.h" > #include "WebFrameLoaderClient.h" > #include "WebFullScreenManager.h" >@@ -57,6 +58,7 @@ > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/AXObjectCache.h> > #include <WebCore/ColorChooser.h> >+#include <WebCore/DataListSuggestionPicker.h> > #include <WebCore/DatabaseTracker.h> > #include <WebCore/DocumentLoader.h> > #include <WebCore/FileChooser.h> >@@ -789,6 +791,15 @@ std::unique_ptr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserCl > > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ >+std::unique_ptr<DataListSuggestionPicker> WebChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient& client) >+{ >+ return std::make_unique<WebDataListSuggestionPicker>(&m_page, &client); >+} >+ >+#endif >+ > void WebChromeClient::runOpenPanel(Frame& frame, FileChooser& fileChooser) > { > if (m_page.activeOpenPanelResultListener()) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 5846ae3c4bc205da93079a47e9f2e73c803d5e6b..811a822c94534366a75031115e9a0faa93f427d8 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -148,6 +148,10 @@ private: > std::unique_ptr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient&, const WebCore::Color&) final; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ std::unique_ptr<WebCore::DataListSuggestionPicker> createDataListSuggestionPicker(WebCore::DataListSuggestionsClient&) final; >+#endif >+ > #if ENABLE(IOS_TOUCH_EVENTS) > void didPreventDefaultForEvent() final; > #endif >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..68445271caf337e23851f2b3d4fe0a3b826ba995 >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp >@@ -0,0 +1,75 @@ >+/* >+ * 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. >+ */ >+ >+#include "config.h" >+#include "WebDataListSuggestionPicker.h" >+ >+#if ENABLE(DATALIST_ELEMENT) >+ >+#include "WebPage.h" >+#include "WebPageProxyMessages.h" >+#include "WebProcess.h" >+#include <WebCore/DataListSuggestionsClient.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+WebDataListSuggestionPicker::WebDataListSuggestionPicker(WebPage* page, DataListSuggestionsClient* client) >+ : m_dataListSuggestionsClient(client) >+ , m_page(page) >+{ >+} >+ >+WebDataListSuggestionPicker::~WebDataListSuggestionPicker() { } >+ >+void WebDataListSuggestionPicker::handleKeydownWithIdentifier(const WTF::String& key) >+{ >+ >+} >+ >+void WebDataListSuggestionPicker::didSelectOption(const WTF::String& selectedOption) >+{ >+ >+} >+ >+void WebDataListSuggestionPicker::didCloseSuggestions() >+{ >+ >+} >+ >+void WebDataListSuggestionPicker::close() >+{ >+ >+} >+ >+void WebDataListSuggestionPicker::displayWithActivationType(DataListSuggestionActivationType type) >+{ >+ >+} >+ >+} // namespace WebKit >+ >+#endif >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h b/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e5b3818022e1200ea8cedd110a24ca4e026c0042 >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h >@@ -0,0 +1,58 @@ >+/* >+ * 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. >+ */ >+ >+#pragma once >+ >+#if ENABLE(DATALIST_ELEMENT) >+ >+#include <WebCore/DataListSuggestionPicker.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+class DataListSuggestionsClient; >+} >+ >+namespace WebKit { >+ >+class WebPage; >+ >+class WebDataListSuggestionPicker : public WebCore::DataListSuggestionPicker { >+public: >+ WebDataListSuggestionPicker(WebPage*, WebCore::DataListSuggestionsClient*); >+ virtual ~WebDataListSuggestionPicker(); >+ >+ void handleKeydownWithIdentifier(const String&) override; >+ void didSelectOption(const String&); >+ void didCloseSuggestions(); >+ void close() override; >+ void displayWithActivationType(WebCore::DataListSuggestionActivationType) override; >+private: >+ __unused WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient; >+ __unused WebPage* m_page; >+}; >+ >+} // namespace WebKit >+ >+#endif >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 9703d4976c1fc92548823e6e8bf5841ace5e59f7..7625e3222a2822e73d221f7db8d80afa19b24cd2 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -76,6 +76,7 @@ > #include "WebContextMenu.h" > #include "WebContextMenuClient.h" > #include "WebCoreArgumentCoders.h" >+#include "WebDataListSuggestionPicker.h" > #include "WebDatabaseProvider.h" > #include "WebDiagnosticLoggingClient.h" > #include "WebDocumentLoader.h" >@@ -3558,6 +3559,26 @@ void WebPage::didChooseColor(const WebCore::Color& color) > > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ >+void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker* dataListSuggestionPicker) >+{ >+ m_activeDataListSuggestionPicker = dataListSuggestionPicker; >+} >+ >+void WebPage::didSelectDataListOption(const String& selectedOption) >+{ >+ m_activeDataListSuggestionPicker->didSelectOption(selectedOption); >+} >+ >+void WebPage::didCloseSuggestions() >+{ >+ m_activeDataListSuggestionPicker->didCloseSuggestions(); >+ m_activeDataListSuggestionPicker = nullptr; >+} >+ >+#endif >+ > void WebPage::setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&& openPanelResultListener) > { > m_activeOpenPanelResultListener = WTFMove(openPanelResultListener); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 1699a91157baa78c8862db63076c080cdff6e533..331575e243f7e5edec096192accb770a8b5c776b 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -199,6 +199,7 @@ class VisibleContentRectUpdateInfo; > class WebColorChooser; > class WebContextMenu; > class WebContextMenuItemData; >+class WebDataListSuggestionPicker; > class WebDocumentLoader; > class WebEvent; > class WebFrame; >@@ -361,6 +362,12 @@ public: > void didEndColorPicker(); > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*); >+ void didSelectDataListOption(const String&); >+ void didCloseSuggestions(); >+#endif >+ > WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); } > void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&); > >@@ -1551,6 +1558,10 @@ private: > WebColorChooser* m_activeColorChooser { nullptr }; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr }; >+#endif >+ > RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener; > RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager; > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 7e1503065a26ad67e3daa3a368241c006c21d706..fcebcf2f17948d5fddefa49db85726c3a7598e8a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -127,6 +127,11 @@ messages -> WebPage LegacyReceiver { > DidChooseColor(WebCore::Color color) > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ DidSelectDataListOption(String selectedOption); >+ DidCloseSuggestions(); >+#endif >+ > #if ENABLE(CONTEXT_MENUS) > ContextMenuHidden() > ContextMenuForKeyEvent() >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >index 424c91a3bd2168771c33ca0b1c0fdfa044b2b264..4355a866d641037ba67f1aedccafc07e8ab2d9db 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >@@ -138,6 +138,10 @@ private: > std::unique_ptr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient&, const WebCore::Color&) final; > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+ std::unique_ptr<WebCore::DataListSuggestionPicker> createDataListSuggestionPicker(WebCore::DataListSuggestionsClient&) final; >+#endif >+ > #if ENABLE(POINTER_LOCK) > bool requestPointerLock() final; > void requestPointerUnlock() final; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >index 7d5ff5ad5fb4e034a9a47b5c12f330f74d46ff80..2884dfd5fd7c36a93c62020a44e7e95f6f9782fc 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >@@ -58,6 +58,7 @@ > #import <WebCore/ContextMenu.h> > #import <WebCore/ContextMenuController.h> > #import <WebCore/Cursor.h> >+#import <WebCore/DataListSuggestionPicker.h> > #import <WebCore/DeprecatedGlobalSettings.h> > #import <WebCore/Element.h> > #import <WebCore/FileChooser.h> >@@ -723,6 +724,14 @@ std::unique_ptr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserCl > > #endif > >+#if ENABLE(DATALIST_ELEMENT) >+std::unique_ptr<DataListSuggestionPicker> WebChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient& client) >+{ >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+} >+#endif >+ > #if ENABLE(POINTER_LOCK) > bool WebChromeClient::requestPointerLock() > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186151
:
341690
|
341977
| 342186