Changeset 106816 in webkit
- Timestamp:
- Feb 6, 2012 9:59:27 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/gtk/ChangeLog
r106793 r106816 1 2012-02-06 Martin Robinson <mrobinson@igalia.com> 2 3 [GTK] WebKitWebView does a lot of work during size_allocate when not mapped 4 https://bugs.webkit.org/show_bug.cgi?id=77743 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Instead of resizing the guts of a WebView when it's not mapped, wait 9 until it's mapped and do one resize. This prevents unmapped WebViews 10 from adding to a container's resize cost. 11 12 * webkit/webkitwebview.cpp: 13 (resizeWebViewFromAllocation): Abstracted out this helper. 14 (webkit_web_view_size_allocate): Wait until map to resize umapped widgets. 15 (webkitWebViewMap): Added this vmethod implementation. 16 (webkit_web_view_class_init): Added vmethod. 17 * webkit/webkitwebviewprivate.h: Added new needsResizeOnMap member. 18 1 19 2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp
r106559 r106816 860 860 } 861 861 862 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) 863 { 864 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation); 865 866 Page* page = core(WEBKIT_WEB_VIEW(widget)); 862 static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* allocation) 863 { 864 Page* page = core(webView); 867 865 IntSize oldSize; 868 866 if (FrameView* frameView = page->mainFrame()->view()) { … … 871 869 } 872 870 873 gtk_container_forall(GTK_CONTAINER(w idget), updateChildAllocationFromPendingAllocation, 0);871 gtk_container_forall(GTK_CONTAINER(webView), updateChildAllocationFromPendingAllocation, 0); 874 872 875 873 WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client()); … … 880 878 WEBKIT_WEB_VIEW(widget)->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height)); 881 879 #endif 880 } 881 882 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) 883 { 884 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation); 885 886 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); 887 if (!gtk_widget_get_mapped(widget)) { 888 webView->priv->needsResizeOnMap = true; 889 return; 890 } 891 resizeWebViewFromAllocation(webView, allocation); 892 } 893 894 static void webkitWebViewMap(GtkWidget* widget) 895 { 896 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->map(widget); 897 898 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); 899 if (!webView->priv->needsResizeOnMap) 900 return; 901 902 GtkAllocation allocation; 903 gtk_widget_get_allocation(widget, &allocation); 904 resizeWebViewFromAllocation(webView, &allocation); 905 webView->priv->needsResizeOnMap = false; 882 906 } 883 907 … … 2768 2792 widgetClass->show_help = webkit_web_view_show_help; 2769 2793 #endif 2794 widgetClass->map = webkitWebViewMap; 2770 2795 2771 2796 GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass); -
trunk/Source/WebKit/gtk/webkit/webkitwebviewprivate.h
r104194 r106816 62 62 63 63 gboolean transparent; 64 bool needsResizeOnMap; 64 65 65 66 #ifndef GTK_API_VERSION_2 -
trunk/Source/WebKit2/ChangeLog
r106803 r106816 1 2012-02-06 Martin Robinson <mrobinson@igalia.com> 2 3 [GTK] WebKitWebView does a lot of work during size_allocate when not mapped 4 https://bugs.webkit.org/show_bug.cgi?id=77743 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Instead of resizing the guts of a WebView when it's not mapped, wait 9 until it's mapped and do one resize. This prevents unmapped WebViews 10 from adding to a container's resize cost. 11 12 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 13 (_WebKitWebViewBasePrivate): Added a new member needsResizeOnMap. 14 (resizeWebKitWebViewBaseFromAllocation): Abstracted out this helper. 15 (webkitWebViewBaseSizeAllocate): Wait until map to resize unmapped WebViews. 16 (webkitWebViewBaseMap): Added this vmethod implementation. 17 (webkit_web_view_base_class_init): Added vmethod. 18 1 19 2012-02-06 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 20 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r106559 r106816 72 72 IntSize resizerSize; 73 73 GRefPtr<AtkObject> accessible; 74 bool needsResizeOnMap; 74 75 }; 75 76 … … 203 204 } 204 205 205 static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) 206 { 207 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); 208 WebKitWebViewBasePrivate* priv = webViewBase->priv; 209 210 if (!priv->pageProxy->drawingArea()) 211 return; 212 213 GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation); 214 priv->pageProxy->drawingArea()->setSize(IntSize(allocation->width, allocation->height), IntSize()); 215 216 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); 206 static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase, GtkAllocation* allocation) 207 { 208 WebKitWebViewBasePrivate* priv = webViewBase->priv; 209 210 if (priv->pageProxy->drawingArea()) 211 priv->pageProxy->drawingArea()->setSize(IntSize(allocation->width, allocation->height), IntSize()); 212 213 GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(webViewBase)); 217 214 if (widgetIsOnscreenToplevelWindow(toplevel)) 218 215 webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(toplevel)); 216 } 217 218 static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) 219 { 220 GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation); 221 222 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); 223 if (!gtk_widget_get_mapped(GTK_WIDGET(webViewBase)) && !webViewBase->priv->pageProxy->drawingArea()->size().isEmpty()) { 224 webViewBase->priv->needsResizeOnMap = true; 225 return; 226 } 227 resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation); 228 } 229 230 static void webkitWebViewBaseMap(GtkWidget* widget) 231 { 232 GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->map(widget); 233 234 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); 235 if (!webViewBase->priv->needsResizeOnMap) 236 return; 237 238 GtkAllocation allocation; 239 gtk_widget_get_allocation(widget, &allocation); 240 resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation); 241 webViewBase->priv->needsResizeOnMap = false; 242 219 243 } 220 244 … … 455 479 widgetClass->draw = webkitWebViewBaseDraw; 456 480 widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; 481 widgetClass->map = webkitWebViewBaseMap; 457 482 widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; 458 483 widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent;
Note: See TracChangeset
for help on using the changeset viewer.