OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/tools/test_shell/webwidget_host.h" | 5 #include "webkit/tools/test_shell/webwidget_host.h" |
6 | 6 |
7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 ResetScrollRect(); | 357 ResetScrollRect(); |
358 paint_rect_ = client_rect; | 358 paint_rect_ = client_rect; |
359 canvas_.reset(new skia::PlatformCanvas(width, height, true)); | 359 canvas_.reset(new skia::PlatformCanvas(width, height, true)); |
360 if (!canvas_.get()) { | 360 if (!canvas_.get()) { |
361 // memory allocation failed, we can't paint. | 361 // memory allocation failed, we can't paint. |
362 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; | 362 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; |
363 return; | 363 return; |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
| 367 webwidget_->animate(); |
| 368 |
367 // This may result in more invalidation | 369 // This may result in more invalidation |
368 webwidget_->layout(); | 370 webwidget_->layout(); |
369 | 371 |
370 // Paint the canvas if necessary. Allow painting to generate extra rects the | 372 // Paint the canvas if necessary. Allow painting to generate extra rects the |
371 // first time we call it. This is necessary because some WebCore rendering | 373 // first time we call it. This is necessary because some WebCore rendering |
372 // objects update their layout only when painted. | 374 // objects update their layout only when painted. |
373 // Store the total area painted in total_paint. Then tell the gdk window | 375 // Store the total area painted in total_paint. Then tell the gdk window |
374 // to update that area after we're done painting it. | 376 // to update that area after we're done painting it. |
375 gfx::Rect total_paint; | 377 gfx::Rect total_paint; |
376 for (int i = 0; i < 2; ++i) { | 378 for (int i = 0; i < 2; ++i) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 424 |
423 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 425 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
424 set_painting(true); | 426 set_painting(true); |
425 webwidget_->paint(canvas_.get(), rect); | 427 webwidget_->paint(canvas_.get(), rect); |
426 set_painting(false); | 428 set_painting(false); |
427 } | 429 } |
428 | 430 |
429 void WebWidgetHost::WindowDestroyed() { | 431 void WebWidgetHost::WindowDestroyed() { |
430 delete this; | 432 delete this; |
431 } | 433 } |
OLD | NEW |