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

Side by Side Diff: content/shell/renderer/test_runner/WebTestThemeEngineWin.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/shell/renderer/test_runner/WebTestThemeEngineWin.h"
6
7 #include "content/shell/renderer/test_runner/TestCommon.h"
8 #include "content/shell/renderer/test_runner/WebTestThemeControlWin.h"
9 #include "third_party/WebKit/public/platform/WebRect.h"
10 #include "third_party/skia/include/core/SkRect.h"
11
12 // Although all this code is generic, we include these headers
13 // to pull in the Windows #defines for the parts and states of
14 // the controls.
15 #include <windows.h>
16 #include <vsstyle.h>
17
18 using namespace blink;
19
20 namespace WebTestRunner {
21
22 namespace {
23
24 // We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h.
25 const int dfcsNormal = 0x0000;
26
27 SkIRect webRectToSkIRect(const WebRect& webRect)
28 {
29 SkIRect irect;
30 irect.set(webRect.x, webRect.y, webRect.x + webRect.width - 1, webRect.y + w ebRect.height - 1);
31 return irect;
32 }
33
34 void drawControl(WebCanvas* canvas, const WebRect& rect, WebTestThemeControlWin: :Type ctype, WebTestThemeControlWin::State cstate)
35 {
36 WebTestThemeControlWin control(canvas, webRectToSkIRect(rect), ctype, cstate );
37 control.draw();
38 }
39
40 void drawTextField(WebCanvas* canvas, const WebRect& rect, WebTestThemeControlWi n::Type ctype, WebTestThemeControlWin::State cstate, bool drawEdges, bool fillCo ntentArea, WebColor color)
41 {
42 WebTestThemeControlWin control(canvas, webRectToSkIRect(rect), ctype, cstate );
43 control.drawTextField(drawEdges, fillContentArea, color);
44 }
45
46 void drawProgressBar(WebCanvas* canvas, WebTestThemeControlWin::Type ctype, WebT estThemeControlWin::State cstate, const WebRect& barRect, const WebRect& fillRec t)
47 {
48 WebTestThemeControlWin control(canvas, webRectToSkIRect(barRect), ctype, cst ate);
49 control.drawProgressBar(webRectToSkIRect(fillRect));
50 }
51
52 }
53
54 void WebTestThemeEngineWin::paintButton(WebCanvas* canvas, int part, int state, int classicState, const WebRect& rect)
55 {
56 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
57 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
58
59 if (part == BP_CHECKBOX) {
60 switch (state) {
61 case CBS_UNCHECKEDNORMAL:
62 BLINK_ASSERT(classicState == dfcsNormal);
63 ctype = WebTestThemeControlWin::UncheckedBoxType;
64 cstate = WebTestThemeControlWin::NormalState;
65 break;
66
67 case CBS_UNCHECKEDHOT:
68 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
69 ctype = WebTestThemeControlWin::UncheckedBoxType;
70 cstate = WebTestThemeControlWin::HotState;
71 break;
72
73 case CBS_UNCHECKEDPRESSED:
74 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
75 ctype = WebTestThemeControlWin::UncheckedBoxType;
76 cstate = WebTestThemeControlWin::PressedState;
77 break;
78
79 case CBS_UNCHECKEDDISABLED:
80 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
81 ctype = WebTestThemeControlWin::UncheckedBoxType;
82 cstate = WebTestThemeControlWin::DisabledState;
83 break;
84
85 case CBS_CHECKEDNORMAL:
86 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED));
87 ctype = WebTestThemeControlWin::CheckedBoxType;
88 cstate = WebTestThemeControlWin::NormalState;
89 break;
90
91 case CBS_CHECKEDHOT:
92 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS _HOT));
93 ctype = WebTestThemeControlWin::CheckedBoxType;
94 cstate = WebTestThemeControlWin::HotState;
95 break;
96
97 case CBS_CHECKEDPRESSED:
98 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS _PUSHED));
99 ctype = WebTestThemeControlWin::CheckedBoxType;
100 cstate = WebTestThemeControlWin::PressedState;
101 break;
102
103 case CBS_CHECKEDDISABLED:
104 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS _INACTIVE));
105 ctype = WebTestThemeControlWin::CheckedBoxType;
106 cstate = WebTestThemeControlWin::DisabledState;
107 break;
108
109 case CBS_MIXEDNORMAL:
110 // Classic theme can't represent mixed state checkbox. We assume
111 // it's equivalent to unchecked.
112 BLINK_ASSERT(classicState == DFCS_BUTTONCHECK);
113 ctype = WebTestThemeControlWin::IndeterminateCheckboxType;
114 cstate = WebTestThemeControlWin::NormalState;
115 break;
116
117 case CBS_MIXEDHOT:
118 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
119 ctype = WebTestThemeControlWin::IndeterminateCheckboxType;
120 cstate = WebTestThemeControlWin::HotState;
121 break;
122
123 case CBS_MIXEDPRESSED:
124 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
125 ctype = WebTestThemeControlWin::IndeterminateCheckboxType;
126 cstate = WebTestThemeControlWin::PressedState;
127 break;
128
129 case CBS_MIXEDDISABLED:
130 BLINK_ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
131 ctype = WebTestThemeControlWin::IndeterminateCheckboxType;
132 cstate = WebTestThemeControlWin::DisabledState;
133 break;
134
135 default:
136 BLINK_ASSERT_NOT_REACHED();
137 break;
138 }
139 } else if (BP_RADIOBUTTON == part) {
140 switch (state) {
141 case RBS_UNCHECKEDNORMAL:
142 BLINK_ASSERT(classicState == DFCS_BUTTONRADIO);
143 ctype = WebTestThemeControlWin::UncheckedRadioType;
144 cstate = WebTestThemeControlWin::NormalState;
145 break;
146
147 case RBS_UNCHECKEDHOT:
148 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT));
149 ctype = WebTestThemeControlWin::UncheckedRadioType;
150 cstate = WebTestThemeControlWin::HotState;
151 break;
152
153 case RBS_UNCHECKEDPRESSED:
154 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED));
155 ctype = WebTestThemeControlWin::UncheckedRadioType;
156 cstate = WebTestThemeControlWin::PressedState;
157 break;
158
159 case RBS_UNCHECKEDDISABLED:
160 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE));
161 ctype = WebTestThemeControlWin::UncheckedRadioType;
162 cstate = WebTestThemeControlWin::DisabledState;
163 break;
164
165 case RBS_CHECKEDNORMAL:
166 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED));
167 ctype = WebTestThemeControlWin::CheckedRadioType;
168 cstate = WebTestThemeControlWin::NormalState;
169 break;
170
171 case RBS_CHECKEDHOT:
172 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS _HOT));
173 ctype = WebTestThemeControlWin::CheckedRadioType;
174 cstate = WebTestThemeControlWin::HotState;
175 break;
176
177 case RBS_CHECKEDPRESSED:
178 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS _PUSHED));
179 ctype = WebTestThemeControlWin::CheckedRadioType;
180 cstate = WebTestThemeControlWin::PressedState;
181 break;
182
183 case RBS_CHECKEDDISABLED:
184 BLINK_ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS _INACTIVE));
185 ctype = WebTestThemeControlWin::CheckedRadioType;
186 cstate = WebTestThemeControlWin::DisabledState;
187 break;
188
189 default:
190 BLINK_ASSERT_NOT_REACHED();
191 break;
192 }
193 } else if (BP_PUSHBUTTON == part) {
194 switch (state) {
195 case PBS_NORMAL:
196 BLINK_ASSERT(classicState == DFCS_BUTTONPUSH);
197 ctype = WebTestThemeControlWin::PushButtonType;
198 cstate = WebTestThemeControlWin::NormalState;
199 break;
200
201 case PBS_HOT:
202 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT));
203 ctype = WebTestThemeControlWin::PushButtonType;
204 cstate = WebTestThemeControlWin::HotState;
205 break;
206
207 case PBS_PRESSED:
208 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED));
209 ctype = WebTestThemeControlWin::PushButtonType;
210 cstate = WebTestThemeControlWin::PressedState;
211 break;
212
213 case PBS_DISABLED:
214 BLINK_ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE));
215 ctype = WebTestThemeControlWin::PushButtonType;
216 cstate = WebTestThemeControlWin::DisabledState;
217 break;
218
219 case PBS_DEFAULTED:
220 BLINK_ASSERT(classicState == DFCS_BUTTONPUSH);
221 ctype = WebTestThemeControlWin::PushButtonType;
222 cstate = WebTestThemeControlWin::FocusedState;
223 break;
224
225 default:
226 BLINK_ASSERT_NOT_REACHED();
227 break;
228 }
229 } else
230 BLINK_ASSERT_NOT_REACHED();
231
232 drawControl(canvas, rect, ctype, cstate);
233 }
234
235 void WebTestThemeEngineWin::paintMenuList(WebCanvas* canvas, int part, int state , int classicState, const WebRect& rect)
236 {
237 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
238 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
239
240 if (CP_DROPDOWNBUTTON == part) {
241 ctype = WebTestThemeControlWin::DropDownButtonType;
242 switch (state) {
243 case CBXS_NORMAL:
244 BLINK_ASSERT(classicState == DFCS_MENUARROW);
245 cstate = WebTestThemeControlWin::NormalState;
246 break;
247
248 case CBXS_HOT:
249 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT));
250 cstate = WebTestThemeControlWin::HoverState;
251 break;
252
253 case CBXS_PRESSED:
254 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED));
255 cstate = WebTestThemeControlWin::PressedState;
256 break;
257
258 case CBXS_DISABLED:
259 BLINK_ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE));
260 cstate = WebTestThemeControlWin::DisabledState;
261 break;
262
263 default:
264 BLINK_ASSERT_NOT_REACHED();
265 break;
266 }
267 } else
268 BLINK_ASSERT_NOT_REACHED();
269
270 drawControl(canvas, rect, ctype, cstate);
271 }
272
273 void WebTestThemeEngineWin::paintScrollbarArrow(WebCanvas* canvas, int state, in t classicState, const WebRect& rect)
274 {
275 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
276 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
277
278 switch (state) {
279 case ABS_UPNORMAL:
280 BLINK_ASSERT(classicState == DFCS_SCROLLUP);
281 ctype = WebTestThemeControlWin::UpArrowType;
282 cstate = WebTestThemeControlWin::NormalState;
283 break;
284
285 case ABS_DOWNNORMAL:
286 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN);
287 ctype = WebTestThemeControlWin::DownArrowType;
288 cstate = WebTestThemeControlWin::NormalState;
289 break;
290
291 case ABS_LEFTNORMAL:
292 BLINK_ASSERT(classicState == DFCS_SCROLLLEFT);
293 ctype = WebTestThemeControlWin::LeftArrowType;
294 cstate = WebTestThemeControlWin::NormalState;
295 break;
296
297 case ABS_RIGHTNORMAL:
298 BLINK_ASSERT(classicState == DFCS_SCROLLRIGHT);
299 ctype = WebTestThemeControlWin::RightArrowType;
300 cstate = WebTestThemeControlWin::NormalState;
301 break;
302
303 case ABS_UPHOT:
304 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
305 ctype = WebTestThemeControlWin::UpArrowType;
306 cstate = WebTestThemeControlWin::HotState;
307 break;
308
309 case ABS_DOWNHOT:
310 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
311 ctype = WebTestThemeControlWin::DownArrowType;
312 cstate = WebTestThemeControlWin::HotState;
313 break;
314
315 case ABS_LEFTHOT:
316 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT));
317 ctype = WebTestThemeControlWin::LeftArrowType;
318 cstate = WebTestThemeControlWin::HotState;
319 break;
320
321 case ABS_RIGHTHOT:
322 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT));
323 ctype = WebTestThemeControlWin::RightArrowType;
324 cstate = WebTestThemeControlWin::HotState;
325 break;
326
327 case ABS_UPHOVER:
328 BLINK_ASSERT(classicState == DFCS_SCROLLUP);
329 ctype = WebTestThemeControlWin::UpArrowType;
330 cstate = WebTestThemeControlWin::HoverState;
331 break;
332
333 case ABS_DOWNHOVER:
334 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN);
335 ctype = WebTestThemeControlWin::DownArrowType;
336 cstate = WebTestThemeControlWin::HoverState;
337 break;
338
339 case ABS_LEFTHOVER:
340 BLINK_ASSERT(classicState == DFCS_SCROLLLEFT);
341 ctype = WebTestThemeControlWin::LeftArrowType;
342 cstate = WebTestThemeControlWin::HoverState;
343 break;
344
345 case ABS_RIGHTHOVER:
346 BLINK_ASSERT(classicState == DFCS_SCROLLRIGHT);
347 ctype = WebTestThemeControlWin::RightArrowType;
348 cstate = WebTestThemeControlWin::HoverState;
349 break;
350
351 case ABS_UPPRESSED:
352 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT));
353 ctype = WebTestThemeControlWin::UpArrowType;
354 cstate = WebTestThemeControlWin::PressedState;
355 break;
356
357 case ABS_DOWNPRESSED:
358 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT) );
359 ctype = WebTestThemeControlWin::DownArrowType;
360 cstate = WebTestThemeControlWin::PressedState;
361 break;
362
363 case ABS_LEFTPRESSED:
364 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT) );
365 ctype = WebTestThemeControlWin::LeftArrowType;
366 cstate = WebTestThemeControlWin::PressedState;
367 break;
368
369 case ABS_RIGHTPRESSED:
370 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT ));
371 ctype = WebTestThemeControlWin::RightArrowType;
372 cstate = WebTestThemeControlWin::PressedState;
373 break;
374
375 case ABS_UPDISABLED:
376 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
377 ctype = WebTestThemeControlWin::UpArrowType;
378 cstate = WebTestThemeControlWin::DisabledState;
379 break;
380
381 case ABS_DOWNDISABLED:
382 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
383 ctype = WebTestThemeControlWin::DownArrowType;
384 cstate = WebTestThemeControlWin::DisabledState;
385 break;
386
387 case ABS_LEFTDISABLED:
388 BLINK_ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE));
389 ctype = WebTestThemeControlWin::LeftArrowType;
390 cstate = WebTestThemeControlWin::DisabledState;
391 break;
392
393 case ABS_RIGHTDISABLED:
394 BLINK_ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE));
395 ctype = WebTestThemeControlWin::RightArrowType;
396 cstate = WebTestThemeControlWin::DisabledState;
397 break;
398
399 default:
400 BLINK_ASSERT_NOT_REACHED();
401 break;
402 }
403
404 drawControl(canvas, rect, ctype, cstate);
405 }
406
407 void WebTestThemeEngineWin::paintScrollbarThumb(WebCanvas* canvas, int part, int state, int classicState, const WebRect& rect)
408 {
409 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
410 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
411
412 switch (part) {
413 case SBP_THUMBBTNHORZ:
414 ctype = WebTestThemeControlWin::HorizontalScrollThumbType;
415 break;
416
417 case SBP_THUMBBTNVERT:
418 ctype = WebTestThemeControlWin::VerticalScrollThumbType;
419 break;
420
421 case SBP_GRIPPERHORZ:
422 ctype = WebTestThemeControlWin::HorizontalScrollGripType;
423 break;
424
425 case SBP_GRIPPERVERT:
426 ctype = WebTestThemeControlWin::VerticalScrollGripType;
427 break;
428
429 default:
430 BLINK_ASSERT_NOT_REACHED();
431 break;
432 }
433
434 switch (state) {
435 case SCRBS_NORMAL:
436 BLINK_ASSERT(classicState == dfcsNormal);
437 cstate = WebTestThemeControlWin::NormalState;
438 break;
439
440 case SCRBS_HOT:
441 BLINK_ASSERT(classicState == DFCS_HOT);
442 cstate = WebTestThemeControlWin::HotState;
443 break;
444
445 case SCRBS_HOVER:
446 BLINK_ASSERT(classicState == dfcsNormal);
447 cstate = WebTestThemeControlWin::HoverState;
448 break;
449
450 case SCRBS_PRESSED:
451 BLINK_ASSERT(classicState == dfcsNormal);
452 cstate = WebTestThemeControlWin::PressedState;
453 break;
454
455 case SCRBS_DISABLED:
456 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice.
457 break;
458
459 default:
460 BLINK_ASSERT_NOT_REACHED();
461 break;
462 }
463
464 drawControl(canvas, rect, ctype, cstate);
465 }
466
467 void WebTestThemeEngineWin::paintScrollbarTrack(WebCanvas* canvas, int part, int state, int classicState, const WebRect& rect, const WebRect& alignRect)
468 {
469 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
470 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
471
472 switch (part) {
473 case SBP_UPPERTRACKHORZ:
474 ctype = WebTestThemeControlWin::HorizontalScrollTrackBackType;
475 break;
476
477 case SBP_LOWERTRACKHORZ:
478 ctype = WebTestThemeControlWin::HorizontalScrollTrackForwardType;
479 break;
480
481 case SBP_UPPERTRACKVERT:
482 ctype = WebTestThemeControlWin::VerticalScrollTrackBackType;
483 break;
484
485 case SBP_LOWERTRACKVERT:
486 ctype = WebTestThemeControlWin::VerticalScrollTrackForwardType;
487 break;
488
489 default:
490 BLINK_ASSERT_NOT_REACHED();
491 break;
492 }
493
494 switch (state) {
495 case SCRBS_NORMAL:
496 BLINK_ASSERT(classicState == dfcsNormal);
497 cstate = WebTestThemeControlWin::NormalState;
498 break;
499
500 case SCRBS_HOT:
501 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice.
502 break;
503
504 case SCRBS_HOVER:
505 BLINK_ASSERT(classicState == dfcsNormal);
506 cstate = WebTestThemeControlWin::HoverState;
507 break;
508
509 case SCRBS_PRESSED:
510 BLINK_ASSERT_NOT_REACHED(); // This should never happen in practice.
511 break;
512
513 case SCRBS_DISABLED:
514 BLINK_ASSERT(classicState == DFCS_INACTIVE);
515 cstate = WebTestThemeControlWin::DisabledState;
516 break;
517
518 default:
519 BLINK_ASSERT_NOT_REACHED();
520 break;
521 }
522
523 drawControl(canvas, rect, ctype, cstate);
524 }
525
526 void WebTestThemeEngineWin::paintSpinButton(WebCanvas* canvas, int part, int sta te, int classicState, const WebRect& rect)
527 {
528 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
529 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
530
531 if (part == SPNP_UP) {
532 ctype = WebTestThemeControlWin::UpArrowType;
533 switch (state) {
534 case UPS_NORMAL:
535 BLINK_ASSERT(classicState == DFCS_SCROLLUP);
536 cstate = WebTestThemeControlWin::NormalState;
537 break;
538 case UPS_DISABLED:
539 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
540 cstate = WebTestThemeControlWin::DisabledState;
541 break;
542 case UPS_PRESSED:
543 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED));
544 cstate = WebTestThemeControlWin::PressedState;
545 break;
546 case UPS_HOT:
547 BLINK_ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
548 cstate = WebTestThemeControlWin::HoverState;
549 break;
550 default:
551 BLINK_ASSERT_NOT_REACHED();
552 }
553 } else if (part == SPNP_DOWN) {
554 ctype = WebTestThemeControlWin::DownArrowType;
555 switch (state) {
556 case DNS_NORMAL:
557 BLINK_ASSERT(classicState == DFCS_SCROLLDOWN);
558 cstate = WebTestThemeControlWin::NormalState;
559 break;
560 case DNS_DISABLED:
561 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
562 cstate = WebTestThemeControlWin::DisabledState;
563 break;
564 case DNS_PRESSED:
565 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED));
566 cstate = WebTestThemeControlWin::PressedState;
567 break;
568 case DNS_HOT:
569 BLINK_ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
570 cstate = WebTestThemeControlWin::HoverState;
571 break;
572 default:
573 BLINK_ASSERT_NOT_REACHED();
574 }
575 } else
576 BLINK_ASSERT_NOT_REACHED();
577 drawControl(canvas, rect, ctype, cstate);
578 }
579
580 void WebTestThemeEngineWin::paintTextField(WebCanvas* canvas, int part, int stat e, int classicState, const WebRect& rect, WebColor color, bool fillContentArea, bool drawEdges)
581 {
582 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
583 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
584
585 BLINK_ASSERT(EP_EDITTEXT == part);
586 ctype = WebTestThemeControlWin::TextFieldType;
587
588 switch (state) {
589 case ETS_NORMAL:
590 BLINK_ASSERT(classicState == dfcsNormal);
591 cstate = WebTestThemeControlWin::NormalState;
592 break;
593
594 case ETS_HOT:
595 BLINK_ASSERT(classicState == DFCS_HOT);
596 cstate = WebTestThemeControlWin::HotState;
597 break;
598
599 case ETS_DISABLED:
600 BLINK_ASSERT(classicState == DFCS_INACTIVE);
601 cstate = WebTestThemeControlWin::DisabledState;
602 break;
603
604 case ETS_SELECTED:
605 BLINK_ASSERT(classicState == DFCS_PUSHED);
606 cstate = WebTestThemeControlWin::PressedState;
607 break;
608
609 case ETS_FOCUSED:
610 BLINK_ASSERT(classicState == dfcsNormal);
611 cstate = WebTestThemeControlWin::FocusedState;
612 break;
613
614 case ETS_READONLY:
615 BLINK_ASSERT(classicState == dfcsNormal);
616 cstate = WebTestThemeControlWin::ReadOnlyState;
617 break;
618
619 default:
620 BLINK_ASSERT_NOT_REACHED();
621 break;
622 }
623
624 drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color );
625 }
626
627 void WebTestThemeEngineWin::paintTrackbar(WebCanvas* canvas, int part, int state , int classicState, const WebRect& rect)
628 {
629 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::UnknownType;
630 WebTestThemeControlWin::State cstate = WebTestThemeControlWin::UnknownState;
631
632 if (TKP_THUMBBOTTOM == part) {
633 ctype = WebTestThemeControlWin::HorizontalSliderThumbType;
634 switch (state) {
635 case TUS_NORMAL:
636 BLINK_ASSERT(classicState == dfcsNormal);
637 cstate = WebTestThemeControlWin::NormalState;
638 break;
639
640 case TUS_HOT:
641 BLINK_ASSERT(classicState == DFCS_HOT);
642 cstate = WebTestThemeControlWin::HotState;
643 break;
644
645 case TUS_DISABLED:
646 BLINK_ASSERT(classicState == DFCS_INACTIVE);
647 cstate = WebTestThemeControlWin::DisabledState;
648 break;
649
650 case TUS_PRESSED:
651 BLINK_ASSERT(classicState == DFCS_PUSHED);
652 cstate = WebTestThemeControlWin::PressedState;
653 break;
654
655 default:
656 BLINK_ASSERT_NOT_REACHED();
657 break;
658 }
659 } else if (TKP_THUMBVERT == part) {
660 ctype = WebTestThemeControlWin::VerticalSliderThumbType;
661 switch (state) {
662 case TUS_NORMAL:
663 BLINK_ASSERT(classicState == dfcsNormal);
664 cstate = WebTestThemeControlWin::NormalState;
665 break;
666
667 case TUS_HOT:
668 BLINK_ASSERT(classicState == DFCS_HOT);
669 cstate = WebTestThemeControlWin::HotState;
670 break;
671
672 case TUS_DISABLED:
673 BLINK_ASSERT(classicState == DFCS_INACTIVE);
674 cstate = WebTestThemeControlWin::DisabledState;
675 break;
676
677 case TUS_PRESSED:
678 BLINK_ASSERT(classicState == DFCS_PUSHED);
679 cstate = WebTestThemeControlWin::PressedState;
680 break;
681
682 default:
683 BLINK_ASSERT_NOT_REACHED();
684 break;
685 }
686 } else if (TKP_TRACK == part) {
687 ctype = WebTestThemeControlWin::HorizontalSliderTrackType;
688 BLINK_ASSERT(state == TRS_NORMAL);
689 BLINK_ASSERT(classicState == dfcsNormal);
690 cstate = WebTestThemeControlWin::NormalState;
691 } else if (TKP_TRACKVERT == part) {
692 ctype = WebTestThemeControlWin::VerticalSliderTrackType;
693 BLINK_ASSERT(state == TRVS_NORMAL);
694 BLINK_ASSERT(classicState == dfcsNormal);
695 cstate = WebTestThemeControlWin::NormalState;
696 } else
697 BLINK_ASSERT_NOT_REACHED();
698
699 drawControl(canvas, rect, ctype, cstate);
700 }
701
702
703 void WebTestThemeEngineWin::paintProgressBar(blink::WebCanvas* canvas, const bli nk::WebRect& barRect, const blink::WebRect& valueRect, bool determinate, double)
704 {
705 WebTestThemeControlWin::Type ctype = WebTestThemeControlWin::ProgressBarType ;
706 WebTestThemeControlWin::State cstate = determinate ? WebTestThemeControlWin: :NormalState : WebTestThemeControlWin::IndeterminateState;
707 drawProgressBar(canvas, ctype, cstate, barRect, valueRect);
708 }
709
710
711 blink::WebSize WebTestThemeEngineWin::getSize(int part)
712 {
713 return blink::WebSize();
714 }
715
716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698