- Revision
- 107249
- Author
- [email protected]
- Date
- 2012-02-09 08:38:52 -0800 (Thu, 09 Feb 2012)
Log Message
[GTK] Embedded GtkWidgets are not drawn
https://bugs.webkit.org/show_bug.cgi?id=63451
Source/WebCore:
Remove widget from it's parent container when GtkPluginWidget is destroyed.
Remove paint() method because real expose even is used for drawing child widgets now.
Patch by Dan Vrátil <[email protected]>, Milan Crha <[email protected]> on 2012-02-08
Reviewed by Martin Robinson.
* platform/gtk/GtkPluginWidget.cpp:
(WebCore::GtkPluginWidget::~GtkPluginWidget):
(WebCore):
* platform/gtk/GtkPluginWidget.h:
(GtkPluginWidget):
Source/WebKit/gtk:
Insert plugin widgets to WebKitWebView container as it's children.
Chain up to parent in webkit_web_view_draw() to ensure the child widgets are drawn.
Patch by Dan Vrátil <[email protected]>, Milan Crha <[email protected]> on 2012-02-08
Reviewed by Martin Robinson.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::createPlugin):
* webkit/webkitwebview.cpp:
(webkit_web_view_draw):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107248 => 107249)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 16:38:52 UTC (rev 107249)
@@ -1,3 +1,19 @@
+2012-02-08 Dan Vrátil <[email protected]>, Milan Crha <[email protected]>
+
+ [GTK] Embedded GtkWidgets are not drawn
+ https://bugs.webkit.org/show_bug.cgi?id=63451
+
+ Remove widget from it's parent container when GtkPluginWidget is destroyed.
+ Remove paint() method because real expose even is used for drawing child widgets now.
+
+ Reviewed by Martin Robinson.
+
+ * platform/gtk/GtkPluginWidget.cpp:
+ (WebCore::GtkPluginWidget::~GtkPluginWidget):
+ (WebCore):
+ * platform/gtk/GtkPluginWidget.h:
+ (GtkPluginWidget):
+
2012-02-09 Arun Patole <[email protected]>
Setting media element 'src' attribute to "" should trigger load
Modified: trunk/Source/WebCore/platform/gtk/GtkPluginWidget.cpp (107248 => 107249)
--- trunk/Source/WebCore/platform/gtk/GtkPluginWidget.cpp 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebCore/platform/gtk/GtkPluginWidget.cpp 2012-02-09 16:38:52 UTC (rev 107249)
@@ -41,6 +41,11 @@
gtk_widget_hide(widget);
}
+GtkPluginWidget::~GtkPluginWidget()
+{
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(platformWidget())), platformWidget());
+}
+
void GtkPluginWidget::invalidateRect(const IntRect& coreRect)
{
/* no need to */
@@ -66,49 +71,4 @@
gtk_widget_show(platformWidget());
}
-void GtkPluginWidget::paint(GraphicsContext* context, const IntRect& rect)
-{
- if (!context->gdkExposeEvent())
- return;
-
- /* only paint widgets with no window this way */
- if (gtk_widget_get_has_window(platformWidget()))
- return;
-
- GtkWidget* widget = platformWidget();
- ASSERT(!gtk_widget_get_has_window(widget));
-
- GdkEvent* event = gdk_event_new(GDK_EXPOSE);
- event->expose = *context->gdkExposeEvent();
- event->expose.area = static_cast<GdkRectangle>(rect);
-
- IntPoint loc = parent()->contentsToWindow(rect.location());
-
- event->expose.area.x = loc.x();
- event->expose.area.y = loc.y();
-
-#ifdef GTK_API_VERSION_2
- event->expose.region = gdk_region_rectangle(&event->expose.area);
-#else
- event->expose.region = cairo_region_create_rectangle(&event->expose.area);
-#endif
-
- /*
- * This will be unref'ed by gdk_event_free.
- */
- g_object_ref(event->expose.window);
-
- /*
- * If we are going to paint do the translation and GtkAllocation manipulation.
- */
-#ifdef GTK_API_VERSION_2
- if (!gdk_region_empty(event->expose.region))
-#else
- if (!cairo_region_is_empty(event->expose.region))
-#endif
- gtk_widget_send_expose(widget, event);
-
- gdk_event_free(event);
}
-
-}
Modified: trunk/Source/WebCore/platform/gtk/GtkPluginWidget.h (107248 => 107249)
--- trunk/Source/WebCore/platform/gtk/GtkPluginWidget.h 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebCore/platform/gtk/GtkPluginWidget.h 2012-02-09 16:38:52 UTC (rev 107249)
@@ -33,9 +33,9 @@
class GtkPluginWidget : public Widget {
public:
GtkPluginWidget(GtkWidget*);
+ virtual ~GtkPluginWidget();
void invalidateRect(const IntRect&);
void frameRectsChanged();
- void paint(GraphicsContext*, const IntRect&);
};
}
Modified: trunk/Source/WebKit/gtk/ChangeLog (107248 => 107249)
--- trunk/Source/WebKit/gtk/ChangeLog 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebKit/gtk/ChangeLog 2012-02-09 16:38:52 UTC (rev 107249)
@@ -1,3 +1,18 @@
+2012-02-08 Dan Vrátil <[email protected]>, Milan Crha <[email protected]>
+
+ [GTK] Embedded GtkWidgets are not drawn
+ https://bugs.webkit.org/show_bug.cgi?id=63451
+
+ Insert plugin widgets to WebKitWebView container as it's children.
+ Chain up to parent in webkit_web_view_draw() to ensure the child widgets are drawn.
+
+ Reviewed by Martin Robinson.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::createPlugin):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_draw):
+
2012-02-08 Mario Sanchez Prada <[email protected]>
[Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (107248 => 107249)
--- trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2012-02-09 16:38:52 UTC (rev 107249)
@@ -482,8 +482,10 @@
GtkWidget* gtkWidget = 0;
g_signal_emit_by_name(getViewFromFrame(m_frame), "create-plugin-widget",
mimeTypeString.data(), urlString.data(), hash.get(), >kWidget);
- if (gtkWidget)
+ if (gtkWidget) {
+ gtk_container_add(GTK_CONTAINER(getViewFromFrame(m_frame)), gtkWidget);
return adoptRef(new GtkPluginWidget(gtkWidget));
+ }
RefPtr<PluginView> pluginView = PluginView::create(core(m_frame), pluginSize, element, url, paramNames, paramValues, mimeType, loadManually);
Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (107248 => 107249)
--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-02-09 16:25:44 UTC (rev 107248)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2012-02-09 16:38:52 UTC (rev 107249)
@@ -639,6 +639,9 @@
copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(),
cr.get(), IntSize(), IntRect(rects.get()[i]));
}
+
+ // Chaining up to the parent forces child widgets to be drawn.
+ GTK_WIDGET_CLASS(webkit_web_view_parent_class)->expose(widget, event);
return FALSE;
}
#else
@@ -667,6 +670,8 @@
}
cairo_rectangle_list_destroy(rectList);
+ // Chaining up to the parent forces child widgets to be drawn.
+ GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
return FALSE;
}
#endif // GTK_API_VERSION_2