1 /*
2 * Copyright (C) 2007 Apple Inc.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Collabora Ltd.
5 * Copyright (C) 2008, 2009 Google Inc.
6 * Copyright (C) 2009 Kenneth Rohde Christiansen
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25 #include "config.h"
26 #include "core/rendering/RenderThemeChromiumDefault.h"
27
28 #include "CSSValueKeywords.h"
29 #include "UserAgentStyleSheets.h"
30 #include "core/rendering/PaintInfo.h"
31 #include "core/rendering/RenderObject.h"
32 #include "core/rendering/RenderProgress.h"
33 #include "platform/LayoutTestSupport.h"
34 #include "platform/graphics/Color.h"
35 #include "platform/graphics/GraphicsContext.h"
36 #include "platform/graphics/GraphicsContextStateSaver.h"
37 #include "public/platform/default/WebThemeEngine.h"
38 #include "public/platform/Platform.h"
39 #include "public/platform/WebRect.h"
40 #include "wtf/StdLibExtras.h"
41
42 namespace WebCore {
43
useMockTheme()44 static bool useMockTheme()
45 {
46 return isRunningLayoutTest();
47 }
48
49 unsigned RenderThemeChromiumDefault::m_activeSelectionBackgroundColor =
50 0xff1e90ff;
51 unsigned RenderThemeChromiumDefault::m_activeSelectionForegroundColor =
52 Color::black;
53 unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor =
54 0xffc8c8c8;
55 unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor =
56 0xff323232;
57
58 double RenderThemeChromiumDefault::m_caretBlinkInterval;
59
60 static const unsigned defaultButtonBackgroundColor = 0xffdddddd;
61
getWebThemeState(const RenderTheme * theme,const RenderObject * o)62 static blink::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, const RenderObject* o)
63 {
64 if (!theme->isEnabled(o))
65 return blink::WebThemeEngine::StateDisabled;
66 if (useMockTheme() && theme->isReadOnlyControl(o))
67 return blink::WebThemeEngine::StateReadonly;
68 if (theme->isPressed(o))
69 return blink::WebThemeEngine::StatePressed;
70 if (useMockTheme() && theme->isFocused(o))
71 return blink::WebThemeEngine::StateFocused;
72 if (theme->isHovered(o))
73 return blink::WebThemeEngine::StateHover;
74
75 return blink::WebThemeEngine::StateNormal;
76 }
77
create()78 PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create()
79 {
80 return adoptRef(new RenderThemeChromiumDefault());
81 }
82
83 // RenderTheme::theme for Android is defined in RenderThemeChromiumAndroid.cpp.
84 #if !OS(ANDROID)
theme()85 RenderTheme& RenderTheme::theme()
86 {
87 DEFINE_STATIC_REF(RenderTheme, renderTheme, (RenderThemeChromiumDefault::create()));
88 return *renderTheme;
89 }
90 #endif
91
RenderThemeChromiumDefault()92 RenderThemeChromiumDefault::RenderThemeChromiumDefault()
93 {
94 m_caretBlinkInterval = RenderTheme::caretBlinkInterval();
95 }
96
~RenderThemeChromiumDefault()97 RenderThemeChromiumDefault::~RenderThemeChromiumDefault()
98 {
99 }
100
supportsFocusRing(const RenderStyle * style) const101 bool RenderThemeChromiumDefault::supportsFocusRing(const RenderStyle* style) const
102 {
103 if (useMockTheme()) {
104 // Don't use focus rings for buttons when mocking controls.
105 return style->appearance() == ButtonPart
106 || style->appearance() == PushButtonPart
107 || style->appearance() == SquareButtonPart;
108 }
109
110 return RenderThemeChromiumSkia::supportsFocusRing(style);
111 }
112
systemColor(CSSValueID cssValueId) const113 Color RenderThemeChromiumDefault::systemColor(CSSValueID cssValueId) const
114 {
115 static const Color defaultButtonGrayColor(0xffdddddd);
116 static const Color defaultMenuColor(0xfff7f7f7);
117
118 if (cssValueId == CSSValueButtonface) {
119 if (useMockTheme())
120 return Color(0xc0, 0xc0, 0xc0);
121 return defaultButtonGrayColor;
122 }
123 if (cssValueId == CSSValueMenu)
124 return defaultMenuColor;
125 return RenderTheme::systemColor(cssValueId);
126 }
127
extraDefaultStyleSheet()128 String RenderThemeChromiumDefault::extraDefaultStyleSheet()
129 {
130 #if !OS(WIN)
131 return RenderTheme::extraDefaultStyleSheet() +
132 RenderThemeChromiumSkia::extraDefaultStyleSheet() +
133 String(themeChromiumLinuxUserAgentStyleSheet, sizeof(themeChromiumLinuxUserAgentStyleSheet));
134 #else
135 return RenderTheme::extraDefaultStyleSheet() +
136 RenderThemeChromiumSkia::extraDefaultStyleSheet();
137 #endif
138 }
139
controlSupportsTints(const RenderObject * o) const140 bool RenderThemeChromiumDefault::controlSupportsTints(const RenderObject* o) const
141 {
142 return isEnabled(o);
143 }
144
activeListBoxSelectionBackgroundColor() const145 Color RenderThemeChromiumDefault::activeListBoxSelectionBackgroundColor() const
146 {
147 return Color(0x28, 0x28, 0x28);
148 }
149
activeListBoxSelectionForegroundColor() const150 Color RenderThemeChromiumDefault::activeListBoxSelectionForegroundColor() const
151 {
152 return Color::black;
153 }
154
inactiveListBoxSelectionBackgroundColor() const155 Color RenderThemeChromiumDefault::inactiveListBoxSelectionBackgroundColor() const
156 {
157 return Color(0xc8, 0xc8, 0xc8);
158 }
159
inactiveListBoxSelectionForegroundColor() const160 Color RenderThemeChromiumDefault::inactiveListBoxSelectionForegroundColor() const
161 {
162 return Color(0x32, 0x32, 0x32);
163 }
164
platformActiveSelectionBackgroundColor() const165 Color RenderThemeChromiumDefault::platformActiveSelectionBackgroundColor() const
166 {
167 if (useMockTheme())
168 return Color(0x00, 0x00, 0xff); // Royal blue.
169 return m_activeSelectionBackgroundColor;
170 }
171
platformInactiveSelectionBackgroundColor() const172 Color RenderThemeChromiumDefault::platformInactiveSelectionBackgroundColor() const
173 {
174 if (useMockTheme())
175 return Color(0x99, 0x99, 0x99); // Medium gray.
176 return m_inactiveSelectionBackgroundColor;
177 }
178
platformActiveSelectionForegroundColor() const179 Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const
180 {
181 if (useMockTheme())
182 return Color(0xff, 0xff, 0xcc); // Pale yellow.
183 return m_activeSelectionForegroundColor;
184 }
185
platformInactiveSelectionForegroundColor() const186 Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() const
187 {
188 if (useMockTheme())
189 return Color::white;
190 return m_inactiveSelectionForegroundColor;
191 }
192
sliderTickSize() const193 IntSize RenderThemeChromiumDefault::sliderTickSize() const
194 {
195 if (useMockTheme())
196 return IntSize(1, 3);
197 return IntSize(1, 6);
198 }
199
sliderTickOffsetFromTrackCenter() const200 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const
201 {
202 if (useMockTheme())
203 return 11;
204 return -16;
205 }
206
adjustSliderThumbSize(RenderStyle * style,Element * element) const207 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Element* element) const
208 {
209 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::WebThemeEngine::PartSliderThumb);
210
211 // FIXME: Mock theme doesn't handle zoomed sliders.
212 float zoomLevel = useMockTheme() ? 1 : style->effectiveZoom();
213 if (style->appearance() == SliderThumbHorizontalPart) {
214 style->setWidth(Length(size.width() * zoomLevel, Fixed));
215 style->setHeight(Length(size.height() * zoomLevel, Fixed));
216 } else if (style->appearance() == SliderThumbVerticalPart) {
217 style->setWidth(Length(size.height() * zoomLevel, Fixed));
218 style->setHeight(Length(size.width() * zoomLevel, Fixed));
219 } else
220 RenderThemeChromiumSkia::adjustSliderThumbSize(style, element);
221 }
222
supportsControlTints() const223 bool RenderThemeChromiumDefault::supportsControlTints() const
224 {
225 return true;
226 }
227
setCaretBlinkInterval(double interval)228 void RenderThemeChromiumDefault::setCaretBlinkInterval(double interval)
229 {
230 m_caretBlinkInterval = interval;
231 }
232
caretBlinkIntervalInternal() const233 double RenderThemeChromiumDefault::caretBlinkIntervalInternal() const
234 {
235 return m_caretBlinkInterval;
236 }
237
setSelectionColors(unsigned activeBackgroundColor,unsigned activeForegroundColor,unsigned inactiveBackgroundColor,unsigned inactiveForegroundColor)238 void RenderThemeChromiumDefault::setSelectionColors(
239 unsigned activeBackgroundColor,
240 unsigned activeForegroundColor,
241 unsigned inactiveBackgroundColor,
242 unsigned inactiveForegroundColor)
243 {
244 m_activeSelectionBackgroundColor = activeBackgroundColor;
245 m_activeSelectionForegroundColor = activeForegroundColor;
246 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor;
247 m_inactiveSelectionForegroundColor = inactiveForegroundColor;
248 }
249
paintCheckbox(RenderObject * o,const PaintInfo & i,const IntRect & rect)250 bool RenderThemeChromiumDefault::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
251 {
252 blink::WebThemeEngine::ExtraParams extraParams;
253 blink::WebCanvas* canvas = i.context->canvas();
254 extraParams.button.checked = isChecked(o);
255 extraParams.button.indeterminate = isIndeterminate(o);
256
257 float zoomLevel = o->style()->effectiveZoom();
258 GraphicsContextStateSaver stateSaver(*i.context);
259 IntRect unzoomedRect = rect;
260 if (zoomLevel != 1) {
261 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
262 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
263 i.context->translate(unzoomedRect.x(), unzoomedRect.y());
264 i.context->scale(FloatSize(zoomLevel, zoomLevel));
265 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
266 }
267
268 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartCheckbox, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extraParams);
269 return false;
270 }
271
setCheckboxSize(RenderStyle * style) const272 void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const
273 {
274 // If the width and height are both specified, then we have nothing to do.
275 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
276 return;
277
278 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::WebThemeEngine::PartCheckbox);
279 float zoomLevel = style->effectiveZoom();
280 size.setWidth(size.width() * zoomLevel);
281 size.setHeight(size.height() * zoomLevel);
282 setSizeIfAuto(style, size);
283 }
284
paintRadio(RenderObject * o,const PaintInfo & i,const IntRect & rect)285 bool RenderThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
286 {
287 blink::WebThemeEngine::ExtraParams extraParams;
288 blink::WebCanvas* canvas = i.context->canvas();
289 extraParams.button.checked = isChecked(o);
290
291 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartRadio, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
292 return false;
293 }
294
setRadioSize(RenderStyle * style) const295 void RenderThemeChromiumDefault::setRadioSize(RenderStyle* style) const
296 {
297 // If the width and height are both specified, then we have nothing to do.
298 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
299 return;
300
301 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::WebThemeEngine::PartRadio);
302 float zoomLevel = style->effectiveZoom();
303 size.setWidth(size.width() * zoomLevel);
304 size.setHeight(size.height() * zoomLevel);
305 setSizeIfAuto(style, size);
306 }
307
paintButton(RenderObject * o,const PaintInfo & i,const IntRect & rect)308 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
309 {
310 blink::WebThemeEngine::ExtraParams extraParams;
311 blink::WebCanvas* canvas = i.context->canvas();
312 extraParams.button.hasBorder = true;
313 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultButtonBackgroundColor;
314 if (o->hasBackground())
315 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgroundColor).rgb();
316
317 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartButton, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
318 return false;
319 }
320
paintTextField(RenderObject * o,const PaintInfo & i,const IntRect & rect)321 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect)
322 {
323 // WebThemeEngine does not handle border rounded corner and background image
324 // so return true to draw CSS border and background.
325 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage())
326 return true;
327
328 ControlPart part = o->style()->appearance();
329
330 blink::WebThemeEngine::ExtraParams extraParams;
331 extraParams.textField.isTextArea = part == TextAreaPart;
332 extraParams.textField.isListbox = part == ListboxPart;
333
334 blink::WebCanvas* canvas = i.context->canvas();
335
336 // Fallback to white if the specified color object is invalid.
337 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor, Color::white);
338 extraParams.textField.backgroundColor = backgroundColor.rgb();
339
340 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartTextField, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
341 return false;
342 }
343
paintMenuList(RenderObject * o,const PaintInfo & i,const IntRect & rect)344 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect)
345 {
346 if (!o->isBox())
347 return false;
348
349 const int right = rect.x() + rect.width();
350 const int middle = rect.y() + rect.height() / 2;
351
352 blink::WebThemeEngine::ExtraParams extraParams;
353 extraParams.menuList.arrowY = middle;
354 const RenderBox* box = toRenderBox(o);
355 // Match Chromium Win behaviour of showing all borders if any are shown.
356 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() || box->borderTop() || box->borderBottom();
357 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius();
358 // Fallback to transparent if the specified color object is invalid.
359 Color backgroundColor(Color::transparent);
360 if (o->hasBackground())
361 backgroundColor = o->resolveColor(CSSPropertyBackgroundColor);
362 extraParams.menuList.backgroundColor = backgroundColor.rgb();
363
364 // If we have a background image, don't fill the content area to expose the
365 // parent's background. Also, we shouldn't fill the content area if the
366 // alpha of the color is 0. The API of Windows GDI ignores the alpha.
367 // FIXME: the normal Aura theme doesn't care about this, so we should
368 // investigate if we really need fillContentArea.
369 extraParams.menuList.fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha();
370
371 if (useMockTheme()) {
372 // The size and position of the drop-down button is different between
373 // the mock theme and the regular aura theme.
374 int spacingTop = box->borderTop() + box->paddingTop();
375 int spacingBottom = box->borderBottom() + box->paddingBottom();
376 int spacingRight = box->borderRight() + box->paddingRight();
377 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 4 + spacingRight: right - 13 - spacingRight;
378 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spacingTop;
379 } else {
380 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
381 }
382
383 blink::WebCanvas* canvas = i.context->canvas();
384
385 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
386 return false;
387 }
388
paintMenuListButton(RenderObject * o,const PaintInfo & i,const IntRect & rect)389 bool RenderThemeChromiumDefault::paintMenuListButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
390 {
391 if (!o->isBox())
392 return false;
393
394 const int right = rect.x() + rect.width();
395 const int middle = rect.y() + rect.height() / 2;
396
397 blink::WebThemeEngine::ExtraParams extraParams;
398 extraParams.menuList.arrowY = middle;
399 extraParams.menuList.hasBorder = false;
400 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius();
401 extraParams.menuList.backgroundColor = Color::transparent;
402 extraParams.menuList.fillContentArea = false;
403
404 if (useMockTheme()) {
405 const RenderBox* box = toRenderBox(o);
406 // The size and position of the drop-down button is different between
407 // the mock theme and the regular aura theme.
408 int spacingTop = box->borderTop() + box->paddingTop();
409 int spacingBottom = box->borderBottom() + box->paddingBottom();
410 int spacingRight = box->borderRight() + box->paddingRight();
411 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 4 + spacingRight: right - 13 - spacingRight;
412 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spacingTop;
413 } else {
414 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
415 }
416
417 blink::WebCanvas* canvas = i.context->canvas();
418
419 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
420 return false;
421 }
422
paintSliderTrack(RenderObject * o,const PaintInfo & i,const IntRect & rect)423 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
424 {
425 blink::WebThemeEngine::ExtraParams extraParams;
426 blink::WebCanvas* canvas = i.context->canvas();
427 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;
428
429 paintSliderTicks(o, i, rect);
430
431 // FIXME: Mock theme doesn't handle zoomed sliders.
432 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom();
433 GraphicsContextStateSaver stateSaver(*i.context);
434 IntRect unzoomedRect = rect;
435 if (zoomLevel != 1) {
436 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
437 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
438 i.context->translate(unzoomedRect.x(), unzoomedRect.y());
439 i.context->scale(FloatSize(zoomLevel, zoomLevel));
440 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
441 }
442
443 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extraParams);
444
445 return false;
446 }
447
paintSliderThumb(RenderObject * o,const PaintInfo & i,const IntRect & rect)448 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
449 {
450 blink::WebThemeEngine::ExtraParams extraParams;
451 blink::WebCanvas* canvas = i.context->canvas();
452 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
453 extraParams.slider.inDrag = isPressed(o);
454
455 // FIXME: Mock theme doesn't handle zoomed sliders.
456 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom();
457 GraphicsContextStateSaver stateSaver(*i.context);
458 IntRect unzoomedRect = rect;
459 if (zoomLevel != 1) {
460 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
461 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
462 i.context->translate(unzoomedRect.x(), unzoomedRect.y());
463 i.context->scale(FloatSize(zoomLevel, zoomLevel));
464 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
465 }
466
467 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartSliderThumb, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extraParams);
468 return false;
469 }
470
adjustInnerSpinButtonStyle(RenderStyle * style,Element *) const471 void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style, Element*) const
472 {
473 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::WebThemeEngine::PartInnerSpinButton);
474
475 style->setWidth(Length(size.width(), Fixed));
476 style->setMinWidth(Length(size.width(), Fixed));
477 }
478
paintInnerSpinButton(RenderObject * o,const PaintInfo & i,const IntRect & rect)479 bool RenderThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
480 {
481 blink::WebThemeEngine::ExtraParams extraParams;
482 blink::WebCanvas* canvas = i.context->canvas();
483 extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
484 extraParams.innerSpin.readOnly = isReadOnlyControl(o);
485
486 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartInnerSpinButton, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
487 return false;
488 }
489
paintProgressBar(RenderObject * o,const PaintInfo & i,const IntRect & rect)490 bool RenderThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect)
491 {
492 if (!o->isProgress())
493 return true;
494
495 RenderProgress* renderProgress = toRenderProgress(o);
496 IntRect valueRect = progressValueRectFor(renderProgress, rect);
497
498 blink::WebThemeEngine::ExtraParams extraParams;
499 extraParams.progressBar.determinate = renderProgress->isDeterminate();
500 extraParams.progressBar.valueRectX = valueRect.x();
501 extraParams.progressBar.valueRectY = valueRect.y();
502 extraParams.progressBar.valueRectWidth = valueRect.width();
503 extraParams.progressBar.valueRectHeight = valueRect.height();
504
505 DirectionFlippingScope scope(o, i, rect);
506 blink::WebCanvas* canvas = i.context->canvas();
507 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngine::PartProgressBar, getWebThemeState(this, o), blink::WebRect(rect), &extraParams);
508 return false;
509 }
510
shouldOpenPickerWithF4Key() const511 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const
512 {
513 return true;
514 }
515
shouldUseFallbackTheme(RenderStyle * style) const516 bool RenderThemeChromiumDefault::shouldUseFallbackTheme(RenderStyle* style) const
517 {
518 if (useMockTheme()) {
519 // The mock theme can't handle zoomed controls, so we fall back to the "fallback" theme.
520 ControlPart part = style->appearance();
521 if (part == CheckboxPart || part == RadioPart)
522 return style->effectiveZoom() != 1;
523 }
524 return RenderTheme::shouldUseFallbackTheme(style);
525 }
526
527 } // namespace WebCore
528