| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "skia/ext/platform_canvas.h" | 8 #include "skia/ext/platform_canvas.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 gfx::Rect client_rect(r); | 236 gfx::Rect client_rect(r); |
| 237 | 237 |
| 238 // Allocate a canvas if necessary | 238 // Allocate a canvas if necessary |
| 239 if (!canvas_.get()) { | 239 if (!canvas_.get()) { |
| 240 ResetScrollRect(); | 240 ResetScrollRect(); |
| 241 paint_rect_ = client_rect; | 241 paint_rect_ = client_rect; |
| 242 canvas_.reset(new skia::PlatformCanvas( | 242 canvas_.reset(new skia::PlatformCanvas( |
| 243 paint_rect_.width(), paint_rect_.height(), true)); | 243 paint_rect_.width(), paint_rect_.height(), true)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 #ifdef WEBWIDGET_HAS_ANIMATE_CHANGES | |
| 247 webwidget_->animate(0.0); | 246 webwidget_->animate(0.0); |
| 248 #else | |
| 249 webwidget_->animate(); | |
| 250 #endif | |
| 251 | 247 |
| 252 // This may result in more invalidation | 248 // This may result in more invalidation |
| 253 webwidget_->layout(); | 249 webwidget_->layout(); |
| 254 | 250 |
| 255 // Scroll the canvas if necessary | 251 // Scroll the canvas if necessary |
| 256 scroll_rect_ = client_rect.Intersect(scroll_rect_); | 252 scroll_rect_ = client_rect.Intersect(scroll_rect_); |
| 257 if (!scroll_rect_.IsEmpty()) { | 253 if (!scroll_rect_.IsEmpty()) { |
| 258 skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get()); | 254 skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get()); |
| 259 HDC hdc = scoped_platform_paint.GetPlatformSurface(); | 255 HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
| 260 | 256 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 373 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 378 #ifndef NDEBUG | 374 #ifndef NDEBUG |
| 379 DCHECK(!painting_); | 375 DCHECK(!painting_); |
| 380 #endif | 376 #endif |
| 381 DCHECK(canvas_.get()); | 377 DCHECK(canvas_.get()); |
| 382 | 378 |
| 383 set_painting(true); | 379 set_painting(true); |
| 384 webwidget_->paint(canvas_.get(), rect); | 380 webwidget_->paint(canvas_.get(), rect); |
| 385 set_painting(false); | 381 set_painting(false); |
| 386 } | 382 } |
| OLD | NEW |