| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/layout/LayoutThemeChromiumDefault.h" | 26 #include "core/layout/LayoutThemeChromiumDefault.h" |
| 27 | 27 |
| 28 #include "core/CSSValueKeywords.h" | 28 #include "core/CSSValueKeywords.h" |
| 29 #include "core/layout/LayoutObject.h" |
| 29 #include "core/rendering/PaintInfo.h" | 30 #include "core/rendering/PaintInfo.h" |
| 30 #include "core/rendering/RenderObject.h" | |
| 31 #include "core/rendering/RenderProgress.h" | 31 #include "core/rendering/RenderProgress.h" |
| 32 #include "platform/LayoutTestSupport.h" | 32 #include "platform/LayoutTestSupport.h" |
| 33 #include "platform/PlatformResourceLoader.h" | 33 #include "platform/PlatformResourceLoader.h" |
| 34 #include "platform/graphics/Color.h" | 34 #include "platform/graphics/Color.h" |
| 35 #include "platform/graphics/GraphicsContext.h" | 35 #include "platform/graphics/GraphicsContext.h" |
| 36 #include "platform/graphics/GraphicsContextStateSaver.h" | 36 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebRect.h" | 38 #include "public/platform/WebRect.h" |
| 39 #include "public/platform/WebThemeEngine.h" | 39 #include "public/platform/WebThemeEngine.h" |
| 40 #include "wtf/StdLibExtras.h" | 40 #include "wtf/StdLibExtras.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 Color::black; | 52 Color::black; |
| 53 unsigned LayoutThemeChromiumDefault::m_inactiveSelectionBackgroundColor = | 53 unsigned LayoutThemeChromiumDefault::m_inactiveSelectionBackgroundColor = |
| 54 0xffc8c8c8; | 54 0xffc8c8c8; |
| 55 unsigned LayoutThemeChromiumDefault::m_inactiveSelectionForegroundColor = | 55 unsigned LayoutThemeChromiumDefault::m_inactiveSelectionForegroundColor = |
| 56 0xff323232; | 56 0xff323232; |
| 57 | 57 |
| 58 double LayoutThemeChromiumDefault::m_caretBlinkInterval; | 58 double LayoutThemeChromiumDefault::m_caretBlinkInterval; |
| 59 | 59 |
| 60 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; | 60 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; |
| 61 | 61 |
| 62 static WebThemeEngine::State getWebThemeState(const LayoutTheme* theme, const Re
nderObject* o) | 62 static WebThemeEngine::State getWebThemeState(const LayoutTheme* theme, const La
youtObject* o) |
| 63 { | 63 { |
| 64 if (!theme->isEnabled(o)) | 64 if (!theme->isEnabled(o)) |
| 65 return WebThemeEngine::StateDisabled; | 65 return WebThemeEngine::StateDisabled; |
| 66 if (useMockTheme() && theme->isReadOnlyControl(o)) | 66 if (useMockTheme() && theme->isReadOnlyControl(o)) |
| 67 return WebThemeEngine::StateReadonly; | 67 return WebThemeEngine::StateReadonly; |
| 68 if (theme->isPressed(o)) | 68 if (theme->isPressed(o)) |
| 69 return WebThemeEngine::StatePressed; | 69 return WebThemeEngine::StatePressed; |
| 70 if (useMockTheme() && theme->isFocused(o)) | 70 if (useMockTheme() && theme->isFocused(o)) |
| 71 return WebThemeEngine::StateFocused; | 71 return WebThemeEngine::StateFocused; |
| 72 if (theme->isHovered(o)) | 72 if (theme->isHovered(o)) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 unsigned activeForegroundColor, | 215 unsigned activeForegroundColor, |
| 216 unsigned inactiveBackgroundColor, | 216 unsigned inactiveBackgroundColor, |
| 217 unsigned inactiveForegroundColor) | 217 unsigned inactiveForegroundColor) |
| 218 { | 218 { |
| 219 m_activeSelectionBackgroundColor = activeBackgroundColor; | 219 m_activeSelectionBackgroundColor = activeBackgroundColor; |
| 220 m_activeSelectionForegroundColor = activeForegroundColor; | 220 m_activeSelectionForegroundColor = activeForegroundColor; |
| 221 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; | 221 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; |
| 222 m_inactiveSelectionForegroundColor = inactiveForegroundColor; | 222 m_inactiveSelectionForegroundColor = inactiveForegroundColor; |
| 223 } | 223 } |
| 224 | 224 |
| 225 bool LayoutThemeChromiumDefault::paintCheckbox(RenderObject* o, const PaintInfo&
i, const IntRect& rect) | 225 bool LayoutThemeChromiumDefault::paintCheckbox(LayoutObject* o, const PaintInfo&
i, const IntRect& rect) |
| 226 { | 226 { |
| 227 WebThemeEngine::ExtraParams extraParams; | 227 WebThemeEngine::ExtraParams extraParams; |
| 228 WebCanvas* canvas = i.context->canvas(); | 228 WebCanvas* canvas = i.context->canvas(); |
| 229 extraParams.button.checked = isChecked(o); | 229 extraParams.button.checked = isChecked(o); |
| 230 extraParams.button.indeterminate = isIndeterminate(o); | 230 extraParams.button.indeterminate = isIndeterminate(o); |
| 231 | 231 |
| 232 float zoomLevel = o->style()->effectiveZoom(); | 232 float zoomLevel = o->style()->effectiveZoom(); |
| 233 GraphicsContextStateSaver stateSaver(*i.context, false); | 233 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 234 IntRect unzoomedRect = rect; | 234 IntRect unzoomedRect = rect; |
| 235 if (zoomLevel != 1) { | 235 if (zoomLevel != 1) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 251 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 251 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artCheckbox); | 254 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artCheckbox); |
| 255 float zoomLevel = style->effectiveZoom(); | 255 float zoomLevel = style->effectiveZoom(); |
| 256 size.setWidth(size.width() * zoomLevel); | 256 size.setWidth(size.width() * zoomLevel); |
| 257 size.setHeight(size.height() * zoomLevel); | 257 size.setHeight(size.height() * zoomLevel); |
| 258 setSizeIfAuto(style, size); | 258 setSizeIfAuto(style, size); |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool LayoutThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i,
const IntRect& rect) | 261 bool LayoutThemeChromiumDefault::paintRadio(LayoutObject* o, const PaintInfo& i,
const IntRect& rect) |
| 262 { | 262 { |
| 263 WebThemeEngine::ExtraParams extraParams; | 263 WebThemeEngine::ExtraParams extraParams; |
| 264 WebCanvas* canvas = i.context->canvas(); | 264 WebCanvas* canvas = i.context->canvas(); |
| 265 extraParams.button.checked = isChecked(o); | 265 extraParams.button.checked = isChecked(o); |
| 266 | 266 |
| 267 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartRadio,
getWebThemeState(this, o), WebRect(rect), &extraParams); | 267 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartRadio,
getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 268 return false; | 268 return false; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void LayoutThemeChromiumDefault::setRadioSize(RenderStyle* style) const | 271 void LayoutThemeChromiumDefault::setRadioSize(RenderStyle* style) const |
| 272 { | 272 { |
| 273 // If the width and height are both specified, then we have nothing to do. | 273 // If the width and height are both specified, then we have nothing to do. |
| 274 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 274 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artRadio); | 277 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artRadio); |
| 278 float zoomLevel = style->effectiveZoom(); | 278 float zoomLevel = style->effectiveZoom(); |
| 279 size.setWidth(size.width() * zoomLevel); | 279 size.setWidth(size.width() * zoomLevel); |
| 280 size.setHeight(size.height() * zoomLevel); | 280 size.setHeight(size.height() * zoomLevel); |
| 281 setSizeIfAuto(style, size); | 281 setSizeIfAuto(style, size); |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool LayoutThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i
, const IntRect& rect) | 284 bool LayoutThemeChromiumDefault::paintButton(LayoutObject* o, const PaintInfo& i
, const IntRect& rect) |
| 285 { | 285 { |
| 286 WebThemeEngine::ExtraParams extraParams; | 286 WebThemeEngine::ExtraParams extraParams; |
| 287 WebCanvas* canvas = i.context->canvas(); | 287 WebCanvas* canvas = i.context->canvas(); |
| 288 extraParams.button.hasBorder = true; | 288 extraParams.button.hasBorder = true; |
| 289 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; | 289 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; |
| 290 if (o->hasBackground()) | 290 if (o->hasBackground()) |
| 291 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); | 291 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); |
| 292 | 292 |
| 293 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartButton
, getWebThemeState(this, o), WebRect(rect), &extraParams); | 293 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartButton
, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| 296 | 296 |
| 297 bool LayoutThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo
& i, const IntRect& rect) | 297 bool LayoutThemeChromiumDefault::paintTextField(LayoutObject* o, const PaintInfo
& i, const IntRect& rect) |
| 298 { | 298 { |
| 299 // WebThemeEngine does not handle border rounded corner and background image | 299 // WebThemeEngine does not handle border rounded corner and background image |
| 300 // so return true to draw CSS border and background. | 300 // so return true to draw CSS border and background. |
| 301 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) | 301 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) |
| 302 return true; | 302 return true; |
| 303 | 303 |
| 304 ControlPart part = o->style()->appearance(); | 304 ControlPart part = o->style()->appearance(); |
| 305 | 305 |
| 306 WebThemeEngine::ExtraParams extraParams; | 306 WebThemeEngine::ExtraParams extraParams; |
| 307 extraParams.textField.isTextArea = part == TextAreaPart; | 307 extraParams.textField.isTextArea = part == TextAreaPart; |
| 308 extraParams.textField.isListbox = part == ListboxPart; | 308 extraParams.textField.isListbox = part == ListboxPart; |
| 309 | 309 |
| 310 WebCanvas* canvas = i.context->canvas(); | 310 WebCanvas* canvas = i.context->canvas(); |
| 311 | 311 |
| 312 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); | 312 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 313 extraParams.textField.backgroundColor = backgroundColor.rgb(); | 313 extraParams.textField.backgroundColor = backgroundColor.rgb(); |
| 314 | 314 |
| 315 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartTextFi
eld, getWebThemeState(this, o), WebRect(rect), &extraParams); | 315 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartTextFi
eld, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 316 return false; | 316 return false; |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool LayoutThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo&
i, const IntRect& rect) | 319 bool LayoutThemeChromiumDefault::paintMenuList(LayoutObject* o, const PaintInfo&
i, const IntRect& rect) |
| 320 { | 320 { |
| 321 if (!o->isBox()) | 321 if (!o->isBox()) |
| 322 return false; | 322 return false; |
| 323 | 323 |
| 324 const int right = rect.x() + rect.width(); | 324 const int right = rect.x() + rect.width(); |
| 325 const int middle = rect.y() + rect.height() / 2; | 325 const int middle = rect.y() + rect.height() / 2; |
| 326 | 326 |
| 327 WebThemeEngine::ExtraParams extraParams; | 327 WebThemeEngine::ExtraParams extraParams; |
| 328 extraParams.menuList.arrowY = middle; | 328 extraParams.menuList.arrowY = middle; |
| 329 const RenderBox* box = toRenderBox(o); | 329 const RenderBox* box = toRenderBox(o); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 354 } else { | 354 } else { |
| 355 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; | 355 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 356 } | 356 } |
| 357 | 357 |
| 358 WebCanvas* canvas = i.context->canvas(); | 358 WebCanvas* canvas = i.context->canvas(); |
| 359 | 359 |
| 360 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); | 360 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool LayoutThemeChromiumDefault::paintMenuListButton(RenderObject* o, const Pain
tInfo& i, const IntRect& rect) | 364 bool LayoutThemeChromiumDefault::paintMenuListButton(LayoutObject* o, const Pain
tInfo& i, const IntRect& rect) |
| 365 { | 365 { |
| 366 if (!o->isBox()) | 366 if (!o->isBox()) |
| 367 return false; | 367 return false; |
| 368 | 368 |
| 369 const int right = rect.x() + rect.width(); | 369 const int right = rect.x() + rect.width(); |
| 370 const int middle = rect.y() + rect.height() / 2; | 370 const int middle = rect.y() + rect.height() / 2; |
| 371 | 371 |
| 372 WebThemeEngine::ExtraParams extraParams; | 372 WebThemeEngine::ExtraParams extraParams; |
| 373 extraParams.menuList.arrowY = middle; | 373 extraParams.menuList.arrowY = middle; |
| 374 extraParams.menuList.hasBorder = false; | 374 extraParams.menuList.hasBorder = false; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 388 } else { | 388 } else { |
| 389 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; | 389 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 390 } | 390 } |
| 391 | 391 |
| 392 WebCanvas* canvas = i.context->canvas(); | 392 WebCanvas* canvas = i.context->canvas(); |
| 393 | 393 |
| 394 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); | 394 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 395 return false; | 395 return false; |
| 396 } | 396 } |
| 397 | 397 |
| 398 bool LayoutThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 398 bool LayoutThemeChromiumDefault::paintSliderTrack(LayoutObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 399 { | 399 { |
| 400 WebThemeEngine::ExtraParams extraParams; | 400 WebThemeEngine::ExtraParams extraParams; |
| 401 WebCanvas* canvas = i.context->canvas(); | 401 WebCanvas* canvas = i.context->canvas(); |
| 402 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; | 402 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; |
| 403 | 403 |
| 404 paintSliderTicks(o, i, rect); | 404 paintSliderTicks(o, i, rect); |
| 405 | 405 |
| 406 // FIXME: Mock theme doesn't handle zoomed sliders. | 406 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 407 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 407 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 408 GraphicsContextStateSaver stateSaver(*i.context, false); | 408 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 409 IntRect unzoomedRect = rect; | 409 IntRect unzoomedRect = rect; |
| 410 if (zoomLevel != 1) { | 410 if (zoomLevel != 1) { |
| 411 stateSaver.save(); | 411 stateSaver.save(); |
| 412 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 412 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 413 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 413 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 414 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 414 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 415 i.context->scale(zoomLevel, zoomLevel); | 415 i.context->scale(zoomLevel, zoomLevel); |
| 416 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 416 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 417 } | 417 } |
| 418 | 418 |
| 419 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Track, getWebThemeState(this, o), WebRect(unzoomedRect), &extraParams); | 419 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Track, getWebThemeState(this, o), WebRect(unzoomedRect), &extraParams); |
| 420 | 420 |
| 421 return false; | 421 return false; |
| 422 } | 422 } |
| 423 | 423 |
| 424 bool LayoutThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 424 bool LayoutThemeChromiumDefault::paintSliderThumb(LayoutObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 425 { | 425 { |
| 426 WebThemeEngine::ExtraParams extraParams; | 426 WebThemeEngine::ExtraParams extraParams; |
| 427 WebCanvas* canvas = i.context->canvas(); | 427 WebCanvas* canvas = i.context->canvas(); |
| 428 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; | 428 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; |
| 429 extraParams.slider.inDrag = isPressed(o); | 429 extraParams.slider.inDrag = isPressed(o); |
| 430 | 430 |
| 431 // FIXME: Mock theme doesn't handle zoomed sliders. | 431 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 432 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 432 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 433 GraphicsContextStateSaver stateSaver(*i.context, false); | 433 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 434 IntRect unzoomedRect = rect; | 434 IntRect unzoomedRect = rect; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 446 } | 446 } |
| 447 | 447 |
| 448 void LayoutThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const | 448 void LayoutThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const |
| 449 { | 449 { |
| 450 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artInnerSpinButton); | 450 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artInnerSpinButton); |
| 451 | 451 |
| 452 style->setWidth(Length(size.width(), Fixed)); | 452 style->setWidth(Length(size.width(), Fixed)); |
| 453 style->setMinWidth(Length(size.width(), Fixed)); | 453 style->setMinWidth(Length(size.width(), Fixed)); |
| 454 } | 454 } |
| 455 | 455 |
| 456 bool LayoutThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const Pai
ntInfo& i, const IntRect& rect) | 456 bool LayoutThemeChromiumDefault::paintInnerSpinButton(LayoutObject* o, const Pai
ntInfo& i, const IntRect& rect) |
| 457 { | 457 { |
| 458 WebThemeEngine::ExtraParams extraParams; | 458 WebThemeEngine::ExtraParams extraParams; |
| 459 WebCanvas* canvas = i.context->canvas(); | 459 WebCanvas* canvas = i.context->canvas(); |
| 460 extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpControlS
tate); | 460 extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpControlS
tate); |
| 461 extraParams.innerSpin.readOnly = isReadOnlyControl(o); | 461 extraParams.innerSpin.readOnly = isReadOnlyControl(o); |
| 462 | 462 |
| 463 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartInnerS
pinButton, getWebThemeState(this, o), WebRect(rect), &extraParams); | 463 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartInnerS
pinButton, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 464 return false; | 464 return false; |
| 465 } | 465 } |
| 466 | 466 |
| 467 bool LayoutThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 467 bool LayoutThemeChromiumDefault::paintProgressBar(LayoutObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 468 { | 468 { |
| 469 if (!o->isProgress()) | 469 if (!o->isProgress()) |
| 470 return true; | 470 return true; |
| 471 | 471 |
| 472 RenderProgress* renderProgress = toRenderProgress(o); | 472 RenderProgress* renderProgress = toRenderProgress(o); |
| 473 IntRect valueRect = progressValueRectFor(renderProgress, rect); | 473 IntRect valueRect = progressValueRectFor(renderProgress, rect); |
| 474 | 474 |
| 475 WebThemeEngine::ExtraParams extraParams; | 475 WebThemeEngine::ExtraParams extraParams; |
| 476 extraParams.progressBar.determinate = renderProgress->isDeterminate(); | 476 extraParams.progressBar.determinate = renderProgress->isDeterminate(); |
| 477 extraParams.progressBar.valueRectX = valueRect.x(); | 477 extraParams.progressBar.valueRectX = valueRect.x(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 495 if (useMockTheme()) { | 495 if (useMockTheme()) { |
| 496 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. | 496 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. |
| 497 ControlPart part = style->appearance(); | 497 ControlPart part = style->appearance(); |
| 498 if (part == CheckboxPart || part == RadioPart) | 498 if (part == CheckboxPart || part == RadioPart) |
| 499 return style->effectiveZoom() != 1; | 499 return style->effectiveZoom() != 1; |
| 500 } | 500 } |
| 501 return LayoutTheme::shouldUseFallbackTheme(style); | 501 return LayoutTheme::shouldUseFallbackTheme(style); |
| 502 } | 502 } |
| 503 | 503 |
| 504 } // namespace blink | 504 } // namespace blink |
| OLD | NEW |