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

Side by Side Diff: webkit/tools/test_shell/test_shell_webthemecontrol.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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file implements a simple generic version of the WebKitThemeEngine, 5 // This file implements a simple generic version of the WebKitThemeEngine,
6 // which is used to draw all the native controls on a web page. We use this 6 // which is used to draw all the native controls on a web page. We use this
7 // file when running in layout test mode in order to remove any 7 // file when running in layout test mode in order to remove any
8 // platform-specific rendering differences due to themes, colors, etc. 8 // platform-specific rendering differences due to themes, colors, etc.
9 // 9 //
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 const int kThumbLongIndent = 0; 239 const int kThumbLongIndent = 0;
240 const int kThumbShortIndent = 2; 240 const int kThumbShortIndent = 2;
241 241
242 // Indents for the crosshatch on a scroll grip. 242 // Indents for the crosshatch on a scroll grip.
243 const int kGripLongIndent = 3; 243 const int kGripLongIndent = 3;
244 const int kGripShortIndent = 5; 244 const int kGripShortIndent = 5;
245 245
246 // Indents for the the slider track. 246 // Indents for the the slider track.
247 const int kSliderIndent = 2; 247 const int kSliderIndent = 2;
248 248
249 skia::BeginPlatformPaint(canvas_); 249 skia::ScopedPlatformPaint scoped_platform_paint(canvas_);
250 switch (type_) { 250 switch (type_) {
251 case kUnknown_Type: 251 case kUnknown_Type:
252 NOTREACHED(); 252 NOTREACHED();
253 break; 253 break;
254 case kTextField_Type: 254 case kTextField_Type:
255 // We render this by hand outside of this function. 255 // We render this by hand outside of this function.
256 NOTREACHED(); 256 NOTREACHED();
257 break; 257 break;
258 case kPushButton_Type: 258 case kPushButton_Type:
259 // push buttons render as a rounded rectangle 259 // push buttons render as a rounded rectangle
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 triangle(left_ + quarter_width, top_, 384 triangle(left_ + quarter_width, top_,
385 right_ - quarter_width, top_, 385 right_ - quarter_width, top_,
386 left_ + half_width, bottom_, fg_color_); 386 left_ + half_width, bottom_, fg_color_);
387 break; 387 break;
388 default: 388 default:
389 NOTREACHED(); 389 NOTREACHED();
390 break; 390 break;
391 } 391 }
392 392
393 markState(); 393 markState();
394 skia::EndPlatformPaint(canvas_);
395 } 394 }
396 395
397 // Because rendering a text field is dependent on input 396 // Because rendering a text field is dependent on input
398 // parameters the other controls don't have, we render it directly 397 // parameters the other controls don't have, we render it directly
399 // rather than trying to overcomplicate draw() further. 398 // rather than trying to overcomplicate draw() further.
400 void Control::drawTextField(bool draw_edges, bool fill_content_area, 399 void Control::drawTextField(bool draw_edges, bool fill_content_area,
401 SkColor color) { 400 SkColor color) {
402 SkPaint paint; 401 SkPaint paint;
403 402
404 skia::BeginPlatformPaint(canvas_); 403 skia::ScopedPlatformPaint scoped_platform_paint(canvas_);
405 if (fill_content_area) { 404 if (fill_content_area) {
406 paint.setColor(color); 405 paint.setColor(color);
407 paint.setStyle(SkPaint::kFill_Style); 406 paint.setStyle(SkPaint::kFill_Style);
408 canvas_->drawIRect(irect_, paint); 407 canvas_->drawIRect(irect_, paint);
409 } 408 }
410 if (draw_edges) { 409 if (draw_edges) {
411 paint.setColor(edge_color_); 410 paint.setColor(edge_color_);
412 paint.setStyle(SkPaint::kStroke_Style); 411 paint.setStyle(SkPaint::kStroke_Style);
413 canvas_->drawIRect(irect_, paint); 412 canvas_->drawIRect(irect_, paint);
414 } 413 }
415 414
416 markState(); 415 markState();
417 skia::EndPlatformPaint(canvas_);
418 } 416 }
419 417
420 void 418 void
421 Control::drawProgressBar(const SkIRect& fill_rect) { 419 Control::drawProgressBar(const SkIRect& fill_rect) {
422 SkPaint paint; 420 SkPaint paint;
423 421
424 skia::BeginPlatformPaint(canvas_); 422 skia::ScopedPlatformPaint scoped_platform_paint(canvas_);
425 paint.setColor(bg_color_); 423 paint.setColor(bg_color_);
426 paint.setStyle(SkPaint::kFill_Style); 424 paint.setStyle(SkPaint::kFill_Style);
427 canvas_->drawIRect(irect_, paint); 425 canvas_->drawIRect(irect_, paint);
428 426
429 // Emulate clipping 427 // Emulate clipping
430 SkIRect tofill; 428 SkIRect tofill;
431 tofill.intersect(irect_, fill_rect); 429 tofill.intersect(irect_, fill_rect);
432 paint.setColor(fg_color_); 430 paint.setColor(fg_color_);
433 paint.setStyle(SkPaint::kFill_Style); 431 paint.setStyle(SkPaint::kFill_Style);
434 canvas_->drawIRect(tofill, paint); 432 canvas_->drawIRect(tofill, paint);
435 433
436 markState(); 434 markState();
437 skia::EndPlatformPaint(canvas_);
438 } 435 }
439 436
440 } // namespace TestShellWebTheme 437 } // namespace TestShellWebTheme
441 438
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/mac/webwidget_host.mm ('k') | webkit/tools/test_shell/webwidget_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698