Changeset 233866 in webkit


Ignore:
Timestamp:
Jul 16, 2018 2:15:57 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[Datalist][macOS] Add suggestions UI for TextFieldInputTypes
https://bugs.webkit.org/show_bug.cgi?id=186531

Patch by Aditya Keerthi <Aditya Keerthi> on 2018-07-16
Reviewed by Tim Horton.

Source/WebCore:

Tests: fast/forms/datalist/datalist-show-hide.html

fast/forms/datalist/datalist-textinput-keydown.html

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::handleKeydownEvent):
(WebCore::TextFieldInputType::handleKeydownEventForSpinButton): The suggestions view takes precedence when handling arrow key events.

Source/WebKit:

Created WebDataListSuggestionsDropdownMac as a wrapper around the suggestions
view. The suggestions for TextFieldInputTypes are displayed using an NSTableView
in it's own child window. This is done so that suggestions can be presented
outside of the page if the parent window's size is too small. The maximum number
of suggestions that are visible at one time is 6, with additional suggestions made
available by scrolling.

Suggestions in the view can be selected via click or by using arrow keys. If the
input element associated with the suggestions is blurred, or the page is moved in
any way, the suggestions view is hidden.

Added IPC messages to the UIProcess to enable the display of the suggestions view.
This required a new ArgumentCoder for DataListSuggestionInformation.

  • Shared/WebCoreArgumentCoders.cpp:

(IPC::ArgumentCoder<DataListSuggestionInformation>::encode):
(IPC::ArgumentCoder<DataListSuggestionInformation>::decode):

  • Shared/WebCoreArgumentCoders.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebDataListSuggestionsDropdown.cpp: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.

(WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
(WebKit::WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown):
(WebKit::WebDataListSuggestionsDropdown::close):

  • UIProcess/WebDataListSuggestionsDropdown.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.

(WebKit::WebDataListSuggestionsDropdown::Client::~Client):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::viewWillStartLiveResize):
(WebKit::WebPageProxy::viewDidLeaveWindow):
(WebKit::WebPageProxy::handleWheelEvent):
(WebKit::WebPageProxy::setPageZoomFactor):
(WebKit::WebPageProxy::setPageAndTextZoomFactors):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::pageDidScroll):
(WebKit::WebPageProxy::showDataListSuggestions):
(WebKit::WebPageProxy::handleKeydownInDataList):
(WebKit::WebPageProxy::endDataListSuggestions):
(WebKit::WebPageProxy::didCloseSuggestions):
(WebKit::WebPageProxy::didSelectOption):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::closeOverlayedViews):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/ios/PageClientImplIOS.h:
  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::createDataListSuggestionsDropdown):

  • UIProcess/mac/PageClientImplMac.h:
  • UIProcess/mac/PageClientImplMac.mm:

(WebKit::PageClientImpl::createDataListSuggestionsDropdown):

  • UIProcess/mac/WebDataListSuggestionsDropdownMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
  • UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: Added.

(WebKit::WebDataListSuggestionsDropdownMac::create):
(WebKit::WebDataListSuggestionsDropdownMac::~WebDataListSuggestionsDropdownMac):
(WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
(WebKit::WebDataListSuggestionsDropdownMac::show):
(WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
(WebKit::WebDataListSuggestionsDropdownMac::selectOption):
(WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
(WebKit::WebDataListSuggestionsDropdownMac::close):
(-[WKDataListSuggestionCell initWithFrame:]):
(-[WKDataListSuggestionCell setText:]):
(-[WKDataListSuggestionCell setActive:]):
(-[WKDataListSuggestionCell drawRect:]):
(-[WKDataListSuggestionCell mouseEntered:]):
(-[WKDataListSuggestionCell mouseExited:]):
(-[WKDataListSuggestionCell acceptsFirstResponder]):
(-[WKDataListSuggestionTable initWithElementRect:]):
(-[WKDataListSuggestionTable setVisibleRect:]):
(-[WKDataListSuggestionTable currentActiveRow]):
(-[WKDataListSuggestionTable setActiveRow:]):
(-[WKDataListSuggestionTable reload]):
(-[WKDataListSuggestionTable acceptsFirstResponder]):
(-[WKDataListSuggestionTable enclosingScrollView]):
(-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]):
(-[WKDataListSuggestionsView initWithInformation:inView:]):
(-[WKDataListSuggestionsView currentSelectedString]):
(-[WKDataListSuggestionsView updateWithInformation:]):
(-[WKDataListSuggestionsView moveSelectionByDirection:]):
(-[WKDataListSuggestionsView invalidate]):
(-[WKDataListSuggestionsView dropdownRectForElementRect:]):
(-[WKDataListSuggestionsView showSuggestionsDropdown:]):
(-[WKDataListSuggestionsView selectedRow:]):
(-[WKDataListSuggestionsView numberOfRowsInTableView:]):
(-[WKDataListSuggestionsView tableView:heightOfRow:]):
(-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]):

  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:

(WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
(WebKit::WebDataListSuggestionPicker::didSelectOption):
(WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
(WebKit::WebDataListSuggestionPicker::close):
(WebKit::WebDataListSuggestionPicker::displayWithActivationType):

  • WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:

Tools:

Added isShowingDatalistSuggestions testing hook in order to enable testing of the
visibility of the suggestions view.

  • DumpRenderTree/mac/UIScriptControllerMac.mm:

(WTR::UIScriptController::isShowingDataListSuggestions const):

  • TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
  • TestRunnerShared/UIScriptContext/UIScriptController.cpp:

(WTR::UIScriptController::isShowingDataListSuggestions const):

  • TestRunnerShared/UIScriptContext/UIScriptController.h:
  • WebKitTestRunner/mac/UIScriptControllerMac.mm:

(WTR::UIScriptController::isShowingDataListSuggestions const):

LayoutTests:

Added tests to verify that the suggestions are correctly shown and hidden, and that
suggestions can be selected and inserted into an input field.

  • fast/forms/datalist/datalist-show-hide-expected.txt: Added.
  • fast/forms/datalist/datalist-show-hide.html: Added.
  • fast/forms/datalist/datalist-textinput-keydown-expected.txt: Added.
  • fast/forms/datalist/datalist-textinput-keydown.html: Added.
  • platform/ios/TestExpectations:
  • resources/ui-helper.js:

(window.UIHelper.isShowingDataListSuggestions):

Location:
trunk
Files:
5 added
25 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r233865 r233866  
     12018-07-16  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
     4        https://bugs.webkit.org/show_bug.cgi?id=186531
     5
     6        Reviewed by Tim Horton.
     7
     8        Added tests to verify that the suggestions are correctly shown and hidden, and that
     9        suggestions can be selected and inserted into an input field.
     10
     11        * fast/forms/datalist/datalist-show-hide-expected.txt: Added.
     12        * fast/forms/datalist/datalist-show-hide.html: Added.
     13        * fast/forms/datalist/datalist-textinput-keydown-expected.txt: Added.
     14        * fast/forms/datalist/datalist-textinput-keydown.html: Added.
     15        * platform/ios/TestExpectations:
     16        * resources/ui-helper.js:
     17        (window.UIHelper.isShowingDataListSuggestions):
     18
    1192018-07-16  Jeremy Jones  <jeremyj@apple.com>
    220
  • trunk/LayoutTests/platform/ios/TestExpectations

    r233447 r233866  
    33303330fast/block/block-only/margin-sibling-collapse-propagated.html [ Failure ]
    33313331fast/block/block-only/relative-auto-with-parent-offset.html [ Failure ]
     3332
     3333# Datalist
     3334webkit.org/b/186714 fast/forms/datalist/datalist-show-hide.html [ Skip ]
     3335webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]
  • trunk/LayoutTests/resources/ui-helper.js

    r232968 r233866  
    230230    }
    231231
     232    static isShowingDataListSuggestions()
     233    {
     234        return new Promise(resolve => {
     235            testRunner.runUIScript(`(() => {
     236                uiController.uiScriptComplete(uiController.isShowingDataListSuggestions);
     237            })()`, resolve);
     238        });
     239    }
     240
    232241    static zoomScale()
    233242    {
  • trunk/Source/WebCore/ChangeLog

    r233865 r233866  
     12018-07-16  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
     4        https://bugs.webkit.org/show_bug.cgi?id=186531
     5
     6        Reviewed by Tim Horton.
     7
     8        Tests: fast/forms/datalist/datalist-show-hide.html
     9               fast/forms/datalist/datalist-textinput-keydown.html
     10
     11        * html/TextFieldInputType.cpp:
     12        (WebCore::TextFieldInputType::handleKeydownEvent):
     13        (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): The suggestions view takes precedence when handling arrow key events.
     14
    1152018-07-16  Jeremy Jones  <jeremyj@apple.com>
    216
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r233578 r233866  
    185185#if ENABLE(DATALIST_ELEMENT)
    186186    const String& key = event.keyIdentifier();
    187     if (m_suggestionPicker && (key == "Enter" || key == "Up" || key == "Down"))
     187    if (m_suggestionPicker && (key == "Enter" || key == "Up" || key == "Down")) {
    188188        m_suggestionPicker->handleKeydownWithIdentifier(key);
     189        event.setDefaultHandled();
     190    }
    189191#endif
    190192    RefPtr<Frame> frame = element()->document().frame();
     
    199201    if (element()->isDisabledOrReadOnly())
    200202        return;
     203#if ENABLE(DATALIST_ELEMENT)
     204    if (m_suggestionPicker)
     205        return;
     206#endif
    201207    const String& key = event.keyIdentifier();
    202208    if (key == "Up")
  • trunk/Source/WebKit/ChangeLog

    r233865 r233866  
     12018-07-16  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
     4        https://bugs.webkit.org/show_bug.cgi?id=186531
     5
     6        Reviewed by Tim Horton.
     7
     8        Created WebDataListSuggestionsDropdownMac as a wrapper around the suggestions
     9        view. The suggestions for TextFieldInputTypes are displayed using an NSTableView
     10        in it's own child window. This is done so that suggestions can be presented
     11        outside of the page if the parent window's size is too small. The maximum number
     12        of suggestions that are visible at one time is 6, with additional suggestions made
     13        available by scrolling.
     14
     15        Suggestions in the view can be selected via click or by using arrow keys. If the
     16        input element associated with the suggestions is blurred, or the page is moved in
     17        any way, the suggestions view is hidden.
     18
     19        Added IPC messages to the UIProcess to enable the display of the suggestions view.
     20        This required a new ArgumentCoder for DataListSuggestionInformation.
     21
     22        * Shared/WebCoreArgumentCoders.cpp:
     23        (IPC::ArgumentCoder<DataListSuggestionInformation>::encode):
     24        (IPC::ArgumentCoder<DataListSuggestionInformation>::decode):
     25        * Shared/WebCoreArgumentCoders.h:
     26        * UIProcess/PageClient.h:
     27        * UIProcess/WebDataListSuggestionsDropdown.cpp: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
     28        (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
     29        (WebKit::WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown):
     30        (WebKit::WebDataListSuggestionsDropdown::close):
     31        * UIProcess/WebDataListSuggestionsDropdown.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
     32        (WebKit::WebDataListSuggestionsDropdown::Client::~Client):
     33        * UIProcess/WebPageProxy.cpp:
     34        (WebKit::WebPageProxy::viewWillStartLiveResize):
     35        (WebKit::WebPageProxy::viewDidLeaveWindow):
     36        (WebKit::WebPageProxy::handleWheelEvent):
     37        (WebKit::WebPageProxy::setPageZoomFactor):
     38        (WebKit::WebPageProxy::setPageAndTextZoomFactors):
     39        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
     40        (WebKit::WebPageProxy::pageDidScroll):
     41        (WebKit::WebPageProxy::showDataListSuggestions):
     42        (WebKit::WebPageProxy::handleKeydownInDataList):
     43        (WebKit::WebPageProxy::endDataListSuggestions):
     44        (WebKit::WebPageProxy::didCloseSuggestions):
     45        (WebKit::WebPageProxy::didSelectOption):
     46        (WebKit::WebPageProxy::resetState):
     47        (WebKit::WebPageProxy::closeOverlayedViews):
     48        * UIProcess/WebPageProxy.h:
     49        * UIProcess/WebPageProxy.messages.in:
     50        * UIProcess/ios/PageClientImplIOS.h:
     51        * UIProcess/ios/PageClientImplIOS.mm:
     52        (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
     53        * UIProcess/mac/PageClientImplMac.h:
     54        * UIProcess/mac/PageClientImplMac.mm:
     55        (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
     56        * UIProcess/mac/WebDataListSuggestionsDropdownMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
     57        * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: Added.
     58        (WebKit::WebDataListSuggestionsDropdownMac::create):
     59        (WebKit::WebDataListSuggestionsDropdownMac::~WebDataListSuggestionsDropdownMac):
     60        (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
     61        (WebKit::WebDataListSuggestionsDropdownMac::show):
     62        (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
     63        (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
     64        (WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
     65        (WebKit::WebDataListSuggestionsDropdownMac::close):
     66        (-[WKDataListSuggestionCell initWithFrame:]):
     67        (-[WKDataListSuggestionCell setText:]):
     68        (-[WKDataListSuggestionCell setActive:]):
     69        (-[WKDataListSuggestionCell drawRect:]):
     70        (-[WKDataListSuggestionCell mouseEntered:]):
     71        (-[WKDataListSuggestionCell mouseExited:]):
     72        (-[WKDataListSuggestionCell acceptsFirstResponder]):
     73        (-[WKDataListSuggestionTable initWithElementRect:]):
     74        (-[WKDataListSuggestionTable setVisibleRect:]):
     75        (-[WKDataListSuggestionTable currentActiveRow]):
     76        (-[WKDataListSuggestionTable setActiveRow:]):
     77        (-[WKDataListSuggestionTable reload]):
     78        (-[WKDataListSuggestionTable acceptsFirstResponder]):
     79        (-[WKDataListSuggestionTable enclosingScrollView]):
     80        (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]):
     81        (-[WKDataListSuggestionsView initWithInformation:inView:]):
     82        (-[WKDataListSuggestionsView currentSelectedString]):
     83        (-[WKDataListSuggestionsView updateWithInformation:]):
     84        (-[WKDataListSuggestionsView moveSelectionByDirection:]):
     85        (-[WKDataListSuggestionsView invalidate]):
     86        (-[WKDataListSuggestionsView dropdownRectForElementRect:]):
     87        (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
     88        (-[WKDataListSuggestionsView selectedRow:]):
     89        (-[WKDataListSuggestionsView numberOfRowsInTableView:]):
     90        (-[WKDataListSuggestionsView tableView:heightOfRow:]):
     91        (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]):
     92        * WebKit.xcodeproj/project.pbxproj:
     93        * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
     94        (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
     95        (WebKit::WebDataListSuggestionPicker::didSelectOption):
     96        (WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
     97        (WebKit::WebDataListSuggestionPicker::close):
     98        (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
     99        * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:
     100
    11012018-07-16  Jeremy Jones  <jeremyj@apple.com>
    2102
  • trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp

    r233753 r233866  
    3737#include <WebCore/Credential.h>
    3838#include <WebCore/Cursor.h>
     39#include <WebCore/DataListSuggestionPicker.h>
    3940#include <WebCore/DatabaseDetails.h>
    4041#include <WebCore/DictationAlternative.h>
     
    16321633}
    16331634
     1635#if ENABLE(DATALIST_ELEMENT)
     1636void ArgumentCoder<DataListSuggestionInformation>::encode(Encoder& encoder, const WebCore::DataListSuggestionInformation& info)
     1637{
     1638    encoder.encodeEnum(info.activationType);
     1639    encoder << info.suggestions;
     1640    encoder << info.elementRect;
     1641}
     1642
     1643bool ArgumentCoder<DataListSuggestionInformation>::decode(Decoder& decoder, WebCore::DataListSuggestionInformation& info)
     1644{
     1645    if (!decoder.decodeEnum(info.activationType))
     1646        return false;
     1647
     1648    if (!decoder.decode(info.suggestions))
     1649        return false;
     1650
     1651    if (!decoder.decode(info.elementRect))
     1652        return false;
     1653
     1654    return true;
     1655}
     1656#endif
     1657
    16341658void ArgumentCoder<PasteboardCustomData>::encode(Encoder& encoder, const PasteboardCustomData& data)
    16351659{
  • trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h

    r233863 r233866  
    136136#endif
    137137
     138#if ENABLE(DATALIST_ELEMENT)
     139struct DataListSuggestionInformation;
     140#endif
     141
    138142#if USE(SOUP)
    139143struct SoupNetworkProxySettings;
     
    453457    static bool decode(Decoder&, WebCore::DatabaseDetails&);
    454458};
     459
     460#if ENABLE(DATALIST_ELEMENT)
     461template<> struct ArgumentCoder<WebCore::DataListSuggestionInformation> {
     462    static void encode(Encoder&, const WebCore::DataListSuggestionInformation&);
     463    static bool decode(Decoder&, WebCore::DataListSuggestionInformation&);
     464};
     465#endif
    455466
    456467template<> struct ArgumentCoder<WebCore::DictationAlternative> {
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r232544 r233866  
    2828#include "ShareableBitmap.h"
    2929#include "WebColorPicker.h"
     30#include "WebDataListSuggestionsDropdown.h"
    3031#include "WebPageProxy.h"
    3132#include "WebPopupMenuProxy.h"
     
    8081#if ENABLE(INPUT_TYPE_COLOR)
    8182class WebColorPicker;
     83#endif
     84
     85#if ENABLE(DATALIST_ELEMENT)
     86class WebDataListSuggestionsDropdown;
    8287#endif
    8388
     
    221226#if ENABLE(INPUT_TYPE_COLOR)
    222227    virtual RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0;
     228#endif
     229
     230#if ENABLE(DATALIST_ELEMENT)
     231    virtual RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) = 0;
    223232#endif
    224233
  • trunk/Source/WebKit/UIProcess/WebDataListSuggestionsDropdown.cpp

    r233865 r233866  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "WebDataListSuggestionsDropdown.h"
    2728
    2829#if ENABLE(DATALIST_ELEMENT)
    2930
    30 #include <WebCore/DataListSuggestionPicker.h>
    31 #include <wtf/text/WTFString.h>
     31namespace WebKit {
    3232
    33 namespace WebCore {
    34 class DataListSuggestionsClient;
     33WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown(Client& client)
     34    : m_client(&client)
     35{
    3536}
    3637
    37 namespace WebKit {
     38WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown()
     39{
     40}
    3841
    39 class WebPage;
    40 
    41 class WebDataListSuggestionPicker : public WebCore::DataListSuggestionPicker {
    42 public:
    43     WebDataListSuggestionPicker(WebPage*, WebCore::DataListSuggestionsClient*);
    44     virtual ~WebDataListSuggestionPicker();
    45 
    46     void handleKeydownWithIdentifier(const String&) override;
    47     void didSelectOption(const String&);
    48     void didCloseSuggestions();
    49     void close() override;
    50     void displayWithActivationType(WebCore::DataListSuggestionActivationType) override;
    51 private:
    52     __unused WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
    53     __unused WebPage* m_page;
    54 };
     42void WebDataListSuggestionsDropdown::close()
     43{
     44    m_client->didCloseSuggestions();
     45    m_client = nullptr;
     46}
    5547
    5648} // namespace WebKit
    5749
    58 #endif
     50#endif // ENABLE(DATALIST_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebDataListSuggestionsDropdown.h

    r233865 r233866  
    2929
    3030#include <WebCore/DataListSuggestionPicker.h>
    31 #include <wtf/text/WTFString.h>
    32 
    33 namespace WebCore {
    34 class DataListSuggestionsClient;
    35 }
     31#include <wtf/RefCounted.h>
     32#include <wtf/RefPtr.h>
    3633
    3734namespace WebKit {
    3835
    39 class WebPage;
     36class WebDataListSuggestionsDropdown : public RefCounted<WebDataListSuggestionsDropdown> {
     37public:
     38    class Client {
     39    protected:
     40        virtual ~Client() { }
    4041
    41 class WebDataListSuggestionPicker : public WebCore::DataListSuggestionPicker {
    42 public:
    43     WebDataListSuggestionPicker(WebPage*, WebCore::DataListSuggestionsClient*);
    44     virtual ~WebDataListSuggestionPicker();
     42    public:
     43        virtual void didSelectOption(String&) = 0;
     44        virtual void didCloseSuggestions() = 0;
     45    };
    4546
    46     void handleKeydownWithIdentifier(const String&) override;
    47     void didSelectOption(const String&);
    48     void didCloseSuggestions();
    49     void close() override;
    50     void displayWithActivationType(WebCore::DataListSuggestionActivationType) override;
    51 private:
    52     __unused WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
    53     __unused WebPage* m_page;
     47    virtual ~WebDataListSuggestionsDropdown();
     48
     49    virtual void show(WebCore::DataListSuggestionInformation&&) = 0;
     50    virtual void handleKeydownWithIdentifier(const String&) = 0;
     51    virtual void close();
     52
     53protected:
     54    explicit WebDataListSuggestionsDropdown(Client&);
     55
     56    Client* m_client;
    5457};
    5558
    5659} // namespace WebKit
    5760
    58 #endif
     61#endif // ENABLE(DATALIST_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r233865 r233866  
    14471447    if (!isValid())
    14481448        return;
    1449 #if ENABLE(INPUT_TYPE_COLOR_POPOVER) && ENABLE(INPUT_TYPE_COLOR)
    1450     if (m_colorPicker)
    1451         endColorPicker();
    1452 #endif
     1449
     1450    closeOverlayedViews();
    14531451    m_process->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
    14541452}
     
    15371535void WebPageProxy::viewDidLeaveWindow()
    15381536{
    1539 #if ENABLE(INPUT_TYPE_COLOR_POPOVER) && ENABLE(INPUT_TYPE_COLOR)
    1540     // When leaving the current page, close the popover color well.
    1541     if (m_colorPicker)
    1542         endColorPicker();
    1543 #endif
     1537    closeOverlayedViews();
    15441538#if PLATFORM(IOS) && HAVE(AVKIT) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    15451539    // When leaving the current page, close the video fullscreen.
     
    20632057        return;
    20642058
    2065     hideValidationMessage();
     2059    closeOverlayedViews();
    20662060
    20672061    if (!m_currentlyProcessedWheelEvents.isEmpty()) {
     
    26932687        return;
    26942688
    2695     hideValidationMessage();
     2689    closeOverlayedViews();
    26962690
    26972691    m_pageZoomFactor = zoomFactor;
     
    27072701        return;
    27082702
    2709     hideValidationMessage();
     2703    closeOverlayedViews();
    27102704
    27112705    m_pageZoomFactor = pageZoomFactor;
     
    34653459        m_pageLoadState.didStartProvisionalLoad(transaction, url, unreachableURL);
    34663460        m_pageClient.didStartProvisionalLoadForMainFrame();
    3467         hideValidationMessage();
     3461        closeOverlayedViews();
    34683462    }
    34693463
     
    45564550        return;
    45574551#endif
    4558     hideValidationMessage();
     4552    closeOverlayedViews();
    45594553}
    45604554
     
    47504744    m_process->send(Messages::WebPage::DidEndColorPicker(), m_pageID);
    47514745}
     4746#endif
     4747
     4748#if ENABLE(DATALIST_ELEMENT)
     4749
     4750void WebPageProxy::showDataListSuggestions(WebCore::DataListSuggestionInformation&& info)
     4751{
     4752    if (!m_dataListSuggestionsDropdown)
     4753        m_dataListSuggestionsDropdown = m_pageClient.createDataListSuggestionsDropdown(*this);
     4754
     4755    m_dataListSuggestionsDropdown->show(WTFMove(info));
     4756}
     4757
     4758void WebPageProxy::handleKeydownInDataList(const String& key)
     4759{
     4760    if (!m_dataListSuggestionsDropdown)
     4761        return;
     4762
     4763    m_dataListSuggestionsDropdown->handleKeydownWithIdentifier(key);
     4764}
     4765
     4766void WebPageProxy::endDataListSuggestions()
     4767{
     4768    if (m_dataListSuggestionsDropdown)
     4769        m_dataListSuggestionsDropdown->close();
     4770}
     4771
     4772void WebPageProxy::didCloseSuggestions()
     4773{
     4774    if (!m_dataListSuggestionsDropdown)
     4775        return;
     4776
     4777    m_dataListSuggestionsDropdown = nullptr;
     4778    m_process->send(Messages::WebPage::DidCloseSuggestions(), m_pageID);
     4779}
     4780
     4781void WebPageProxy::didSelectOption(String& selectedOption)
     4782{
     4783    if (!isValid())
     4784        return;
     4785
     4786    m_process->send(Messages::WebPage::DidSelectDataListOption(selectedOption), m_pageID);
     4787}
     4788
    47524789#endif
    47534790
     
    59786015#endif
    59796016    m_drawingArea = nullptr;
    5980     hideValidationMessage();
     6017    closeOverlayedViews();
    59816018
    59826019    if (m_inspector) {
     
    75337570#endif
    75347571}
    7535    
     7572
     7573// FIXME: Consolidate with dismissContentRelativeChildWindows
     7574void WebPageProxy::closeOverlayedViews()
     7575{
     7576    hideValidationMessage();
     7577
     7578#if ENABLE(DATALIST_ELEMENT)
     7579    endDataListSuggestions();
     7580#endif
     7581
     7582#if ENABLE(INPUT_TYPE_COLOR_POPOVER) && ENABLE(INPUT_TYPE_COLOR)
     7583    if (m_colorPicker)
     7584        endColorPicker();
     7585#endif
     7586}
     7587
    75367588#if ENABLE(POINTER_LOCK)
    75377589void WebPageProxy::requestPointerLock()
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r233865 r233866  
    5555#include "WebContextMenuItemData.h"
    5656#include "WebCoreArgumentCoders.h"
     57#include "WebDataListSuggestionsDropdown.h"
    5758#include "WebFrameProxy.h"
    5859#include "WebPageCreationParameters.h"
     
    178179struct ApplicationManifest;
    179180struct BackForwardItemIdentifier;
     181struct DataListSuggestionInformation;
    180182struct DictionaryPopupInfo;
    181183struct ExceptionDetails;
     
    322324#if ENABLE(INPUT_TYPE_COLOR)
    323325    , public WebColorPicker::Client
     326#endif
     327#if ENABLE(DATALIST_ELEMENT)
     328    , public WebDataListSuggestionsDropdown::Client
    324329#endif
    325330#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
     
    15161521#endif
    15171522
     1523#if ENABLE(DATALIST_ELEMENT)
     1524    void showDataListSuggestions(WebCore::DataListSuggestionInformation&&);
     1525    void handleKeydownInDataList(const String&);
     1526    void endDataListSuggestions();
     1527    void didSelectOption(String&) final;
     1528    void didCloseSuggestions() final;
     1529#endif
     1530
     1531    void closeOverlayedViews();
     1532
    15181533    void compositionWasCanceled();
    15191534    void setHasHadSelectionChangesFromUserInteraction(bool);
     
    20322047    RefPtr<WebColorPicker> m_colorPicker;
    20332048#endif
     2049#if ENABLE(DATALIST_ELEMENT)
     2050    RefPtr<WebDataListSuggestionsDropdown> m_dataListSuggestionsDropdown;
     2051#endif
    20342052#if PLATFORM(COCOA)
    20352053    RefPtr<WebCore::ValidationBubble> m_validationBubble;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r233865 r233866  
    9999#endif
    100100
     101#if ENABLE(DATALIST_ELEMENT)
     102    ShowDataListSuggestions(struct WebCore::DataListSuggestionInformation suggestionInformation);
     103    HandleKeydownInDataList(String key);
     104    EndDataListSuggestions();
     105#endif
     106
    101107    # Policy messages
    102108    DecidePolicyForResponse(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData)
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h

    r232544 r233866  
    101101    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
    102102
     103#if ENABLE(DATALIST_ELEMENT)
     104    RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) final;
     105#endif
     106
    103107    void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
    104108    void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm

    r233751 r233866  
    765765}
    766766
     767#if ENABLE(DATALIST_ELEMENT)
     768RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page)
     769{
     770    return nullptr;
     771}
     772#endif
     773
    767774#if ENABLE(DATA_INTERACTION)
    768775void PageClientImpl::didPerformDataInteractionControllerOperation(bool handled)
  • trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h

    r232416 r233866  
    133133#endif
    134134
     135#if ENABLE(DATALIST_ELEMENT)
     136    RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) override;
     137#endif
     138
    135139    Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
    136140
  • trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm

    r232416 r233866  
    4949#import "WebColorPickerMac.h"
    5050#import "WebContextMenuProxyMac.h"
     51#import "WebDataListSuggestionsDropdownMac.h"
    5152#import "WebEditCommandProxy.h"
    5253#import "WebPopupMenuProxyMac.h"
     
    459460#endif
    460461
     462#if ENABLE(DATALIST_ELEMENT)
     463RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page)
     464{
     465    return WebDataListSuggestionsDropdownMac::create(page, m_view);
     466}
     467#endif
     468
    461469Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message, const ValidationBubble::Settings& settings)
    462470{
  • trunk/Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.h

    r233865 r233866  
    2626#pragma once
    2727
    28 #if ENABLE(DATALIST_ELEMENT)
     28#if ENABLE(DATALIST_ELEMENT) && USE(APPKIT)
    2929
    30 #include <WebCore/DataListSuggestionPicker.h>
    31 #include <wtf/text/WTFString.h>
     30#import "WebDataListSuggestionsDropdown.h"
     31#import <wtf/RetainPtr.h>
    3232
    33 namespace WebCore {
    34 class DataListSuggestionsClient;
    35 }
     33OBJC_CLASS WKDataListSuggestionsView;
    3634
    3735namespace WebKit {
    3836
    39 class WebPage;
     37class WebDataListSuggestionsDropdownMac final : public WebDataListSuggestionsDropdown {
     38public:
     39    static Ref<WebDataListSuggestionsDropdownMac> create(WebDataListSuggestionsDropdown::Client&, NSView *);
     40    ~WebDataListSuggestionsDropdownMac();
    4041
    41 class WebDataListSuggestionPicker : public WebCore::DataListSuggestionPicker {
    42 public:
    43     WebDataListSuggestionPicker(WebPage*, WebCore::DataListSuggestionsClient*);
    44     virtual ~WebDataListSuggestionPicker();
     42    void didSelectOption(String&);
    4543
    46     void handleKeydownWithIdentifier(const String&) override;
    47     void didSelectOption(const String&);
    48     void didCloseSuggestions();
    49     void close() override;
    50     void displayWithActivationType(WebCore::DataListSuggestionActivationType) override;
    5144private:
    52     __unused WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
    53     __unused WebPage* m_page;
     45    WebDataListSuggestionsDropdownMac(WebDataListSuggestionsDropdown::Client&, NSView *);
     46
     47    void show(WebCore::DataListSuggestionInformation&&) final;
     48    void handleKeydownWithIdentifier(const String&) final;
     49    void close() final;
     50
     51    void selectOption();
     52
     53    NSView *m_view;
     54    RetainPtr<WKDataListSuggestionsView> m_dropdownUI;
    5455};
    5556
    5657} // namespace WebKit
    5758
    58 #endif
     59#endif // ENABLE(DATALIST_ELEMENT) && USE(APPKIT)
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r233770 r233866  
    21862186                E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; };
    21872187                E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */; };
     2188                E54A14CF20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */; };
     2189                E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */; };
     2190                E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */; };
     2191                E568B92320A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */; };
    21882192                ECA680D81E690E2500731D20 /* WebProcessCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = ECA680D71E690DF800731D20 /* WebProcessCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
    21892193                ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    48254829                E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionPicker.h; sourceTree = "<group>"; };
    48264830                E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionPicker.cpp; sourceTree = "<group>"; };
     4831                E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionsDropdown.cpp; sourceTree = "<group>"; };
     4832                E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdown.h; sourceTree = "<group>"; };
     4833                E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdownMac.h; sourceTree = "<group>"; };
     4834                E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = WebDataListSuggestionsDropdownMac.mm; sourceTree = "<group>"; };
    48274835                ECA680D31E6904B500731D20 /* ExtraPrivateSymbolsForTAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtraPrivateSymbolsForTAPI.h; sourceTree = "<group>"; };
    48284836                ECA680D71E690DF800731D20 /* WebProcessCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebProcessCocoa.h; sourceTree = "<group>"; };
     
    74807488                                33AA1064131F060000D4A575 /* WebCookieManagerProxyClient.cpp */,
    74817489                                33AA1065131F060000D4A575 /* WebCookieManagerProxyClient.h */,
     7490                                E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */,
     7491                                E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */,
    74827492                                BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */,
    74837493                                BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */,
     
    82588268                                51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */,
    82598269                                F6D632BA133D181B00743D77 /* WebCookieManagerProxyMac.mm */,
     8270                                E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */,
     8271                                E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */,
    82608272                                1CA8B935127C774E00576C2B /* WebInspectorProxyMac.mm */,
    82618273                                BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */,
     
    94469458                                1AA83F6D1A5B63FF00026EC6 /* WebDatabaseProvider.h in Headers */,
    94479459                                E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */,
     9460                                E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */,
     9461                                E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */,
    94489462                                CD19A26E1A13E834008D650E /* WebDiagnosticLoggingClient.h in Headers */,
    94499463                                1A5B1C5518987EDF004FCF9B /* WebDocumentLoader.h in Headers */,
     
    1125411268                                1AA83F6C1A5B63FF00026EC6 /* WebDatabaseProvider.cpp in Sources */,
    1125511269                                E52CF55320A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp in Sources */,
     11270                                E54A14CF20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp in Sources */,
     11271                                E568B92320A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm in Sources */,
    1125611272                                CD19A26D1A13E82A008D650E /* WebDiagnosticLoggingClient.cpp in Sources */,
    1125711273                                1A5B1C5418987EDF004FCF9B /* WebDocumentLoader.cpp in Sources */,
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp

    r232640 r233866  
    2929#if ENABLE(DATALIST_ELEMENT)
    3030
     31#include "WebCoreArgumentCoders.h"
    3132#include "WebPage.h"
    3233#include "WebPageProxyMessages.h"
     
    4849void WebDataListSuggestionPicker::handleKeydownWithIdentifier(const WTF::String& key)
    4950{
    50 
     51    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::HandleKeydownInDataList(key), m_page->pageID());
    5152}
    5253
    5354void WebDataListSuggestionPicker::didSelectOption(const WTF::String& selectedOption)
    5455{
    55 
     56    m_dataListSuggestionsClient->didSelectDataListOption(selectedOption);
    5657}
    5758
    5859void WebDataListSuggestionPicker::didCloseSuggestions()
    5960{
    60 
     61    m_dataListSuggestionsClient->didCloseSuggestions();
    6162}
    6263
    6364void WebDataListSuggestionPicker::close()
    6465{
    65 
     66    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::EndDataListSuggestions(), m_page->pageID());
    6667}
    6768
    6869void WebDataListSuggestionPicker::displayWithActivationType(DataListSuggestionActivationType type)
    6970{
     71    if (!m_dataListSuggestionsClient->suggestions().size()) {
     72        close();
     73        return;
     74    }
    7075
     76    m_page->setActiveDataListSuggestionPicker(this);
     77
     78    DataListSuggestionInformation info = { type, m_dataListSuggestionsClient->suggestions(), m_dataListSuggestionsClient->elementRectInRootViewCoordinates() };
     79    WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowDataListSuggestions(info), m_page->pageID());
    7180}
    7281
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h

    r232640 r233866  
    5050    void displayWithActivationType(WebCore::DataListSuggestionActivationType) override;
    5151private:
    52     __unused WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
    53     __unused WebPage* m_page;
     52    WebCore::DataListSuggestionsClient* m_dataListSuggestionsClient;
     53    WebPage* m_page;
    5454};
    5555
  • trunk/Tools/ChangeLog

    r233856 r233866  
     12018-07-16  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
     4        https://bugs.webkit.org/show_bug.cgi?id=186531
     5
     6        Reviewed by Tim Horton.
     7
     8        Added isShowingDatalistSuggestions testing hook in order to enable testing of the
     9        visibility of the suggestions view.
     10
     11        * DumpRenderTree/mac/UIScriptControllerMac.mm:
     12        (WTR::UIScriptController::isShowingDataListSuggestions const):
     13        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
     14        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     15        (WTR::UIScriptController::isShowingDataListSuggestions const):
     16        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     17        * WebKitTestRunner/mac/UIScriptControllerMac.mm:
     18        (WTR::UIScriptController::isShowingDataListSuggestions const):
     19
    1202018-07-16  Yusuke Suzuki  <utatane.tea@gmail.com>
    221
  • trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm

    r232452 r233866  
    181181}
    182182
     183bool UIScriptController::isShowingDataListSuggestions() const
     184{
     185    return false;
     186}
     187
    183188}
    184189
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r232968 r233866  
    196196    void setTimePickerValue(long hour, long minute);
    197197
     198    // <datalist>
     199    readonly attribute boolean isShowingDataListSuggestions;
     200
    198201    void keyboardAccessoryBarNext();
    199202    void keyboardAccessoryBarPrevious();
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r232968 r233866  
    518518}
    519519
     520bool UIScriptController::isShowingDataListSuggestions() const
     521{
     522    return false;
     523}
     524
    520525#endif
    521526
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r232968 r233866  
    103103    JSRetainPtr<JSStringRef> formInputLabel() const;
    104104    void setTimePickerValue(long hour, long minute);
    105    
     105
     106    bool isShowingDataListSuggestions() const;
     107
    106108    JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;
    107109    void overridePreference(JSStringRef preference, JSStringRef value);
  • trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm

    r232452 r233866  
    169169}
    170170
     171bool UIScriptController::isShowingDataListSuggestions() const
     172{
     173#if WK_API_ENABLED
     174    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     175    for (NSWindow *childWindow in webView.window.childWindows) {
     176        if ([childWindow isKindOfClass:NSClassFromString(@"WKDataListSuggestionWindow")])
     177            return true;
     178    }
     179#endif
     180    return false;
     181}
     182
    171183void UIScriptController::removeViewFromWindow(JSValueRef callback)
    172184{
Note: See TracChangeset for help on using the changeset viewer.