Index: chrome/renderer/render_widget.cc |
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc |
index 2f145765acd5eb0195223f4e01e4cd675e1c6dbb..5adc812d9b1831417e211e6c843163a55983edeb 100644 |
--- a/chrome/renderer/render_widget.cc |
+++ b/chrome/renderer/render_widget.cc |
@@ -487,8 +487,7 @@ void RenderWidget::CallDoDeferredUpdate() { |
} |
void RenderWidget::DoDeferredUpdate() { |
- if (!webwidget_ || !paint_aggregator_.HasPendingUpdate() || |
- update_reply_pending()) |
+ if (!webwidget_ || update_reply_pending()) |
return; |
// Suppress updating when we are hidden. |
@@ -498,11 +497,20 @@ void RenderWidget::DoDeferredUpdate() { |
return; |
} |
+ // Request animation updates. |
+ // TODO(jamesr): Do we wanna throttle? |
+ webwidget_->animate(); |
+ |
// Layout may generate more invalidation. It may also enable the |
// GPU acceleration, so make sure to run layout before we send the |
// GpuRenderingActivated message. |
webwidget_->layout(); |
+ // Suppress painting if nothing is dirty. This has to be done after updating |
+ // animations running layout as these may generate further invalidations. |
+ if (!paint_aggregator_.HasPendingUpdate()) |
+ return; |
+ |
// OK, save the pending update to a local since painting may cause more |
// invalidation. Some WebCore rendering objects only layout when painted. |
PaintAggregator::PendingUpdate update; |
@@ -681,6 +689,12 @@ void RenderWidget::scheduleComposite() { |
didInvalidateRect(WebRect(0, 0, 1, 1)); |
} |
+void RenderWidget::scheduleAnimation() { |
+ // TODO(jamesr): Come up with a more intelligent scheduling algorithm. |
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
+ this, &RenderWidget::scheduleComposite)); |
+} |
+ |
void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) { |
// TODO(darin): Eliminate this temporary. |
WebCursor cursor(cursor_info); |