ChangeLog

 12019-07-30 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [GTK] Datalist element support for TextFieldInputType
 4 https://bugs.webkit.org/show_bug.cgi?id=98934
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Enable DATALIST_ELEMENT.
 9
 10 * Source/cmake/OptionsGTK.cmake:
 11
1122019-07-24 Fujii Hironori <fujii.hironori@gmail.com>
213
314 [CMake] CMAKE_SHARED_LINKER_FLAGS drops "-Wl,--no-undefined"

LayoutTests/ChangeLog

 12019-07-30 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [GTK] Datalist element support for TextFieldInputType
 4 https://bugs.webkit.org/show_bug.cgi?id=98934
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Unskip datalist tests for GTK port.
 9
 10 * platform/gtk/TestExpectations:
 11
1122019-07-28 Tim Horton <timothy_horton@apple.com>
213
314 Reorganize UIScriptController into platform-specific subclasses

LayoutTests/platform/gtk/TestExpectations

@@webkit.org/b/98927 fast/dom/DeviceOrientation [ Skip ]
177177fast/history/page-cache-notification-non-suspendable.html
178178fast/history/page-cache-notification-suspendable.html
179179
180 # Datalist is not yet enabled.
181 accessibility/datalist.html [ Skip ]
182 webkit.org/b/98934 fast/forms/datalist [ Skip ]
183 
184180# ENABLE_INPUT_TYPE_* are not enabled.
185181webkit.org/b/98936 fast/forms/date [ Skip ]
186182webkit.org/b/98936 fast/forms/datetime [ Skip ]

@@webkit.org/b/199009 fast/text/variations/optical-sizing-units.html [ ImageOnlyFa
37993795webkit.org/b/199859 imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-001.html [ ImageOnlyFailure ]
38003796
38013797webkit.org/b/199860 accessibility/button-with-aria-haspopup-role.html [ Failure ]
 3798webkit.org/b/199860 accessibility/datalist.html [ Failure ]
38023799webkit.org/b/199868 accessibility/gtk/aria-haspopup.html [ Failure ]
38033800
38043801webkit.org/b/199440 fast/mediastream/apply-constraints-video.html [ Failure ]

Source/WebCore/ChangeLog

 12019-07-30 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [GTK] Datalist element support for TextFieldInputType
 4 https://bugs.webkit.org/show_bug.cgi?id=98934
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add support for rendering the arrow indicator of text fields having data list.
 9
 10 * rendering/RenderThemeGtk.cpp:
 11 (WebCore::RenderThemeGtk::paintTextField):
 12 (WebCore::RenderThemeGtk::adjustListButtonStyle const):
 13 (WebCore::RenderThemeGtk::paintListButtonForInput):
 14 (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
 15 * rendering/RenderThemeGtk.h:
 16
1172019-07-29 Carlos Garcia Campos <cgarcia@igalia.com>
218
319 WebSockets: workers never use the platform WebSockets path

Source/WebCore/rendering/RenderThemeGtk.cpp

@@bool RenderThemeGtk::paintTextField(const RenderObject& renderObject, const Pain
520520 auto& entryWidget = static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Entry));
521521 entryWidget.entry().setState(themePartStateFlags(*this, Entry, renderObject));
522522 entryWidget.entry().render(paintInfo.context().platformContext()->cr(), rect);
 523
 524#if ENABLE(DATALIST_ELEMENT)
 525 if (is<HTMLInputElement>(renderObject.generatingNode())) {
 526 const auto& input = downcast<HTMLInputElement>(*(renderObject.generatingNode()));
 527 if (input.list())
 528 paintListButtonForInput(renderObject, paintInfo, rect);
 529 }
 530#endif
523531 }
524532 return false;
525533}

@@bool RenderThemeGtk::paintSearchFieldCancelButton(const RenderBox& renderObject,
597605 return paintSearchFieldIcon(this, EntryIconRight, renderObject, paintInfo, rect);
598606}
599607
 608#if ENABLE(DATALIST_ELEMENT)
 609void RenderThemeGtk::adjustListButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
 610{
 611 // Add a margin to place the button at end of the input field.
 612 if (style.isLeftToRightDirection())
 613 style.setMarginRight(Length(-4, Fixed));
 614 else
 615 style.setMarginLeft(Length(-4, Fixed));
 616}
 617
 618void RenderThemeGtk::paintListButtonForInput(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect)
 619{
 620 // Use a combo box widget to render its arrow.
 621 auto& comboWidget = static_cast<RenderThemeComboBox&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ComboBox));
 622 comboWidget.arrow().setState(themePartStateFlags(*this, ComboBoxButton, renderObject));
 623
 624 // But a search entry widget to get the contents rect, since this is a text input field.
 625 auto& searchEntryWidget = static_cast<RenderThemeSearchEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SearchEntry));
 626 auto& icon = static_cast<RenderThemeIconGadget&>(searchEntryWidget.rightIcon());
 627 icon.setIconSize(comboWidget.arrow().preferredSize().width());
 628 GtkBorder contentsBox = searchEntryWidget.entry().contentsBox();
 629 FloatRect adjustedRect(rect);
 630 adjustedRect.move(contentsBox.left, contentsBox.top);
 631 adjustedRect.contract(contentsBox.right + 1, contentsBox.top + contentsBox.bottom);
 632 comboWidget.arrow().render(paintInfo.context().platformContext()->cr(), adjustedRect);
 633}
 634#endif
 635
600636void RenderThemeGtk::adjustSearchFieldStyle(StyleResolver&, RenderStyle& style, const Element*) const
601637{
602638 // We cannot give a proper rendering when border radius is active, unfortunately.

Source/WebCore/rendering/RenderThemeGtk.h

@@private:
143143 void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
144144 bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
145145
 146#if ENABLE(DATALIST_ELEMENT)
 147 void paintListButtonForInput(const RenderObject&, const PaintInfo&, const FloatRect&);
 148 void adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
 149#endif
 150
146151 bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
147152 void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const override;
148153

Source/WebKit/ChangeLog

 12019-07-30 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [GTK] Datalist element support for TextFieldInputType
 4 https://bugs.webkit.org/show_bug.cgi?id=98934
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add a WebDataListSuggestionsDropdown implementation for the GTK port using a popup window with a tree view list.
 9
 10 * Sources.txt:
 11 * SourcesGTK.txt:
 12 * UIProcess/API/gtk/PageClientImpl.cpp:
 13 (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
 14 * UIProcess/API/gtk/PageClientImpl.h:
 15 * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: Added.
 16 (WebKit::firstTimeItemSelectedCallback):
 17 (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk):
 18 (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk):
 19 (WebKit::WebDataListSuggestionsDropdownGtk::treeViewRowActivatedCallback):
 20 (WebKit::WebDataListSuggestionsDropdownGtk::didSelectOption):
 21 (WebKit::WebDataListSuggestionsDropdownGtk::show):
 22 (WebKit::WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier):
 23 (WebKit::WebDataListSuggestionsDropdownGtk::close):
 24 * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: Copied from Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h.
 25
1262019-07-27 Chris Dumez <cdumez@apple.com>
227
328 Allow more syscalls in the WebContent process' sandbox profile

Source/WebKit/Sources.txt

@@UIProcess/WebContextMenuListenerProxy.cpp
268268UIProcess/WebContextMenuProxy.cpp
269269UIProcess/WebCookieManagerProxy.cpp
270270UIProcess/WebCookieManagerProxyClient.cpp
 271UIProcess/WebDataListSuggestionsDropdown.cpp
271272UIProcess/WebEditCommandProxy.cpp
272273UIProcess/WebFormClient.cpp
273274UIProcess/WebFormSubmissionListenerProxy.cpp

@@WebProcess/WebCoreSupport/SessionStateConversion.cpp
532533WebProcess/WebCoreSupport/WebChromeClient.cpp
533534WebProcess/WebCoreSupport/WebColorChooser.cpp
534535WebProcess/WebCoreSupport/WebContextMenuClient.cpp
 536WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp
535537WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp
536538WebProcess/WebCoreSupport/WebDragClient.cpp
537539WebProcess/WebCoreSupport/WebEditorClient.cpp

Source/WebKit/SourcesGTK.txt

@@UIProcess/gtk/ViewSnapshotStoreGtk.cpp
251251UIProcess/gtk/WaylandCompositor.cpp @no-unify
252252UIProcess/gtk/WebColorPickerGtk.cpp
253253UIProcess/gtk/WebContextMenuProxyGtk.cpp
 254UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp
254255UIProcess/gtk/WebInspectorProxyGtk.cpp
255256UIProcess/gtk/WebKitInspectorWindow.cpp
256257UIProcess/gtk/WebPageProxyGtk.cpp @no-unify

Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp

3535#include "ViewSnapshotStore.h"
3636#include "WebColorPickerGtk.h"
3737#include "WebContextMenuProxyGtk.h"
 38#include "WebDataListSuggestionsDropdownGtk.h"
3839#include "WebEventFactory.h"
3940#include "WebKitColorChooser.h"
4041#include "WebKitPopupMenu.h"

@@RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, con
250251 return WebColorPickerGtk::create(*page, color, rect);
251252}
252253
 254#if ENABLE(DATALIST_ELEMENT)
 255RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page)
 256{
 257 return WebDataListSuggestionsDropdownGtk::create(m_viewWidget, page);
 258}
 259#endif
 260
253261void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
254262{
255263 webkitWebViewBaseEnterAcceleratedCompositingMode(WEBKIT_WEB_VIEW_BASE(m_viewWidget), layerTreeContext);

Source/WebKit/UIProcess/API/gtk/PageClientImpl.h

@@private:
9393 Ref<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, ContextMenuContextData&&, const UserData&) override;
9494#if ENABLE(INPUT_TYPE_COLOR)
9595 RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&, Vector<WebCore::Color>&&) override;
 96#endif
 97#if ENABLE(DATALIST_ELEMENT)
 98 RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) override;
9699#endif
97100 void selectionDidChange() override;
98101 RefPtr<ViewSnapshot> takeViewSnapshot() override;

Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp

 1/*
 2 * Copyright (C) 2019 Igalia S.L.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "WebDataListSuggestionsDropdownGtk.h"
 28
 29#if ENABLE(DATALIST_ELEMENT)
 30
 31#include <WebCore/DataListSuggestionInformation.h>
 32#include <wtf/glib/GRefPtr.h>
 33#include <wtf/glib/GUniquePtr.h>
 34
 35namespace WebKit {
 36
 37static void firstTimeItemSelectedCallback(GtkTreeSelection* selection, GtkWidget* treeView)
 38{
 39 if (gtk_widget_is_focus(treeView))
 40 gtk_tree_selection_unselect_all(selection);
 41 g_signal_handlers_disconnect_by_func(selection, reinterpret_cast<gpointer>(firstTimeItemSelectedCallback), treeView);
 42}
 43
 44WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk(GtkWidget* webView, WebPageProxy& page)
 45 : WebDataListSuggestionsDropdown(page)
 46 , m_webView(webView)
 47{
 48 GRefPtr<GtkListStore> model = adoptGRef(gtk_list_store_new(1, G_TYPE_STRING));
 49 m_treeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model.get()));
 50 auto* treeView = GTK_TREE_VIEW(m_treeView);
 51 g_signal_connect(treeView, "row-activated", G_CALLBACK(treeViewRowActivatedCallback), this);
 52 gtk_tree_view_set_enable_search(treeView, FALSE);
 53 gtk_tree_view_set_activate_on_single_click(treeView, TRUE);
 54 gtk_tree_view_set_hover_selection(treeView, TRUE);
 55 gtk_tree_view_set_headers_visible(treeView, FALSE);
 56 gtk_tree_view_insert_column_with_attributes(treeView, 0, nullptr, gtk_cell_renderer_text_new(), "text", 0, nullptr);
 57
 58 auto* selection = gtk_tree_view_get_selection(treeView);
 59 // The first time it's shown the first item is always selected, so we connect to selection changed to unselect it.
 60 g_signal_connect_object(selection, "changed", G_CALLBACK(firstTimeItemSelectedCallback), treeView, static_cast<GConnectFlags>(0));
 61 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
 62
 63 auto* swindow = gtk_scrolled_window_new(nullptr, nullptr);
 64 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 65 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swindow), GTK_SHADOW_ETCHED_IN);
 66 gtk_container_add(GTK_CONTAINER(swindow), m_treeView);
 67 gtk_widget_show(m_treeView);
 68
 69 m_popup = gtk_window_new(GTK_WINDOW_POPUP);
 70 gtk_window_set_type_hint(GTK_WINDOW(m_popup), GDK_WINDOW_TYPE_HINT_COMBO);
 71 gtk_window_set_resizable(GTK_WINDOW(m_popup), FALSE);
 72 gtk_container_add(GTK_CONTAINER(m_popup), swindow);
 73 gtk_widget_show(swindow);
 74
 75 g_signal_connect_object(m_webView, "focus-out-event", G_CALLBACK(gtk_widget_hide), m_popup, G_CONNECT_SWAPPED);
 76 g_signal_connect_object(m_webView, "unmap-event", G_CALLBACK(gtk_widget_hide), m_popup, G_CONNECT_SWAPPED);
 77
 78#if ENABLE(DEVELOPER_MODE)
 79 g_object_set_data(G_OBJECT(m_webView), "wk-datalist-popup", m_popup);
 80#endif
 81}
 82
 83WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk()
 84{
 85 gtk_window_set_transient_for(GTK_WINDOW(m_popup), nullptr);
 86 gtk_window_set_attached_to(GTK_WINDOW(m_popup), nullptr);
 87#if ENABLE(DEVELOPER_MODE)
 88 g_object_set_data(G_OBJECT(m_webView), "wk-datalist-popup", nullptr);
 89#endif
 90 gtk_widget_destroy(m_popup);
 91}
 92
 93void WebDataListSuggestionsDropdownGtk::treeViewRowActivatedCallback(GtkTreeView* treeView, GtkTreePath* path, GtkTreeViewColumn*, WebDataListSuggestionsDropdownGtk* menu)
 94{
 95 auto* model = gtk_tree_view_get_model(treeView);
 96 GtkTreeIter iter;
 97 gtk_tree_model_get_iter(model, &iter, path);
 98 GUniqueOutPtr<char> item;
 99 gtk_tree_model_get(model, &iter, 0, &item.outPtr(), -1);
 100
 101 menu->didSelectOption(String::fromUTF8(item.get()));
 102}
 103
 104void WebDataListSuggestionsDropdownGtk::didSelectOption(const String& selectedOption)
 105{
 106 if (!m_page)
 107 return;
 108
 109 m_page->didSelectOption(selectedOption);
 110 close();
 111}
 112
 113void WebDataListSuggestionsDropdownGtk::show(WebCore::DataListSuggestionInformation&& information)
 114{
 115 auto* model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(m_treeView)));
 116 gtk_list_store_clear(model);
 117 for (const auto& suggestion : information.suggestions) {
 118 GtkTreeIter iter;
 119 gtk_list_store_append(model, &iter);
 120 gtk_list_store_set(model, &iter, 0, suggestion.utf8().data(), -1);
 121 }
 122
 123 GtkRequisition treeViewRequisition;
 124 gtk_widget_get_preferred_size(m_treeView, &treeViewRequisition, nullptr);
 125 auto* column = gtk_tree_view_get_column(GTK_TREE_VIEW(m_treeView), 0);
 126 gint itemHeight;
 127 gtk_tree_view_column_cell_get_size(column, nullptr, nullptr, nullptr, nullptr, &itemHeight);
 128 gint verticalSeparator;
 129 gtk_widget_style_get(m_treeView, "vertical-separator", &verticalSeparator, nullptr);
 130 itemHeight += verticalSeparator;
 131 if (!itemHeight)
 132 return;
 133
 134 auto* display = gtk_widget_get_display(m_webView);
 135 auto* monitor = gdk_display_get_monitor_at_window(display, gtk_widget_get_window(m_webView));
 136 GdkRectangle area;
 137 gdk_monitor_get_workarea(monitor, &area);
 138 int width = std::min(information.elementRect.width(), area.width);
 139 size_t itemCount = std::min<size_t>(information.suggestions.size(), (area.height / 3) / itemHeight);
 140
 141 auto* swindow = GTK_SCROLLED_WINDOW(gtk_bin_get_child(GTK_BIN(m_popup)));
 142 // Disable scrollbars when there's only one item to ensure the scrolled window doesn't take them into account when calculating its minimum size.
 143 gtk_scrolled_window_set_policy(swindow, GTK_POLICY_NEVER, itemCount > 1 ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER);
 144 gtk_widget_realize(m_treeView);
 145 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(m_treeView));
 146 gtk_scrolled_window_set_min_content_width(swindow, width);
 147 gtk_widget_set_size_request(m_popup, width, -1);
 148 gtk_scrolled_window_set_min_content_height(swindow, itemCount * itemHeight);
 149
 150 GtkRequisition menuRequisition;
 151 gtk_widget_get_preferred_size(m_popup, &menuRequisition, nullptr);
 152 IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, information.elementRect.location());
 153 // FIXME: We can't ensure the menu will be on screen in Wayland.
 154 // https://blog.gtk.org/2016/07/15/future-of-relative-window-positioning/
 155 // https://gitlab.gnome.org/GNOME/gtk/issues/997
 156 if (menuPosition.x() + menuRequisition.width > area.x + area.width)
 157 menuPosition.setX(area.x + area.width - menuRequisition.width);
 158
 159 if (menuPosition.y() + information.elementRect.height() + menuRequisition.height <= area.y + area.height
 160 || menuPosition.y() - area.y < (area.y + area.height) - (menuPosition.y() + information.elementRect.height()))
 161 menuPosition.move(0, information.elementRect.height());
 162 else
 163 menuPosition.move(0, -menuRequisition.height);
 164 gtk_window_move(GTK_WINDOW(m_popup), menuPosition.x(), menuPosition.y());
 165
 166 auto* toplevel = gtk_widget_get_toplevel(m_webView);
 167 if (GTK_IS_WINDOW(toplevel)) {
 168 gtk_window_set_transient_for(GTK_WINDOW(m_popup), GTK_WINDOW(toplevel));
 169 gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(toplevel)), GTK_WINDOW(m_popup));
 170 }
 171 gtk_window_set_attached_to(GTK_WINDOW(m_popup), m_webView);
 172 gtk_window_set_screen(GTK_WINDOW(m_popup), gtk_widget_get_screen(m_webView));
 173
 174 gtk_widget_show(m_popup);
 175}
 176
 177void WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier(const String& key)
 178{
 179 auto* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeView));
 180 GtkTreeModel* model;
 181 GtkTreeIter iter;
 182 bool hasSelection = gtk_tree_selection_get_selected(selection, &model, &iter);
 183 if (key == "Enter") {
 184 if (hasSelection) {
 185 GUniqueOutPtr<char> item;
 186 gtk_tree_model_get(model, &iter, 0, &item.outPtr(), -1);
 187 m_page->didSelectOption(String::fromUTF8(item.get()));
 188 }
 189 close();
 190 return;
 191 }
 192
 193 if (key == "Up") {
 194 if ((hasSelection && gtk_tree_model_iter_previous(model, &iter)) || gtk_tree_model_iter_nth_child(model, &iter, nullptr, gtk_tree_model_iter_n_children(model, nullptr) - 1))
 195 gtk_tree_selection_select_iter(selection, &iter);
 196 else
 197 return;
 198 } else if (key == "Down") {
 199 if ((hasSelection && gtk_tree_model_iter_next(model, &iter)) || gtk_tree_model_get_iter_first(model, &iter))
 200 gtk_tree_selection_select_iter(selection, &iter);
 201 else
 202 return;
 203 }
 204
 205 GUniquePtr<GtkTreePath> path(gtk_tree_model_get_path(model, &iter));
 206 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(m_treeView), path.get(), nullptr, FALSE, 0, 0);
 207}
 208
 209void WebDataListSuggestionsDropdownGtk::close()
 210{
 211 gtk_widget_hide(m_popup);
 212}
 213
 214} // namespace WebKit
 215
 216#endif // ENABLE(DATALIST_ELEMENT)

Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h

 1/*
 2 * Copyright (C) 2019 Igalia S.L.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(DATALIST_ELEMENT)
 29
 30#include "WebDataListSuggestionsDropdown.h"
 31
 32typedef struct _GtkTreePath GtkTreePath;
 33typedef struct _GtkTreeView GtkTreeView;
 34typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
 35
 36namespace WebKit {
 37
 38class WebPageProxy;
 39
 40class WebDataListSuggestionsDropdownGtk final : public WebDataListSuggestionsDropdown {
 41public:
 42 static Ref<WebDataListSuggestionsDropdownGtk> create(GtkWidget* webView, WebPageProxy& page)
 43 {
 44 return adoptRef(*new WebDataListSuggestionsDropdownGtk(webView, page));
 45 }
 46
 47 ~WebDataListSuggestionsDropdownGtk();
 48
 49private:
 50 WebDataListSuggestionsDropdownGtk(GtkWidget*, WebPageProxy&);
 51
 52 void show(WebCore::DataListSuggestionInformation&&) final;
 53 void handleKeydownWithIdentifier(const String&) final;
 54 void close() final;
 55
 56 static void treeViewRowActivatedCallback(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*, WebDataListSuggestionsDropdownGtk*);
 57 void didSelectOption(const String&);
 58
 59 GtkWidget* m_webView { nullptr };
 60 GtkWidget* m_popup { nullptr };
 61 GtkWidget* m_treeView { nullptr };
 62};
 63
 64} // namespace WebKit
 65
 66#endif // ENABLE(DATALIST_ELEMENT)

Source/cmake/OptionsGTK.cmake

@@WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
150150# Changing these options is completely unsupported.
151151WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
152152WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
 153WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PRIVATE ON)
153154WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
154155WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
155156WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)

Tools/ChangeLog

 12019-07-30 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [GTK] Datalist element support for TextFieldInputType
 4 https://bugs.webkit.org/show_bug.cgi?id=98934
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Implement UIScriptControllerGtk::isShowingDataListSuggestions.
 9
 10 * WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:
 11 (WTR::UIScriptControllerGtk::isShowingDataListSuggestions const):
 12 * WebKitTestRunner/gtk/UIScriptControllerGtk.h:
 13
1142019-07-29 Carlos Garcia Campos <cgarcia@igalia.com>
215
316 Multiple context menu actions broken for YouTube videos

Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp

2929#include "PlatformWebView.h"
3030#include "TestController.h"
3131#include <WebKit/WKViewPrivate.h>
 32#include <gtk/gtk.h>
3233
3334namespace WTR {
3435

@@void UIScriptControllerGtk::completeBackSwipe(JSValueRef callback)
5152 WKViewCompleteBackSwipeForTesting(webView);
5253}
5354
 55bool UIScriptControllerGtk::isShowingDataListSuggestions() const
 56{
 57 auto* webView = TestController::singleton().mainWebView()->platformView();
 58 if (auto* popup = g_object_get_data(G_OBJECT(webView), "wk-datalist-popup"))
 59 return gtk_widget_get_mapped(GTK_WIDGET(popup));
 60 return false;
 61}
 62
5463} // namespace WTR

Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h

@@public:
4141
4242 void beginBackSwipe(JSValueRef) override;
4343 void completeBackSwipe(JSValueRef) override;
 44 bool isShowingDataListSuggestions() const override;
4445};
4546
4647} // namespace WTR