| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. | 2 * Copyright (C) 2007 Apple Inc. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2008 Collabora Ltd. | 4 * Copyright (C) 2008 Collabora Ltd. |
| 5 * Copyright (C) 2008, 2009 Google Inc. | 5 * Copyright (C) 2008, 2009 Google Inc. |
| 6 * Copyright (C) 2009 Kenneth Rohde Christiansen | 6 * Copyright (C) 2009 Kenneth Rohde Christiansen |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/rendering/RenderThemeChromiumDefault.h" | 26 #include "core/rendering/RenderThemeChromiumDefault.h" |
| 27 | 27 |
| 28 #include "CSSValueKeywords.h" | 28 #include "CSSValueKeywords.h" |
| 29 #include "UserAgentStyleSheets.h" | 29 #include "UserAgentStyleSheets.h" |
| 30 #include "core/platform/graphics/GraphicsContext.h" | 30 #include "core/platform/graphics/GraphicsContext.h" |
| 31 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 31 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
| 32 #include "core/rendering/PaintInfo.h" | 32 #include "core/rendering/PaintInfo.h" |
| 33 #include "core/rendering/RenderObject.h" | 33 #include "core/rendering/RenderObject.h" |
| 34 #include "core/rendering/RenderProgress.h" | 34 #include "core/rendering/RenderProgress.h" |
| 35 #include "platform/LayoutTestSupport.h" |
| 35 #include "platform/graphics/Color.h" | 36 #include "platform/graphics/Color.h" |
| 36 #include "public/platform/default/WebThemeEngine.h" | 37 #include "public/platform/default/WebThemeEngine.h" |
| 37 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebRect.h" | 39 #include "public/platform/WebRect.h" |
| 39 | 40 |
| 41 |
| 40 namespace WebCore { | 42 namespace WebCore { |
| 41 | 43 |
| 44 static bool useMockTheme() |
| 45 { |
| 46 #if defined(USE_AURA) |
| 47 return isRunningLayoutTest(); |
| 48 #endif |
| 49 return false; |
| 50 } |
| 51 |
| 42 unsigned RenderThemeChromiumDefault::m_activeSelectionBackgroundColor = | 52 unsigned RenderThemeChromiumDefault::m_activeSelectionBackgroundColor = |
| 43 0xff1e90ff; | 53 0xff1e90ff; |
| 44 unsigned RenderThemeChromiumDefault::m_activeSelectionForegroundColor = | 54 unsigned RenderThemeChromiumDefault::m_activeSelectionForegroundColor = |
| 45 Color::black; | 55 Color::black; |
| 46 unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor = | 56 unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor = |
| 47 0xffc8c8c8; | 57 0xffc8c8c8; |
| 48 unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor = | 58 unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor = |
| 49 0xff323232; | 59 0xff323232; |
| 50 | 60 |
| 51 double RenderThemeChromiumDefault::m_caretBlinkInterval; | 61 double RenderThemeChromiumDefault::m_caretBlinkInterval; |
| 52 | 62 |
| 53 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; | 63 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; |
| 54 | 64 |
| 55 static blink::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, c
onst RenderObject* o) | 65 static blink::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, c
onst RenderObject* o) |
| 56 { | 66 { |
| 57 if (!theme->isEnabled(o)) | 67 if (!theme->isEnabled(o)) |
| 58 return blink::WebThemeEngine::StateDisabled; | 68 return blink::WebThemeEngine::StateDisabled; |
| 69 if (useMockTheme() && theme->isReadOnlyControl(o)) |
| 70 return blink::WebThemeEngine::StateReadonly; |
| 59 if (theme->isPressed(o)) | 71 if (theme->isPressed(o)) |
| 60 return blink::WebThemeEngine::StatePressed; | 72 return blink::WebThemeEngine::StatePressed; |
| 73 if (useMockTheme() && theme->isFocused(o)) |
| 74 return blink::WebThemeEngine::StateFocused; |
| 61 if (theme->isHovered(o)) | 75 if (theme->isHovered(o)) |
| 62 return blink::WebThemeEngine::StateHover; | 76 return blink::WebThemeEngine::StateHover; |
| 63 | 77 |
| 64 return blink::WebThemeEngine::StateNormal; | 78 return blink::WebThemeEngine::StateNormal; |
| 65 } | 79 } |
| 66 | 80 |
| 67 PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create() | 81 PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create() |
| 68 { | 82 { |
| 69 return adoptRef(new RenderThemeChromiumDefault()); | 83 return adoptRef(new RenderThemeChromiumDefault()); |
| 70 } | 84 } |
| 71 | 85 |
| 72 // RenderTheme::theme for Android is defined in RenderThemeChromiumAndroid.cpp. | 86 // RenderTheme::theme for Android is defined in RenderThemeChromiumAndroid.cpp. |
| 73 #if !OS(ANDROID) | 87 #if !OS(ANDROID) |
| 74 RenderTheme& RenderTheme::theme() | 88 RenderTheme& RenderTheme::theme() |
| 75 { | 89 { |
| 76 static RenderTheme* renderTheme = RenderThemeChromiumDefault::create().leakR
ef(); | 90 static RenderTheme* renderTheme = RenderThemeChromiumDefault::create().leakR
ef(); |
| 77 return *renderTheme; | 91 return *renderTheme; |
| 78 } | 92 } |
| 79 #endif | 93 #endif |
| 80 | 94 |
| 81 RenderThemeChromiumDefault::RenderThemeChromiumDefault() | 95 RenderThemeChromiumDefault::RenderThemeChromiumDefault() |
| 82 { | 96 { |
| 83 m_caretBlinkInterval = RenderTheme::caretBlinkInterval(); | 97 m_caretBlinkInterval = RenderTheme::caretBlinkInterval(); |
| 84 } | 98 } |
| 85 | 99 |
| 86 RenderThemeChromiumDefault::~RenderThemeChromiumDefault() | 100 RenderThemeChromiumDefault::~RenderThemeChromiumDefault() |
| 87 { | 101 { |
| 88 } | 102 } |
| 89 | 103 |
| 104 bool RenderThemeChromiumDefault::supportsFocusRing(const RenderStyle* style) con
st |
| 105 { |
| 106 if (useMockTheme()) { |
| 107 // Don't use focus rings for buttons when mocking controls. |
| 108 return style->appearance() == ButtonPart |
| 109 || style->appearance() == PushButtonPart |
| 110 || style->appearance() == SquareButtonPart; |
| 111 } |
| 112 |
| 113 return RenderThemeChromiumSkia::supportsFocusRing(style); |
| 114 } |
| 115 |
| 90 Color RenderThemeChromiumDefault::systemColor(CSSValueID cssValueId) const | 116 Color RenderThemeChromiumDefault::systemColor(CSSValueID cssValueId) const |
| 91 { | 117 { |
| 92 static const Color defaultButtonGrayColor(0xffdddddd); | 118 static const Color defaultButtonGrayColor(0xffdddddd); |
| 93 static const Color defaultMenuColor(0xfff7f7f7); | 119 static const Color defaultMenuColor(0xfff7f7f7); |
| 94 | 120 |
| 95 if (cssValueId == CSSValueButtonface) | 121 if (cssValueId == CSSValueButtonface) { |
| 122 if (useMockTheme()) |
| 123 return Color(0xc0, 0xc0, 0xc0); |
| 96 return defaultButtonGrayColor; | 124 return defaultButtonGrayColor; |
| 125 } |
| 97 if (cssValueId == CSSValueMenu) | 126 if (cssValueId == CSSValueMenu) |
| 98 return defaultMenuColor; | 127 return defaultMenuColor; |
| 99 return RenderTheme::systemColor(cssValueId); | 128 return RenderTheme::systemColor(cssValueId); |
| 100 } | 129 } |
| 101 | 130 |
| 102 String RenderThemeChromiumDefault::extraDefaultStyleSheet() | 131 String RenderThemeChromiumDefault::extraDefaultStyleSheet() |
| 103 { | 132 { |
| 104 #if !OS(WIN) | 133 #if !OS(WIN) |
| 105 return RenderTheme::extraDefaultStyleSheet() + | 134 return RenderTheme::extraDefaultStyleSheet() + |
| 106 RenderThemeChromiumSkia::extraDefaultStyleSheet() + | 135 RenderThemeChromiumSkia::extraDefaultStyleSheet() + |
| (...skipping 24 matching lines...) Expand all Loading... |
| 131 return Color(0xc8, 0xc8, 0xc8); | 160 return Color(0xc8, 0xc8, 0xc8); |
| 132 } | 161 } |
| 133 | 162 |
| 134 Color RenderThemeChromiumDefault::inactiveListBoxSelectionForegroundColor() cons
t | 163 Color RenderThemeChromiumDefault::inactiveListBoxSelectionForegroundColor() cons
t |
| 135 { | 164 { |
| 136 return Color(0x32, 0x32, 0x32); | 165 return Color(0x32, 0x32, 0x32); |
| 137 } | 166 } |
| 138 | 167 |
| 139 Color RenderThemeChromiumDefault::platformActiveSelectionBackgroundColor() const | 168 Color RenderThemeChromiumDefault::platformActiveSelectionBackgroundColor() const |
| 140 { | 169 { |
| 170 if (useMockTheme()) |
| 171 return Color(0x00, 0x00, 0xff); // Royal blue. |
| 141 return m_activeSelectionBackgroundColor; | 172 return m_activeSelectionBackgroundColor; |
| 142 } | 173 } |
| 143 | 174 |
| 144 Color RenderThemeChromiumDefault::platformInactiveSelectionBackgroundColor() con
st | 175 Color RenderThemeChromiumDefault::platformInactiveSelectionBackgroundColor() con
st |
| 145 { | 176 { |
| 177 if (useMockTheme()) |
| 178 return Color(0x99, 0x99, 0x99); // Medium gray. |
| 146 return m_inactiveSelectionBackgroundColor; | 179 return m_inactiveSelectionBackgroundColor; |
| 147 } | 180 } |
| 148 | 181 |
| 149 Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const | 182 Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const |
| 150 { | 183 { |
| 184 if (useMockTheme()) |
| 185 return Color(0xff, 0xff, 0xcc); // Pale yellow. |
| 151 return m_activeSelectionForegroundColor; | 186 return m_activeSelectionForegroundColor; |
| 152 } | 187 } |
| 153 | 188 |
| 154 Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() con
st | 189 Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() con
st |
| 155 { | 190 { |
| 191 if (useMockTheme()) |
| 192 return Color::white; |
| 156 return m_inactiveSelectionForegroundColor; | 193 return m_inactiveSelectionForegroundColor; |
| 157 } | 194 } |
| 158 | 195 |
| 159 IntSize RenderThemeChromiumDefault::sliderTickSize() const | 196 IntSize RenderThemeChromiumDefault::sliderTickSize() const |
| 160 { | 197 { |
| 198 if (useMockTheme()) |
| 199 return IntSize(1, 3); |
| 161 return IntSize(1, 6); | 200 return IntSize(1, 6); |
| 162 } | 201 } |
| 163 | 202 |
| 164 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const | 203 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const |
| 165 { | 204 { |
| 205 if (useMockTheme()) |
| 206 return 11; |
| 166 return -16; | 207 return -16; |
| 167 } | 208 } |
| 168 | 209 |
| 169 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme
nt* element) const | 210 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme
nt* element) const |
| 170 { | 211 { |
| 171 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartSliderThumb); | 212 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartSliderThumb); |
| 172 float zoomLevel = style->effectiveZoom(); | 213 |
| 214 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 215 float zoomLevel = useMockTheme() ? 1 : style->effectiveZoom(); |
| 173 if (style->appearance() == SliderThumbHorizontalPart) { | 216 if (style->appearance() == SliderThumbHorizontalPart) { |
| 174 style->setWidth(Length(size.width() * zoomLevel, Fixed)); | 217 style->setWidth(Length(size.width() * zoomLevel, Fixed)); |
| 175 style->setHeight(Length(size.height() * zoomLevel, Fixed)); | 218 style->setHeight(Length(size.height() * zoomLevel, Fixed)); |
| 176 } else if (style->appearance() == SliderThumbVerticalPart) { | 219 } else if (style->appearance() == SliderThumbVerticalPart) { |
| 177 style->setWidth(Length(size.height() * zoomLevel, Fixed)); | 220 style->setWidth(Length(size.height() * zoomLevel, Fixed)); |
| 178 style->setHeight(Length(size.width() * zoomLevel, Fixed)); | 221 style->setHeight(Length(size.width() * zoomLevel, Fixed)); |
| 179 } else | 222 } else |
| 180 RenderThemeChromiumSkia::adjustSliderThumbSize(style, element); | 223 RenderThemeChromiumSkia::adjustSliderThumbSize(style, element); |
| 181 } | 224 } |
| 182 | 225 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 size.setWidth(size.width() * zoomLevel); | 306 size.setWidth(size.width() * zoomLevel); |
| 264 size.setHeight(size.height() * zoomLevel); | 307 size.setHeight(size.height() * zoomLevel); |
| 265 setSizeIfAuto(style, size); | 308 setSizeIfAuto(style, size); |
| 266 } | 309 } |
| 267 | 310 |
| 268 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i
, const IntRect& rect) | 311 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i
, const IntRect& rect) |
| 269 { | 312 { |
| 270 blink::WebThemeEngine::ExtraParams extraParams; | 313 blink::WebThemeEngine::ExtraParams extraParams; |
| 271 blink::WebCanvas* canvas = i.context->canvas(); | 314 blink::WebCanvas* canvas = i.context->canvas(); |
| 272 extraParams.button.hasBorder = true; | 315 extraParams.button.hasBorder = true; |
| 273 extraParams.button.backgroundColor = defaultButtonBackgroundColor; | 316 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; |
| 274 if (o->hasBackground()) | 317 if (o->hasBackground()) |
| 275 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); | 318 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); |
| 276 | 319 |
| 277 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartButton, getWebThemeState(this, o), blink::WebRect(rect), &extraParams); | 320 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartButton, getWebThemeState(this, o), blink::WebRect(rect), &extraParams); |
| 278 return false; | 321 return false; |
| 279 } | 322 } |
| 280 | 323 |
| 281 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo
& i, const IntRect& rect) | 324 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo
& i, const IntRect& rect) |
| 282 { | 325 { |
| 283 // WebThemeEngine does not handle border rounded corner and background image | 326 // WebThemeEngine does not handle border rounded corner and background image |
| (...skipping 19 matching lines...) Expand all Loading... |
| 303 | 346 |
| 304 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo&
i, const IntRect& rect) | 347 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo&
i, const IntRect& rect) |
| 305 { | 348 { |
| 306 if (!o->isBox()) | 349 if (!o->isBox()) |
| 307 return false; | 350 return false; |
| 308 | 351 |
| 309 const int right = rect.x() + rect.width(); | 352 const int right = rect.x() + rect.width(); |
| 310 const int middle = rect.y() + rect.height() / 2; | 353 const int middle = rect.y() + rect.height() / 2; |
| 311 | 354 |
| 312 blink::WebThemeEngine::ExtraParams extraParams; | 355 blink::WebThemeEngine::ExtraParams extraParams; |
| 313 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() +
7 : right - 13; | |
| 314 extraParams.menuList.arrowY = middle; | 356 extraParams.menuList.arrowY = middle; |
| 315 const RenderBox* box = toRenderBox(o); | 357 const RenderBox* box = toRenderBox(o); |
| 316 // Match Chromium Win behaviour of showing all borders if any are shown. | 358 // Match Chromium Win behaviour of showing all borders if any are shown. |
| 317 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() ||
box->borderTop() || box->borderBottom(); | 359 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() ||
box->borderTop() || box->borderBottom(); |
| 318 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); | 360 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); |
| 319 // Fallback to transparent if the specified color object is invalid. | 361 // Fallback to transparent if the specified color object is invalid. |
| 320 extraParams.menuList.backgroundColor = Color::transparent; | 362 Color backgroundColor(Color::transparent); |
| 321 if (o->hasBackground()) | 363 if (o->hasBackground()) |
| 322 extraParams.menuList.backgroundColor = o->resolveColor(CSSPropertyBackgr
oundColor).rgb(); | 364 backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 365 extraParams.menuList.backgroundColor = backgroundColor.rgb(); |
| 366 |
| 367 // If we have a background image, don't fill the content area to expose the |
| 368 // parent's background. Also, we shouldn't fill the content area if the |
| 369 // alpha of the color is 0. The API of Windows GDI ignores the alpha. |
| 370 // FIXME: the normal Aura theme doesn't care about this, so we should |
| 371 // investigate if we really need fillContentArea. |
| 372 extraParams.menuList.fillContentArea = !o->style()->hasBackgroundImage() &&
backgroundColor.alpha(); |
| 373 |
| 374 if (useMockTheme()) { |
| 375 // The size and position of the drop-down button is different between |
| 376 // the mock theme and the regular aura theme. |
| 377 int spacingTop = box->borderTop() + box->paddingTop(); |
| 378 int spacingBottom = box->borderBottom() + box->paddingBottom(); |
| 379 int spacingRight = box->borderRight() + box->paddingRight(); |
| 380 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; |
| 381 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; |
| 382 } else { |
| 383 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 384 } |
| 323 | 385 |
| 324 blink::WebCanvas* canvas = i.context->canvas(); | 386 blink::WebCanvas* canvas = i.context->canvas(); |
| 325 | 387 |
| 326 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams)
; | 388 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams)
; |
| 327 return false; | 389 return false; |
| 328 } | 390 } |
| 329 | 391 |
| 330 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 392 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 331 { | 393 { |
| 332 blink::WebThemeEngine::ExtraParams extraParams; | 394 blink::WebThemeEngine::ExtraParams extraParams; |
| 333 blink::WebCanvas* canvas = i.context->canvas(); | 395 blink::WebCanvas* canvas = i.context->canvas(); |
| 334 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; | 396 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; |
| 335 | 397 |
| 336 paintSliderTicks(o, i, rect); | 398 paintSliderTicks(o, i, rect); |
| 337 | 399 |
| 338 float zoomLevel = o->style()->effectiveZoom(); | 400 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 401 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 339 GraphicsContextStateSaver stateSaver(*i.context); | 402 GraphicsContextStateSaver stateSaver(*i.context); |
| 340 IntRect unzoomedRect = rect; | 403 IntRect unzoomedRect = rect; |
| 341 if (zoomLevel != 1) { | 404 if (zoomLevel != 1) { |
| 342 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 405 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 343 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 406 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 344 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 407 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 345 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 408 i.context->scale(FloatSize(zoomLevel, zoomLevel)); |
| 346 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 409 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 347 } | 410 } |
| 348 | 411 |
| 349 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); | 412 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); |
| 350 | 413 |
| 351 return false; | 414 return false; |
| 352 } | 415 } |
| 353 | 416 |
| 354 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 417 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 355 { | 418 { |
| 356 blink::WebThemeEngine::ExtraParams extraParams; | 419 blink::WebThemeEngine::ExtraParams extraParams; |
| 357 blink::WebCanvas* canvas = i.context->canvas(); | 420 blink::WebCanvas* canvas = i.context->canvas(); |
| 358 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; | 421 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; |
| 359 extraParams.slider.inDrag = isPressed(o); | 422 extraParams.slider.inDrag = isPressed(o); |
| 360 | 423 |
| 361 float zoomLevel = o->style()->effectiveZoom(); | 424 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 425 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 362 GraphicsContextStateSaver stateSaver(*i.context); | 426 GraphicsContextStateSaver stateSaver(*i.context); |
| 363 IntRect unzoomedRect = rect; | 427 IntRect unzoomedRect = rect; |
| 364 if (zoomLevel != 1) { | 428 if (zoomLevel != 1) { |
| 365 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 429 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 366 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 430 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 367 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 431 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 368 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 432 i.context->scale(FloatSize(zoomLevel, zoomLevel)); |
| 369 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 433 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 370 } | 434 } |
| 371 | 435 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 blink::WebCanvas* canvas = i.context->canvas(); | 475 blink::WebCanvas* canvas = i.context->canvas(); |
| 412 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartProgressBar, getWebThemeState(this, o), blink::WebRect(rect), &extraPara
ms); | 476 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartProgressBar, getWebThemeState(this, o), blink::WebRect(rect), &extraPara
ms); |
| 413 return false; | 477 return false; |
| 414 } | 478 } |
| 415 | 479 |
| 416 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const | 480 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const |
| 417 { | 481 { |
| 418 return true; | 482 return true; |
| 419 } | 483 } |
| 420 | 484 |
| 485 bool RenderThemeChromiumDefault::shouldUseFallbackTheme(RenderStyle* style) cons
t |
| 486 { |
| 487 if (useMockTheme()) { |
| 488 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. |
| 489 ControlPart part = style->appearance(); |
| 490 if (part == CheckboxPart || part == RadioPart) |
| 491 return style->effectiveZoom() != 1; |
| 492 } |
| 493 return RenderTheme::shouldUseFallbackTheme(style); |
| 494 } |
| 495 |
| 421 } // namespace WebCore | 496 } // namespace WebCore |
| OLD | NEW |