Modified: trunk/Source/WebKit2/ChangeLog (218250 => 218251)
--- trunk/Source/WebKit2/ChangeLog 2017-06-14 10:41:33 UTC (rev 218250)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-14 10:49:18 UTC (rev 218251)
@@ -1,5 +1,18 @@
2017-06-14 Carlos Garcia Campos <[email protected]>
+ [GTK] Use API::InjectedBundle::EditorClient in WebKitWebEditor
+ https://bugs.webkit.org/show_bug.cgi?id=173355
+
+ Reviewed by Žan Doberšek.
+
+ Instead of the C API.
+
+ * WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp:
+ (webkitWebEditorCreate):
+ (didChangeSelection): Deleted.
+
+2017-06-14 Carlos Garcia Campos <[email protected]>
+
Unreviewed. Fix GTK+ build with GCC 4.9 after r218244.
It seems that GCC 4.9 gets confused by enum named General and value of Print enum named General too. This
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp (218250 => 218251)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp 2017-06-14 10:41:33 UTC (rev 218250)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.cpp 2017-06-14 10:49:18 UTC (rev 218251)
@@ -23,7 +23,6 @@
#include "WebKitPrivate.h"
#include "WebKitWebEditorPrivate.h"
#include "WebKitWebPagePrivate.h"
-#include "WKBundleAPICast.h"
using namespace WebKit;
using namespace WebCore;
@@ -75,35 +74,27 @@
G_TYPE_NONE, 0);
}
-static void didChangeSelection(WKBundlePageRef, WKStringRef /* notificationName */, const void* clientInfo)
-{
- g_signal_emit(WEBKIT_WEB_EDITOR(clientInfo), signals[SELECTION_CHANGED], 0);
-}
+class PageEditorClient final : public API::InjectedBundle::EditorClient {
+public:
+ explicit PageEditorClient(WebKitWebEditor* editor)
+ : m_editor(editor)
+ {
+ }
+private:
+ void didChangeSelection(WebPage&, StringImpl*) override
+ {
+ g_signal_emit(m_editor, signals[SELECTION_CHANGED], 0);
+ }
+
+ WebKitWebEditor* m_editor;
+};
+
WebKitWebEditor* webkitWebEditorCreate(WebKitWebPage* webPage)
{
WebKitWebEditor* editor = WEBKIT_WEB_EDITOR(g_object_new(WEBKIT_TYPE_WEB_EDITOR, nullptr));
editor->priv->webPage = webPage;
-
- WKBundlePageEditorClientV0 editorClient = {
- {
- 0, // version
- editor, // clientInfo
- },
- nullptr, // shouldBeginEditing
- nullptr, // shouldEndEditing
- nullptr, // shouldInsertNode
- nullptr, // shouldInsertText
- nullptr, // shouldDeleteRange
- nullptr, // shouldChangeSelectedRange
- nullptr, // shouldApplyStyle
- nullptr, // didBeginEditing
- nullptr, // didEndEditing
- nullptr, // didChange
- didChangeSelection
- };
- WKBundlePageSetEditorClient(toAPI(webkitWebPageGetPage(webPage)), &editorClient.base);
-
+ webkitWebPageGetPage(webPage)->setInjectedBundleEditorClient(std::make_unique<PageEditorClient>(editor));
return editor;
}