Changeset 102604 in webkit


Ignore:
Timestamp:
Dec 12, 2011 10:44:10 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] gtk_widget_size_allocate for plugin widgets should happen in the WebView size-allocate method
https://bugs.webkit.org/show_bug.cgi?id=72805

Patch by Martin Robinson <mrobinson@igalia.com> on 2011-12-12
Reviewed by Gustavo Noronha Silva.

Source/WebCore:

No new tests. This is only a performance tweak.

Instead of immediately calling gtk_widget_size during painting, defer
this until the size-allocate method of the WebView.

  • plugins/gtk/PluginViewGtk.cpp:

(WebCore::PluginView::updateWidgetAllocationAndClip): Instead of immediately changing
the widget allocation, just record it in a GObject data attachment.

Source/WebKit/gtk:

Instead of immediately calling gtk_widget_size during painting, defer
this until the size-allocate method of the WebView.

  • WebCoreSupport/ChromeClientGtk.cpp:

(WebKit::ChromeClient::paint): If any child widgets have a pending allocation
call gtk_widget_size_allocate.

  • webkit/webkitwebview.cpp:

(updateChildAllocationFromPendingAllocation): Added this helper.
(webkit_web_view_size_allocate): Call the helper on all child widgets.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102602 r102604  
     12011-12-12  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] gtk_widget_size_allocate for plugin widgets should happen in the WebView size-allocate method
     4        https://bugs.webkit.org/show_bug.cgi?id=72805
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        No new tests. This is only a performance tweak.
     9
     10        Instead of immediately calling gtk_widget_size during painting, defer
     11        this until the size-allocate method of the WebView.
     12
     13        * plugins/gtk/PluginViewGtk.cpp:
     14        (WebCore::PluginView::updateWidgetAllocationAndClip): Instead of immediately changing
     15        the widget allocation, just record it in a GObject data attachment.
     16
    1172011-12-12  Nate Chapin  <japhet@chromium.org>
    218
  • trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp

    r100725 r102604  
    577577    }
    578578
    579     GtkAllocation allocation(m_delayedAllocation);
    580     m_delayedAllocation = IntRect();
    581 
    582     // The goal is to avoid calling gtk_widget_size_allocate when necessary.
    583     // It blocks the main loop and if the widget is offscreen or hasn't moved
    584     // it isn't required.
     579    // The goal is to try to avoid calling gtk_widget_size_allocate in the WebView's
     580    // size-allocate method. It blocks the main loop and if the widget is offscreen
     581    // or hasn't moved it isn't required.
    585582
    586583    // Don't do anything if the allocation has not changed.
    587584    GtkAllocation currentAllocation;
    588585    gtk_widget_get_allocation(widget, &currentAllocation);
    589     if (currentAllocation == allocation)
     586    if (currentAllocation == m_delayedAllocation)
    590587        return;
    591588
     
    596593        return;
    597594
    598     gtk_widget_size_allocate(widget, &allocation);
     595    g_object_set_data(G_OBJECT(widget), "delayed-allocation", &m_delayedAllocation);
    599596}
    600597
  • trunk/Source/WebKit/gtk/ChangeLog

    r102448 r102604  
     12011-12-12  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] gtk_widget_size_allocate for plugin widgets should happen in the WebView size-allocate method
     4        https://bugs.webkit.org/show_bug.cgi?id=72805
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Instead of immediately calling gtk_widget_size during painting, defer
     9        this until the size-allocate method of the WebView.
     10
     11        * WebCoreSupport/ChromeClientGtk.cpp:
     12        (WebKit::ChromeClient::paint): If any child widgets have a pending allocation
     13        call gtk_widget_size_allocate.
     14        * webkit/webkitwebview.cpp:
     15        (updateChildAllocationFromPendingAllocation): Added this helper.
     16        (webkit_web_view_size_allocate): Call the helper on all child widgets.
     17
    1182011-12-09  Joone Hur  <joone.hur@collabora.co.uk>
    219
  • trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r102448 r102604  
    566566    gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());
    567567
     568    HashSet<GtkWidget*> children = m_webView->priv->children;
     569    HashSet<GtkWidget*>::const_iterator end = children.end();
     570    for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) {
     571        if (static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(*current), "delayed-allocation"))) {
     572            gtk_widget_queue_resize_no_redraw(GTK_WIDGET(m_webView));
     573            break;
     574        }
     575    }
     576
    568577    m_dirtyRegion = Region();
    569578    m_lastDisplayTime = currentTime();
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r102448 r102604  
    842842#endif
    843843
     844static void updateChildAllocationFromPendingAllocation(GtkWidget* child, void*)
     845{
     846    if (!gtk_widget_get_visible(child))
     847        return;
     848
     849    GtkAllocation* allocation = static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(child), "delayed-allocation"));
     850    if (!allocation)
     851        return;
     852
     853    g_object_set_data(G_OBJECT(child), "delayed-allocation", 0);
     854    gtk_widget_size_allocate(child, allocation);
     855    *allocation = IntRect();
     856}
     857
    844858static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
    845859{
    846860    GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
    847861
    848     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
    849     Page* page = core(webView);
     862    Page* page = core(WEBKIT_WEB_VIEW(widget));
    850863    IntSize oldSize;
    851864    if (FrameView* frameView = page->mainFrame()->view()) {
     
    853866        frameView->resize(allocation->width, allocation->height);
    854867    }
     868
     869    gtk_container_forall(GTK_CONTAINER(widget), updateChildAllocationFromPendingAllocation, 0);
    855870
    856871    WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
Note: See TracChangeset for help on using the changeset viewer.