Changeset 107249 in webkit


Ignore:
Timestamp:
Feb 9, 2012 8:38:52 AM (12 years ago)
Author:
Martin Robinson
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 <dvratil@redhat.com>, Milan Crha <mcrha@redhat.com> 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 <dvratil@redhat.com>, Milan Crha <mcrha@redhat.com> on 2012-02-08
Reviewed by Martin Robinson.

  • WebCoreSupport/FrameLoaderClientGtk.cpp:

(WebKit::FrameLoaderClient::createPlugin):

  • webkit/webkitwebview.cpp:

(webkit_web_view_draw):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107244 r107249  
     12012-02-08  Dan Vrátil  <dvratil@redhat.com>, Milan Crha <mcrha@redhat.com>
     2
     3        [GTK] Embedded GtkWidgets are not drawn
     4        https://bugs.webkit.org/show_bug.cgi?id=63451
     5
     6        Remove widget from it's parent container when GtkPluginWidget is destroyed.
     7        Remove paint() method because real expose even is used for drawing child widgets now.
     8
     9        Reviewed by Martin Robinson.
     10
     11        * platform/gtk/GtkPluginWidget.cpp:
     12        (WebCore::GtkPluginWidget::~GtkPluginWidget):
     13        (WebCore):
     14        * platform/gtk/GtkPluginWidget.h:
     15        (GtkPluginWidget):
     16
    1172012-02-09  Arun Patole  <arun.patole@motorola.com>
    218
  • trunk/Source/WebCore/platform/gtk/GtkPluginWidget.cpp

    r89133 r107249  
    4242}
    4343
     44GtkPluginWidget::~GtkPluginWidget()
     45{
     46    gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(platformWidget())), platformWidget());
     47}
     48
    4449void GtkPluginWidget::invalidateRect(const IntRect& coreRect)
    4550{
     
    6772}
    6873
    69 void GtkPluginWidget::paint(GraphicsContext* context, const IntRect& rect)
    70 {
    71     if (!context->gdkExposeEvent())
    72         return;
    73 
    74     /* only paint widgets with no window this way */
    75     if (gtk_widget_get_has_window(platformWidget()))
    76         return;
    77 
    78     GtkWidget* widget = platformWidget();
    79     ASSERT(!gtk_widget_get_has_window(widget));
    80 
    81     GdkEvent* event = gdk_event_new(GDK_EXPOSE);
    82     event->expose = *context->gdkExposeEvent();
    83     event->expose.area = static_cast<GdkRectangle>(rect);
    84 
    85     IntPoint loc = parent()->contentsToWindow(rect.location());
    86 
    87     event->expose.area.x = loc.x();
    88     event->expose.area.y = loc.y();
    89 
    90 #ifdef GTK_API_VERSION_2
    91     event->expose.region = gdk_region_rectangle(&event->expose.area);
    92 #else
    93     event->expose.region = cairo_region_create_rectangle(&event->expose.area);
    94 #endif
    95 
    96     /*
    97      * This will be unref'ed by gdk_event_free.
    98      */
    99     g_object_ref(event->expose.window);
    100 
    101     /*
    102      * If we are going to paint do the translation and GtkAllocation manipulation.
    103      */
    104 #ifdef GTK_API_VERSION_2
    105     if (!gdk_region_empty(event->expose.region))
    106 #else
    107     if (!cairo_region_is_empty(event->expose.region))
    108 #endif
    109         gtk_widget_send_expose(widget, event);
    110 
    111     gdk_event_free(event);
    11274}
    113 
    114 }
  • trunk/Source/WebCore/platform/gtk/GtkPluginWidget.h

    r44183 r107249  
    3434    public:
    3535        GtkPluginWidget(GtkWidget*);
     36        virtual ~GtkPluginWidget();
    3637        void invalidateRect(const IntRect&);
    3738        void frameRectsChanged();
    38         void paint(GraphicsContext*, const IntRect&);
    3939    };
    4040}
  • trunk/Source/WebKit/gtk/ChangeLog

    r107086 r107249  
     12012-02-08  Dan Vrátil  <dvratil@redhat.com>, Milan Crha <mcrha@redhat.com>
     2
     3        [GTK] Embedded GtkWidgets are not drawn
     4        https://bugs.webkit.org/show_bug.cgi?id=63451
     5
     6        Insert plugin widgets to WebKitWebView container as it's children.
     7        Chain up to parent in webkit_web_view_draw() to ensure the child widgets are drawn.
     8
     9        Reviewed by Martin Robinson.
     10
     11        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     12        (WebKit::FrameLoaderClient::createPlugin):
     13        * webkit/webkitwebview.cpp:
     14        (webkit_web_view_draw):
     15
    1162012-02-08  Mario Sanchez Prada  <msanchez@igalia.com>
    217
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r106467 r107249  
    483483    g_signal_emit_by_name(getViewFromFrame(m_frame), "create-plugin-widget",
    484484                          mimeTypeString.data(), urlString.data(), hash.get(), &gtkWidget);
    485     if (gtkWidget)
     485    if (gtkWidget) {
     486        gtk_container_add(GTK_CONTAINER(getViewFromFrame(m_frame)), gtkWidget);
    486487        return adoptRef(new GtkPluginWidget(gtkWidget));
     488    }
    487489
    488490    RefPtr<PluginView> pluginView = PluginView::create(core(m_frame), pluginSize, element, url, paramNames, paramValues, mimeType, loadManually);
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r106901 r107249  
    640640                                          cr.get(), IntSize(), IntRect(rects.get()[i]));
    641641    }
     642
     643    // Chaining up to the parent forces child widgets to be drawn.
     644    GTK_WIDGET_CLASS(webkit_web_view_parent_class)->expose(widget, event);
    642645    return FALSE;
    643646}
     
    668671    cairo_rectangle_list_destroy(rectList);
    669672
     673    // Chaining up to the parent forces child widgets to be drawn.
     674    GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
    670675    return FALSE;
    671676}
Note: See TracChangeset for help on using the changeset viewer.