WebKit Bugzilla
Attachment 341690 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-20180531133355.patch (text/plain), 46.74 KB, created by
Aditya Keerthi
on 2018-05-31 13:33:56 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Aditya Keerthi
Created:
2018-05-31 13:33:56 PDT
Size:
46.74 KB
patch
obsolete
>Subversion Revision: 232309 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 76a81d086fa55e5f06f9ff7b194a580b9adedd23..2b0efeb2e5da197f20a041f8ad11b2cf2492c9b5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,54 @@ >+2018-05-31 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-05-30 Youenn Fablet <youenn@apple.com> > > Rename CrossOriginResourcePolicy same to same-origin >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6224cd600084f9241c8017772bba12e3f158e5bd..a194a314b21b7d1d4ef51b85b99ec6174988f471 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,35 @@ >+2018-05-31 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-05-30 Youenn Fablet <youenn@apple.com> > > Rename CrossOriginResourcePolicy same to same-origin >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index e7785501b26e57c0a8f43376d6d9c9ab1316e8c1..fae3ddc5006f73f3a5f5a2c66453b44313100cf4 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,14 @@ >+2018-05-31 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-05-27 Dan Bernstein <mitz@apple.com> > > Reverted the changes made for https://webkit.org/b/186016 >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..462307ee19d5437133ed87b0d73180765439583f >--- /dev/null >+++ b/Source/WebCore/html/DataListSuggestionInformation.h >@@ -0,0 +1,44 @@ >+/* >+ * 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) >+namespace WebCore { >+ >+enum 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 d9c492ed13831f8c691451187d6bbe07bdd6a231..b8523b5086846a69eee5fbdb3702b247d2dc31e6 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 >@@ -156,10 +164,23 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange > input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); > } > >+#if ENABLE(DATALIST_ELEMENT) >+void TextFieldInputType::handleClickEvent(__unused MouseEvent& event) >+{ >+ if (element().focused() && element().list()) >+ displaySuggestions(DataListSuggestionActivationType::ControlClicked); >+} >+#endif >+ > void TextFieldInputType::handleKeydownEvent(KeyboardEvent& event) > { > 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; >@@ -213,6 +234,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) >@@ -516,7 +541,11 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent& > > bool TextFieldInputType::shouldRespectListAttribute() > { >+#if ENABLE(DATALIST_ELEMENT) >+ return true; >+#else > return InputType::themeSupportsDataListUI(this); >+#endif > } > > void TextFieldInputType::updatePlaceholderText() >@@ -583,6 +612,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() >@@ -717,4 +750,67 @@ void TextFieldInputType::updateAutoFillButton() > m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true); > } > >+#if ENABLE(DATALIST_ELEMENT) >+ >+IntRect TextFieldInputType::elementRectRelativeToRootView() 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; RefPtr<HTMLOptionElement> 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 07b573d7e489cdec9a67a09b57e45b74af5812fa..a1b6edce3ff8bb78402acfe5d59706de4e732ac0 100644 >--- a/Source/WebCore/html/TextFieldInputType.h >+++ b/Source/WebCore/html/TextFieldInputType.h >@@ -31,6 +31,8 @@ > #pragma once > > #include "AutoFillButtonElement.h" >+#include "DataListSuggestionPicker.h" >+#include "DataListSuggestionsClient.h" > #include "InputType.h" > #include "SpinButtonElement.h" > >@@ -41,12 +43,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&) override; >+#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 elementRectRelativeToRootView() 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..433154c803bbc4a318d12beeac96053644a527fb >--- /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 WTF::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..200894a9381959c6d1eeef6709797eae4dabb856 >--- /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 elementRectRelativeToRootView() 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 326ed6d115e3b01e8d042a6ac66753c762492ecb..bda77731b5f4c8f084471b618785e96ce44bbbaa 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -2156,6 +2156,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 */; }; >@@ -4700,6 +4702,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>"; }; >@@ -7161,6 +7165,8 @@ > 4A410F4919AF7B80002EBAB5 /* WebUserMediaClient.h */, > 83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */, > 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */, >+ E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */, >+ E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */, > ); > path = WebCoreSupport; > sourceTree = "<group>"; >@@ -8842,6 +8848,7 @@ > 7CE4D2071A46776100C7F152 /* APILegacyContextHistoryClient.h in Headers */, > 1A2464F31891E45100234C5B /* APILoaderClient.h in Headers */, > 7CD3A4831A5D02FA009623B8 /* APINavigation.h in Headers */, >+ E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */, > 2DF9EEEC1A7836EE00B6CFBE /* APINavigationAction.h in Headers */, > 2DD9EB2D1A6F012500BB1267 /* APINavigationClient.h in Headers */, > BCF69FA21176D01400471A52 /* APINavigationData.h in Headers */, >@@ -11063,6 +11070,7 @@ > 1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */, > 1C891D6519B124FF00BA79DD /* WebInspectorUI.cpp in Sources */, > 1CA8B954127C891500576C2B /* WebInspectorUIMac.mm in Sources */, >+ E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */, > 1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */, > A55BA82C1BA38E64007CD33D /* WebInspectorUtilities.cpp in Sources */, > 2DA944A11884E4F000ED86DB /* WebIOSEventFactory.mm 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..778b5bb4bd7497e32cee06a016100efcb96e5259 >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp >@@ -0,0 +1,73 @@ >+/* >+ * 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..3f31399532ef67b49d28a7ef998dbe59e774f6eb >--- /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 WTF::String&) override; >+ void didSelectOption(const WTF::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 8daa1180942381b1420865b3c51b8a2590418217..2de609c44d7f11b8c432e03be9cfa5ee9f70681e 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" >@@ -3548,6 +3549,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 81fe21d7a6b741eaebe439f9b5731ec2b6590f38..9d6e8d878c6b33c2c67e797fc6876379d6a7454e 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