Title: [97865] trunk/Source/WebCore
- Revision
- 97865
- Author
- [email protected]
- Date
- 2011-10-19 08:25:15 -0700 (Wed, 19 Oct 2011)
Log Message
[GTK] Avoid unecessarily calling gtk_widget_size_allocate on plugin widgets
https://bugs.webkit.org/show_bug.cgi?id=70190
Reviewed by Xan Lopez.
Instead of always calling gtk_widget_size_allocate on every single plugin
widget during scrolling, only call it on widgets that are both in the view
and that have moved.
No new tests. It's difficult to test scrolling performance in an
automated way.
* plugins/gtk/PluginViewGtk.cpp:
(WebCore::PluginView::setNPWindowIfNeeded): Reverse the if statement detecting a
clipped out plugin. It was incorrect.
(WebCore::PluginView::updateWidgetAllocationAndClip): If the current allocation of
the plugin widget has not changed or if the widget remains scrolled out, do not call
gtk_widget_size_allocate.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97864 => 97865)
--- trunk/Source/WebCore/ChangeLog 2011-10-19 15:13:49 UTC (rev 97864)
+++ trunk/Source/WebCore/ChangeLog 2011-10-19 15:25:15 UTC (rev 97865)
@@ -1,3 +1,24 @@
+2011-10-19 Martin Robinson <[email protected]>
+
+ [GTK] Avoid unecessarily calling gtk_widget_size_allocate on plugin widgets
+ https://bugs.webkit.org/show_bug.cgi?id=70190
+
+ Reviewed by Xan Lopez.
+
+ Instead of always calling gtk_widget_size_allocate on every single plugin
+ widget during scrolling, only call it on widgets that are both in the view
+ and that have moved.
+
+ No new tests. It's difficult to test scrolling performance in an
+ automated way.
+
+ * plugins/gtk/PluginViewGtk.cpp:
+ (WebCore::PluginView::setNPWindowIfNeeded): Reverse the if statement detecting a
+ clipped out plugin. It was incorrect.
+ (WebCore::PluginView::updateWidgetAllocationAndClip): If the current allocation of
+ the plugin widget has not changed or if the widget remains scrolled out, do not call
+ gtk_widget_size_allocate.
+
2011-10-19 Renata Hodovan <[email protected]>
Add new renderer for SVGRectElement.
Modified: trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp (97864 => 97865)
--- trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp 2011-10-19 15:13:49 UTC (rev 97864)
+++ trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp 2011-10-19 15:25:15 UTC (rev 97865)
@@ -506,9 +506,9 @@
if (m_isWindowed && !platformPluginWidget())
return;
- // If width or height are null, set the clipRect to null, indicating that
- // the plugin is not visible/scrolled out.
- if (!m_clipRect.isEmpty()) {
+ if (m_clipRect.isEmpty()) {
+ // If width or height are null, set the clipRect to null,
+ // indicating that the plugin is not visible/scrolled out.
m_npWindow.clipRect.left = 0;
m_npWindow.clipRect.right = 0;
m_npWindow.clipRect.top = 0;
@@ -574,8 +574,25 @@
}
GtkAllocation allocation(m_delayedAllocation);
+ m_delayedAllocation = IntRect();
+
+ // The goal is to avoid calling gtk_widget_size_allocate when necessary.
+ // It blocks the main loop and if the widget is offscreen or hasn't moved
+ // it isn't required.
+
+ // Don't do anything if the allocation has not changed.
+ GtkAllocation currentAllocation;
+ gtk_widget_get_allocation(widget, ¤tAllocation);
+ if (currentAllocation == allocation)
+ return;
+
+ // Don't do anything if both the old and the new allocations are outside the frame.
+ IntRect currentAllocationRect(currentAllocation);
+ currentAllocationRect.intersect(frameRect());
+ if (currentAllocationRect.isEmpty() && m_clipRect.isEmpty())
+ return;
+
gtk_widget_size_allocate(widget, &allocation);
- m_delayedAllocation = IntRect();
}
void PluginView::setParentVisible(bool visible)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes