| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 12 matching lines...) Expand all Loading... |
| 23 const SkColor kFgColor = SK_ColorBLACK; | 23 const SkColor kFgColor = SK_ColorBLACK; |
| 24 | 24 |
| 25 const SkColor kBgColors[] = { | 25 const SkColor kBgColors[] = { |
| 26 SK_ColorBLACK, // Unknown | 26 SK_ColorBLACK, // Unknown |
| 27 SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled | 27 SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled |
| 28 SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly | 28 SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly |
| 29 SkColorSetRGB(0x89, 0xc4, 0xff), // Normal | 29 SkColorSetRGB(0x89, 0xc4, 0xff), // Normal |
| 30 SkColorSetRGB(0x43, 0xf9, 0xff), // Hot | 30 SkColorSetRGB(0x43, 0xf9, 0xff), // Hot |
| 31 SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused | 31 SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused |
| 32 SkColorSetRGB(0x00, 0xf3, 0xac), // Hover | 32 SkColorSetRGB(0x00, 0xf3, 0xac), // Hover |
| 33 SkColorSetRGB(0xa9, 0xff, 0x12) // Pressed | 33 SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed |
| 34 SkColorSetRGB(0xcc, 0xcc, 0xcc) // Indetermiante |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 SkIRect Validate(const SkIRect& rect, Control::Type ctype) { | 37 SkIRect Validate(const SkIRect& rect, Control::Type ctype) { |
| 37 SkIRect retval = rect; | 38 SkIRect retval = rect; |
| 38 if (ctype == Control::kUncheckedBox_Type || | 39 if (ctype == Control::kUncheckedBox_Type || |
| 39 ctype == Control::kCheckedBox_Type || | 40 ctype == Control::kCheckedBox_Type || |
| 40 ctype == Control::kUncheckedRadio_Type || | 41 ctype == Control::kUncheckedRadio_Type || |
| 41 ctype == Control::kCheckedRadio_Type) { | 42 ctype == Control::kCheckedRadio_Type) { |
| 42 // The maximum width and height is 13. Center the square in the passed | 43 // The maximum width and height is 13. Center the square in the passed |
| 43 // rectangle. | 44 // rectangle. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (draw_edges) { | 405 if (draw_edges) { |
| 405 paint.setColor(edge_color_); | 406 paint.setColor(edge_color_); |
| 406 paint.setStyle(SkPaint::kStroke_Style); | 407 paint.setStyle(SkPaint::kStroke_Style); |
| 407 canvas_->drawIRect(irect_, paint); | 408 canvas_->drawIRect(irect_, paint); |
| 408 } | 409 } |
| 409 | 410 |
| 410 markState(); | 411 markState(); |
| 411 canvas_->endPlatformPaint(); | 412 canvas_->endPlatformPaint(); |
| 412 } | 413 } |
| 413 | 414 |
| 415 void |
| 416 Control::drawProgressBar(const SkIRect &fill_rect) |
| 417 { |
| 418 SkPaint paint; |
| 419 |
| 420 canvas_->beginPlatformPaint(); |
| 421 |
| 422 paint.setColor(bg_color_); |
| 423 paint.setStyle(SkPaint::kFill_Style); |
| 424 canvas_->drawIRect(irect_, paint); |
| 425 |
| 426 // Emulate clipping |
| 427 SkIRect tofill; |
| 428 tofill.intersect(irect_, fill_rect); |
| 429 paint.setColor(fg_color_); |
| 430 paint.setStyle(SkPaint::kFill_Style); |
| 431 canvas_->drawIRect(tofill, paint); |
| 432 |
| 433 markState(); |
| 434 canvas_->endPlatformPaint(); |
| 435 } |
| 436 |
| 414 } // namespace TestShellWebTheme | 437 } // namespace TestShellWebTheme |
| 415 | 438 |
| OLD | NEW |