| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 ResetScrollRect(); | 358 ResetScrollRect(); |
| 359 paint_rect_ = client_rect; | 359 paint_rect_ = client_rect; |
| 360 canvas_.reset(new skia::PlatformCanvas(width, height, true)); | 360 canvas_.reset(new skia::PlatformCanvas(width, height, true)); |
| 361 if (!canvas_.get()) { | 361 if (!canvas_.get()) { |
| 362 // memory allocation failed, we can't paint. | 362 // memory allocation failed, we can't paint. |
| 363 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; | 363 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; |
| 364 return; | 364 return; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 #ifdef WEBWIDGET_HAS_ANIMATE_CHANGES | |
| 369 webwidget_->animate(0.0); | 368 webwidget_->animate(0.0); |
| 370 #else | |
| 371 webwidget_->animate(); | |
| 372 #endif | |
| 373 | 369 |
| 374 // This may result in more invalidation | 370 // This may result in more invalidation |
| 375 webwidget_->layout(); | 371 webwidget_->layout(); |
| 376 | 372 |
| 377 // Paint the canvas if necessary. Allow painting to generate extra rects the | 373 // Paint the canvas if necessary. Allow painting to generate extra rects the |
| 378 // first time we call it. This is necessary because some WebCore rendering | 374 // first time we call it. This is necessary because some WebCore rendering |
| 379 // objects update their layout only when painted. | 375 // objects update their layout only when painted. |
| 380 // Store the total area painted in total_paint. Then tell the gdk window | 376 // Store the total area painted in total_paint. Then tell the gdk window |
| 381 // to update that area after we're done painting it. | 377 // to update that area after we're done painting it. |
| 382 gfx::Rect total_paint; | 378 gfx::Rect total_paint; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 426 |
| 431 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 427 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 432 set_painting(true); | 428 set_painting(true); |
| 433 webwidget_->paint(canvas_.get(), rect); | 429 webwidget_->paint(canvas_.get(), rect); |
| 434 set_painting(false); | 430 set_painting(false); |
| 435 } | 431 } |
| 436 | 432 |
| 437 void WebWidgetHost::WindowDestroyed() { | 433 void WebWidgetHost::WindowDestroyed() { |
| 438 delete this; | 434 delete this; |
| 439 } | 435 } |
| OLD | NEW |