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

Side by Side Diff: webkit/tools/test_shell/test_shell_webthemecontrol.h

Issue 1596018: Added support for HTML5 progress element. (Closed)
Patch Set: just sync the change of webkit side. Created 10 years, 8 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
OLDNEW
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 // TestShellWebTheme::Control implements the generic rendering of controls 5 // TestShellWebTheme::Control implements the generic rendering of controls
6 // needed by TestShellWebTheme::Engine. See the comments in that class 6 // needed by TestShellWebTheme::Engine. See the comments in that class
7 // header file for why this class is needed and used. 7 // header file for why this class is needed and used.
8 // 8 //
9 // This class implements a generic set of widgets using Skia. The widgets 9 // This class implements a generic set of widgets using Skia. The widgets
10 // are optimized for testability, not a pleasing appearance. 10 // are optimized for testability, not a pleasing appearance.
(...skipping 25 matching lines...) Expand all
36 // selected 36 // selected
37 // Normal - the normal state of control on the page when it isn't 37 // Normal - the normal state of control on the page when it isn't
38 // focused or otherwise active 38 // focused or otherwise active
39 // Hot - when the mouse is hovering over a part of the control, 39 // Hot - when the mouse is hovering over a part of the control,
40 // all the other parts are considered "hot" 40 // all the other parts are considered "hot"
41 // Hover - when the mouse is directly over a control (the CSS 41 // Hover - when the mouse is directly over a control (the CSS
42 // :hover pseudo-class) 42 // :hover pseudo-class)
43 // Focused - when the control has the keyboard focus 43 // Focused - when the control has the keyboard focus
44 // Pressed - when the control is being triggered (by a mousedown or 44 // Pressed - when the control is being triggered (by a mousedown or
45 // a key event). 45 // a key event).
46 // Indetermiante - when set to indetermiante (only for progress bar)
46 enum State { 47 enum State {
47 kUnknown_State = 0, 48 kUnknown_State = 0,
48 kDisabled_State, 49 kDisabled_State,
49 kReadOnly_State, 50 kReadOnly_State,
50 kNormal_State, 51 kNormal_State,
51 kHot_State, 52 kHot_State,
52 kHover_State, 53 kHover_State,
53 kFocused_State, 54 kFocused_State,
54 kPressed_State 55 kPressed_State,
56 kIndeterminate_State
55 }; 57 };
56 58
57 // This list of types mostly mirrors the list in 59 // This list of types mostly mirrors the list in
58 // third_party/WebKit/WebCore/platform/ThemeTypes.h but is maintained 60 // third_party/WebKit/WebCore/platform/ThemeTypes.h but is maintained
59 // separately since that isn't public and also to minimize dependencies. 61 // separately since that isn't public and also to minimize dependencies.
60 // 62 //
61 // Note that what the user might think of as a single control can be 63 // Note that what the user might think of as a single control can be
62 // made up of multiple parts. For example, a single scroll bar contains 64 // made up of multiple parts. For example, a single scroll bar contains
63 // six clickable parts - two arrows, the "thumb" indicating the current 65 // six clickable parts - two arrows, the "thumb" indicating the current
64 // position on the bar, the other two parts of the bar (before and after 66 // position on the bar, the other two parts of the bar (before and after
(...skipping 14 matching lines...) Expand all
79 kVerticalScrollTrackBack_Type, 81 kVerticalScrollTrackBack_Type,
80 kVerticalScrollTrackForward_Type, 82 kVerticalScrollTrackForward_Type,
81 kVerticalScrollThumb_Type, 83 kVerticalScrollThumb_Type,
82 kVerticalScrollGrip_Type, 84 kVerticalScrollGrip_Type,
83 kLeftArrow_Type, 85 kLeftArrow_Type,
84 kRightArrow_Type, 86 kRightArrow_Type,
85 kUpArrow_Type, 87 kUpArrow_Type,
86 kDownArrow_Type, 88 kDownArrow_Type,
87 kHorizontalSliderTrack_Type, 89 kHorizontalSliderTrack_Type,
88 kHorizontalSliderThumb_Type, 90 kHorizontalSliderThumb_Type,
89 kDropDownButton_Type 91 kDropDownButton_Type,
92 kProgressBar_Type
90 }; 93 };
91 94
92 // canvas is the canvas to draw onto, and rect gives the size of the 95 // canvas is the canvas to draw onto, and rect gives the size of the
93 // control. ctype and cstate specify the type and state of the control. 96 // control. ctype and cstate specify the type and state of the control.
94 Control(skia::PlatformCanvas *canvas, const SkIRect &rect, 97 Control(skia::PlatformCanvas *canvas, const SkIRect &rect,
95 Type ctype, State cstate); 98 Type ctype, State cstate);
96 ~Control(); 99 ~Control();
97 100
98 // Draws the control. 101 // Draws the control.
99 void draw(); 102 void draw();
100 103
101 // Use this for TextField controls instead, because the logic 104 // Use this for TextField controls instead, because the logic
102 // for drawing them is dependent on what WebKit tells us to do. 105 // for drawing them is dependent on what WebKit tells us to do.
103 // If draw_edges is true, draw an edge around the control. If 106 // If draw_edges is true, draw an edge around the control. If
104 // fill_content_area is true, fill the content area with the given color. 107 // fill_content_area is true, fill the content area with the given color.
105 void drawTextField(bool draw_edges, bool fill_content_area, SkColor color); 108 void drawTextField(bool draw_edges, bool fill_content_area, SkColor color);
106 109
110 // Like drawTextField(), drawing a progress bar also requires extra states
111 // that is not captured by Control instances; fill_rect represents
112 // an drawing area of the bar inside the background container.
113 void drawProgressBar(const SkIRect &fill_rect);
107 private: 114 private:
108 // Draws a box of size specified by irect, filled with the given color. 115 // Draws a box of size specified by irect, filled with the given color.
109 // The box will have a border drawn in the default edge color. 116 // The box will have a border drawn in the default edge color.
110 void box(const SkIRect &irect, SkColor color); 117 void box(const SkIRect &irect, SkColor color);
111 118
112 119
113 // Draws a triangle of size specified by the three pairs of coordinates, 120 // Draws a triangle of size specified by the three pairs of coordinates,
114 // filled with the given color. The box will have an edge drawn in the 121 // filled with the given color. The box will have an edge drawn in the
115 // default edge color. 122 // default edge color.
116 void triangle(int x0, int y0, int x1, int y1, int x2, int y2, 123 void triangle(int x0, int y0, int x1, int y1, int x2, int y2,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const int width_; 168 const int width_;
162 const int height_; 169 const int height_;
163 170
164 DISALLOW_COPY_AND_ASSIGN(Control); 171 DISALLOW_COPY_AND_ASSIGN(Control);
165 }; 172 };
166 173
167 } // namespace TestShellWebTheme 174 } // namespace TestShellWebTheme
168 175
169 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBTHEMECONTROL_H_ 176 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBTHEMECONTROL_H_
170 177
OLDNEW
« no previous file with comments | « webkit/glue/webthemeengine_impl_win.cc ('k') | webkit/tools/test_shell/test_shell_webthemecontrol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698