Diff
Modified: trunk/Source/WebCore/ChangeLog (246668 => 246669)
--- trunk/Source/WebCore/ChangeLog 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/ChangeLog 2019-06-21 05:15:06 UTC (rev 246669)
@@ -1,3 +1,38 @@
+2019-06-20 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Stop pretending WebCore::Widget can have a platform widget
+ https://bugs.webkit.org/show_bug.cgi?id=199066
+
+ Reviewed by Michael Catanzaro.
+
+ That was only possible in legacy WebKit that we no longer support. The code can be simplified a bit.
+
+ * platform/Widget.cpp:
+ (WebCore::Widget::init):
+ * platform/Widget.h:
+ (WebCore::Widget::setPlatformWidget):
+ (WebCore::Widget::releasePlatformWidget): Deleted.
+ (WebCore::Widget::retainPlatformWidget): Deleted.
+ * platform/gtk/PlatformScreenGtk.cpp:
+ (WebCore::systemVisual):
+ (WebCore::screenDepth):
+ (WebCore::screenDepthPerComponent):
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ (WebCore::getToplevel): Deleted.
+ (WebCore::getVisual): Deleted.
+ (WebCore::getScreen): Deleted.
+ * platform/gtk/WidgetGtk.cpp:
+ (WebCore::Widget::~Widget):
+ (WebCore::Widget::show):
+ (WebCore::Widget::hide):
+ (WebCore::Widget::setIsSelected):
+ (WebCore::Widget::setFrameRect):
+ (WebCore::Widget::releasePlatformWidget): Deleted.
+ (WebCore::Widget::retainPlatformWidget): Deleted.
+ * platform/ios/WidgetIOS.mm:
+ (WebCore::Widget::~Widget):
+
2019-06-20 Simon Fraser <simon.fra...@apple.com>
Make it possible to include clipping in GraphicsLayer tree dumps
Modified: trunk/Source/WebCore/platform/Widget.cpp (246668 => 246669)
--- trunk/Source/WebCore/platform/Widget.cpp 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/platform/Widget.cpp 2019-06-21 05:15:06 UTC (rev 246669)
@@ -38,8 +38,6 @@
m_selfVisible = false;
m_parentVisible = false;
m_widget = widget;
- if (m_widget)
- retainPlatformWidget();
}
ScrollView* Widget::parent() const
Modified: trunk/Source/WebCore/platform/Widget.h (246668 => 246669)
--- trunk/Source/WebCore/platform/Widget.h 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/platform/Widget.h 2019-06-21 05:15:06 UTC (rev 246669)
@@ -50,10 +50,6 @@
#elif PLATFORM(WIN)
typedef struct HWND__* HWND;
typedef HWND PlatformWidget;
-#elif PLATFORM(GTK)
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkContainer GtkContainer;
-typedef GtkWidget* PlatformWidget;
#else
typedef void* PlatformWidget;
#endif
@@ -200,9 +196,6 @@
private:
void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.
- void releasePlatformWidget();
- void retainPlatformWidget();
-
// These methods are used to convert from the root widget to the containing window,
// which has behavior that may differ between platforms (e.g. Mac uses flipped window coordinates).
static IntRect convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect&);
@@ -234,27 +227,11 @@
inline void Widget::setPlatformWidget(PlatformWidget widget)
{
- if (widget != m_widget) {
- releasePlatformWidget();
- m_widget = widget;
- retainPlatformWidget();
- }
+ m_widget = widget;
}
#endif
-#if !PLATFORM(GTK)
-
-inline void Widget::releasePlatformWidget()
-{
-}
-
-inline void Widget::retainPlatformWidget()
-{
-}
-
-#endif
-
} // namespace WebCore
#define SPECIALIZE_TYPE_TRAITS_WIDGET(ToValueTypeName, predicate) \
Modified: trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp (246668 => 246669)
--- trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2019-06-21 05:15:06 UTC (rev 246669)
@@ -46,40 +46,28 @@
namespace WebCore {
-static GtkWidget* getToplevel(GtkWidget* widget)
+static GdkVisual* systemVisual()
{
- GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
- return gtk_widget_is_toplevel(toplevel) ? toplevel : 0;
+ if (auto* screen = gdk_screen_get_default())
+ return gdk_screen_get_system_visual(screen);
+
+ return nullptr;
}
-static GdkVisual* getVisual(Widget* widget)
+int screenDepth(Widget*)
{
- GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
- if (!container) {
- GdkScreen* screen = gdk_screen_get_default();
- return screen ? gdk_screen_get_system_visual(screen) : 0;
- }
+ if (auto* visual = systemVisual())
+ return gdk_visual_get_depth(visual);
- if (!gtk_widget_get_realized(container))
- container = getToplevel(container);
- return container ? gdk_window_get_visual(gtk_widget_get_window(container)) : 0;
+ return 24;
}
-int screenDepth(Widget* widget)
+int screenDepthPerComponent(Widget*)
{
- GdkVisual* visual = getVisual(widget);
- if (!visual)
- return 24;
- return gdk_visual_get_depth(visual);
-}
+ if (auto* visual = systemVisual())
+ return gdk_visual_get_bits_per_rgb(visual);
-int screenDepthPerComponent(Widget* widget)
-{
- GdkVisual* visual = getVisual(widget);
- if (!visual)
- return 8;
-
- return gdk_visual_get_bits_per_rgb(visual);
+ return 8;
}
bool screenIsMonochrome(Widget* widget)
@@ -149,68 +137,52 @@
}
}
-#if !GTK_CHECK_VERSION(3, 22, 0)
-static GdkScreen* getScreen(GtkWidget* widget)
+FloatRect screenRect(Widget*)
{
- return gtk_widget_has_screen(widget) ? gtk_widget_get_screen(widget) : gdk_screen_get_default();
-}
-#endif
-
-FloatRect screenRect(Widget* widget)
-{
- GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
- if (container)
- container = getToplevel(container);
-
GdkRectangle geometry;
#if GTK_CHECK_VERSION(3, 22, 0)
- GdkDisplay* display = container ? gtk_widget_get_display(container) : gdk_display_get_default();
+ GdkDisplay* display = gdk_display_get_default();
if (!display)
- return FloatRect();
+ return { };
- GdkMonitor* monitor = container ? gdk_display_get_monitor_at_window(display, gtk_widget_get_window(container)) : gdk_display_get_monitor(display, 0);
+ auto* monitor = gdk_display_get_monitor(display, 0);
+ if (!monitor)
+ return { };
gdk_monitor_get_geometry(monitor, &geometry);
#else
- GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default();
+ GdkScreen* screen = gdk_screen_get_default();
if (!screen)
- return FloatRect();
+ return { };
- gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0;
-
- gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
+ gdk_screen_get_monitor_geometry(screen, 0, &geometry);
#endif // !GTK_CHECK_VERSION(3, 22, 0)
return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height);
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(Widget*)
{
- GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
- if (container && !gtk_widget_get_realized(container))
- return screenRect(widget);
-
GdkRectangle workArea;
#if GTK_CHECK_VERSION(3, 22, 0)
- GdkDisplay* display = container ? gtk_widget_get_display(container) : gdk_display_get_default();
+ GdkDisplay* display = gdk_display_get_default();
if (!display)
- return FloatRect();
+ return { };
- GdkMonitor* monitor = container ? gdk_display_get_monitor_at_window(display, gtk_widget_get_window(container)) : gdk_display_get_monitor(display, 0);
+ auto* monitor = gdk_display_get_monitor(display, 0);
+ if (!monitor)
+ return { };
gdk_monitor_get_workarea(monitor, &workArea);
#else
- GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default();
+ GdkScreen* screen = gdk_screen_get_default();
if (!screen)
return FloatRect();
- gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0;
-
- gdk_screen_get_monitor_workarea(screen, monitor, &workArea);
+ gdk_screen_get_monitor_workarea(screen, 0, &workArea);
#endif // !GTK_CHECK_VERSION(3, 22, 0)
return FloatRect(workArea.x, workArea.y, workArea.width, workArea.height);
-
}
bool screenSupportsExtendedColor(Widget*)
Modified: trunk/Source/WebCore/platform/gtk/WidgetGtk.cpp (246668 => 246669)
--- trunk/Source/WebCore/platform/gtk/WidgetGtk.cpp 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/platform/gtk/WidgetGtk.cpp 2019-06-21 05:15:06 UTC (rev 246669)
@@ -30,20 +30,14 @@
#include "Cursor.h"
#include "FrameView.h"
-#include "GraphicsContext.h"
#include "HostWindow.h"
#include "IntRect.h"
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
namespace WebCore {
Widget::~Widget()
{
ASSERT(!parent());
-
- releasePlatformWidget();
}
void Widget::setFocus(bool)
@@ -61,17 +55,11 @@
void Widget::show()
{
setSelfVisible(true);
-
- if (isParentVisible() && platformWidget())
- gtk_widget_show(platformWidget());
}
void Widget::hide()
{
setSelfVisible(false);
-
- if (isParentVisible() && platformWidget())
- gtk_widget_hide(platformWidget());
}
void Widget::paint(GraphicsContext&, const IntRect&, SecurityOriginPaintPolicy)
@@ -78,39 +66,13 @@
{
}
-void Widget::setIsSelected(bool isSelected)
+void Widget::setIsSelected(bool)
{
- if (!platformWidget())
- return;
-
- // See if the platformWidget has a webkit-widget-is-selected property
- // and set it afterwards.
- GParamSpec* spec = g_object_class_find_property(G_OBJECT_GET_CLASS(platformWidget()),
- "webkit-widget-is-selected");
- if (!spec)
- return;
-
- g_object_set(platformWidget(), "webkit-widget-is-selected", isSelected, NULL);
}
void Widget::setFrameRect(const IntRect& rect)
{
m_frame = rect;
- frameRectsChanged();
}
-void Widget::releasePlatformWidget()
-{
- if (!platformWidget())
- return;
- g_object_unref(platformWidget());
}
-
-void Widget::retainPlatformWidget()
-{
- if (!platformWidget())
- return;
- g_object_ref_sink(platformWidget());
-}
-
-}
Modified: trunk/Source/WebCore/platform/ios/WidgetIOS.mm (246668 => 246669)
--- trunk/Source/WebCore/platform/ios/WidgetIOS.mm 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebCore/platform/ios/WidgetIOS.mm 2019-06-21 05:15:06 UTC (rev 246669)
@@ -62,9 +62,8 @@
init(view);
}
-Widget::~Widget()
+Widget::~Widget()
{
- releasePlatformWidget();
}
// FIXME: Should move this to Chrome; bad layering that this knows about Frame.
Modified: trunk/Source/WebKit/ChangeLog (246668 => 246669)
--- trunk/Source/WebKit/ChangeLog 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebKit/ChangeLog 2019-06-21 05:15:06 UTC (rev 246669)
@@ -1,3 +1,16 @@
+2019-06-20 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Stop pretending WebCore::Widget can have a platform widget
+ https://bugs.webkit.org/show_bug.cgi?id=199066
+
+ Reviewed by Michael Catanzaro.
+
+ Rename PlatformWidget as PlatformViewWidget to avoid conflict with PlatformWidget defined in WebCore.
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/win/WebPageProxyWin.cpp:
+ (WebKit::WebPageProxy::viewWidget):
+
2019-06-20 Megan Gardner <megan_gard...@apple.com>
Remove change that was causing hangs
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (246668 => 246669)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-06-21 05:15:06 UTC (rev 246669)
@@ -217,7 +217,7 @@
}
#if PLATFORM(GTK)
-typedef GtkWidget* PlatformWidget;
+typedef GtkWidget* PlatformViewWidget;
#endif
#if PLATFORM(WPE)
@@ -229,7 +229,7 @@
#endif
#if PLATFORM(WIN)
-typedef HWND PlatformWidget;
+typedef HWND PlatformViewWidget;
#endif
namespace WebKit {
@@ -804,7 +804,7 @@
#endif // PLATFORM(MAC)
#if PLATFORM(GTK)
- PlatformWidget viewWidget();
+ PlatformViewWidget viewWidget();
bool makeGLContextCurrent();
#endif
@@ -812,7 +812,7 @@
void setBackgroundColor(const Optional<WebCore::Color>&);
#if PLATFORM(WIN)
- PlatformWidget viewWidget();
+ PlatformViewWidget viewWidget();
#endif
#if PLATFORM(WPE)
struct wpe_view_backend* viewBackend();
Modified: trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp (246668 => 246669)
--- trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp 2019-06-21 02:30:35 UTC (rev 246668)
+++ trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp 2019-06-21 05:15:06 UTC (rev 246669)
@@ -65,7 +65,7 @@
m_editorState = editorState;
}
-PlatformWidget WebPageProxy::viewWidget()
+PlatformViewWidget WebPageProxy::viewWidget()
{
return static_cast<PageClientImpl&>(pageClient()).viewWidget();
}