Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Side by Side Diff: webkit/tools/test_shell/webwidget_host_win.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/webwidget_host_gtk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_->beginPlatformPaint(); 254 skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get());
255 HDC hdc = scoped_platform_paint.GetPlatformSurface();
255 256
256 RECT damaged_rect, r = scroll_rect_.ToRECT(); 257 RECT damaged_rect, r = scroll_rect_.ToRECT();
257 ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_rect); 258 ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_rect);
258 259
259 PaintRect(gfx::Rect(damaged_rect)); 260 PaintRect(gfx::Rect(damaged_rect));
260 canvas_->endPlatformPaint();
261 } 261 }
262 ResetScrollRect(); 262 ResetScrollRect();
263 263
264 // 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
265 // 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
266 // objects update their layout only when painted. 266 // objects update their layout only when painted.
267 for (int i = 0; i < 2; ++i) { 267 for (int i = 0; i < 2; ++i) {
268 paint_rect_ = client_rect.Intersect(paint_rect_); 268 paint_rect_ = client_rect.Intersect(paint_rect_);
269 if (!paint_rect_.IsEmpty()) { 269 if (!paint_rect_.IsEmpty()) {
270 gfx::Rect rect(paint_rect_); 270 gfx::Rect rect(paint_rect_);
271 paint_rect_ = gfx::Rect(); 271 paint_rect_ = gfx::Rect();
272 272
273 DLOG_IF(WARNING, i == 1) << "painting caused additional invalidations"; 273 DLOG_IF(WARNING, i == 1) << "painting caused additional invalidations";
274 PaintRect(rect); 274 PaintRect(rect);
275 } 275 }
276 } 276 }
277 DCHECK(paint_rect_.IsEmpty()); 277 DCHECK(paint_rect_.IsEmpty());
278 278
279 // Paint to the screen 279 // Paint to the screen
280 PAINTSTRUCT ps; 280 PAINTSTRUCT ps;
281 BeginPaint(view_, &ps); 281 BeginPaint(view_, &ps);
282 canvas_->getTopPlatformDevice().drawToHDC(ps.hdc, 282 skia::DrawToNativeContext(canvas_.get(), ps.hdc, ps.rcPaint.left,
283 ps.rcPaint.left, 283 ps.rcPaint.top, &ps.rcPaint);
284 ps.rcPaint.top,
285 &ps.rcPaint);
286 EndPaint(view_, &ps); 284 EndPaint(view_, &ps);
287 285
288 // Draw children 286 // Draw children
289 UpdateWindow(view_); 287 UpdateWindow(view_);
290 } 288 }
291 289
292 WebScreenInfo WebWidgetHost::GetScreenInfo() { 290 WebScreenInfo WebWidgetHost::GetScreenInfo() {
293 return WebScreenInfoFactory::screenInfo(view_); 291 return WebScreenInfoFactory::screenInfo(view_);
294 } 292 }
295 293
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 373 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
376 #ifndef NDEBUG 374 #ifndef NDEBUG
377 DCHECK(!painting_); 375 DCHECK(!painting_);
378 #endif 376 #endif
379 DCHECK(canvas_.get()); 377 DCHECK(canvas_.get());
380 378
381 set_painting(true); 379 set_painting(true);
382 webwidget_->paint(canvas_.get(), rect); 380 webwidget_->paint(canvas_.get(), rect);
383 set_painting(false); 381 set_painting(false);
384 } 382 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/webwidget_host_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698