Diff
Modified: trunk/Source/WebCore/platform/gtk/po/ChangeLog (215731 => 215732)
--- trunk/Source/WebCore/platform/gtk/po/ChangeLog 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebCore/platform/gtk/po/ChangeLog 2017-04-25 15:24:35 UTC (rev 215732)
@@ -1,3 +1,14 @@
+2017-04-25 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Add WebKitInspectorWindow to create inspector windows from local and remote inspector
+ https://bugs.webkit.org/show_bug.cgi?id=171261
+
+ Reviewed by Michael Catanzaro.
+
+ Remove WebInspectorProxyGtk.cpp and RemoteWebInspectorProxyGtk.cpp from POTFILES.in and add WebKitInspectorWindow.cpp.
+
+ * POTFILES.in:
+
2017-04-25 Piotr Drąg <piotrd...@gmail.com>
[GTK] Add po/Makevars
Modified: trunk/Source/WebCore/platform/gtk/po/POTFILES.in (215731 => 215732)
--- trunk/Source/WebCore/platform/gtk/po/POTFILES.in 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebCore/platform/gtk/po/POTFILES.in 2017-04-25 15:24:35 UTC (rev 215732)
@@ -31,9 +31,8 @@
../../../WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
../../../WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
../../../WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
-../../../WebKit2/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp
../../../WebKit2/UIProcess/gtk/WebColorPickerGtk.cpp
-../../../WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
+../../../WebKit2/UIProcess/gtk/WebKitInspectorWindow.cpp
../../../WebKit2/UIProcess/WebEditCommandProxy.cpp
../../../WebKit2/UIProcess/WebsiteData/WebsiteDataRecord.cpp
../../../WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebHitTestResult.cpp
Modified: trunk/Source/WebKit2/ChangeLog (215731 => 215732)
--- trunk/Source/WebKit2/ChangeLog 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-25 15:24:35 UTC (rev 215732)
@@ -1,3 +1,28 @@
+2017-04-25 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Add WebKitInspectorWindow to create inspector windows from local and remote inspector
+ https://bugs.webkit.org/show_bug.cgi?id=171261
+
+ Reviewed by Michael Catanzaro.
+
+ The code is currently duplicated in WebInspectorProxyGtk.cpp and RemoteWebInspectorProxyGtk.cpp. We can simplify
+ it by using a common widget in both places.
+ This patch also fixes the build when using GTK+ < 3.16.
+
+ * PlatformGTK.cmake:
+ * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
+ (WebKit::RemoteWebInspectorProxy::updateWindowTitle):
+ (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
+ * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+ (WebKit::WebInspectorProxy::createInspectorWindow):
+ (WebKit::WebInspectorProxy::updateInspectorWindowTitle):
+ * UIProcess/gtk/WebKitInspectorWindow.cpp: Added.
+ (webkit_inspector_window_class_init):
+ (webkit_inspector_window_init):
+ (webkitInspectorWindowNew):
+ (webkitInspectorWindowSetSubtitle):
+ * UIProcess/gtk/WebKitInspectorWindow.h: Added.
+
2017-04-25 Antti Koivisto <an...@apple.com>
Enable expired-only reload policy on Mac and iOS
Modified: trunk/Source/WebKit2/PlatformGTK.cmake (215731 => 215732)
--- trunk/Source/WebKit2/PlatformGTK.cmake 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebKit2/PlatformGTK.cmake 2017-04-25 15:24:35 UTC (rev 215732)
@@ -337,6 +337,7 @@
UIProcess/gtk/WebFullScreenClientGtk.cpp
UIProcess/gtk/WebInspectorClientGtk.cpp
UIProcess/gtk/WebInspectorProxyGtk.cpp
+ UIProcess/gtk/WebKitInspectorWindow.cpp
UIProcess/gtk/WebPageProxyGtk.cpp
UIProcess/gtk/WebPasteboardProxyGtk.cpp
UIProcess/gtk/WebPopupMenuProxyGtk.cpp
Modified: trunk/Source/WebKit2/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp (215731 => 215732)
--- trunk/Source/WebKit2/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebKit2/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp 2017-04-25 15:24:35 UTC (rev 215732)
@@ -29,11 +29,9 @@
#if ENABLE(REMOTE_INSPECTOR)
#include "WebInspectorProxy.h"
+#include "WebKitInspectorWindow.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebPageGroup.h"
-#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-#include <wtf/glib/GUniquePtr.h>
namespace WebKit {
@@ -41,15 +39,7 @@
{
if (!m_window)
return;
-
-#if GTK_CHECK_VERSION(3, 10, 0)
- GtkHeaderBar* headerBar = GTK_HEADER_BAR(gtk_window_get_titlebar(GTK_WINDOW(m_window)));
- gtk_header_bar_set_title(headerBar, _("Web Inspector"));
- gtk_header_bar_set_subtitle(headerBar, targetName.data());
-#else
- GUniquePtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), targetName.data()));
- gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get());
-#endif
+ webkitInspectorWindowSetSubtitle(WEBKIT_INSPECTOR_WINDOW(m_window), !targetName.isNull() ? targetName.data() : nullptr);
}
static void inspectorViewDestroyed(RemoteWebInspectorProxy* inspectorProxy)
@@ -77,17 +67,7 @@
g_signal_connect_swapped(m_webView, "destroy", G_CALLBACK(inspectorViewDestroyed), this);
g_object_add_weak_pointer(G_OBJECT(m_webView), reinterpret_cast<void**>(&m_webView));
- m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-
-#if GTK_CHECK_VERSION(3, 10, 0)
- GtkWidget* headerBar = gtk_header_bar_new();
- gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(headerBar), TRUE);
- gtk_window_set_titlebar(GTK_WINDOW(m_window), headerBar);
- gtk_widget_show(headerBar);
-#endif
-
- gtk_window_set_default_size(GTK_WINDOW(m_window), WebInspectorProxy::initialWindowWidth, WebInspectorProxy::initialWindowHeight);
-
+ m_window = webkitInspectorWindowNew(nullptr);
gtk_container_add(GTK_CONTAINER(m_window), m_webView);
gtk_widget_show(m_webView);
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (215731 => 215732)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2017-04-25 14:15:42 UTC (rev 215731)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2017-04-25 15:24:35 UTC (rev 215732)
@@ -29,6 +29,7 @@
#include "config.h"
#include "WebInspectorProxy.h"
+#include "WebKitInspectorWindow.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebPageGroup.h"
#include "WebProcessPool.h"
@@ -36,9 +37,6 @@
#include <WebCore/FileSystem.h>
#include <WebCore/GtkUtilities.h>
#include <WebCore/NotImplemented.h>
-#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-#include <wtf/glib/GUniquePtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -147,26 +145,18 @@
if (m_client.openWindow(this))
return;
- ASSERT(!m_inspectorWindow);
- m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-
GtkWidget* inspectedViewParent = gtk_widget_get_toplevel(inspectedPage()->viewWidget());
- if (WebCore::widgetIsOnscreenToplevelWindow(inspectedViewParent))
- gtk_window_set_transient_for(GTK_WINDOW(m_inspectorWindow), GTK_WINDOW(inspectedViewParent));
+ if (!WebCore::widgetIsOnscreenToplevelWindow(inspectedViewParent))
+ inspectedViewParent = nullptr;
-#if GTK_CHECK_VERSION(3, 10, 0)
- m_headerBar = gtk_header_bar_new();
- gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(m_headerBar), TRUE);
- gtk_window_set_titlebar(GTK_WINDOW(m_inspectorWindow), m_headerBar);
- gtk_widget_show(m_headerBar);
-#endif
-
- updateInspectorWindowTitle();
- gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight);
-
+ ASSERT(!m_inspectorWindow);
+ m_inspectorWindow = webkitInspectorWindowNew(inspectedViewParent ? GTK_WINDOW(inspectedViewParent) : nullptr);
gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView);
gtk_widget_show(m_inspectorView);
+ if (!m_inspectedURLString.isEmpty())
+ updateInspectorWindowTitle();
+
g_object_add_weak_pointer(G_OBJECT(m_inspectorWindow), reinterpret_cast<void**>(&m_inspectorWindow));
gtk_window_present(GTK_WINDOW(m_inspectorWindow));
}
@@ -174,18 +164,7 @@
void WebInspectorProxy::updateInspectorWindowTitle() const
{
ASSERT(m_inspectorWindow);
- if (m_inspectedURLString.isEmpty()) {
- gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector"));
- return;
- }
-
-#if GTK_CHECK_VERSION(3, 10, 0)
- gtk_header_bar_set_title(GTK_HEADER_BAR(m_headerBar), _("Web Inspector"));
- gtk_header_bar_set_subtitle(GTK_HEADER_BAR(m_headerBar), m_inspectedURLString.utf8().data());
-#else
- GUniquePtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), m_inspectedURLString.utf8().data()));
- gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get());
-#endif
+ webkitInspectorWindowSetSubtitle(WEBKIT_INSPECTOR_WINDOW(m_inspectorWindow), !m_inspectedURLString.isEmpty() ? m_inspectedURLString.utf8().data() : nullptr);
}
void WebInspectorProxy::platformOpen()
Added: trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.cpp (0 => 215732)
--- trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.cpp 2017-04-25 15:24:35 UTC (rev 215732)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2017 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 "WebKitInspectorWindow.h"
+
+#include "WebInspectorProxy.h"
+#include <glib/gi18n-lib.h>
+#include <wtf/glib/GUniquePtr.h>
+
+using namespace WebKit;
+
+struct _WebKitInspectorWindow {
+ GtkWindow parent;
+
+#if GTK_CHECK_VERSION(3, 10, 0)
+ GtkWidget* headerBar;
+#endif
+};
+
+struct _WebKitInspectorWindowClass {
+ GtkWindowClass parent;
+};
+
+G_DEFINE_TYPE(WebKitInspectorWindow, webkit_inspector_window, GTK_TYPE_WINDOW)
+
+static void webkit_inspector_window_class_init(WebKitInspectorWindowClass*)
+{
+}
+
+static void webkit_inspector_window_init(WebKitInspectorWindow* window)
+{
+#if GTK_CHECK_VERSION(3, 10, 0)
+ window->headerBar = gtk_header_bar_new();
+ gtk_header_bar_set_title(GTK_HEADER_BAR(window->headerBar), _("Web Inspector"));
+ gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(window->headerBar), TRUE);
+ gtk_window_set_titlebar(GTK_WINDOW(window), window->headerBar);
+ gtk_widget_show(window->headerBar);
+#else
+ gtk_window_set_title(GTK_WINDOW(window), _("Web Inspector"));
+#endif
+}
+
+GtkWidget* webkitInspectorWindowNew(GtkWindow* parent)
+{
+ return GTK_WIDGET(g_object_new(WEBKIT_TYPE_INSPECTOR_WINDOW, "type", GTK_WINDOW_TOPLEVEL, "transient-for", parent,
+ "default-width", WebInspectorProxy::initialWindowWidth, "default-height", WebInspectorProxy::initialWindowHeight, nullptr));
+}
+
+void webkitInspectorWindowSetSubtitle(WebKitInspectorWindow* window, const char* subtitle)
+{
+ g_return_if_fail(WEBKIT_IS_INSPECTOR_WINDOW(window));
+
+#if GTK_CHECK_VERSION(3, 10, 0)
+ gtk_header_bar_set_subtitle(GTK_HEADER_BAR(window->headerBar), subtitle);
+#else
+ if (subtitle) {
+ GUniquePtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), subtitle));
+ gtk_window_set_title(GTK_WINDOW(window), title.get());
+ } else
+ gtk_window_set_title(GTK_WINDOW(window), _("Web Inspector"));
+#endif
+}
+
Added: trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.h (0 => 215732)
--- trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebKitInspectorWindow.h 2017-04-25 15:24:35 UTC (rev 215732)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_INSPECTOR_WINDOW (webkit_inspector_window_get_type())
+#define WEBKIT_INSPECTOR_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_INSPECTOR_WINDOW, WebKitInspectorWindow))
+#define WEBKIT_IS_INSPECTOR_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_INSPECTOR_WINDOW))
+#define WEBKIT_INSPECTOR_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_INSPECTOR_WINDOW, WebKitInspectorWindowClass))
+#define WEBKIT_IS_INSPECTOR_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_INSPECTOR_WINDOW))
+#define WEBKIT_INSPECTOR_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_INSPECTOR_WINDOW, WebKitInspectorWindowClass))
+
+typedef struct _WebKitInspectorWindow WebKitInspectorWindow;
+typedef struct _WebKitInspectorWindowClass WebKitInspectorWindowClass;
+
+GType webkit_inspector_window_get_type(void);
+
+GtkWidget* webkitInspectorWindowNew(GtkWindow* parent);
+void webkitInspectorWindowSetSubtitle(WebKitInspectorWindow*, const char* subtitle);
+
+G_END_DECLS