OLD | NEW |
1 // Copyright (c) 2010 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" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 webwidget_->animate(); | 246 webwidget_->animate(); |
247 | 247 |
248 // This may result in more invalidation | 248 // This may result in more invalidation |
249 webwidget_->layout(); | 249 webwidget_->layout(); |
250 | 250 |
251 // Scroll the canvas if necessary | 251 // Scroll the canvas if necessary |
252 scroll_rect_ = client_rect.Intersect(scroll_rect_); | 252 scroll_rect_ = client_rect.Intersect(scroll_rect_); |
253 if (!scroll_rect_.IsEmpty()) { | 253 if (!scroll_rect_.IsEmpty()) { |
254 HDC hdc = canvas_->getTopPlatformDevice().getBitmapDC(); | 254 HDC hdc = canvas_->beginPlatformPaint(); |
255 | 255 |
256 RECT damaged_rect, r = scroll_rect_.ToRECT(); | 256 RECT damaged_rect, r = scroll_rect_.ToRECT(); |
257 ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_rect); | 257 ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_rect); |
258 | 258 |
259 PaintRect(gfx::Rect(damaged_rect)); | 259 PaintRect(gfx::Rect(damaged_rect)); |
| 260 canvas_->endPlatformPaint(); |
260 } | 261 } |
261 ResetScrollRect(); | 262 ResetScrollRect(); |
262 | 263 |
263 // Paint the canvas if necessary. Allow painting to generate extra rects the | 264 // Paint the canvas if necessary. Allow painting to generate extra rects the |
264 // first time we call it. This is necessary because some WebCore rendering | 265 // first time we call it. This is necessary because some WebCore rendering |
265 // objects update their layout only when painted. | 266 // objects update their layout only when painted. |
266 for (int i = 0; i < 2; ++i) { | 267 for (int i = 0; i < 2; ++i) { |
267 paint_rect_ = client_rect.Intersect(paint_rect_); | 268 paint_rect_ = client_rect.Intersect(paint_rect_); |
268 if (!paint_rect_.IsEmpty()) { | 269 if (!paint_rect_.IsEmpty()) { |
269 gfx::Rect rect(paint_rect_); | 270 gfx::Rect rect(paint_rect_); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 375 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
375 #ifndef NDEBUG | 376 #ifndef NDEBUG |
376 DCHECK(!painting_); | 377 DCHECK(!painting_); |
377 #endif | 378 #endif |
378 DCHECK(canvas_.get()); | 379 DCHECK(canvas_.get()); |
379 | 380 |
380 set_painting(true); | 381 set_painting(true); |
381 webwidget_->paint(canvas_.get(), rect); | 382 webwidget_->paint(canvas_.get(), rect); |
382 set_painting(false); | 383 set_painting(false); |
383 } | 384 } |
OLD | NEW |