WebKit Bugzilla
Attachment 372550 Details for
Bug 199066
: [GTK] Stop pretending WebCore::Widget can have a platform widget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
wk2-no-platform-widget.diff (text/plain), 13.02 KB, created by
Carlos Garcia Campos
on 2019-06-20 04:13:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2019-06-20 04:13:51 PDT
Size:
13.02 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2ef5392c82b..e8c0a860574 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2019-06-20 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop pretending WebCore::Widget can have a platform widget >+ https://bugs.webkit.org/show_bug.cgi?id=199066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Remove support for GTK2 plugins >diff --git a/Source/WebCore/platform/Widget.cpp b/Source/WebCore/platform/Widget.cpp >index 6cc645e1722..e9f5d81e03a 100644 >--- a/Source/WebCore/platform/Widget.cpp >+++ b/Source/WebCore/platform/Widget.cpp >@@ -38,8 +38,6 @@ void Widget::init(PlatformWidget widget) > m_selfVisible = false; > m_parentVisible = false; > m_widget = widget; >- if (m_widget) >- retainPlatformWidget(); > } > > ScrollView* Widget::parent() const >diff --git a/Source/WebCore/platform/Widget.h b/Source/WebCore/platform/Widget.h >index f2879cc2c0b..1cf931c1223 100644 >--- a/Source/WebCore/platform/Widget.h >+++ b/Source/WebCore/platform/Widget.h >@@ -50,10 +50,6 @@ typedef NSView *PlatformWidget; > #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 @@ public: > 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,23 +227,7 @@ inline PlatformWidget Widget::platformWidget() const > > inline void Widget::setPlatformWidget(PlatformWidget widget) > { >- if (widget != m_widget) { >- releasePlatformWidget(); >- m_widget = widget; >- retainPlatformWidget(); >- } >-} >- >-#endif >- >-#if !PLATFORM(GTK) >- >-inline void Widget::releasePlatformWidget() >-{ >-} >- >-inline void Widget::retainPlatformWidget() >-{ >+ m_widget = widget; > } > > #endif >diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp >index bd47b739667..bee6ef4bd69 100644 >--- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp >+++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp >@@ -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); > >-static GdkVisual* getVisual(Widget* 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 (!gtk_widget_get_realized(container)) >- container = getToplevel(container); >- return container ? gdk_window_get_visual(gtk_widget_get_window(container)) : 0; >+ return nullptr; > } > >-int screenDepth(Widget* widget) >+int screenDepth(Widget*) > { >- GdkVisual* visual = getVisual(widget); >- if (!visual) >- return 24; >- return gdk_visual_get_depth(visual); >+ if (auto* visual = systemVisual()) >+ return gdk_visual_get_depth(visual); >+ >+ return 24; > } > >-int screenDepthPerComponent(Widget* widget) >+int screenDepthPerComponent(Widget*) > { >- GdkVisual* visual = getVisual(widget); >- if (!visual) >- return 8; >+ if (auto* visual = systemVisual()) >+ return gdk_visual_get_bits_per_rgb(visual); > >- return gdk_visual_get_bits_per_rgb(visual); >+ return 8; > } > > bool screenIsMonochrome(Widget* widget) >@@ -149,68 +137,52 @@ void setScreenDPIObserverHandler(Function<void()>&& handler, void* context) > } > } > >-#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*) >diff --git a/Source/WebCore/platform/gtk/WidgetGtk.cpp b/Source/WebCore/platform/gtk/WidgetGtk.cpp >index 73616fb6277..6919ee42ba0 100644 >--- a/Source/WebCore/platform/gtk/WidgetGtk.cpp >+++ b/Source/WebCore/platform/gtk/WidgetGtk.cpp >@@ -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,56 +55,24 @@ void Widget::setCursor(const Cursor& cursor) > 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) > { > } > >-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()); > } > > } >diff --git a/Source/WebCore/platform/ios/WidgetIOS.mm b/Source/WebCore/platform/ios/WidgetIOS.mm >index 05b44491bee..04928f94345 100644 >--- a/Source/WebCore/platform/ios/WidgetIOS.mm >+++ b/Source/WebCore/platform/ios/WidgetIOS.mm >@@ -62,9 +62,8 @@ Widget::Widget(NSView* view) > init(view); > } > >-Widget::~Widget() >+Widget::~Widget() > { >- releasePlatformWidget(); > } > > // FIXME: Should move this to Chrome; bad layering that this knows about Frame. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b3393be5560..90a5e4f5534 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-20 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK] Stop pretending WebCore::Widget can have a platform widget >+ https://bugs.webkit.org/show_bug.cgi?id=199066 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Remove support for GTK2 plugins >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 5dd623b4732..18b2016e035 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -217,7 +217,7 @@ using FloatBoxExtent = RectEdges<float>; > } > > #if PLATFORM(GTK) >-typedef GtkWidget* PlatformWidget; >+typedef GtkWidget* PlatformViewWidget; > #endif > > #if PLATFORM(WPE) >@@ -229,7 +229,7 @@ typedef struct OpaqueJSContext* JSGlobalContextRef; > #endif > > #if PLATFORM(WIN) >-typedef HWND PlatformWidget; >+typedef HWND PlatformViewWidget; > #endif > > namespace WebKit { >@@ -804,7 +804,7 @@ public: > #endif // PLATFORM(MAC) > > #if PLATFORM(GTK) >- PlatformWidget viewWidget(); >+ PlatformViewWidget viewWidget(); > bool makeGLContextCurrent(); > #endif > >@@ -812,7 +812,7 @@ public: > void setBackgroundColor(const Optional<WebCore::Color>&); > > #if PLATFORM(WIN) >- PlatformWidget viewWidget(); >+ PlatformViewWidget viewWidget(); > #endif > #if PLATFORM(WPE) > struct wpe_view_backend* viewBackend(); >diff --git a/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >index 6f760527935..8d58592d54f 100644 >--- a/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >+++ b/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp >@@ -65,7 +65,7 @@ void WebPageProxy::updateEditorState(const EditorState& editorState) > m_editorState = editorState; > } > >-PlatformWidget WebPageProxy::viewWidget() >+PlatformViewWidget WebPageProxy::viewWidget() > { > return static_cast<PageClientImpl&>(pageClient()).viewWidget(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mcatanzaro
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199066
: 372550