summaryrefslogtreecommitdiff
path: root/Source/WebKit2/Shared/gtk
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 /Source/WebKit2/Shared/gtk
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebKit2/Shared/gtk')
-rw-r--r--Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp145
-rw-r--r--Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h23
-rw-r--r--Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp64
-rw-r--r--Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp8
-rw-r--r--Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp12
-rw-r--r--Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp22
-rw-r--r--Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp181
-rw-r--r--Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.h64
-rw-r--r--Source/WebKit2/Shared/gtk/WebEventFactory.cpp104
-rw-r--r--Source/WebKit2/Shared/gtk/WebEventFactory.h7
-rw-r--r--Source/WebKit2/Shared/gtk/WebKit2WaylandProtocol.xml37
-rw-r--r--Source/WebKit2/Shared/gtk/WebSelectionData.cpp54
-rw-r--r--Source/WebKit2/Shared/gtk/WebSelectionData.h42
13 files changed, 494 insertions, 269 deletions
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
index ef1cb1acc..342626020 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
@@ -29,27 +29,21 @@
#include "DataReference.h"
#include "ShareableBitmap.h"
#include "WebCoreArgumentCoders.h"
-#include <WebCore/DataObjectGtk.h>
-#include <WebCore/DragData.h>
#include <WebCore/GraphicsContext.h>
-#include <WebCore/GtkVersioning.h>
-#include <WebCore/PlatformContextCairo.h>
-#include <wtf/gobject/GUniquePtr.h>
+#include <WebCore/Image.h>
+#include <WebCore/SelectionData.h>
+#include <gtk/gtk.h>
+#include <wtf/glib/GUniquePtr.h>
using namespace WebCore;
using namespace WebKit;
namespace IPC {
-static void encodeImage(ArgumentEncoder& encoder, const GdkPixbuf* pixbuf)
+static void encodeImage(Encoder& encoder, Image& image)
{
- IntSize imageSize(gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, ShareableBitmap::SupportsAlpha);
- auto graphicsContext = bitmap->createGraphicsContext();
-
- cairo_t* cr = graphicsContext->platformContext()->cr();
- gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
- cairo_paint(cr);
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(IntSize(image.size()), ShareableBitmap::SupportsAlpha);
+ bitmap->createGraphicsContext()->drawImage(image, IntPoint());
ShareableBitmap::Handle handle;
bitmap->createHandle(handle);
@@ -57,7 +51,7 @@ static void encodeImage(ArgumentEncoder& encoder, const GdkPixbuf* pixbuf)
encoder << handle;
}
-static bool decodeImage(ArgumentDecoder& decoder, GRefPtr<GdkPixbuf>& pixbuf)
+static bool decodeImage(Decoder& decoder, RefPtr<Image>& image)
{
ShareableBitmap::Handle handle;
if (!decoder.decode(handle))
@@ -66,58 +60,51 @@ static bool decodeImage(ArgumentDecoder& decoder, GRefPtr<GdkPixbuf>& pixbuf)
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle);
if (!bitmap)
return false;
-
- RefPtr<Image> image = bitmap->createImage();
+ image = bitmap->createImage();
if (!image)
return false;
-
- RefPtr<cairo_surface_t> surface = image->nativeImageForCurrentFrame();
- if (!surface)
- return false;
-
- pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface.get(), 0, 0, cairo_image_surface_get_width(surface.get()), cairo_image_surface_get_height(surface.get())));
- if (!pixbuf)
- return false;
-
return true;
}
-static void encodeDataObject(ArgumentEncoder& encoder, const DataObjectGtk* dataObject)
+void ArgumentCoder<SelectionData>::encode(Encoder& encoder, const SelectionData& selection)
{
- bool hasText = dataObject->hasText();
+ bool hasText = selection.hasText();
encoder << hasText;
if (hasText)
- encoder << dataObject->text();
+ encoder << selection.text();
- bool hasMarkup = dataObject->hasMarkup();
+ bool hasMarkup = selection.hasMarkup();
encoder << hasMarkup;
if (hasMarkup)
- encoder << dataObject->markup();
+ encoder << selection.markup();
- bool hasURL = dataObject->hasURL();
+ bool hasURL = selection.hasURL();
encoder << hasURL;
if (hasURL)
- encoder << dataObject->url().string();
+ encoder << selection.url().string();
- bool hasURIList = dataObject->hasURIList();
+ bool hasURIList = selection.hasURIList();
encoder << hasURIList;
if (hasURIList)
- encoder << dataObject->uriList();
+ encoder << selection.uriList();
- bool hasImage = dataObject->hasImage();
+ bool hasImage = selection.hasImage();
encoder << hasImage;
if (hasImage)
- encodeImage(encoder, dataObject->image());
+ encodeImage(encoder, *selection.image());
- bool hasUnknownTypeData = dataObject->hasUnknownTypeData();
+ bool hasUnknownTypeData = selection.hasUnknownTypeData();
encoder << hasUnknownTypeData;
if (hasUnknownTypeData)
- encoder << dataObject->unknownTypes();
+ encoder << selection.unknownTypes();
+
+ bool canSmartReplace = selection.canSmartReplace();
+ encoder << canSmartReplace;
}
-static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& dataObject)
+bool ArgumentCoder<SelectionData>::decode(Decoder& decoder, SelectionData& selection)
{
- RefPtr<DataObjectGtk> data = DataObjectGtk::create();
+ selection.clearAll();
bool hasText;
if (!decoder.decode(hasText))
@@ -126,7 +113,7 @@ static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& da
String text;
if (!decoder.decode(text))
return false;
- data->setText(text);
+ selection.setText(text);
}
bool hasMarkup;
@@ -136,7 +123,7 @@ static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& da
String markup;
if (!decoder.decode(markup))
return false;
- data->setMarkup(markup);
+ selection.setMarkup(markup);
}
bool hasURL;
@@ -146,7 +133,7 @@ static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& da
String url;
if (!decoder.decode(url))
return false;
- data->setURL(URL(URL(), url), String());
+ selection.setURL(URL(URL(), url), String());
}
bool hasURIList;
@@ -156,17 +143,17 @@ static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& da
String uriList;
if (!decoder.decode(uriList))
return false;
- data->setURIList(uriList);
+ selection.setURIList(uriList);
}
bool hasImage;
if (!decoder.decode(hasImage))
return false;
if (hasImage) {
- GRefPtr<GdkPixbuf> image;
+ RefPtr<Image> image;
if (!decodeImage(decoder, image))
return false;
- data->setImage(image.get());
+ selection.setImage(image.get());
}
bool hasUnknownTypeData;
@@ -179,71 +166,25 @@ static bool decodeDataObject(ArgumentDecoder& decoder, RefPtr<DataObjectGtk>& da
auto end = unknownTypes.end();
for (auto it = unknownTypes.begin(); it != end; ++it)
- data->setUnknownTypeData(it->key, it->value);
+ selection.setUnknownTypeData(it->key, it->value);
}
- dataObject = data;
-
- return true;
-}
-
-#if ENABLE(DRAG_SUPPORT)
-void ArgumentCoder<DragData>::encode(ArgumentEncoder& encoder, const DragData& dragData)
-{
- encoder << dragData.clientPosition();
- encoder << dragData.globalPosition();
- encoder << static_cast<uint64_t>(dragData.draggingSourceOperationMask());
- encoder << static_cast<uint64_t>(dragData.flags());
-
- DataObjectGtk* platformData = dragData.platformData();
- encoder << static_cast<bool>(platformData);
- if (platformData)
- encodeDataObject(encoder, platformData);
-}
-
-bool ArgumentCoder<DragData>::decode(ArgumentDecoder& decoder, DragData& dragData)
-{
- IntPoint clientPosition;
- if (!decoder.decode(clientPosition))
- return false;
-
- IntPoint globalPosition;
- if (!decoder.decode(globalPosition))
- return false;
-
- uint64_t sourceOperationMask;
- if (!decoder.decode(sourceOperationMask))
- return false;
-
- uint64_t flags;
- if (!decoder.decode(flags))
- return false;
-
- bool hasPlatformData;
- if (!decoder.decode(hasPlatformData))
+ bool canSmartReplace;
+ if (!decoder.decode(canSmartReplace))
return false;
-
- RefPtr<DataObjectGtk> platformData;
- if (hasPlatformData) {
- if (!decodeDataObject(decoder, platformData))
- return false;
- }
-
- dragData = DragData(platformData.release().leakRef(), clientPosition, globalPosition, static_cast<DragOperation>(sourceOperationMask),
- static_cast<DragApplicationFlags>(flags));
+ selection.setCanSmartReplace(canSmartReplace);
return true;
}
-#endif // ENABLE(DRAG_SUPPORT)
-static void encodeGKeyFile(ArgumentEncoder& encoder, GKeyFile* keyFile)
+static void encodeGKeyFile(Encoder& encoder, GKeyFile* keyFile)
{
gsize dataSize;
GUniquePtr<char> data(g_key_file_to_data(keyFile, &dataSize, 0));
encoder << DataReference(reinterpret_cast<uint8_t*>(data.get()), dataSize);
}
-static bool decodeGKeyFile(ArgumentDecoder& decoder, GUniquePtr<GKeyFile>& keyFile)
+static bool decodeGKeyFile(Decoder& decoder, GUniquePtr<GKeyFile>& keyFile)
{
DataReference dataReference;
if (!decoder.decode(dataReference))
@@ -261,14 +202,14 @@ static bool decodeGKeyFile(ArgumentDecoder& decoder, GUniquePtr<GKeyFile>& keyFi
return true;
}
-void encode(ArgumentEncoder& encoder, GtkPrintSettings* printSettings)
+void encode(Encoder& encoder, GtkPrintSettings* printSettings)
{
GUniquePtr<GKeyFile> keyFile(g_key_file_new());
gtk_print_settings_to_key_file(printSettings, keyFile.get(), "Print Settings");
encodeGKeyFile(encoder, keyFile.get());
}
-bool decode(ArgumentDecoder& decoder, GRefPtr<GtkPrintSettings>& printSettings)
+bool decode(Decoder& decoder, GRefPtr<GtkPrintSettings>& printSettings)
{
GUniquePtr<GKeyFile> keyFile;
if (!decodeGKeyFile(decoder, keyFile))
@@ -284,14 +225,14 @@ bool decode(ArgumentDecoder& decoder, GRefPtr<GtkPrintSettings>& printSettings)
return printSettings;
}
-void encode(ArgumentEncoder& encoder, GtkPageSetup* pageSetup)
+void encode(Encoder& encoder, GtkPageSetup* pageSetup)
{
GUniquePtr<GKeyFile> keyFile(g_key_file_new());
gtk_page_setup_to_key_file(pageSetup, keyFile.get(), "Page Setup");
encodeGKeyFile(encoder, keyFile.get());
}
-bool decode(ArgumentDecoder& decoder, GRefPtr<GtkPageSetup>& pageSetup)
+bool decode(Decoder& decoder, GRefPtr<GtkPageSetup>& pageSetup)
{
GUniquePtr<GKeyFile> keyFile;
if (!decodeGKeyFile(decoder, keyFile))
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
index 4aa55de74..f1e78502f 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
@@ -27,30 +27,27 @@
#define ArgumentCodersGtk_h
#include "ArgumentCoders.h"
-#include <wtf/gobject/GRefPtr.h>
+#include <wtf/glib/GRefPtr.h>
typedef struct _GtkPrintSettings GtkPrintSettings;
typedef struct _GtkPageSetup GtkPageSetup;
namespace WebCore {
-class DataObjectGtk;
-class DragData;
+class SelectionData;
}
namespace IPC {
-#if ENABLE(DRAG_SUPPORT)
-template<> struct ArgumentCoder<WebCore::DragData> {
- static void encode(ArgumentEncoder&, const WebCore::DragData&);
- static bool decode(ArgumentDecoder&, WebCore::DragData&);
-};
-#endif
+void encode(Encoder&, GtkPrintSettings*);
+bool decode(Decoder&, GRefPtr<GtkPrintSettings>&);
-void encode(ArgumentEncoder&, GtkPrintSettings*);
-bool decode(ArgumentDecoder&, GRefPtr<GtkPrintSettings>&);
+void encode(Encoder&, GtkPageSetup*);
+bool decode(Decoder&, GRefPtr<GtkPageSetup>&);
-void encode(ArgumentEncoder&, GtkPageSetup*);
-bool decode(ArgumentDecoder&, GRefPtr<GtkPageSetup>&);
+template<> struct ArgumentCoder<WebCore::SelectionData> {
+ static void encode(Encoder&, const WebCore::SelectionData&);
+ static bool decode(Decoder&, WebCore::SelectionData&);
+};
} // namespace IPC
diff --git a/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp b/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp
deleted file mode 100644
index 5ba79d337..000000000
--- a/Source/WebKit2/Shared/gtk/LayerTreeContextGtk.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayerTreeContext.h"
-
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
-
-namespace WebKit {
-
-LayerTreeContext::LayerTreeContext()
- : windowHandle(0)
-{
-}
-
-LayerTreeContext::~LayerTreeContext()
-{
-}
-
-void LayerTreeContext::encode(IPC::ArgumentEncoder& encoder) const
-{
- encoder << windowHandle;
-}
-
-bool LayerTreeContext::decode(IPC::ArgumentDecoder& decoder, LayerTreeContext& context)
-{
- return decoder.decode(context.windowHandle);
-}
-
-bool LayerTreeContext::isEmpty() const
-{
- return !windowHandle;
-}
-
-bool operator==(const LayerTreeContext& a, const LayerTreeContext& b)
-{
- return a.windowHandle == b.windowHandle;
-}
-
-} // namespace WebKit
-
diff --git a/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp b/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
index 424e0b3f9..834a7e091 100644
--- a/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
@@ -35,16 +35,16 @@ using namespace WebCore;
namespace WebKit {
-NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event, const WebCore::CompositionResults& compositionResults, GtkInputMethodFilter::EventFakedForComposition faked)
- : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, compositionResults))
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event, const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked, Vector<String>&& commands)
+ : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, compositionResults, WTFMove(commands)))
, m_nativeEvent(gdk_event_copy(event))
, m_compositionResults(compositionResults)
- , m_fakeEventForComposition(faked == GtkInputMethodFilter::EventFaked)
+ , m_fakeEventForComposition(faked == InputMethodFilter::EventFaked)
{
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event)
- : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event.nativeEvent(), event.compositionResults()))
+ : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event.nativeEvent(), event.compositionResults(), Vector<String>(event.commands())))
, m_nativeEvent(gdk_event_copy(event.nativeEvent()))
, m_compositionResults(event.compositionResults())
, m_fakeEventForComposition(event.isFakeEventForComposition())
diff --git a/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp b/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp
index b2cd4a536..5ec476b2d 100644
--- a/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp
@@ -26,23 +26,25 @@
#include "config.h"
#include "NativeWebTouchEvent.h"
+#if ENABLE(TOUCH_EVENTS)
+
#include "WebEventFactory.h"
#include <gdk/gdk.h>
namespace WebKit {
-NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, WebCore::GtkTouchContextHelper& context)
- : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, context))
+NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
+ : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, WTFMove(touchPoints)))
, m_nativeEvent(gdk_event_copy(event))
- , m_touchContext(context)
{
}
NativeWebTouchEvent::NativeWebTouchEvent(const NativeWebTouchEvent& event)
- : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), event.touchContext()))
+ : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), Vector<WebPlatformTouchPoint>(event.touchPoints())))
, m_nativeEvent(gdk_event_copy(event.nativeEvent()))
- , m_touchContext(event.touchContext())
{
}
} // namespace WebKit
+
+#endif // ENABLE(TOUCH_EVENTS)
diff --git a/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp b/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
index e757cc2ea..f0aa966db 100644
--- a/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
@@ -29,25 +29,31 @@
#include <WebCore/FileSystem.h>
#include <glib.h>
-#include <wtf/gobject/GlibUtilities.h>
+
+#if ENABLE(DEVELOPER_MODE)
+#include <wtf/glib/GLibUtilities.h>
+#endif
using namespace WebCore;
namespace WebKit {
+#if ENABLE(DEVELOPER_MODE)
static String getExecutablePath()
{
CString executablePath = getCurrentExecutablePath();
if (!executablePath.isNull())
- return directoryName(filenameToString(executablePath.data()));
+ return directoryName(stringFromFileSystemRepresentation(executablePath.data()));
return String();
}
+#endif
static String findWebKitProcess(const char* processName)
{
+#if ENABLE(DEVELOPER_MODE)
static const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
if (execDirectory) {
- String processPath = pathByAppendingComponent(filenameToString(execDirectory), processName);
+ String processPath = pathByAppendingComponent(stringFromFileSystemRepresentation(execDirectory), processName);
if (fileExists(processPath))
return processPath;
}
@@ -58,8 +64,9 @@ static String findWebKitProcess(const char* processName)
if (fileExists(processPath))
return processPath;
}
+#endif
- return pathByAppendingComponent(filenameToString(LIBEXECDIR), processName);
+ return pathByAppendingComponent(stringFromFileSystemRepresentation(PKGLIBEXECDIR), processName);
}
String executablePathOfWebProcess()
@@ -72,11 +79,16 @@ String executablePathOfPluginProcess()
return findWebKitProcess("WebKitPluginProcess");
}
-#if ENABLE(NETWORK_PROCESS)
String executablePathOfNetworkProcess()
{
return findWebKitProcess("WebKitNetworkProcess");
}
+
+#if ENABLE(DATABASE_PROCESS)
+String executablePathOfDatabaseProcess()
+{
+ return findWebKitProcess("WebKitDatabaseProcess");
+}
#endif
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp b/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp
new file mode 100644
index 000000000..a93552991
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebContextMenuItemGtk.h"
+
+#include <gtk/gtk.h>
+#include <wtf/glib/GUniquePtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static const char* gtkStockIDFromContextMenuAction(ContextMenuAction action)
+{
+ switch (action) {
+ case ContextMenuItemTagCopyLinkToClipboard:
+ case ContextMenuItemTagCopyImageToClipboard:
+ case ContextMenuItemTagCopyMediaLinkToClipboard:
+ case ContextMenuItemTagCopy:
+ return GTK_STOCK_COPY;
+ case ContextMenuItemTagOpenLinkInNewWindow:
+ case ContextMenuItemTagOpenImageInNewWindow:
+ case ContextMenuItemTagOpenFrameInNewWindow:
+ case ContextMenuItemTagOpenMediaInNewWindow:
+ return GTK_STOCK_OPEN;
+ case ContextMenuItemTagDownloadLinkToDisk:
+ case ContextMenuItemTagDownloadImageToDisk:
+ return GTK_STOCK_SAVE;
+ case ContextMenuItemTagGoBack:
+ return GTK_STOCK_GO_BACK;
+ case ContextMenuItemTagGoForward:
+ return GTK_STOCK_GO_FORWARD;
+ case ContextMenuItemTagStop:
+ return GTK_STOCK_STOP;
+ case ContextMenuItemTagReload:
+ return GTK_STOCK_REFRESH;
+ case ContextMenuItemTagCut:
+ return GTK_STOCK_CUT;
+ case ContextMenuItemTagPaste:
+ return GTK_STOCK_PASTE;
+ case ContextMenuItemTagDelete:
+ return GTK_STOCK_DELETE;
+ case ContextMenuItemTagSelectAll:
+ return GTK_STOCK_SELECT_ALL;
+ case ContextMenuItemTagSpellingGuess:
+ return 0;
+ case ContextMenuItemTagIgnoreSpelling:
+ return GTK_STOCK_NO;
+ case ContextMenuItemTagLearnSpelling:
+ return GTK_STOCK_OK;
+ case ContextMenuItemTagOther:
+ return GTK_STOCK_MISSING_IMAGE;
+ case ContextMenuItemTagSearchInSpotlight:
+ return GTK_STOCK_FIND;
+ case ContextMenuItemTagSearchWeb:
+ return GTK_STOCK_FIND;
+ case ContextMenuItemTagOpenWithDefaultApplication:
+ return GTK_STOCK_OPEN;
+ case ContextMenuItemPDFZoomIn:
+ return GTK_STOCK_ZOOM_IN;
+ case ContextMenuItemPDFZoomOut:
+ return GTK_STOCK_ZOOM_OUT;
+ case ContextMenuItemPDFAutoSize:
+ return GTK_STOCK_ZOOM_FIT;
+ case ContextMenuItemPDFNextPage:
+ return GTK_STOCK_GO_FORWARD;
+ case ContextMenuItemPDFPreviousPage:
+ return GTK_STOCK_GO_BACK;
+ // New tags, not part of API
+ case ContextMenuItemTagOpenLink:
+ return GTK_STOCK_OPEN;
+ case ContextMenuItemTagCheckSpelling:
+ return GTK_STOCK_SPELL_CHECK;
+ case ContextMenuItemTagFontMenu:
+ return GTK_STOCK_SELECT_FONT;
+ case ContextMenuItemTagShowFonts:
+ return GTK_STOCK_SELECT_FONT;
+ case ContextMenuItemTagBold:
+ return GTK_STOCK_BOLD;
+ case ContextMenuItemTagItalic:
+ return GTK_STOCK_ITALIC;
+ case ContextMenuItemTagUnderline:
+ return GTK_STOCK_UNDERLINE;
+ case ContextMenuItemTagShowColors:
+ return GTK_STOCK_SELECT_COLOR;
+ case ContextMenuItemTagToggleMediaControls:
+ case ContextMenuItemTagToggleMediaLoop:
+ case ContextMenuItemTagCopyImageUrlToClipboard:
+ // No icon for this.
+ return 0;
+ case ContextMenuItemTagEnterVideoFullscreen:
+ return GTK_STOCK_FULLSCREEN;
+ default:
+ return 0;
+ }
+}
+
+WebContextMenuItemGtk::WebContextMenuItemGtk(ContextMenuItemType type, ContextMenuAction action, const String& title, bool enabled, bool checked)
+ : WebContextMenuItemData(type, action, title, enabled, checked)
+{
+ ASSERT(type != SubmenuType);
+ createActionIfNeeded();
+}
+
+WebContextMenuItemGtk::WebContextMenuItemGtk(const WebContextMenuItemData& data)
+ : WebContextMenuItemData(data.type() == SubmenuType ? ActionType : data.type(), data.action(), data.title(), data.enabled(), data.checked())
+{
+ createActionIfNeeded();
+}
+
+WebContextMenuItemGtk::WebContextMenuItemGtk(const WebContextMenuItemGtk& data, Vector<WebContextMenuItemGtk>&& submenu)
+ : WebContextMenuItemData(ActionType, data.action(), data.title(), data.enabled(), false)
+{
+ m_gAction = G_SIMPLE_ACTION(data.gAction());
+ m_gtkAction = data.gtkAction();
+ m_submenuItems = WTFMove(submenu);
+}
+
+WebContextMenuItemGtk::WebContextMenuItemGtk(GtkAction* action)
+ : WebContextMenuItemData(GTK_IS_TOGGLE_ACTION(action) ? CheckableActionType : ActionType, ContextMenuItemBaseApplicationTag, String::fromUTF8(gtk_action_get_label(action)), gtk_action_get_sensitive(action), GTK_IS_TOGGLE_ACTION(action) ? gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)) : false)
+{
+ m_gtkAction = action;
+ createActionIfNeeded();
+ g_object_set_data_full(G_OBJECT(m_gAction.get()), "webkit-gtk-action", g_object_ref(m_gtkAction), g_object_unref);
+}
+
+WebContextMenuItemGtk::~WebContextMenuItemGtk()
+{
+}
+
+void WebContextMenuItemGtk::createActionIfNeeded()
+{
+ if (type() == SeparatorType)
+ return;
+
+ static uint64_t actionID = 0;
+ GUniquePtr<char> actionName(g_strdup_printf("action-%" PRIu64, ++actionID));
+ if (type() == CheckableActionType)
+ m_gAction = adoptGRef(g_simple_action_new_stateful(actionName.get(), nullptr, g_variant_new_boolean(checked())));
+ else
+ m_gAction = adoptGRef(g_simple_action_new(actionName.get(), nullptr));
+ g_simple_action_set_enabled(m_gAction.get(), enabled());
+
+ // Create the GtkAction for backwards compatibility only.
+ if (!m_gtkAction) {
+ if (type() == CheckableActionType) {
+ m_gtkAction = GTK_ACTION(gtk_toggle_action_new(actionName.get(), title().utf8().data(), nullptr, gtkStockIDFromContextMenuAction(action())));
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(m_gtkAction), checked());
+ } else
+ m_gtkAction = gtk_action_new(actionName.get(), title().utf8().data(), 0, gtkStockIDFromContextMenuAction(action()));
+ gtk_action_set_sensitive(m_gtkAction, enabled());
+ g_object_set_data_full(G_OBJECT(m_gAction.get()), "webkit-gtk-action", m_gtkAction, g_object_unref);
+ }
+
+ g_signal_connect_object(m_gAction.get(), "activate", G_CALLBACK(gtk_action_activate), m_gtkAction, G_CONNECT_SWAPPED);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.h b/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.h
new file mode 100644
index 000000000..1df8b08c6
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebContextMenuItemGtk_h
+#define WebContextMenuItemGtk_h
+
+#include "APIObject.h"
+#include "WebContextMenuItemData.h"
+#include <wtf/glib/GRefPtr.h>
+
+typedef struct _GtkAction GtkAction;
+typedef struct _GAction GAction;
+typedef struct _GSimpleAction GSimpleAction;
+
+namespace WebKit {
+
+class WebContextMenuItemGtk : public WebContextMenuItemData {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ WebContextMenuItemGtk(WebCore::ContextMenuItemType, WebCore::ContextMenuAction, const String& title, bool enabled = true, bool checked = false);
+ WebContextMenuItemGtk(const WebContextMenuItemData&);
+ WebContextMenuItemGtk(const WebContextMenuItemGtk&, Vector<WebContextMenuItemGtk>&& submenu);
+ WebContextMenuItemGtk(GtkAction*);
+ ~WebContextMenuItemGtk();
+
+ // We don't use the SubmenuType internally, so check if we have submenu items.
+ WebCore::ContextMenuItemType type() const { return m_submenuItems.isEmpty() ? WebContextMenuItemData::type() : WebCore::SubmenuType; }
+ GtkAction* gtkAction() const { return m_gtkAction; }
+ GAction* gAction() const { return reinterpret_cast<GAction*>(m_gAction.get()); }
+ const Vector<WebContextMenuItemGtk>& submenuItems() const { return m_submenuItems; }
+
+private:
+ void createActionIfNeeded();
+
+ GRefPtr<GSimpleAction> m_gAction;
+ GtkAction* m_gtkAction { nullptr };
+ Vector<WebContextMenuItemGtk> m_submenuItems;
+};
+
+} // namespace WebKit
+
+#endif // WebContextMenuItemGtk_h
diff --git a/Source/WebKit2/Shared/gtk/WebEventFactory.cpp b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
index 462b11b89..afb5f8451 100644
--- a/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
+++ b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
@@ -63,6 +63,8 @@ static inline WebEvent::Modifiers modifiersForEvent(const GdkEvent* event)
modifiers |= WebEvent::AltKey;
if (state & GDK_META_MASK)
modifiers |= WebEvent::MetaKey;
+ if (PlatformKeyboardEvent::modifiersContainCapsLock(state))
+ modifiers |= WebEvent::CapsLockKey;
return static_cast<WebEvent::Modifiers>(modifiers);
}
@@ -72,15 +74,20 @@ static inline WebMouseEvent::Button buttonForEvent(const GdkEvent* event)
unsigned button = 0;
switch (event->type) {
- case GDK_MOTION_NOTIFY:
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ case GDK_MOTION_NOTIFY: {
button = WebMouseEvent::NoButton;
- if (event->motion.state & GDK_BUTTON1_MASK)
+ GdkModifierType state;
+ gdk_event_get_state(event, &state);
+ if (state & GDK_BUTTON1_MASK)
button = WebMouseEvent::LeftButton;
- else if (event->motion.state & GDK_BUTTON2_MASK)
+ else if (state & GDK_BUTTON2_MASK)
button = WebMouseEvent::MiddleButton;
- else if (event->motion.state & GDK_BUTTON3_MASK)
+ else if (state & GDK_BUTTON3_MASK)
button = WebMouseEvent::RightButton;
break;
+ }
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
@@ -108,6 +115,8 @@ WebMouseEvent WebEventFactory::createWebMouseEvent(const GdkEvent* event, int cu
WebEvent::Type type = static_cast<WebEvent::Type>(0);
switch (event->type) {
case GDK_MOTION_NOTIFY:
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
type = WebEvent::MouseMove;
break;
case GDK_BUTTON_PRESS:
@@ -181,69 +190,28 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event)
gdk_event_get_time(event));
}
-WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event, const WebCore::CompositionResults& compositionResults)
-{
- unsigned int keyValue = event->key.keyval;
- String text = compositionResults.simpleString.length() ?
- compositionResults.simpleString : PlatformKeyboardEvent::singleCharacterString(keyValue);
-
- int windowsVirtualKeyCode = compositionResults.compositionUpdated() ?
- VK_PROCESSKEY : PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event->key.keyval);
-
- return WebKeyboardEvent((event->type == GDK_KEY_RELEASE) ? WebEvent::KeyUp : WebEvent::KeyDown,
- text,
- text,
- PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(keyValue),
- windowsVirtualKeyCode,
- static_cast<int>(keyValue),
- 0 /* macCharCode */,
- false /* isAutoRepeat */,
- isGdkKeyCodeFromKeyPad(keyValue),
- false /* isSystemKey */,
- modifiersForEvent(event),
- gdk_event_get_time(event));
-}
-
-#ifndef GTK_API_VERSION_2
-static WebPlatformTouchPoint::TouchPointState touchPhaseFromEvents(const GdkEvent* current, const GdkEvent* event)
-{
- if (gdk_event_get_event_sequence(current) != gdk_event_get_event_sequence(event))
- return WebPlatformTouchPoint::TouchStationary;
-
- switch (current->type) {
- case GDK_TOUCH_UPDATE:
- return WebPlatformTouchPoint::TouchMoved;
- case GDK_TOUCH_BEGIN:
- return WebPlatformTouchPoint::TouchPressed;
- case GDK_TOUCH_END:
- return WebPlatformTouchPoint::TouchReleased;
- default:
- return WebPlatformTouchPoint::TouchStationary;
- }
-}
-
-static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPointList, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state)
+WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event, const WebCore::CompositionResults& compositionResults, Vector<String>&& commands)
{
- uint32_t identifier = GPOINTER_TO_UINT(gdk_event_get_event_sequence(event));
-
- gdouble x, y;
- gdk_event_get_coords(event, &x, &y);
-
- gdouble xRoot, yRoot;
- gdk_event_get_root_coords(event, &xRoot, &yRoot);
-
- WebPlatformTouchPoint touchPoint(identifier, state, IntPoint(xRoot, yRoot), IntPoint(x, y));
- touchPointList.uncheckedAppend(touchPoint);
+ return WebKeyboardEvent(
+ event->type == GDK_KEY_RELEASE ? WebEvent::KeyUp : WebEvent::KeyDown,
+ compositionResults.simpleString.length() ? compositionResults.simpleString : PlatformKeyboardEvent::singleCharacterString(event->key.keyval),
+ PlatformKeyboardEvent::keyValueForGdkKeyCode(event->key.keyval),
+ PlatformKeyboardEvent::keyCodeForHardwareKeyCode(event->key.hardware_keycode),
+ PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event->key.keyval),
+ PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event->key.keyval),
+ static_cast<int>(event->key.keyval),
+ compositionResults.compositionUpdated(),
+ WTFMove(commands),
+ isGdkKeyCodeFromKeyPad(event->key.keyval),
+ modifiersForEvent(event),
+ gdk_event_get_time(event));
}
-#endif // GTK_API_VERSION_2
-WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const WebCore::GtkTouchContextHelper& touchContext)
+#if ENABLE(TOUCH_EVENTS)
+WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
{
#ifndef GTK_API_VERSION_2
WebEvent::Type type = WebEvent::NoType;
- const auto& touchEvents = touchContext.touchEvents();
- int numEvents = touchEvents.size();
-
switch (event->type) {
case GDK_TOUCH_BEGIN:
type = WebEvent::TouchStart;
@@ -253,26 +221,16 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const
break;
case GDK_TOUCH_END:
type = WebEvent::TouchEnd;
- ++numEvents;
break;
default:
ASSERT_NOT_REACHED();
}
- Vector<WebPlatformTouchPoint> touchPointList;
- touchPointList.reserveInitialCapacity(numEvents);
-
- for (auto it = touchEvents.begin(); it != touchEvents.end(); ++it)
- appendTouchEvent(touchPointList, it->value.get(), touchPhaseFromEvents(it->value.get(), event));
-
- // Touch was already removed from the GtkTouchContextHelper, add it here.
- if (event->type == GDK_TOUCH_END)
- appendTouchEvent(touchPointList, event, WebPlatformTouchPoint::TouchReleased);
-
- return WebTouchEvent(type, touchPointList, modifiersForEvent(event), gdk_event_get_time(event));
+ return WebTouchEvent(type, WTFMove(touchPoints), modifiersForEvent(event), gdk_event_get_time(event));
#else
return WebTouchEvent();
#endif // GTK_API_VERSION_2
}
+#endif
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/WebEventFactory.h b/Source/WebKit2/Shared/gtk/WebEventFactory.h
index fc30296f4..28b69538e 100644
--- a/Source/WebKit2/Shared/gtk/WebEventFactory.h
+++ b/Source/WebKit2/Shared/gtk/WebEventFactory.h
@@ -29,7 +29,6 @@
#include "WebEvent.h"
#include <WebCore/CompositionResults.h>
-#include <WebCore/GtkTouchContextHelper.h>
typedef union _GdkEvent GdkEvent;
@@ -39,8 +38,10 @@ class WebEventFactory {
public:
static WebMouseEvent createWebMouseEvent(const GdkEvent*, int);
static WebWheelEvent createWebWheelEvent(const GdkEvent*);
- static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&);
- static WebTouchEvent createWebTouchEvent(const GdkEvent*, const WebCore::GtkTouchContextHelper&);
+ static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&, Vector<String>&& commands);
+#if ENABLE(TOUCH_EVENTS)
+ static WebTouchEvent createWebTouchEvent(const GdkEvent*, Vector<WebPlatformTouchPoint>&&);
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/WebKit2WaylandProtocol.xml b/Source/WebKit2/Shared/gtk/WebKit2WaylandProtocol.xml
new file mode 100644
index 000000000..1246132f9
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebKit2WaylandProtocol.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="wl_webkitgtk">
+
+ <copyright>
+ Copyright © 2014 Igalia S.L.
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <interface name="wl_webkitgtk" version="1">
+ <request name="bind_surface_to_page">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="page_id" type="uint"/>
+ </request>
+
+ </interface>
+
+</protocol>
diff --git a/Source/WebKit2/Shared/gtk/WebSelectionData.cpp b/Source/WebKit2/Shared/gtk/WebSelectionData.cpp
new file mode 100644
index 000000000..19fc24ac6
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebSelectionData.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "WebSelectionData.h"
+
+#include "ArgumentCodersGtk.h"
+#include "Decoder.h"
+#include "Encoder.h"
+#include <wtf/RetainPtr.h>
+
+namespace WebKit {
+
+WebSelectionData::WebSelectionData()
+ : selectionData(WebCore::SelectionData::create())
+{
+}
+
+WebSelectionData::WebSelectionData(const WebCore::SelectionData& data)
+ : selectionData(const_cast<WebCore::SelectionData&>(data))
+{
+}
+
+WebSelectionData::WebSelectionData(Ref<WebCore::SelectionData>&& data)
+ : selectionData(WTFMove(data))
+{
+}
+
+void WebSelectionData::encode(IPC::Encoder& encoder) const
+{
+ encoder << selectionData.get();
+}
+
+bool WebSelectionData::decode(IPC::Decoder& decoder, WebSelectionData& selection)
+{
+ return decoder.decode(selection.selectionData.get());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/WebSelectionData.h b/Source/WebKit2/Shared/gtk/WebSelectionData.h
new file mode 100644
index 000000000..18d850304
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebSelectionData.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#pragma once
+
+#include <WebCore/SelectionData.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+struct WebSelectionData {
+ WebSelectionData();
+ explicit WebSelectionData(const WebCore::SelectionData&);
+ explicit WebSelectionData(Ref<WebCore::SelectionData>&&);
+
+ Ref<WebCore::SelectionData> selectionData;
+
+ void encode(IPC::Encoder&) const;
+ static bool decode(IPC::Decoder&, WebSelectionData&);
+};
+
+} // namespace WebKit
+