diff options
Diffstat (limited to 'Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp')
-rw-r--r-- | Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp b/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp index 03160419e..0feb2b54a 100644 --- a/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp +++ b/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp @@ -27,18 +27,35 @@ #include "PlatformWebView.h" #include <WebCore/GUniquePtrGtk.h> +#include <WebKit/WKRetainPtr.h> +#include <WebKit/WKView.h> #include <gtk/gtk.h> -#include <wtf/gobject/GUniquePtr.h> +#include <wtf/glib/GUniquePtr.h> namespace TestWebKitAPI { PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef) { - m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - m_view = WKViewCreate(contextRef, pageGroupRef); - gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_view)); - gtk_widget_show(GTK_WIDGET(m_view)); - gtk_widget_show(m_window); + WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate()); + WKPageConfigurationSetContext(configuration.get(), contextRef); + WKPageConfigurationSetPageGroup(configuration.get(), pageGroupRef); + + initialize(configuration.get()); +} + +PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration) +{ + initialize(configuration); +} + +PlatformWebView::PlatformWebView(WKPageRef relatedPage) +{ + WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate()); + WKPageConfigurationSetContext(configuration.get(), WKPageGetContext(relatedPage)); + WKPageConfigurationSetPageGroup(configuration.get(), WKPageGetPageGroup(relatedPage)); + WKPageConfigurationSetRelatedPage(configuration.get(), relatedPage); + + initialize(configuration.get()); } PlatformWebView::~PlatformWebView() @@ -46,6 +63,15 @@ PlatformWebView::~PlatformWebView() gtk_widget_destroy(m_window); } +void PlatformWebView::initialize(WKPageConfigurationRef configuration) +{ + m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + m_view = WKViewCreate(configuration); + gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_view)); + gtk_widget_show(GTK_WIDGET(m_view)); + gtk_widget_show(m_window); +} + WKPageRef PlatformWebView::page() const { return WKViewGetPage(m_view); @@ -122,7 +148,7 @@ void PlatformWebView::simulateRightClick(unsigned x, unsigned y) doMouseButtonEvent(viewWidget, GDK_BUTTON_RELEASE, x, y, 3); } -void PlatformWebView::simulateMouseMove(unsigned x, unsigned y) +void PlatformWebView::simulateMouseMove(unsigned x, unsigned y, WKEventModifiers) { GUniquePtr<GdkEvent> event(gdk_event_new(GDK_MOTION_NOTIFY)); event->motion.x = x; |