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 // Since WebThemeEngine is unfortunately defined in terms of the Windows | 6 // Since WebThemeEngine is unfortunately defined in terms of the Windows |
7 // Theme parameters and values, we need to translate all the values into | 7 // Theme parameters and values, we need to translate all the values into |
8 // generic equivalents that we can more easily understand. This file does | 8 // generic equivalents that we can more easily understand. This file does |
9 // that translation (acting as a Facade design pattern) and then uses | 9 // that translation (acting as a Facade design pattern) and then uses |
10 // TestShellWebTheme::Control for the actual rendering of the widgets. | 10 // TestShellWebTheme::Control for the actual rendering of the widgets. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 control.draw(); | 53 control.draw(); |
54 } | 54 } |
55 | 55 |
56 void drawTextField(WebCanvas *canvas, const WebRect &rect, | 56 void drawTextField(WebCanvas *canvas, const WebRect &rect, |
57 Control::Type ctype, Control::State cstate, | 57 Control::Type ctype, Control::State cstate, |
58 bool draw_edges, bool fill_content_area, WebColor color) { | 58 bool draw_edges, bool fill_content_area, WebColor color) { |
59 Control control(canvas, webRectToSkIRect(rect), ctype, cstate); | 59 Control control(canvas, webRectToSkIRect(rect), ctype, cstate); |
60 control.drawTextField(draw_edges, fill_content_area, color); | 60 control.drawTextField(draw_edges, fill_content_area, color); |
61 } | 61 } |
62 | 62 |
| 63 void drawProgressBar(WebCanvas *canvas, |
| 64 Control::Type ctype, Control::State cstate, |
| 65 const WebRect &bar_rect, const WebRect &fill_rect) { |
| 66 Control control(canvas, webRectToSkIRect(bar_rect), ctype, cstate); |
| 67 control.drawProgressBar(webRectToSkIRect(fill_rect)); |
| 68 } |
| 69 |
63 void Engine::paintButton(WebCanvas* canvas, int part, int state, | 70 void Engine::paintButton(WebCanvas* canvas, int part, int state, |
64 int classic_state, const WebRect& rect) { | 71 int classic_state, const WebRect& rect) { |
65 Control::Type ctype = Control::kUnknown_Type; | 72 Control::Type ctype = Control::kUnknown_Type; |
66 Control::State cstate = Control::kUnknown_State; | 73 Control::State cstate = Control::kUnknown_State; |
67 | 74 |
68 if (part == BP_CHECKBOX) { | 75 if (part == BP_CHECKBOX) { |
69 switch (state) { | 76 switch (state) { |
70 case CBS_UNCHECKEDNORMAL: | 77 case CBS_UNCHECKEDNORMAL: |
71 CHECK_EQ(classic_state, kDFCSNormal); | 78 CHECK_EQ(classic_state, kDFCSNormal); |
72 ctype = Control::kUncheckedBox_Type; | 79 ctype = Control::kUncheckedBox_Type; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 CHECK_EQ(part, TUS_NORMAL); | 533 CHECK_EQ(part, TUS_NORMAL); |
527 CHECK_EQ(classic_state, kDFCSNormal); | 534 CHECK_EQ(classic_state, kDFCSNormal); |
528 cstate = Control::kNormal_State; | 535 cstate = Control::kNormal_State; |
529 } else { | 536 } else { |
530 NOTREACHED(); | 537 NOTREACHED(); |
531 } | 538 } |
532 | 539 |
533 drawControl(canvas, rect, ctype, cstate); | 540 drawControl(canvas, rect, ctype, cstate); |
534 } | 541 } |
535 | 542 |
| 543 |
| 544 void Engine::paintProgressBar(WebKit::WebCanvas* canvas, |
| 545 const WebKit::WebRect& barRect, |
| 546 int valuePart, const WebKit::WebRect& valueRect) { |
| 547 Control::Type ctype = Control::kProgressBar_Type; |
| 548 Control::State cstate = valuePart == PP_FILL ? Control::kNormal_State : Cont
rol::kIndeterminate_State; |
| 549 drawProgressBar(canvas, ctype, cstate, barRect, valueRect); |
| 550 } |
| 551 |
536 } // namespace TestShellWebTheme | 552 } // namespace TestShellWebTheme |
OLD | NEW |