Changeset 265080 in webkit
- Timestamp:
- Jul 30, 2020 1:53:28 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r265041 r265080 1 2020-07-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK4] Enable API tests 4 https://bugs.webkit.org/show_bug.cgi?id=214344 5 6 Reviewed by Adrian Perez de Castro. 7 8 Build API tests for GTK4 too. 9 10 * Source/cmake/OptionsGTK.cmake: 11 1 12 2020-07-29 Adrian Perez de Castro <aperez@igalia.com> 2 13 -
trunk/Source/WebKit/ChangeLog
r265079 r265080 1 2020-07-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK4] Enable API tests 4 https://bugs.webkit.org/show_bug.cgi?id=214344 5 6 Reviewed by Adrian Perez de Castro. 7 8 Use a custom KeyEvent struct to pass to the IM filter as a fake GdkEvent to be able to test input methods with 9 GTK4. 10 11 * UIProcess/API/glib/InputMethodFilter.h: 12 * UIProcess/API/gtk/InputMethodFilterGtk.cpp: 13 (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const): 14 (WebKit::InputMethodFilter::filterKeyEvent): 15 * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: 16 * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: 17 (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start): 18 (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop): 19 1 20 2020-07-30 Brady Eidson <beidson@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.h
r264647 r265080 113 113 bool isActive { false }; 114 114 bool preeditChanged { false }; 115 #if PLATFORM(GTK) && USE(GTK4) 116 bool isFakeKeyEventForTesting { false }; 117 #endif 115 118 } m_filteringContext; 116 119 -
trunk/Source/WebKit/UIProcess/API/gtk/InputMethodFilterGtk.cpp
r264647 r265080 21 21 #include "InputMethodFilter.h" 22 22 23 #include "WebKitInputMethodContextImplGtk.h" 23 24 #include "WebKitInputMethodContextPrivate.h" 25 #include "WebKitWebViewBaseInternal.h" 24 26 #include <WebCore/GUniquePtrGtk.h> 25 27 #include <WebCore/IntRect.h> 26 28 #include <gdk/gdk.h> 29 #include <wtf/SetForScope.h> 27 30 28 31 namespace WebKit { … … 40 43 bool InputMethodFilter::platformEventKeyIsKeyPress(PlatformEventKey* event) const 41 44 { 45 #if USE(GTK4) 46 if (UNLIKELY(m_filteringContext.isFakeKeyEventForTesting)) 47 return reinterpret_cast<KeyEvent*>(event)->type == GDK_KEY_PRESS; 48 #endif 42 49 return gdk_event_get_event_type(event) == GDK_KEY_PRESS; 43 50 } … … 48 55 return { }; 49 56 50 #if !USE(GTK4) 57 #if USE(GTK4) 58 if (WEBKIT_IS_INPUT_METHOD_CONTEXT_IMPL_GTK(m_context.get())) 59 return { }; 60 61 // In GTK4 we can't create GdkEvents, so here we create a custom KeyEvent struct that is passed 62 // as a GdkEvent to the filter. This is only called from tests, and tests know they are receiving 63 // a KeyEvent struct instead of an actual GdkEvent. 64 SetForScope<bool> isFakeKeyEventForTesting(m_filteringContext.isFakeKeyEventForTesting, true); 65 KeyEvent event { type, keyval, modifiers }; 66 return filterKeyEvent(reinterpret_cast<GdkEvent*>(&event)); 67 #else 51 68 auto* webView = webkitInputMethodContextGetWebView(m_context.get()); 52 69 ASSERT(webView); … … 61 78 gdk_event_set_device(event.get(), gdk_seat_get_keyboard(gdk_display_get_default_seat(gtk_widget_get_display(GTK_WIDGET(webView))))); 62 79 return filterKeyEvent(event.get()); 63 #else64 return { };65 80 #endif 66 81 } -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBaseInternal.h
r262343 r265080 28 28 typedef struct _WebKitWebViewBase WebKitWebViewBase; 29 29 30 struct KeyEvent { 31 unsigned type { 0 }; 32 unsigned keyval { 0 }; 33 unsigned modifiers { 0 }; 34 }; 35 30 36 enum class MouseEventType { Press, Release, Motion }; 31 37 void webkitWebViewBaseSynthesizeMouseEvent(WebKitWebViewBase*, MouseEventType type, unsigned button, unsigned short buttons, int x, int y, unsigned modifiers, int clickCount); -
trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
r255518 r265080 412 412 #if PLATFORM(GTK) 413 413 gtk_widget_queue_draw(m_webPage.viewWidget()); 414 #if USE(GTK4) 415 m_timer.startOneShot(16_ms); 416 #else 414 417 g_signal_connect_swapped(m_webPage.viewWidget(), "draw", reinterpret_cast<GCallback>(webViewDrawCallback), this); 415 418 m_timer.startOneShot(100_ms); 419 #endif 416 420 #else 417 421 m_timer.startOneShot(0_s); … … 422 426 { 423 427 m_timer.stop(); 424 #if PLATFORM(GTK) 428 #if PLATFORM(GTK) && !USE(GTK4) 425 429 g_signal_handlers_disconnect_by_func(m_webPage.viewWidget(), reinterpret_cast<gpointer>(webViewDrawCallback), this); 426 430 #endif -
trunk/Source/cmake/OptionsGTK.cmake
r265032 r265080 121 121 if (DEVELOPER_MODE) 122 122 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON) 123 if (USE_GTK4) 124 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF) 125 else () 126 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON) 127 endif () 123 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON) 128 124 else () 129 125 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC OFF) -
trunk/Tools/ChangeLog
r265079 r265080 1 2020-07-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK4] Enable API tests 4 https://bugs.webkit.org/show_bug.cgi?id=214344 5 6 Reviewed by Adrian Perez de Castro. 7 8 Port API tests to GTK4. Context menu and option menu tests are still disabled for GTK4 because we plan to change 9 the API for GTK4 in those cases. 10 11 * TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp: 12 (beforeAll): 13 * TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp: 14 (webkitInputMethodContextMockFilterKeyEvent): 15 * TestWebKitAPI/Tests/WebKitGLib/TestMultiprocess.cpp: 16 * TestWebKitAPI/Tests/WebKitGLib/TestOptionMenu.cpp: 17 (beforeAll): 18 * TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp: 19 (checkMimeTypeForFilter): 20 * TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp: 21 (testWebExtensionInputElementIsUserEdited): 22 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp: 23 (testWebKitSettings): 24 * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp: 25 * TestWebKitAPI/Tests/WebKitGtk/AccessibilityTestServer.cpp: 26 * TestWebKitAPI/Tests/WebKitGtk/InspectorTestServer.cpp: 27 (main): 28 * TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp: 29 (testContextMenuPopulateMenu): 30 (beforeAll): 31 * TestWebKitAPI/Tests/WebKitGtk/TestInspector.cpp: 32 * TestWebKitAPI/Tests/WebKitGtk/TestPrinting.cpp: 33 * TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp: 34 (Clipboard::Clipboard): 35 (Clipboard::clear): 36 (Clipboard::containsText const): 37 (Clipboard::waitForText): 38 (Clipboard::readText): 39 (testWebViewEditorCutCopyPasteNonEditable): 40 (testWebViewEditorCutCopyPasteEditable): 41 (testWebViewEditorSelectAllNonEditable): 42 (testWebViewEditorSelectAllEditable): 43 (loadContentsAndTryToCutSelection): 44 * TestWebKitAPI/glib/WebKitGLib/TestMain.h: 45 (Test::Test): 46 * TestWebKitAPI/glib/WebKitGLib/gtk/WebViewTestGtk.cpp: 47 (WebViewTest::platformDestroy): 48 (WebViewTest::showInWindow): 49 * TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp: 50 (TestWebKitAPI::Util::isKeyDown): 51 * TestWebKitAPI/gtk/PlatformWebViewGtk.cpp: 52 (TestWebKitAPI::PlatformWebView::~PlatformWebView): 53 (TestWebKitAPI::PlatformWebView::initialize): 54 1 55 2020-07-30 Brady Eidson <beidson@apple.com> 2 56 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp
r264647 r265080 808 808 // FIXME: Implement keyStroke in WPE. 809 809 #if PLATFORM(GTK) 810 #if !USE(GTK4) 811 // FIXME: Rework context menu API in GTK4 to not expose GdkEvent. 810 812 WebViewDownloadTest::add("Downloads", "contex-menu-download-actions", testContextMenuDownloadActions); 813 #endif 811 814 // FIXME: Implement mouse click in WPE. 812 815 WebViewDownloadTest::add("Downloads", "blob-download", testBlobDownload); -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp
r264647 r265080 25 25 26 26 #if PLATFORM(GTK) 27 #include <WebCore/GtkVersioning.h> 28 #if USE(GTK4) 29 #include "WebKitWebViewBaseInternal.h" 30 using PlatformEventKey = GdkEvent; 31 #else 27 32 using PlatformEventKey = GdkEventKey; 33 #endif 28 34 #define KEY(x) GDK_KEY_##x 29 35 #define CONTROL_MASK GDK_CONTROL_MASK … … 93 99 94 100 #if PLATFORM(GTK) 101 #if USE(GTK4) 102 auto* event = reinterpret_cast<KeyEvent*>(keyEvent); 103 unsigned keyval = event->keyval; 104 auto state = static_cast<GdkModifierType>(event->modifiers); 105 bool isKeyPress = event->type == GDK_KEY_PRESS; 106 #else 95 107 GdkModifierType state; 96 108 guint keyval; … … 98 110 return FALSE; 99 111 bool isKeyPress = gdk_event_get_event_type(reinterpret_cast<GdkEvent*>(keyEvent)) == GDK_KEY_PRESS; 112 #endif 100 113 gunichar character = gdk_keyval_to_unicode(keyval); 101 114 #elif PLATFORM(WPE) -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestMultiprocess.cpp
r249759 r265080 100 100 g_assert_nonnull(connection); 101 101 g_signal_connect_swapped(connection, "closed", G_CALLBACK(g_main_loop_quit), m_mainLoop); 102 #if USE(GTK4) 103 g_object_run_dispose(G_OBJECT(m_webViews[index].get())); 104 #else 102 105 gtk_widget_destroy(GTK_WIDGET(m_webViews[index].get())); 106 #endif 103 107 g_main_loop_run(m_mainLoop); 104 108 } -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestOptionMenu.cpp
r264647 r265080 305 305 void beforeAll() 306 306 { 307 #if !PLATFORM(GTK) || !USE(GTK4) 308 // FIXME: Rework option menu API in GTK4 to not expose GdkEvent. 307 309 OptionMenuTest::add("WebKitWebView", "option-menu-simple", testOptionMenuSimple); 308 310 OptionMenuTest::add("WebKitWebView", "option-menu-groups", testOptionMenuGroups); 309 311 OptionMenuTest::add("WebKitWebView", "option-menu-activate", testOptionMenuActivate); 310 312 OptionMenuTest::add("WebKitWebView", "option-menu-select", testOptionMenuSelect); 313 #endif 311 314 } 312 315 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp
r264647 r265080 318 318 { 319 319 m_shouldCreateWebViewsInNewWindowsAutomatically = true; 320 m_ DefaultGeometryNewWindows.width = width;321 m_ DefaultGeometryNewWindows.height = height;320 m_defaultGeometryNewWindows.width = width; 321 m_defaultGeometryNewWindows.height = height; 322 322 } 323 323 #endif … … 339 339 keyStroke(GDK_KEY_a); 340 340 keyStroke(GDK_KEY_b); 341 while (g tk_events_pending())342 g tk_main_iteration();341 while (g_main_context_pending(nullptr)) 342 g_main_context_iteration(nullptr, TRUE); 343 343 #endif 344 344 } … … 368 368 if (m_shouldCreateWebViewsInNewWindowsAutomatically) { 369 369 g_assert_null(m_parentWindow); 370 #if USE(GTK4) 371 m_parentWindow = gtk_window_new(); 372 gtk_window_set_child(GTK_WINDOW(m_parentWindow), GTK_WIDGET(newWebView)); 373 #else 370 374 m_parentWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); 371 gtk_window_set_default_size(GTK_WINDOW(m_parentWindow), m_DefaultGeometryNewWindows.width, m_DefaultGeometryNewWindows.height);372 375 gtk_container_add(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(newWebView)); 373 376 gtk_widget_show(GTK_WIDGET(newWebView)); 377 #endif 378 gtk_window_set_default_size(GTK_WINDOW(m_parentWindow), m_defaultGeometryNewWindows.width, m_defaultGeometryNewWindows.height); 374 379 gtk_widget_show(m_parentWindow); 375 380 } … … 417 422 #if PLATFORM(GTK) 418 423 bool m_shouldCreateWebViewsInNewWindowsAutomatically { false }; 419 cairo_rectangle_int_t m_ DefaultGeometryNewWindows;424 cairo_rectangle_int_t m_defaultGeometryNewWindows; 420 425 #endif 421 426 }; … … 522 527 static gboolean checkMimeTypeForFilter(GtkFileFilter* filter, const gchar* mimeType) 523 528 { 529 #if USE(GTK4) 530 GRefPtr<GFileInfo> filterInfo = adoptGRef(g_file_info_new()); 531 g_file_info_set_content_type(filterInfo.get(), mimeType); 532 return gtk_filter_match(GTK_FILTER(filter), filterInfo.get()); 533 #else 524 534 GtkFileFilterInfo filterInfo; 525 535 filterInfo.contains = GTK_FILE_FILTER_MIME_TYPE; 526 536 filterInfo.mime_type = mimeType; 527 537 return gtk_file_filter_filter(filter, &filterInfo); 538 #endif 528 539 } 529 540 #endif -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp
r264647 r265080 84 84 test->runJavaScriptAndWaitUntilFinished("document.getElementById('input').focus()", nullptr); 85 85 test->keyStroke(GDK_KEY_a); 86 while (g tk_events_pending())87 g tk_main_iteration();86 while (g_main_context_pending(nullptr)) 87 g_main_context_iteration(nullptr, TRUE); 88 88 GUniquePtr<char> resultString; 89 89 do { … … 96 96 test->runJavaScriptAndWaitUntilFinished("document.getElementById('textarea').focus()", nullptr); 97 97 test->keyStroke(GDK_KEY_b); 98 while (g tk_events_pending())99 g tk_main_iteration();98 while (g_main_context_pending(nullptr)) 99 g_main_context_iteration(nullptr, TRUE); 100 100 do { 101 101 auto* result = test->runJavaScriptAndWaitUntilFinished("document.getElementById('textarea').value", nullptr); -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp
r261986 r265080 350 350 351 351 #if PLATFORM(GTK) 352 #if !USE(GTK4) 352 353 // Ondemand is the default hardware acceleration policy. 353 354 g_assert_cmpuint(webkit_settings_get_hardware_acceleration_policy(settings), ==, WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND); … … 358 359 webkit_settings_set_hardware_acceleration_policy(settings, WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND); 359 360 g_assert_cmpuint(webkit_settings_get_hardware_acceleration_policy(settings), ==, WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND); 361 #endif 360 362 361 363 // Back-forward navigation gesture is disabled by default -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp
r264647 r265080 445 445 static gboolean leaveFullScreenIdle(FullScreenClientTest* test) 446 446 { 447 // FIXME: Implement key strokes in WPE448 447 #if PLATFORM(GTK) 449 448 test->keyStroke(GDK_KEY_Escape); 449 #else 450 test->keyStroke(WPE_KEY_Escape); 450 451 #endif 451 452 return FALSE; -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/AccessibilityTestServer.cpp
r260132 r265080 22 22 #include <WebCore/GtkVersioning.h> 23 23 #include <webkit2/webkit2.h> 24 #include <wtf/glib/GRefPtr.h> 24 25 25 26 static const char introspectionXML[] = … … 71 72 72 73 GtkWidget* webView = webkit_web_view_new(); 73 74 #if USE(GTK4) 75 GtkWidget* window = gtk_window_new(); 76 gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(webView)); 77 #else 74 78 GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 75 79 g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), nullptr); 76 80 gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView)); 77 gtk_widget_show_all(window); 81 gtk_widget_show(GTK_WIDGET(webView)); 82 #endif 83 gtk_widget_show(window); 78 84 79 85 g_dbus_connection_new_for_address(argv[1], G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, nullptr, nullptr, … … 89 95 }, webView); 90 96 97 #if USE(GTK4) 98 GRefPtr<GMainLoop> loop = adoptGRef(g_main_loop_new(nullptr, TRUE)); 99 g_main_loop_run(loop.get()); 100 #else 91 101 gtk_main(); 102 #endif 92 103 } -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/InspectorTestServer.cpp
r260132 r265080 27 27 #include <WebCore/GtkVersioning.h> 28 28 #include <webkit2/webkit2.h> 29 #include <wtf/glib/GRefPtr.h> 29 30 30 31 int main(int argc, char** argv) … … 41 42 "http://127.0.0.1:2999/"); 42 43 44 #if USE(GTK4) 45 GtkWidget* window = gtk_window_new(); 46 gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(webView)); 47 gtk_widget_show(window); 48 49 GRefPtr<GMainLoop> loop = adoptGRef(g_main_loop_new(nullptr, TRUE)); 50 g_main_loop_run(loop.get()); 51 #else 43 52 GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 44 53 gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView)); … … 48 57 49 58 gtk_main(); 59 #endif 50 60 } -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp
r264647 r265080 27 27 static WebKitTestServer* kServer; 28 28 29 #if USE(GTK4)30 struct LookupWidgetsData {31 void (*walkChildren)(GtkContainer*, GtkCallback, void*);32 Function<bool(GtkWidget*)> predicate;33 Vector<GtkWidget*> result;34 };35 36 static void lookupWidgetsWalkChild(GtkWidget* child, void* userdata)37 {38 auto& data = *reinterpret_cast<LookupWidgetsData*>(userdata);39 if (data.predicate(child))40 data.result.append(child);41 else if (GTK_IS_CONTAINER(child))42 data.walkChildren(GTK_CONTAINER(child), lookupWidgetsWalkChild, userdata);43 }44 45 static Vector<GtkWidget*> lookupWidgets(GtkWidget* widget, Function<bool(GtkWidget*)>&& predicate, bool internal = false)46 {47 LookupWidgetsData data = {internal ? gtk_container_forall : gtk_container_foreach, WTFMove(predicate)};48 lookupWidgetsWalkChild(widget, &data);49 return WTFMove(data.result);50 }51 #endif // USE(GTK4)52 53 29 class ContextMenuTest: public WebViewTest { 54 30 public: … … 62 38 { 63 39 g_assert_nonnull(event); 40 #if !USE(GTK4) 64 41 g_assert_cmpint(event->type, ==, m_expectedEventType); 65 42 … … 80 57 g_assert_not_reached(); 81 58 } 59 #endif 82 60 } 83 61 … … 127 105 128 106 #if USE(GTK4) 129 // Popovers are internal to the GtkContainer where the webview resides, 130 // gtk_container_forall() is the only way to enumerate internal children. 131 GtkPopover *popover = nullptr; 132 gtk_container_forall(GTK_CONTAINER(iter->data), 133 [](GtkWidget* child, void* data) { 134 auto** popover = reinterpret_cast<GtkPopover**>(data); 135 if (GTK_IS_POPOVER_MENU(child) && !*popover) 136 *popover = GTK_POPOVER(child); 137 }, &popover); 138 139 if (popover && gtk_popover_get_relative_to(popover) == GTK_WIDGET(m_webView)) 140 return popover; 107 return nullptr; 141 108 #else 142 109 GtkWidget* child = gtk_bin_get_child(GTK_BIN(iter->data)); … … 177 144 assertObjectIsDeletedWhenTestFinishes(G_OBJECT(item)); 178 145 146 #if !USE(GTK4) 179 147 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 180 148 GtkAction* action = webkit_context_menu_item_get_action(item); 181 149 g_assert_true(GTK_IS_ACTION(action)); 182 150 G_GNUC_END_IGNORE_DEPRECATIONS; 151 #endif 183 152 184 153 GAction* gAction = webkit_context_menu_item_get_gaction(item); … … 200 169 assertObjectIsDeletedWhenTestFinishes(G_OBJECT(item)); 201 170 171 #if !USE(GTK4) 202 172 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 203 173 GtkAction* action = webkit_context_menu_item_get_action(item); 204 174 g_assert_true(GTK_IS_ACTION(action)); 175 #endif 205 176 206 177 GAction* gAction = webkit_context_menu_item_get_gaction(item); 207 178 g_assert_true(G_IS_ACTION(gAction)); 179 #if !USE(GTK4) 208 180 g_assert_cmpstr(gtk_action_get_name(action), ==, g_action_get_name(gAction)); 209 181 g_assert_cmpint(gtk_action_get_sensitive(action), ==, g_action_get_enabled(gAction)); … … 218 190 g_assert_cmpstr(gtk_action_get_label(action), ==, label); 219 191 G_GNUC_END_IGNORE_DEPRECATIONS; 192 #endif 220 193 221 194 checkActionState(gAction, state); … … 232 205 assertObjectIsDeletedWhenTestFinishes(G_OBJECT(item)); 233 206 207 #if !USE(GTK4) 234 208 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 235 209 GtkAction* action = webkit_context_menu_item_get_action(item); … … 237 211 g_assert_cmpstr(gtk_action_get_label(action), ==, label); 238 212 G_GNUC_END_IGNORE_DEPRECATIONS; 213 #endif 239 214 240 215 GAction* gAction = webkit_context_menu_item_get_gaction(item); … … 302 277 void showContextMenuTriggeredByPopupEventAndWaitUntilFinished() 303 278 { 279 #if !USE(GTK4) 304 280 m_expectedEventType = GDK_NOTHING; 281 #endif 305 282 g_idle_add(reinterpret_cast<GSourceFunc>(emitPopupMenuSignalIdleCallback), this); 306 283 g_main_loop_run(m_mainLoop); … … 601 578 { 602 579 // Append our custom item to the default menu. 580 #if !USE(GTK4) 603 581 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 604 582 if (m_action) … … 607 585 webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_gaction(m_gAction.get(), m_gActionTitle.data(), m_expectedTarget.get())); 608 586 G_GNUC_END_IGNORE_DEPRECATIONS; 587 #endif 609 588 quitMainLoop(); 610 589 … … 615 594 GtkButton* getMenuItem(GtkWidget* popover, const gchar* itemLabel) 616 595 { 617 auto items = lookupWidgets(popover, 618 [itemLabel](GtkWidget* widget) { 619 if (!GTK_IS_BUTTON(widget)) 620 return false; 621 const char* label = gtk_button_get_label(GTK_BUTTON(widget)); 622 if (!label) { 623 const auto labels = lookupWidgets(GTK_WIDGET(widget), 624 [](GtkWidget* child) { return GTK_IS_LABEL(child); }); 625 g_assert_cmpuint(1, ==, labels.size()); 626 label = gtk_label_get_label(GTK_LABEL(labels[0])); 627 } 628 return GTK_IS_BUTTON(widget) && g_strcmp0(label, itemLabel) == 0; 629 }, true); 630 631 g_assert_cmpuint(items.size(), >, 0); 632 return items.size() ? GTK_BUTTON(items[0]) : nullptr; 596 return nullptr; 633 597 } 634 598 #else … … 652 616 auto* item = getMenuItem(menu, m_itemToActivateLabel); 653 617 #if USE(GTK4) 654 // GTK4 uses a popover, which contains buttons. 655 gtk_button_clicked(item); 618 656 619 #else 657 620 // GTK3 uses a menu, which contains menu items. … … 701 664 { 702 665 test->m_toggled = true; 703 704 #if USE(GTK4)705 // For toggle actions the popover menu is NOT dismissed automatically, as to show visual feedback to the user706 // (i.e. the check marker). Dismiss it here to trigger contextMenuDismissedCallback() and continue the test.707 gtk_popover_popdown(test->getPopoverMenu());708 #endif // USE(GTK4)709 666 } 710 667 … … 714 671 m_gAction = nullptr; 715 672 m_expectedTarget = nullptr; 673 #if !USE(GTK4) 716 674 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 717 675 if (GTK_IS_TOGGLE_ACTION(action)) … … 720 678 g_signal_connect_swapped(action, "activate", G_CALLBACK(actionActivatedCallback), this); 721 679 G_GNUC_END_IGNORE_DEPRECATIONS; 680 #endif 722 681 } 723 682 … … 748 707 test->waitUntilLoadFinished(); 749 708 709 #if !USE(GTK4) 750 710 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 751 711 // Create a custom menu item. … … 765 725 g_assert_true(test->m_toggled); 766 726 G_GNUC_END_IGNORE_DEPRECATIONS; 727 #endif 767 728 768 729 // Create a custom menu item using GAction. … … 806 767 807 768 // Add custom actions. 769 #if !USE(GTK4) 808 770 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 809 771 GRefPtr<GtkAction> action = adoptGRef(gtk_action_new("WebKitGTKCustomAction", "Custom _Action", nullptr, nullptr)); … … 814 776 webkit_context_menu_append(contextMenu, webkit_context_menu_item_new(toggleAction.get())); 815 777 webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); 778 #endif 816 779 GRefPtr<GAction> gAction = adoptGRef(G_ACTION(g_simple_action_new("WebKitGTKCustomGAction", nullptr))); 817 780 g_simple_action_set_enabled(G_SIMPLE_ACTION(gAction.get()), FALSE); … … 1176 1139 kServer->run(serverCallback); 1177 1140 1141 #if !USE(GTK4) 1142 // FIXME: Rework context menu API in GTK4 to not expose GdkEvent. 1178 1143 ContextMenuDefaultTest::add("WebKitWebView", "default-menu", testContextMenuDefaultMenu); 1179 1144 ContextMenuDefaultTest::add("WebKitWebView", "context-menu-key", testContextMenuKey); … … 1186 1151 ContextMenuWebExtensionTest::add("WebKitWebPage", "context-menu", testContextMenuWebExtensionMenu); 1187 1152 ContextMenuWebExtensionNodeTest::add("WebKitWebPage", "context-menu-node", testContextMenuWebExtensionNode); 1153 #endif 1188 1154 } 1189 1155 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestInspector.cpp
r264647 r265080 227 227 ~CustomInspectorTest() 228 228 { 229 #if USE(GTK4) 230 if (m_inspectorWindow) 231 gtk_window_destroy(GTK_WINDOW(m_inspectorWindow)); 232 #else 229 233 if (m_inspectorWindow) 230 234 gtk_widget_destroy(m_inspectorWindow); 235 #endif 231 236 } 232 237 … … 234 239 { 235 240 g_assert_null(m_inspectorWindow); 236 m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);237 241 WebKitWebViewBase* inspectorView = webkit_web_inspector_get_web_view(m_inspector); 238 242 g_assert_nonnull(inspectorView); 243 #if USE(GTK4) 244 m_inspectorWindow = gtk_window_new(); 245 gtk_window_set_child(GTK_WINDOW(m_inspectorWindow), GTK_WIDGET(inspectorView)); 246 #else 247 m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); 239 248 gtk_container_add(GTK_CONTAINER(m_inspectorWindow), GTK_WIDGET(inspectorView)); 240 gtk_widget_show_all(m_inspectorWindow); 249 gtk_widget_show(GTK_WIDGET(inspectorView)); 250 #endif 251 gtk_widget_show(m_inspectorWindow); 241 252 242 253 return InspectorTest::openWindow(); … … 245 256 void closed() 246 257 { 247 if (m_inspectorWindow) { 248 gtk_widget_destroy(m_inspectorWindow); 249 m_inspectorWindow = 0; 250 } 258 #if USE(GTK4) 259 g_clear_pointer(&m_inspectorWindow, gtk_window_destroy); 260 #else 261 g_clear_pointer(&m_inspectorWindow, gtk_widget_destroy); 262 #endif 251 263 252 264 return InspectorTest::closed(); … … 257 269 GRefPtr<WebKitWebViewBase> inspectorView = webkit_web_inspector_get_web_view(m_inspector); 258 270 if (m_inspectorWindow) { 271 #if USE(GTK4) 272 gtk_window_set_child(GTK_WINDOW(m_inspectorWindow), nullptr); 273 gtk_window_destroy(GTK_WINDOW(m_inspectorWindow)); 274 #else 259 275 gtk_container_remove(GTK_CONTAINER(m_inspectorWindow), GTK_WIDGET(inspectorView.get())); 260 276 gtk_widget_destroy(m_inspectorWindow); 261 m_inspectorWindow = 0; 277 #endif 278 m_inspectorWindow = nullptr; 262 279 } 263 280 264 281 GtkWidget* pane; 282 #if USE(GTK4) 283 if (gtk_window_get_child(GTK_WINDOW(m_parentWindow)) == GTK_WIDGET(m_webView)) { 284 GRefPtr<WebKitWebView> inspectedView = m_webView; 285 gtk_window_set_child(GTK_WINDOW(m_parentWindow), nullptr); 286 pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL); 287 gtk_paned_set_start_child(GTK_PANED(pane), GTK_WIDGET(m_webView)); 288 gtk_window_set_child(GTK_WINDOW(m_parentWindow), pane); 289 } else 290 pane = gtk_window_get_child(GTK_WINDOW(m_parentWindow)); 291 gtk_paned_set_position(GTK_PANED(pane), webkit_web_inspector_get_attached_height(m_inspector)); 292 gtk_paned_set_end_child(GTK_PANED(pane), GTK_WIDGET(inspectorView.get())); 293 #else 265 294 if (gtk_bin_get_child(GTK_BIN(m_parentWindow)) == GTK_WIDGET(m_webView)) { 266 295 GRefPtr<WebKitWebView> inspectedView = m_webView; … … 274 303 gtk_paned_set_position(GTK_PANED(pane), webkit_web_inspector_get_attached_height(m_inspector)); 275 304 gtk_paned_add2(GTK_PANED(pane), GTK_WIDGET(inspectorView.get())); 305 #endif 276 306 277 307 return InspectorTest::attach(); … … 281 311 { 282 312 GRefPtr<WebKitWebViewBase> inspectorView = webkit_web_inspector_get_web_view(m_inspector); 313 #if USE(GTK4) 314 GtkWidget* pane = gtk_window_get_child(GTK_WINDOW(m_parentWindow)); 315 g_assert_true(GTK_IS_PANED(pane)); 316 gtk_paned_set_end_child(GTK_PANED(pane), nullptr); 317 #else 283 318 GtkWidget* pane = gtk_bin_get_child(GTK_BIN(m_parentWindow)); 284 319 g_assert_true(GTK_IS_PANED(pane)); 285 320 gtk_container_remove(GTK_CONTAINER(pane), GTK_WIDGET(inspectorView.get())); 321 #endif 286 322 return InspectorTest::detach(); 287 323 } … … 290 326 { 291 327 g_assert_nonnull(m_inspectorWindow); 292 gtk_widget_destroy(m_inspectorWindow); 293 m_inspectorWindow = 0; 328 #if USE(GTK4) 329 g_clear_pointer(&m_inspectorWindow, gtk_window_destroy); 330 #else 331 g_clear_pointer(&m_inspectorWindow, gtk_widget_destroy); 332 #endif 294 333 } 295 334 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestPrinting.cpp
r264647 r265080 20 20 #include "config.h" 21 21 #include "WebViewTest.h" 22 #include <WebCore/GtkVersioning.h> 22 23 #include <glib/gstdio.h> 23 24 #include <wtf/glib/GRefPtr.h> -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp
r264647 r265080 22 22 #include <wtf/glib/GRefPtr.h> 23 23 24 class Clipboard { 25 public: 26 Clipboard(GMainLoop* loop) 27 : m_mainLoop(loop) 28 #if USE(GTK4) 29 , m_clipboard(gdk_display_get_clipboard(gdk_display_get_default())) 30 #else 31 , m_clipboard(gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD)) 32 #endif 33 { 34 } 35 36 void clear() 37 { 38 #if USE(GTK4) 39 g_assert_true(gdk_clipboard_set_content(m_clipboard, nullptr)); 40 #else 41 gtk_clipboard_clear(m_clipboard); 42 #endif 43 m_text = nullptr; 44 } 45 46 bool containsText() const 47 { 48 #if USE(GTK4) 49 return gdk_content_formats_contain_gtype(gdk_clipboard_get_formats(m_clipboard), G_TYPE_STRING); 50 #else 51 return gtk_clipboard_wait_is_text_available(m_clipboard); 52 #endif 53 } 54 55 bool waitForText() 56 { 57 // There's no way to know when the selection has been written to 58 // the clipboard, so use a timeout source to query the clipboard. 59 static const unsigned kClipboardWaitTimeout = 50; 60 static const unsigned kClipboardWaitMaxTries = 2; 61 m_triesCount = 0; 62 g_timeout_add(kClipboardWaitTimeout, [](gpointer userData) -> gboolean { 63 auto* clipboard = static_cast<Clipboard*>(userData); 64 clipboard->m_triesCount++; 65 if (clipboard->containsText() || clipboard->m_triesCount > kClipboardWaitMaxTries) { 66 g_main_loop_quit(clipboard->m_mainLoop); 67 return FALSE; 68 } 69 return TRUE; 70 }, this); 71 g_main_loop_run(m_mainLoop); 72 return containsText(); 73 } 74 75 const char* readText() 76 { 77 m_text = nullptr; 78 if (waitForText()) { 79 #if USE(GTK4) 80 gdk_clipboard_read_text_async(m_clipboard, nullptr, [](GObject* gdkClipboard, GAsyncResult* result, gpointer userData) { 81 auto* clipboard = static_cast<Clipboard*>(userData); 82 clipboard->m_text.reset(gdk_clipboard_read_text_finish(GDK_CLIPBOARD(gdkClipboard), result, nullptr)); 83 g_main_loop_quit(clipboard->m_mainLoop); 84 }, this); 85 g_main_loop_run(m_mainLoop); 86 #else 87 m_text.reset(gtk_clipboard_wait_for_text(m_clipboard)); 88 #endif 89 } 90 return m_text.get(); 91 } 92 93 private: 94 GMainLoop* m_mainLoop { nullptr }; 95 #if USE(GTK4) 96 GdkClipboard* m_clipboard { nullptr }; 97 #else 98 GtkClipboard* m_clipboard { nullptr }; 99 #endif 100 GUniquePtr<char> m_text; 101 unsigned m_triesCount { 0 }; 102 }; 103 24 104 class EditorTest: public WebViewTest { 25 105 public: 26 106 MAKE_GLIB_TEST_FIXTURE(EditorTest); 27 107 28 static const unsigned kClipboardWaitTimeout = 50;29 static const unsigned kClipboardWaitMaxTries = 2;30 31 108 EditorTest() 32 : m_clipboard(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)) 33 , m_canExecuteEditingCommand(false) 34 , m_triesCount(0) 35 , m_editorState(nullptr) 109 : m_clipboard(m_mainLoop) 36 110 { 37 111 showInWindow(); 112 m_clipboard.clear(); 38 113 loadURI("about:blank"); 39 114 waitUntilLoadFinished(); 40 gtk_clipboard_clear(m_clipboard); 115 } 116 117 ~EditorTest() 118 { 119 m_clipboard.clear(); 41 120 } 42 121 … … 49 128 void flushEditorState() 50 129 { 130 #if USE(GTK4) 131 auto* surface = gtk_native_get_surface(gtk_widget_get_native(GTK_WIDGET(m_webView))); 132 auto* clock = gdk_surface_get_frame_clock(surface); 133 auto signalID = g_signal_connect_swapped(clock, "paint", G_CALLBACK(webViewDrawCallback), m_mainLoop); 134 #else 51 135 auto signalID = g_signal_connect_swapped(m_webView, "draw", G_CALLBACK(webViewDrawCallback), m_mainLoop); 136 #endif 52 137 gtk_widget_queue_draw(GTK_WIDGET(m_webView)); 53 138 g_main_loop_run(m_mainLoop); 139 #if USE(GTK4) 140 g_signal_handler_disconnect(clock, signalID); 141 #else 54 142 g_signal_handler_disconnect(m_webView, signalID); 143 #endif 55 144 } 56 145 … … 85 174 } 86 175 87 static gboolean waitForClipboardText(EditorTest* test) 88 { 89 test->m_triesCount++; 90 if (gtk_clipboard_wait_is_text_available(test->m_clipboard) || test->m_triesCount > kClipboardWaitMaxTries) { 91 g_main_loop_quit(test->m_mainLoop); 92 return FALSE; 93 } 94 95 return TRUE; 96 } 97 98 void copyClipboard() 176 const char* copyClipboard() 99 177 { 100 178 webkit_web_view_execute_editing_command(m_webView, WEBKIT_EDITING_COMMAND_COPY); 101 // There's no way to know when the selection has been copied to 102 // the clipboard, so use a timeout source to query the clipboard. 103 m_triesCount = 0; 104 g_timeout_add(kClipboardWaitTimeout, reinterpret_cast<GSourceFunc>(waitForClipboardText), this); 105 g_main_loop_run(m_mainLoop); 106 } 107 108 gchar* cutSelection() 179 return m_clipboard.readText(); 180 } 181 182 const char* cutSelection() 109 183 { 110 184 g_assert_true(canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT)); … … 113 187 114 188 webkit_web_view_execute_editing_command(m_webView, WEBKIT_EDITING_COMMAND_CUT); 115 // There's no way to know when the selection has been cut to 116 // the clipboard, so use a timeout source to query the clipboard. 117 m_triesCount = 0; 118 g_timeout_add(kClipboardWaitTimeout, reinterpret_cast<GSourceFunc>(waitForClipboardText), this); 119 g_main_loop_run(m_mainLoop); 120 121 return gtk_clipboard_wait_for_text(m_clipboard); 189 return m_clipboard.readText(); 122 190 } 123 191 … … 150 218 } 151 219 152 GtkClipboard* m_clipboard; 153 bool m_canExecuteEditingCommand; 154 size_t m_triesCount; 155 WebKitEditorState* m_editorState; 220 Clipboard m_clipboard; 221 bool m_canExecuteEditingCommand { false }; 222 WebKitEditorState* m_editorState { nullptr }; 156 223 }; 157 224 … … 183 250 g_assert_false(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE_AS_PLAIN_TEXT)); 184 251 185 test->copyClipboard(); 186 GUniquePtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard)); 187 g_assert_cmpstr(clipboardText.get(), ==, "make Jack a dull"); 252 g_assert_cmpstr(test->copyClipboard(), ==, "make Jack a dull"); 188 253 } 189 254 … … 211 276 g_assert_true(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE_AS_PLAIN_TEXT)); 212 277 213 test->copyClipboard(); 214 GUniquePtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard)); 215 g_assert_cmpstr(clipboardText.get(), ==, "make Jack a dull"); 278 g_assert_cmpstr(test->copyClipboard(), ==, "make Jack a dull"); 216 279 } 217 280 … … 227 290 g_assert_true(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_SELECT_ALL)); 228 291 229 test->copyClipboard();230 GUniquePtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard));231 232 292 // Initially only the subspan is selected. 233 g_assert_cmpstr( clipboardText.get(), ==, "make Jack a dull");293 g_assert_cmpstr(test->copyClipboard(), ==, "make Jack a dull"); 234 294 235 295 webkit_web_view_execute_editing_command(test->m_webView, WEBKIT_EDITING_COMMAND_SELECT_ALL); 236 test->copyClipboard();237 clipboardText.reset(gtk_clipboard_wait_for_text(test->m_clipboard));238 239 296 // The mainspan should be selected after calling SELECT_ALL. 240 g_assert_cmpstr( clipboardText.get(), ==, "All work and no play make Jack a dull boy.");297 g_assert_cmpstr(test->copyClipboard(), ==, "All work and no play make Jack a dull boy."); 241 298 } 242 299 … … 256 313 g_assert_true(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_SELECT_ALL)); 257 314 258 test->copyClipboard();259 GUniquePtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard));260 261 315 // Initially only the subspan is selected. 262 g_assert_cmpstr( clipboardText.get(), ==, "make Jack a dull");316 g_assert_cmpstr(test->copyClipboard(), ==, "make Jack a dull"); 263 317 264 318 webkit_web_view_execute_editing_command(test->m_webView, WEBKIT_EDITING_COMMAND_SELECT_ALL); 265 test->copyClipboard();266 clipboardText.reset(gtk_clipboard_wait_for_text(test->m_clipboard));267 268 319 // The mainspan should be selected after calling SELECT_ALL. 269 g_assert_cmpstr( clipboardText.get(), ==, "All work and no play make Jack a dull boy.");320 g_assert_cmpstr(test->copyClipboard(), ==, "All work and no play make Jack a dull boy."); 270 321 } 271 322 … … 287 338 288 339 // Cut the selection to the clipboard to see if the view is indeed editable. 289 GUniquePtr<char> clipboardText(test->cutSelection()); 290 g_assert_cmpstr(clipboardText.get(), ==, "make Jack a dull"); 340 g_assert_cmpstr(test->cutSelection(), ==, "make Jack a dull"); 291 341 292 342 // Reset the editable for next test. -
trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h
r263386 r265080 139 139 #if PLATFORM(GTK) 140 140 "process-swap-on-cross-site-navigation-enabled", TRUE, 141 #if !USE(GTK4) 141 142 "use-system-appearance-for-scrollbars", FALSE, 143 #endif 142 144 #endif 143 145 nullptr))); -
trunk/Tools/TestWebKitAPI/glib/WebKitGLib/gtk/WebViewTestGtk.cpp
r264647 r265080 29 29 void WebViewTest::platformDestroy() 30 30 { 31 #if USE(GTK4) 32 if (m_parentWindow) 33 gtk_window_destroy(GTK_WINDOW(m_parentWindow)); 34 #else 31 35 if (m_parentWindow) 32 36 gtk_widget_destroy(m_parentWindow); 37 #endif 33 38 } 34 39 … … 66 71 { 67 72 g_assert_null(m_parentWindow); 73 #if USE(GTK4) 74 m_parentWindow = gtk_window_new(); 75 gtk_window_set_child(GTK_WINDOW(m_parentWindow), GTK_WIDGET(m_webView)); 76 #else 68 77 m_parentWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); 78 gtk_container_add(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView)); 79 gtk_widget_show(GTK_WIDGET(m_webView)); 80 #endif 81 69 82 if (width && height) 70 83 gtk_window_set_default_size(GTK_WINDOW(m_parentWindow), width, height); 71 gtk_container_add(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView)); 72 gtk_widget_show(GTK_WIDGET(m_webView)); 84 73 85 gtk_widget_show(m_parentWindow); 74 86 -
trunk/Tools/TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp
r222962 r265080 69 69 bool isKeyDown(WKNativeEventPtr event) 70 70 { 71 return event->type== GDK_KEY_PRESS;71 return gdk_event_get_event_type(const_cast<GdkEvent*>(event)) == GDK_KEY_PRESS; 72 72 } 73 73 -
trunk/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
r264647 r265080 63 63 PlatformWebView::~PlatformWebView() 64 64 { 65 #if USE(GTK4) 66 gtk_window_destroy(GTK_WINDOW(m_window)); 67 #else 65 68 gtk_widget_destroy(m_window); 69 #endif 66 70 } 67 71 68 72 void PlatformWebView::initialize(WKPageConfigurationRef configuration) 69 73 { 74 m_view = WKViewCreate(configuration); 75 #if USE(GTK4) 76 m_window = gtk_window_new(); 77 gtk_window_set_child(GTK_WINDOW(m_window), GTK_WIDGET(m_view)); 78 #else 70 79 m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 71 m_view = WKViewCreate(configuration);72 80 gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_view)); 73 81 gtk_widget_show(GTK_WIDGET(m_view)); 82 #endif 74 83 gtk_widget_show(m_window); 75 84 }
Note: See TracChangeset
for help on using the changeset viewer.