Changeset 246669 in webkit
- Timestamp:
- Jun 20, 2019 10:15:06 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246668 r246669 1 2019-06-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Stop pretending WebCore::Widget can have a platform widget 4 https://bugs.webkit.org/show_bug.cgi?id=199066 5 6 Reviewed by Michael Catanzaro. 7 8 That was only possible in legacy WebKit that we no longer support. The code can be simplified a bit. 9 10 * platform/Widget.cpp: 11 (WebCore::Widget::init): 12 * platform/Widget.h: 13 (WebCore::Widget::setPlatformWidget): 14 (WebCore::Widget::releasePlatformWidget): Deleted. 15 (WebCore::Widget::retainPlatformWidget): Deleted. 16 * platform/gtk/PlatformScreenGtk.cpp: 17 (WebCore::systemVisual): 18 (WebCore::screenDepth): 19 (WebCore::screenDepthPerComponent): 20 (WebCore::screenRect): 21 (WebCore::screenAvailableRect): 22 (WebCore::getToplevel): Deleted. 23 (WebCore::getVisual): Deleted. 24 (WebCore::getScreen): Deleted. 25 * platform/gtk/WidgetGtk.cpp: 26 (WebCore::Widget::~Widget): 27 (WebCore::Widget::show): 28 (WebCore::Widget::hide): 29 (WebCore::Widget::setIsSelected): 30 (WebCore::Widget::setFrameRect): 31 (WebCore::Widget::releasePlatformWidget): Deleted. 32 (WebCore::Widget::retainPlatformWidget): Deleted. 33 * platform/ios/WidgetIOS.mm: 34 (WebCore::Widget::~Widget): 35 1 36 2019-06-20 Simon Fraser <simon.fraser@apple.com> 2 37 -
trunk/Source/WebCore/platform/Widget.cpp
r245868 r246669 39 39 m_parentVisible = false; 40 40 m_widget = widget; 41 if (m_widget)42 retainPlatformWidget();43 41 } 44 42 -
trunk/Source/WebCore/platform/Widget.h
r245868 r246669 51 51 typedef struct HWND__* HWND; 52 52 typedef HWND PlatformWidget; 53 #elif PLATFORM(GTK)54 typedef struct _GtkWidget GtkWidget;55 typedef struct _GtkContainer GtkContainer;56 typedef GtkWidget* PlatformWidget;57 53 #else 58 54 typedef void* PlatformWidget; … … 201 197 void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data. 202 198 203 void releasePlatformWidget();204 void retainPlatformWidget();205 206 199 // These methods are used to convert from the root widget to the containing window, 207 200 // which has behavior that may differ between platforms (e.g. Mac uses flipped window coordinates). … … 235 228 inline void Widget::setPlatformWidget(PlatformWidget widget) 236 229 { 237 if (widget != m_widget) { 238 releasePlatformWidget(); 239 m_widget = widget; 240 retainPlatformWidget(); 241 } 242 } 243 244 #endif 245 246 #if !PLATFORM(GTK) 247 248 inline void Widget::releasePlatformWidget() 249 { 250 } 251 252 inline void Widget::retainPlatformWidget() 253 { 230 m_widget = widget; 254 231 } 255 232 -
trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
r246632 r246669 47 47 namespace WebCore { 48 48 49 static GtkWidget* getToplevel(GtkWidget* widget) 50 { 51 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); 52 return gtk_widget_is_toplevel(toplevel) ? toplevel : 0; 53 } 54 55 static GdkVisual* getVisual(Widget* widget) 56 { 57 GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0; 58 if (!container) { 59 GdkScreen* screen = gdk_screen_get_default(); 60 return screen ? gdk_screen_get_system_visual(screen) : 0; 61 } 62 63 if (!gtk_widget_get_realized(container)) 64 container = getToplevel(container); 65 return container ? gdk_window_get_visual(gtk_widget_get_window(container)) : 0; 66 } 67 68 int screenDepth(Widget* widget) 69 { 70 GdkVisual* visual = getVisual(widget); 71 if (!visual) 72 return 24; 73 return gdk_visual_get_depth(visual); 74 } 75 76 int screenDepthPerComponent(Widget* widget) 77 { 78 GdkVisual* visual = getVisual(widget); 79 if (!visual) 80 return 8; 81 82 return gdk_visual_get_bits_per_rgb(visual); 49 static GdkVisual* systemVisual() 50 { 51 if (auto* screen = gdk_screen_get_default()) 52 return gdk_screen_get_system_visual(screen); 53 54 return nullptr; 55 } 56 57 int screenDepth(Widget*) 58 { 59 if (auto* visual = systemVisual()) 60 return gdk_visual_get_depth(visual); 61 62 return 24; 63 } 64 65 int screenDepthPerComponent(Widget*) 66 { 67 if (auto* visual = systemVisual()) 68 return gdk_visual_get_bits_per_rgb(visual); 69 70 return 8; 83 71 } 84 72 … … 150 138 } 151 139 152 #if !GTK_CHECK_VERSION(3, 22, 0) 153 static GdkScreen* getScreen(GtkWidget* widget) 154 { 155 return gtk_widget_has_screen(widget) ? gtk_widget_get_screen(widget) : gdk_screen_get_default(); 156 } 157 #endif 158 159 FloatRect screenRect(Widget* widget) 160 { 161 GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0; 162 if (container) 163 container = getToplevel(container); 164 140 FloatRect screenRect(Widget*) 141 { 165 142 GdkRectangle geometry; 166 143 #if GTK_CHECK_VERSION(3, 22, 0) 167 GdkDisplay* display = container ? gtk_widget_get_display(container) : gdk_display_get_default(); 168 if (!display) 169 return FloatRect(); 170 171 GdkMonitor* monitor = container ? gdk_display_get_monitor_at_window(display, gtk_widget_get_window(container)) : gdk_display_get_monitor(display, 0); 144 GdkDisplay* display = gdk_display_get_default(); 145 if (!display) 146 return { }; 147 148 auto* monitor = gdk_display_get_monitor(display, 0); 149 if (!monitor) 150 return { }; 172 151 173 152 gdk_monitor_get_geometry(monitor, &geometry); 174 153 #else 175 GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default(); 154 GdkScreen* screen = gdk_screen_get_default(); 155 if (!screen) 156 return { }; 157 158 gdk_screen_get_monitor_geometry(screen, 0, &geometry); 159 #endif // !GTK_CHECK_VERSION(3, 22, 0) 160 161 return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height); 162 } 163 164 FloatRect screenAvailableRect(Widget*) 165 { 166 GdkRectangle workArea; 167 #if GTK_CHECK_VERSION(3, 22, 0) 168 GdkDisplay* display = gdk_display_get_default(); 169 if (!display) 170 return { }; 171 172 auto* monitor = gdk_display_get_monitor(display, 0); 173 if (!monitor) 174 return { }; 175 176 gdk_monitor_get_workarea(monitor, &workArea); 177 #else 178 GdkScreen* screen = gdk_screen_get_default(); 176 179 if (!screen) 177 180 return FloatRect(); 178 181 179 gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0; 180 181 gdk_screen_get_monitor_geometry(screen, monitor, &geometry); 182 gdk_screen_get_monitor_workarea(screen, 0, &workArea); 182 183 #endif // !GTK_CHECK_VERSION(3, 22, 0) 183 184 184 return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height);185 }186 187 FloatRect screenAvailableRect(Widget* widget)188 {189 GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;190 if (container && !gtk_widget_get_realized(container))191 return screenRect(widget);192 193 GdkRectangle workArea;194 #if GTK_CHECK_VERSION(3, 22, 0)195 GdkDisplay* display = container ? gtk_widget_get_display(container) : gdk_display_get_default();196 if (!display)197 return FloatRect();198 199 GdkMonitor* monitor = container ? gdk_display_get_monitor_at_window(display, gtk_widget_get_window(container)) : gdk_display_get_monitor(display, 0);200 201 gdk_monitor_get_workarea(monitor, &workArea);202 #else203 GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default();204 if (!screen)205 return FloatRect();206 207 gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0;208 209 gdk_screen_get_monitor_workarea(screen, monitor, &workArea);210 #endif // !GTK_CHECK_VERSION(3, 22, 0)211 212 185 return FloatRect(workArea.x, workArea.y, workArea.width, workArea.height); 213 214 186 } 215 187 -
trunk/Source/WebCore/platform/gtk/WidgetGtk.cpp
r246632 r246669 31 31 #include "Cursor.h" 32 32 #include "FrameView.h" 33 #include "GraphicsContext.h"34 33 #include "HostWindow.h" 35 34 #include "IntRect.h" 36 37 #include <gdk/gdk.h>38 #include <gtk/gtk.h>39 35 40 36 namespace WebCore { … … 43 39 { 44 40 ASSERT(!parent()); 45 46 releasePlatformWidget();47 41 } 48 42 … … 62 56 { 63 57 setSelfVisible(true); 64 65 if (isParentVisible() && platformWidget())66 gtk_widget_show(platformWidget());67 58 } 68 59 … … 70 61 { 71 62 setSelfVisible(false); 72 73 if (isParentVisible() && platformWidget())74 gtk_widget_hide(platformWidget());75 63 } 76 64 … … 79 67 } 80 68 81 void Widget::setIsSelected(bool isSelected)69 void Widget::setIsSelected(bool) 82 70 { 83 if (!platformWidget())84 return;85 86 // See if the platformWidget has a webkit-widget-is-selected property87 // and set it afterwards.88 GParamSpec* spec = g_object_class_find_property(G_OBJECT_GET_CLASS(platformWidget()),89 "webkit-widget-is-selected");90 if (!spec)91 return;92 93 g_object_set(platformWidget(), "webkit-widget-is-selected", isSelected, NULL);94 71 } 95 72 … … 97 74 { 98 75 m_frame = rect; 99 frameRectsChanged();100 }101 102 void Widget::releasePlatformWidget()103 {104 if (!platformWidget())105 return;106 g_object_unref(platformWidget());107 }108 109 void Widget::retainPlatformWidget()110 {111 if (!platformWidget())112 return;113 g_object_ref_sink(platformWidget());114 76 } 115 77 -
trunk/Source/WebCore/platform/ios/WidgetIOS.mm
r237266 r246669 63 63 } 64 64 65 Widget::~Widget() 66 { 67 releasePlatformWidget(); 65 Widget::~Widget() 66 { 68 67 } 69 68 -
trunk/Source/WebKit/ChangeLog
r246665 r246669 1 2019-06-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Stop pretending WebCore::Widget can have a platform widget 4 https://bugs.webkit.org/show_bug.cgi?id=199066 5 6 Reviewed by Michael Catanzaro. 7 8 Rename PlatformWidget as PlatformViewWidget to avoid conflict with PlatformWidget defined in WebCore. 9 10 * UIProcess/WebPageProxy.h: 11 * UIProcess/win/WebPageProxyWin.cpp: 12 (WebKit::WebPageProxy::viewWidget): 13 1 14 2019-06-20 Megan Gardner <megan_gardner@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r246596 r246669 218 218 219 219 #if PLATFORM(GTK) 220 typedef GtkWidget* Platform Widget;220 typedef GtkWidget* PlatformViewWidget; 221 221 #endif 222 222 … … 230 230 231 231 #if PLATFORM(WIN) 232 typedef HWND Platform Widget;232 typedef HWND PlatformViewWidget; 233 233 #endif 234 234 … … 805 805 806 806 #if PLATFORM(GTK) 807 Platform Widget viewWidget();807 PlatformViewWidget viewWidget(); 808 808 bool makeGLContextCurrent(); 809 809 #endif … … 813 813 814 814 #if PLATFORM(WIN) 815 Platform Widget viewWidget();815 PlatformViewWidget viewWidget(); 816 816 #endif 817 817 #if PLATFORM(WPE) -
trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp
r244897 r246669 66 66 } 67 67 68 Platform Widget WebPageProxy::viewWidget()68 PlatformViewWidget WebPageProxy::viewWidget() 69 69 { 70 70 return static_cast<PageClientImpl&>(pageClient()).viewWidget();
Note: See TracChangeset
for help on using the changeset viewer.