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

Side by Side Diff: Source/testing/runner/WebTestThemeEngineMock.cpp

Issue 41733004: Roll up patch for running layout tests under Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add even more comments about why we have special logic for the layout tests Created 7 years, 1 month 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
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 // FIXME: This code is largely cloned from WebTestThemeEngineWin.cpp
32 // and WebTestThemeControlWin.cpp. We should delete that code once the
33 // cutover to Aura is final.
34
35 #include "Source/testing/runner/WebTestThemeEngineMock.h"
jamesr 2013/11/06 21:54:09 this is a bit odd. grep can't find any #includes t
Dirk Pranke 2013/11/06 22:29:11 Done.
36
37 #include "public/platform/WebRect.h"
38 #include "public/platform/WebSize.h"
39 #include "skia/ext/platform_canvas.h"
40 #include "third_party/skia/include/core/SkRect.h"
41
42 using WebKit::WebCanvas;
43 using WebKit::WebColor;
44 using WebKit::WebRect;
45 using WebKit::WebThemeEngine;
46
47 namespace WebTestRunner {
48
49 static const SkColor edgeColor = SK_ColorBLACK;
50 static const SkColor readOnlyColor = SkColorSetRGB(0xe9, 0xc2, 0xa6);
51 static const SkColor fgColor = SK_ColorBLACK;
52 static const SkColor bgColors[] = {
53 SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled
54 SkColorSetRGB(0x20, 0xf6, 0xcc), // Hover
55 SkColorSetRGB(0x89, 0xc4, 0xff), // Normal
56 SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed
57 SkColorSetRGB(0x00, 0xf3, 0xac), // Focused
58 SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly
59 SkColorSetRGB(0x43, 0xf9, 0xff), // Hot
60 };
61
62 WebKit::WebSize WebTestThemeEngineMock::getSize(WebThemeEngine::Part part)
63 {
64 switch (part) {
65 case WebThemeEngine::PartScrollbarLeftArrow:
66 return WebKit::WebSize(17, 15);
67 case WebThemeEngine::PartScrollbarRightArrow:
68 return WebKit::WebSize(0, 0); // FIXME: ASSERT_NOT_REACHED();
jamesr 2013/11/06 21:54:09 what do these FIXMEs mean?
Dirk Pranke 2013/11/06 22:29:11 These mean that they should really be ASSERT_NOT_R
69 case WebThemeEngine::PartScrollbarUpArrow:
70 return WebKit::WebSize(15, 17);
71 case WebThemeEngine::PartScrollbarDownArrow:
72 return WebKit::WebSize(0, 0); // FIXME: ASSERT_NOT_REACHED();
73 case WebThemeEngine::PartScrollbarHorizontalThumb:
74 return WebKit::WebSize(15, 15);
75 case WebThemeEngine::PartScrollbarVerticalThumb:
76 return WebKit::WebSize(15, 15);
77 case WebThemeEngine::PartScrollbarHorizontalTrack:
78 return WebKit::WebSize(0, 15);
79 case WebThemeEngine::PartScrollbarVerticalTrack:
80 return WebKit::WebSize(15, 0);
81 case WebThemeEngine::PartCheckbox:
82 case WebThemeEngine::PartRadio:
83 return WebKit::WebSize(13, 13);
84 case WebThemeEngine::PartSliderThumb:
85 return WebKit::WebSize(11, 21);
86 case WebThemeEngine::PartInnerSpinButton:
87 return WebKit::WebSize(15, 8);
88 default:
89 return WebKit::WebSize(); // FIXME: ASSERT_NOT_REACHED();
90 }
91 }
92
93 static SkIRect webRectToSkIRect(const WebRect& webRect)
94 {
95 SkIRect irect;
96 irect.set(webRect.x, webRect.y,
97 webRect.x + webRect.width - 1, webRect.y + webRect.height - 1);
jamesr 2013/11/06 21:54:09 this is really frustrating. inside blink, we have
Dirk Pranke 2013/11/06 22:29:11 Yeah :(. Fortunately, it's not a huge amount of co
98 return irect;
99 }
100
101 static SkIRect validate(const SkIRect& rect, WebThemeEngine::Part part)
102 {
103 switch (part) {
104 case WebThemeEngine::PartCheckbox:
105 case WebThemeEngine::PartRadio: {
106 SkIRect retval = rect;
107
108 // The maximum width and height is 13.
109 // Center the square in the passed rectangle.
110 const int maxControlSize = 13;
111 int controlSize = std::min(rect.width(), rect.height());
112 controlSize = std::min(controlSize, maxControlSize);
113
114 retval.fLeft = rect.fLeft + (rect.width() / 2) - (controlSize / 2);
115 retval.fRight = retval.fLeft + controlSize - 1;
116 retval.fTop = rect.fTop + (rect.height() / 2) - (controlSize / 2);
117 retval.fBottom = retval.fTop + controlSize - 1;
118
119 return retval;
120 }
121 default:
122 return rect;
123 }
124 }
125
126
127 void box(SkCanvas *canvas, const SkIRect& rect, SkColor fillColor)
128 {
129 SkPaint paint;
130
131 paint.setStyle(SkPaint::kFill_Style);
132 paint.setColor(fillColor);
133 canvas->drawIRect(rect, paint);
134
135 paint.setColor(edgeColor);
136 paint.setStyle(SkPaint::kStroke_Style);
137 canvas->drawIRect(rect, paint);
138 }
139
140 void line(SkCanvas *canvas, int x0, int y0, int x1, int y1, SkColor color)
141 {
142 SkPaint paint;
143 paint.setColor(color);
144 canvas->drawLine(SkIntToScalar(x0), SkIntToScalar(y0),
145 SkIntToScalar(x1), SkIntToScalar(y1), paint);
146 }
147
148 void triangle(SkCanvas *canvas,
149 int x0, int y0,
150 int x1, int y1,
151 int x2, int y2,
152 SkColor color)
153 {
154 SkPath path;
155 SkPaint paint;
156
157 paint.setColor(color);
158 paint.setStyle(SkPaint::kFill_Style);
159 path.incReserve(4);
160 path.moveTo(SkIntToScalar(x0), SkIntToScalar(y0));
161 path.lineTo(SkIntToScalar(x1), SkIntToScalar(y1));
162 path.lineTo(SkIntToScalar(x2), SkIntToScalar(y2));
163 path.close();
164 canvas->drawPath(path, paint);
165
166 paint.setColor(edgeColor);
167 paint.setStyle(SkPaint::kStroke_Style);
168 canvas->drawPath(path, paint);
169 }
170
171 void roundRect(SkCanvas *canvas, SkIRect irect, SkColor color)
172 {
173 SkRect rect;
174 SkScalar radius = SkIntToScalar(5);
175 SkPaint paint;
176
177 rect.set(irect);
178 paint.setColor(color);
179 paint.setStyle(SkPaint::kFill_Style);
180 canvas->drawRoundRect(rect, radius, radius, paint);
181
182 paint.setColor(edgeColor);
183 paint.setStyle(SkPaint::kStroke_Style);
184 canvas->drawRoundRect(rect, radius, radius, paint);
185 }
186
187 void oval(SkCanvas* canvas, SkIRect irect, SkColor color)
188 {
189 SkRect rect;
190 SkPaint paint;
191
192 rect.set(irect);
193 paint.setColor(color);
194 paint.setStyle(SkPaint::kFill_Style);
195 canvas->drawOval(rect, paint);
196
197 paint.setColor(edgeColor);
198 paint.setStyle(SkPaint::kStroke_Style);
199 canvas->drawOval(rect, paint);
200 }
201
202 void circle(SkCanvas *canvas, SkIRect irect, SkScalar radius, SkColor color)
203 {
204 int left = irect.fLeft;
205 int width = irect.width();
206 int height = irect.height();
207 int top = irect.fTop;
208
209 SkScalar cy = SkIntToScalar(top + height / 2);
210 SkScalar cx = SkIntToScalar(left + width / 2);
211 SkPaint paint;
212
213 paint.setColor(color);
214 paint.setStyle(SkPaint::kFill_Style);
215 canvas->drawCircle(cx, cy, radius, paint);
216
217 paint.setColor(edgeColor);
218 paint.setStyle(SkPaint::kStroke_Style);
219 canvas->drawCircle(cx, cy, radius, paint);
220 }
221
222 void nestedBoxes(SkCanvas *canvas,
223 SkIRect irect,
224 int indentLeft,
225 int indentTop,
226 int indentRight,
227 int indentBottom,
228 SkColor outerColor,
229 SkColor innerColor)
230 {
231 SkIRect lirect;
232 box(canvas, irect, outerColor);
233 lirect.set(irect.fLeft + indentLeft,
234 irect.fTop + indentTop,
235 irect.fRight - indentRight,
236 irect.fBottom - indentBottom);
237 box(canvas, lirect, innerColor);
238 }
239
240 void markState(SkCanvas *canvas, SkIRect irect, WebThemeEngine::State state)
241 {
242 int left = irect.fLeft;
243 int right = irect.fRight;
244 int width = irect.width();
245 int height = irect.height();
246 int top = irect.fTop;
247 int bottom = irect.fBottom;
248
249 // The length of a triangle side for the corner marks.
250 const int triangleSize = 5;
251
252 switch (state) {
253 case WebThemeEngine::StateDisabled:
254 case WebThemeEngine::StateNormal:
255 // Don't visually mark these states (color is enough).
256 break;
257
258 case WebThemeEngine::StateReadonly: {
259 // The horizontal lines in a read only control are spaced by this amount .
260 const int readOnlyLineOffset = 5;
261
262 // Drawing lines across the control.
263 for (int i = top + readOnlyLineOffset; i < bottom; i += readOnlyLineOffs et)
264 line(canvas, left + 1, i, right - 1, i, readOnlyColor);
265 break;
266 }
267 case WebThemeEngine::StateHover:
268 // Draw a triangle in the upper right corner of the control.
269 triangle(canvas,
270 right, top,
271 right, top + triangleSize,
272 right - triangleSize, top,
273 edgeColor);
274 break;
275
276 case WebThemeEngine::StateFocused:
277 // Draw a triangle in the bottom right corner of the control.
278 triangle(canvas,
279 right, bottom,
280 right - triangleSize, bottom,
281 right, bottom - triangleSize,
282 edgeColor);
283 break;
284
285 case WebThemeEngine::StatePressed:
286 // Draw a triangle in the bottom left corner of the control.
287 triangle(canvas,
288 left, bottom,
289 left, bottom - triangleSize,
290 left + triangleSize, bottom,
291 edgeColor);
292 break;
293
294 case WebThemeEngine::StateHot:
295 // Draw a triangle in the upper left corner of the control.
296 triangle(canvas,
297 left, top,
298 left + triangleSize, top,
299 left, top + triangleSize,
300 edgeColor);
301 break;
302
303 default:
304 break; // FIXME: LOG_ASSERT(false) << "unknown state";
305 }
306 }
307
308 void WebTestThemeEngineMock::paint(
309 WebKit::WebCanvas* canvas,
310 WebThemeEngine::Part part,
311 WebThemeEngine::State state,
312 const WebKit::WebRect& rect,
313 const WebThemeEngine::ExtraParams* extraParams)
314 {
315 SkIRect irect = webRectToSkIRect(rect);
316 SkPaint paint;
317
318 // Indent amounts for the check in a checkbox or radio button.
319 const int checkIndent = 3;
320
321 // Indent amounts for short and long sides of the scrollbar notches.
322 const int notchLongOffset = 1;
323 const int notchShortOffset = 4;
324 const int noOffset = 0;
325
326 // Indent amounts for the short and long sides of a scroll thumb box.
327 const int thumbLongIndent = 0;
328 const int thumbShortIndent = 2;
329
330 // Indents for the crosshatch on a scroll grip.
331 const int gripLongIndent = 3;
332 const int gripShortIndent = 5;
333
334 // Indents for the the slider track.
335 const int sliderIndent = 2;
336
337 int halfHeight = irect.height() / 2;
338 int halfWidth = irect.width() / 2;
339 int quarterHeight = irect.height() / 4;
340 int quarterWidth = irect.width() / 4;
341 int left = irect.fLeft;
342 int right = irect.fRight;
343 int top = irect.fTop;
344 int bottom = irect.fBottom;
345
346 switch (part) {
347 case WebThemeEngine::PartScrollbarDownArrow:
348 box(canvas, irect, bgColors[state]);
349 triangle(canvas,
350 left + quarterWidth, top + quarterHeight,
351 right - quarterWidth, top + quarterHeight,
352 left + halfWidth, bottom - quarterHeight,
353 edgeColor);
354 markState(canvas, irect, state);
355 break;
356
357 case WebThemeEngine::PartScrollbarLeftArrow:
358 box(canvas, irect, bgColors[state]);
359 triangle(canvas,
360 right - quarterWidth, top + quarterHeight,
361 right - quarterWidth, bottom - quarterHeight,
362 left + quarterWidth, top + halfHeight,
363 edgeColor);
364 break;
365
366 case WebThemeEngine::PartScrollbarRightArrow:
367 box(canvas, irect, bgColors[state]);
368 triangle(canvas,
369 left + quarterWidth, top + quarterHeight,
370 right - quarterWidth, top + halfHeight,
371 left + quarterWidth, bottom - quarterHeight,
372 edgeColor);
373 break;
374
375 case WebThemeEngine::PartScrollbarUpArrow:
376 box(canvas, irect, bgColors[state]);
377 triangle(canvas,
378 left + quarterWidth, bottom - quarterHeight,
379 left + halfWidth, top + quarterHeight,
380 right - quarterWidth, bottom - quarterHeight,
381 edgeColor);
382 markState(canvas, irect, state);
383 break;
384
385 case WebThemeEngine::PartScrollbarHorizontalThumb: {
386 // Draw a narrower box on top of the outside box.
387 nestedBoxes(canvas, irect, thumbLongIndent, thumbShortIndent,
388 thumbLongIndent, thumbShortIndent,
389 bgColors[state], bgColors[state]);
390 // Draw a horizontal crosshatch for the grip.
391 int longOffset = halfWidth - gripLongIndent;
392 line(canvas,
393 left + gripLongIndent, top + halfHeight,
394 right - gripLongIndent, top + halfHeight,
395 edgeColor);
396 line(canvas,
397 left + longOffset, top + gripShortIndent,
398 left + longOffset, bottom - gripShortIndent,
399 edgeColor);
400 line(canvas,
401 right - longOffset, top + gripShortIndent,
402 right - longOffset, bottom - gripShortIndent,
403 edgeColor);
404 markState(canvas, irect, state);
405 break;
406 }
407
408 case WebThemeEngine::PartScrollbarVerticalThumb: {
409 // Draw a shorter box on top of the outside box.
410 nestedBoxes(canvas, irect, thumbShortIndent, thumbLongIndent,
411 thumbShortIndent, thumbLongIndent,
412 bgColors[state], bgColors[state]);
413 // Draw a vertical crosshatch for the grip.
414 int longOffset = halfHeight - gripLongIndent;
415 line(canvas,
416 left + halfWidth, top + gripLongIndent,
417 left + halfWidth, bottom - gripLongIndent,
418 edgeColor);
419 line(canvas,
420 left + gripShortIndent, top + longOffset,
421 right - gripShortIndent, top + longOffset,
422 edgeColor);
423 line(canvas,
424 left + gripShortIndent, bottom - longOffset,
425 right - gripShortIndent, bottom - longOffset,
426 edgeColor);
427 markState(canvas, irect, state);
428 break;
429 }
430
431 case WebThemeEngine::PartScrollbarHorizontalTrack: {
432 int longOffset = halfHeight - notchLongOffset;
433 int shortOffset = irect.width() - notchShortOffset;
434 if (extraParams->scrollbarTrack.isBack) {
435 // back, notch on left
436 nestedBoxes(canvas, irect, noOffset, longOffset, shortOffset,
437 longOffset, bgColors[state], edgeColor);
438 } else {
439 // forward, notch on right
440 nestedBoxes(canvas, irect, shortOffset, longOffset, noOffset,
441 longOffset, bgColors[state], edgeColor);
442 }
443
444 markState(canvas, irect, state);
445 break;
446 }
447
448 case WebThemeEngine::PartScrollbarVerticalTrack: {
449 int longOffset = halfWidth - notchLongOffset;
450 int shortOffset = irect.height() - notchShortOffset;
451 if (extraParams->scrollbarTrack.isBack) {
452 // back, notch at top
453 nestedBoxes(canvas, irect, longOffset, noOffset, longOffset,
454 shortOffset, bgColors[state], edgeColor);
455 } else {
456 // forward, notch at bottom
457 nestedBoxes(canvas, irect, longOffset, shortOffset, longOffset,
458 noOffset, bgColors[state], edgeColor);
459 }
460
461 markState(canvas, irect, state);
462 break;
463 }
464
465 case WebThemeEngine::PartCheckbox:
466 if (extraParams->button.indeterminate) {
467 nestedBoxes(canvas, irect,
468 checkIndent, halfHeight,
469 checkIndent, halfHeight,
470 bgColors[state], edgeColor);
471 } else if (extraParams->button.checked) {
472 irect = validate(irect, part);
473 nestedBoxes(canvas, irect,
474 checkIndent, checkIndent,
475 checkIndent, checkIndent,
476 bgColors[state], edgeColor);
477 } else {
478 irect = validate(irect, part);
479 box(canvas, irect, bgColors[state]);
480 }
481 break;
482
483 case WebThemeEngine::PartRadio:
484 irect = validate(irect, part);
485 halfHeight = irect.height() / 2;
486 if (extraParams->button.checked) {
487 circle(canvas, irect, SkIntToScalar(halfHeight), bgColors[state]);
488 circle(canvas, irect, SkIntToScalar(halfHeight - checkIndent), edgeC olor);
489 } else {
490 circle(canvas, irect, SkIntToScalar(halfHeight), bgColors[state]);
491 }
492 break;
493
494 case WebThemeEngine::PartButton:
495 roundRect(canvas, irect, bgColors[state]);
496 markState(canvas, irect, state);
497 break;
498
499 case WebThemeEngine::PartTextField:
500 paint.setColor(extraParams->textField.backgroundColor);
501 paint.setStyle(SkPaint::kFill_Style);
502 canvas->drawIRect(irect, paint);
503
504 paint.setColor(edgeColor);
505 paint.setStyle(SkPaint::kStroke_Style);
506 canvas->drawIRect(irect, paint);
507
508 markState(canvas, irect, state);
509 break;
510
511 case WebThemeEngine::PartMenuList:
512 if (extraParams->menuList.fillContentArea) {
513 box(canvas, irect, extraParams->menuList.backgroundColor);
514 } else {
515 SkPaint paint;
516 paint.setColor(edgeColor);
517 paint.setStyle(SkPaint::kStroke_Style);
518 canvas->drawIRect(irect, paint);
519 }
520
521 // clip the drop-down arrow to be inside the select box
522 if (extraParams->menuList.arrowX - 4 > irect.fLeft)
523 irect.fLeft = extraParams->menuList.arrowX - 4;
524 if (extraParams->menuList.arrowX + 12 < irect.fRight)
525 irect.fRight = extraParams->menuList.arrowX + 12;
526
527 irect.fTop = extraParams->menuList.arrowY - (extraParams->menuList.arrow Height) / 2;
528 irect.fBottom = extraParams->menuList.arrowY + (extraParams->menuList.ar rowHeight - 1) / 2;
529 halfWidth = irect.width() / 2;
530 quarterWidth = irect.width() / 4;
531
532 if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty?
533 state = WebThemeEngine::StateNormal;
534 box(canvas, irect, bgColors[state]);
535 triangle(canvas,
536 irect.fLeft + quarterWidth, irect.fTop,
537 irect.fRight - quarterWidth, irect.fTop,
538 irect.fLeft + halfWidth, irect.fBottom,
539 edgeColor);
540
541 break;
542
543 case WebThemeEngine::PartSliderTrack: {
544 SkIRect lirect = irect;
545
546 // Draw a narrow rect for the track plus box hatches on the ends.
547 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently?
548 state = WebThemeEngine::StateNormal;
549 if (extraParams->slider.vertical) {
550 lirect.inset(halfWidth - sliderIndent, noOffset);
551 box(canvas, lirect, bgColors[state]);
552 line(canvas, left, top, right, top, edgeColor);
553 line(canvas, left, bottom, right, bottom, edgeColor);
554 } else {
555 lirect.inset(noOffset, halfHeight - sliderIndent);
556 box(canvas, lirect, bgColors[state]);
557 line(canvas, left, top, left, bottom, edgeColor);
558 line(canvas, right, top, right, bottom, edgeColor);
559 }
560 break;
561 }
562
563 case WebThemeEngine::PartSliderThumb:
564 if (state == WebThemeEngine::StateFocused) // FIXME: draw differently?
565 state = WebThemeEngine::StateNormal;
566 oval(canvas, irect, bgColors[state]);
567 break;
568
569 case WebThemeEngine::PartInnerSpinButton: {
570 // stack half-height up and down arrows on top of each other
571 SkIRect lirect;
572 int halfHeight = rect.height / 2;
573 if (state == WebKit::WebThemeEngine::StateReadonly)
574 state = WebKit::WebThemeEngine::StateDisabled;
575
576 lirect.set(rect.x, rect.y, rect.x + rect.width - 1, rect.y + halfHeight - 1);
577 box(canvas, lirect, bgColors[state]);
578 bottom = lirect.fBottom;
579 quarterHeight = lirect.height() / 4;
580 triangle(canvas,
581 left + quarterWidth, bottom - quarterHeight,
582 right - quarterWidth, bottom - quarterHeight,
583 left + halfWidth, top + quarterHeight,
584 edgeColor);
585
586 lirect.set(rect.x, rect.y + halfHeight, rect.x + rect.width - 1,
587 rect.y + 2 * halfHeight - 1);
588 top = lirect.fTop;
589 bottom = lirect.fBottom;
590 quarterHeight = lirect.height() / 4;
591 box(canvas, lirect, bgColors[state]);
592 triangle(canvas,
593 left + quarterWidth, top + quarterHeight,
594 right - quarterWidth, top + quarterHeight,
595 left + halfWidth, bottom - quarterHeight,
596 edgeColor);
597 markState(canvas, irect, state);
598 break;
599 }
600 case WebThemeEngine::PartProgressBar: {
601 paint.setColor(bgColors[state]);
602 paint.setStyle(SkPaint::kFill_Style);
603 canvas->drawIRect(irect, paint);
604
605 // Emulate clipping
606 SkIRect tofill;
607 if (extraParams->progressBar.determinate) {
608 tofill.set(extraParams->progressBar.valueRectX,
609 extraParams->progressBar.valueRectY,
610 extraParams->progressBar.valueRectX +
611 extraParams->progressBar.valueRectWidth - 1,
612 extraParams->progressBar.valueRectY +
613 extraParams->progressBar.valueRectHeight);
614 }
615
616 tofill.intersect(irect, tofill);
617 paint.setColor(edgeColor);
618 paint.setStyle(SkPaint::kFill_Style);
619 canvas->drawIRect(tofill, paint);
620
621 markState(canvas, irect, state);
622 break;
623 }
624 default:
625 break; // FIXME: LOG_ASSERT(false) << "Unknown part type: " << part;
626 }
627 }
628
629 } // namespace WebTestRunner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698