summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp')
-rw-r--r--Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp40
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;