| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Color::black; | 52 Color::black; |
| 53 unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor = | 53 unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor = |
| 54 0xffc8c8c8; | 54 0xffc8c8c8; |
| 55 unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor = | 55 unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor = |
| 56 0xff323232; | 56 0xff323232; |
| 57 | 57 |
| 58 double RenderThemeChromiumDefault::m_caretBlinkInterval; | 58 double RenderThemeChromiumDefault::m_caretBlinkInterval; |
| 59 | 59 |
| 60 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; | 60 static const unsigned defaultButtonBackgroundColor = 0xffdddddd; |
| 61 | 61 |
| 62 static blink::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, c
onst RenderObject* o) | 62 static WebThemeEngine::State getWebThemeState(const RenderTheme* theme, const Re
nderObject* o) |
| 63 { | 63 { |
| 64 if (!theme->isEnabled(o)) | 64 if (!theme->isEnabled(o)) |
| 65 return blink::WebThemeEngine::StateDisabled; | 65 return WebThemeEngine::StateDisabled; |
| 66 if (useMockTheme() && theme->isReadOnlyControl(o)) | 66 if (useMockTheme() && theme->isReadOnlyControl(o)) |
| 67 return blink::WebThemeEngine::StateReadonly; | 67 return WebThemeEngine::StateReadonly; |
| 68 if (theme->isPressed(o)) | 68 if (theme->isPressed(o)) |
| 69 return blink::WebThemeEngine::StatePressed; | 69 return WebThemeEngine::StatePressed; |
| 70 if (useMockTheme() && theme->isFocused(o)) | 70 if (useMockTheme() && theme->isFocused(o)) |
| 71 return blink::WebThemeEngine::StateFocused; | 71 return WebThemeEngine::StateFocused; |
| 72 if (theme->isHovered(o)) | 72 if (theme->isHovered(o)) |
| 73 return blink::WebThemeEngine::StateHover; | 73 return WebThemeEngine::StateHover; |
| 74 | 74 |
| 75 return blink::WebThemeEngine::StateNormal; | 75 return WebThemeEngine::StateNormal; |
| 76 } | 76 } |
| 77 | 77 |
| 78 PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create() | 78 PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create() |
| 79 { | 79 { |
| 80 return adoptRef(new RenderThemeChromiumDefault()); | 80 return adoptRef(new RenderThemeChromiumDefault()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // RenderTheme::theme for Android is defined in RenderThemeChromiumAndroid.cpp. | 83 // RenderTheme::theme for Android is defined in RenderThemeChromiumAndroid.cpp. |
| 84 #if !OS(ANDROID) | 84 #if !OS(ANDROID) |
| 85 RenderTheme& RenderTheme::theme() | 85 RenderTheme& RenderTheme::theme() |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const | 200 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const |
| 201 { | 201 { |
| 202 if (useMockTheme()) | 202 if (useMockTheme()) |
| 203 return 11; | 203 return 11; |
| 204 return -16; | 204 return -16; |
| 205 } | 205 } |
| 206 | 206 |
| 207 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme
nt* element) const | 207 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme
nt* element) const |
| 208 { | 208 { |
| 209 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartSliderThumb); | 209 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artSliderThumb); |
| 210 | 210 |
| 211 // FIXME: Mock theme doesn't handle zoomed sliders. | 211 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 212 float zoomLevel = useMockTheme() ? 1 : style->effectiveZoom(); | 212 float zoomLevel = useMockTheme() ? 1 : style->effectiveZoom(); |
| 213 if (style->appearance() == SliderThumbHorizontalPart) { | 213 if (style->appearance() == SliderThumbHorizontalPart) { |
| 214 style->setWidth(Length(size.width() * zoomLevel, Fixed)); | 214 style->setWidth(Length(size.width() * zoomLevel, Fixed)); |
| 215 style->setHeight(Length(size.height() * zoomLevel, Fixed)); | 215 style->setHeight(Length(size.height() * zoomLevel, Fixed)); |
| 216 } else if (style->appearance() == SliderThumbVerticalPart) { | 216 } else if (style->appearance() == SliderThumbVerticalPart) { |
| 217 style->setWidth(Length(size.height() * zoomLevel, Fixed)); | 217 style->setWidth(Length(size.height() * zoomLevel, Fixed)); |
| 218 style->setHeight(Length(size.width() * zoomLevel, Fixed)); | 218 style->setHeight(Length(size.width() * zoomLevel, Fixed)); |
| 219 } else | 219 } else |
| (...skipping 17 matching lines...) Expand all Loading... |
| 237 unsigned inactiveForegroundColor) | 237 unsigned inactiveForegroundColor) |
| 238 { | 238 { |
| 239 m_activeSelectionBackgroundColor = activeBackgroundColor; | 239 m_activeSelectionBackgroundColor = activeBackgroundColor; |
| 240 m_activeSelectionForegroundColor = activeForegroundColor; | 240 m_activeSelectionForegroundColor = activeForegroundColor; |
| 241 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; | 241 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; |
| 242 m_inactiveSelectionForegroundColor = inactiveForegroundColor; | 242 m_inactiveSelectionForegroundColor = inactiveForegroundColor; |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool RenderThemeChromiumDefault::paintCheckbox(RenderObject* o, const PaintInfo&
i, const IntRect& rect) | 245 bool RenderThemeChromiumDefault::paintCheckbox(RenderObject* o, const PaintInfo&
i, const IntRect& rect) |
| 246 { | 246 { |
| 247 blink::WebThemeEngine::ExtraParams extraParams; | 247 WebThemeEngine::ExtraParams extraParams; |
| 248 blink::WebCanvas* canvas = i.context->canvas(); | 248 WebCanvas* canvas = i.context->canvas(); |
| 249 extraParams.button.checked = isChecked(o); | 249 extraParams.button.checked = isChecked(o); |
| 250 extraParams.button.indeterminate = isIndeterminate(o); | 250 extraParams.button.indeterminate = isIndeterminate(o); |
| 251 | 251 |
| 252 float zoomLevel = o->style()->effectiveZoom(); | 252 float zoomLevel = o->style()->effectiveZoom(); |
| 253 GraphicsContextStateSaver stateSaver(*i.context, false); | 253 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 254 IntRect unzoomedRect = rect; | 254 IntRect unzoomedRect = rect; |
| 255 if (zoomLevel != 1) { | 255 if (zoomLevel != 1) { |
| 256 stateSaver.save(); | 256 stateSaver.save(); |
| 257 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 257 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 258 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 258 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 259 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 259 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 260 i.context->scale(zoomLevel, zoomLevel); | 260 i.context->scale(zoomLevel, zoomLevel); |
| 261 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 261 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartCheckbox, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extr
aParams); | 264 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartCheckb
ox, getWebThemeState(this, o), WebRect(unzoomedRect), &extraParams); |
| 265 return false; | 265 return false; |
| 266 } | 266 } |
| 267 | 267 |
| 268 void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const | 268 void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const |
| 269 { | 269 { |
| 270 // If the width and height are both specified, then we have nothing to do. | 270 // If the width and height are both specified, then we have nothing to do. |
| 271 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 271 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartCheckbox); | 274 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artCheckbox); |
| 275 float zoomLevel = style->effectiveZoom(); | 275 float zoomLevel = style->effectiveZoom(); |
| 276 size.setWidth(size.width() * zoomLevel); | 276 size.setWidth(size.width() * zoomLevel); |
| 277 size.setHeight(size.height() * zoomLevel); | 277 size.setHeight(size.height() * zoomLevel); |
| 278 setSizeIfAuto(style, size); | 278 setSizeIfAuto(style, size); |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool RenderThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i,
const IntRect& rect) | 281 bool RenderThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i,
const IntRect& rect) |
| 282 { | 282 { |
| 283 blink::WebThemeEngine::ExtraParams extraParams; | 283 WebThemeEngine::ExtraParams extraParams; |
| 284 blink::WebCanvas* canvas = i.context->canvas(); | 284 WebCanvas* canvas = i.context->canvas(); |
| 285 extraParams.button.checked = isChecked(o); | 285 extraParams.button.checked = isChecked(o); |
| 286 | 286 |
| 287 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartRadio, getWebThemeState(this, o), blink::WebRect(rect), &extraParams); | 287 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartRadio,
getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 288 return false; | 288 return false; |
| 289 } | 289 } |
| 290 | 290 |
| 291 void RenderThemeChromiumDefault::setRadioSize(RenderStyle* style) const | 291 void RenderThemeChromiumDefault::setRadioSize(RenderStyle* style) const |
| 292 { | 292 { |
| 293 // If the width and height are both specified, then we have nothing to do. | 293 // If the width and height are both specified, then we have nothing to do. |
| 294 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 294 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 295 return; | 295 return; |
| 296 | 296 |
| 297 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartRadio); | 297 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artRadio); |
| 298 float zoomLevel = style->effectiveZoom(); | 298 float zoomLevel = style->effectiveZoom(); |
| 299 size.setWidth(size.width() * zoomLevel); | 299 size.setWidth(size.width() * zoomLevel); |
| 300 size.setHeight(size.height() * zoomLevel); | 300 size.setHeight(size.height() * zoomLevel); |
| 301 setSizeIfAuto(style, size); | 301 setSizeIfAuto(style, size); |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i
, const IntRect& rect) | 304 bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i
, const IntRect& rect) |
| 305 { | 305 { |
| 306 blink::WebThemeEngine::ExtraParams extraParams; | 306 WebThemeEngine::ExtraParams extraParams; |
| 307 blink::WebCanvas* canvas = i.context->canvas(); | 307 WebCanvas* canvas = i.context->canvas(); |
| 308 extraParams.button.hasBorder = true; | 308 extraParams.button.hasBorder = true; |
| 309 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; | 309 extraParams.button.backgroundColor = useMockTheme() ? 0xffc0c0c0 : defaultBu
ttonBackgroundColor; |
| 310 if (o->hasBackground()) | 310 if (o->hasBackground()) |
| 311 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); | 311 extraParams.button.backgroundColor = o->resolveColor(CSSPropertyBackgrou
ndColor).rgb(); |
| 312 | 312 |
| 313 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartButton, getWebThemeState(this, o), blink::WebRect(rect), &extraParams); | 313 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartButton
, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 314 return false; | 314 return false; |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo
& i, const IntRect& rect) | 317 bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo
& i, const IntRect& rect) |
| 318 { | 318 { |
| 319 // WebThemeEngine does not handle border rounded corner and background image | 319 // WebThemeEngine does not handle border rounded corner and background image |
| 320 // so return true to draw CSS border and background. | 320 // so return true to draw CSS border and background. |
| 321 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) | 321 if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) |
| 322 return true; | 322 return true; |
| 323 | 323 |
| 324 ControlPart part = o->style()->appearance(); | 324 ControlPart part = o->style()->appearance(); |
| 325 | 325 |
| 326 blink::WebThemeEngine::ExtraParams extraParams; | 326 WebThemeEngine::ExtraParams extraParams; |
| 327 extraParams.textField.isTextArea = part == TextAreaPart; | 327 extraParams.textField.isTextArea = part == TextAreaPart; |
| 328 extraParams.textField.isListbox = part == ListboxPart; | 328 extraParams.textField.isListbox = part == ListboxPart; |
| 329 | 329 |
| 330 blink::WebCanvas* canvas = i.context->canvas(); | 330 WebCanvas* canvas = i.context->canvas(); |
| 331 | 331 |
| 332 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); | 332 Color backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 333 extraParams.textField.backgroundColor = backgroundColor.rgb(); | 333 extraParams.textField.backgroundColor = backgroundColor.rgb(); |
| 334 | 334 |
| 335 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartTextField, getWebThemeState(this, o), blink::WebRect(rect), &extraParams
); | 335 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartTextFi
eld, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 336 return false; | 336 return false; |
| 337 } | 337 } |
| 338 | 338 |
| 339 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo&
i, const IntRect& rect) | 339 bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo&
i, const IntRect& rect) |
| 340 { | 340 { |
| 341 if (!o->isBox()) | 341 if (!o->isBox()) |
| 342 return false; | 342 return false; |
| 343 | 343 |
| 344 const int right = rect.x() + rect.width(); | 344 const int right = rect.x() + rect.width(); |
| 345 const int middle = rect.y() + rect.height() / 2; | 345 const int middle = rect.y() + rect.height() / 2; |
| 346 | 346 |
| 347 blink::WebThemeEngine::ExtraParams extraParams; | 347 WebThemeEngine::ExtraParams extraParams; |
| 348 extraParams.menuList.arrowY = middle; | 348 extraParams.menuList.arrowY = middle; |
| 349 const RenderBox* box = toRenderBox(o); | 349 const RenderBox* box = toRenderBox(o); |
| 350 // Match Chromium Win behaviour of showing all borders if any are shown. | 350 // Match Chromium Win behaviour of showing all borders if any are shown. |
| 351 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() ||
box->borderTop() || box->borderBottom(); | 351 extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() ||
box->borderTop() || box->borderBottom(); |
| 352 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); | 352 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); |
| 353 // Fallback to transparent if the specified color object is invalid. | 353 // Fallback to transparent if the specified color object is invalid. |
| 354 Color backgroundColor(Color::transparent); | 354 Color backgroundColor(Color::transparent); |
| 355 if (o->hasBackground()) | 355 if (o->hasBackground()) |
| 356 backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); | 356 backgroundColor = o->resolveColor(CSSPropertyBackgroundColor); |
| 357 extraParams.menuList.backgroundColor = backgroundColor.rgb(); | 357 extraParams.menuList.backgroundColor = backgroundColor.rgb(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 368 // the mock theme and the regular aura theme. | 368 // the mock theme and the regular aura theme. |
| 369 int spacingTop = box->borderTop() + box->paddingTop(); | 369 int spacingTop = box->borderTop() + box->paddingTop(); |
| 370 int spacingBottom = box->borderBottom() + box->paddingBottom(); | 370 int spacingBottom = box->borderBottom() + box->paddingBottom(); |
| 371 int spacingRight = box->borderRight() + box->paddingRight(); | 371 int spacingRight = box->borderRight() + box->paddingRight(); |
| 372 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; | 372 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; |
| 373 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; | 373 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; |
| 374 } else { | 374 } else { |
| 375 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; | 375 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 376 } | 376 } |
| 377 | 377 |
| 378 blink::WebCanvas* canvas = i.context->canvas(); | 378 WebCanvas* canvas = i.context->canvas(); |
| 379 | 379 |
| 380 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams)
; | 380 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 381 return false; | 381 return false; |
| 382 } | 382 } |
| 383 | 383 |
| 384 bool RenderThemeChromiumDefault::paintMenuListButton(RenderObject* o, const Pain
tInfo& i, const IntRect& rect) | 384 bool RenderThemeChromiumDefault::paintMenuListButton(RenderObject* o, const Pain
tInfo& i, const IntRect& rect) |
| 385 { | 385 { |
| 386 if (!o->isBox()) | 386 if (!o->isBox()) |
| 387 return false; | 387 return false; |
| 388 | 388 |
| 389 const int right = rect.x() + rect.width(); | 389 const int right = rect.x() + rect.width(); |
| 390 const int middle = rect.y() + rect.height() / 2; | 390 const int middle = rect.y() + rect.height() / 2; |
| 391 | 391 |
| 392 blink::WebThemeEngine::ExtraParams extraParams; | 392 WebThemeEngine::ExtraParams extraParams; |
| 393 extraParams.menuList.arrowY = middle; | 393 extraParams.menuList.arrowY = middle; |
| 394 extraParams.menuList.hasBorder = false; | 394 extraParams.menuList.hasBorder = false; |
| 395 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); | 395 extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius(); |
| 396 extraParams.menuList.backgroundColor = Color::transparent; | 396 extraParams.menuList.backgroundColor = Color::transparent; |
| 397 extraParams.menuList.fillContentArea = false; | 397 extraParams.menuList.fillContentArea = false; |
| 398 | 398 |
| 399 if (useMockTheme()) { | 399 if (useMockTheme()) { |
| 400 const RenderBox* box = toRenderBox(o); | 400 const RenderBox* box = toRenderBox(o); |
| 401 // The size and position of the drop-down button is different between | 401 // The size and position of the drop-down button is different between |
| 402 // the mock theme and the regular aura theme. | 402 // the mock theme and the regular aura theme. |
| 403 int spacingTop = box->borderTop() + box->paddingTop(); | 403 int spacingTop = box->borderTop() + box->paddingTop(); |
| 404 int spacingBottom = box->borderBottom() + box->paddingBottom(); | 404 int spacingBottom = box->borderBottom() + box->paddingBottom(); |
| 405 int spacingRight = box->borderRight() + box->paddingRight(); | 405 int spacingRight = box->borderRight() + box->paddingRight(); |
| 406 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; | 406 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 4 + spacingRight: right - 13 - spacingRight; |
| 407 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; | 407 extraParams.menuList.arrowHeight = rect.height() - spacingBottom - spaci
ngTop; |
| 408 } else { | 408 } else { |
| 409 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; | 409 extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x(
) + 7 : right - 13; |
| 410 } | 410 } |
| 411 | 411 |
| 412 blink::WebCanvas* canvas = i.context->canvas(); | 412 WebCanvas* canvas = i.context->canvas(); |
| 413 | 413 |
| 414 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartMenuList, getWebThemeState(this, o), blink::WebRect(rect), &extraParams)
; | 414 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartMenuLi
st, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 415 return false; | 415 return false; |
| 416 } | 416 } |
| 417 | 417 |
| 418 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 418 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 419 { | 419 { |
| 420 blink::WebThemeEngine::ExtraParams extraParams; | 420 WebThemeEngine::ExtraParams extraParams; |
| 421 blink::WebCanvas* canvas = i.context->canvas(); | 421 WebCanvas* canvas = i.context->canvas(); |
| 422 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; | 422 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart
; |
| 423 | 423 |
| 424 paintSliderTicks(o, i, rect); | 424 paintSliderTicks(o, i, rect); |
| 425 | 425 |
| 426 // FIXME: Mock theme doesn't handle zoomed sliders. | 426 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 427 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 427 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 428 GraphicsContextStateSaver stateSaver(*i.context, false); | 428 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 429 IntRect unzoomedRect = rect; | 429 IntRect unzoomedRect = rect; |
| 430 if (zoomLevel != 1) { | 430 if (zoomLevel != 1) { |
| 431 stateSaver.save(); | 431 stateSaver.save(); |
| 432 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 432 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 433 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 433 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 434 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 434 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 435 i.context->scale(zoomLevel, zoomLevel); | 435 i.context->scale(zoomLevel, zoomLevel); |
| 436 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 436 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 437 } | 437 } |
| 438 | 438 |
| 439 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); | 439 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Track, getWebThemeState(this, o), WebRect(unzoomedRect), &extraParams); |
| 440 | 440 |
| 441 return false; | 441 return false; |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 444 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 445 { | 445 { |
| 446 blink::WebThemeEngine::ExtraParams extraParams; | 446 WebThemeEngine::ExtraParams extraParams; |
| 447 blink::WebCanvas* canvas = i.context->canvas(); | 447 WebCanvas* canvas = i.context->canvas(); |
| 448 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; | 448 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; |
| 449 extraParams.slider.inDrag = isPressed(o); | 449 extraParams.slider.inDrag = isPressed(o); |
| 450 | 450 |
| 451 // FIXME: Mock theme doesn't handle zoomed sliders. | 451 // FIXME: Mock theme doesn't handle zoomed sliders. |
| 452 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 452 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
| 453 GraphicsContextStateSaver stateSaver(*i.context, false); | 453 GraphicsContextStateSaver stateSaver(*i.context, false); |
| 454 IntRect unzoomedRect = rect; | 454 IntRect unzoomedRect = rect; |
| 455 if (zoomLevel != 1) { | 455 if (zoomLevel != 1) { |
| 456 stateSaver.save(); | 456 stateSaver.save(); |
| 457 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 457 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
| 458 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 458 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
| 459 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 459 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 460 i.context->scale(zoomLevel, zoomLevel); | 460 i.context->scale(zoomLevel, zoomLevel); |
| 461 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 461 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 462 } | 462 } |
| 463 | 463 |
| 464 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderThumb, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); | 464 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartSlider
Thumb, getWebThemeState(this, o), WebRect(unzoomedRect), &extraParams); |
| 465 return false; | 465 return false; |
| 466 } | 466 } |
| 467 | 467 |
| 468 void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const | 468 void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const |
| 469 { | 469 { |
| 470 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartInnerSpinButton); | 470 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P
artInnerSpinButton); |
| 471 | 471 |
| 472 style->setWidth(Length(size.width(), Fixed)); | 472 style->setWidth(Length(size.width(), Fixed)); |
| 473 style->setMinWidth(Length(size.width(), Fixed)); | 473 style->setMinWidth(Length(size.width(), Fixed)); |
| 474 } | 474 } |
| 475 | 475 |
| 476 bool RenderThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const Pai
ntInfo& i, const IntRect& rect) | 476 bool RenderThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const Pai
ntInfo& i, const IntRect& rect) |
| 477 { | 477 { |
| 478 blink::WebThemeEngine::ExtraParams extraParams; | 478 WebThemeEngine::ExtraParams extraParams; |
| 479 blink::WebCanvas* canvas = i.context->canvas(); | 479 WebCanvas* canvas = i.context->canvas(); |
| 480 extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpControlS
tate); | 480 extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpControlS
tate); |
| 481 extraParams.innerSpin.readOnly = isReadOnlyControl(o); | 481 extraParams.innerSpin.readOnly = isReadOnlyControl(o); |
| 482 | 482 |
| 483 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartInnerSpinButton, getWebThemeState(this, o), blink::WebRect(rect), &extra
Params); | 483 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartInnerS
pinButton, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 484 return false; | 484 return false; |
| 485 } | 485 } |
| 486 | 486 |
| 487 bool RenderThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 487 bool RenderThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
| 488 { | 488 { |
| 489 if (!o->isProgress()) | 489 if (!o->isProgress()) |
| 490 return true; | 490 return true; |
| 491 | 491 |
| 492 RenderProgress* renderProgress = toRenderProgress(o); | 492 RenderProgress* renderProgress = toRenderProgress(o); |
| 493 IntRect valueRect = progressValueRectFor(renderProgress, rect); | 493 IntRect valueRect = progressValueRectFor(renderProgress, rect); |
| 494 | 494 |
| 495 blink::WebThemeEngine::ExtraParams extraParams; | 495 WebThemeEngine::ExtraParams extraParams; |
| 496 extraParams.progressBar.determinate = renderProgress->isDeterminate(); | 496 extraParams.progressBar.determinate = renderProgress->isDeterminate(); |
| 497 extraParams.progressBar.valueRectX = valueRect.x(); | 497 extraParams.progressBar.valueRectX = valueRect.x(); |
| 498 extraParams.progressBar.valueRectY = valueRect.y(); | 498 extraParams.progressBar.valueRectY = valueRect.y(); |
| 499 extraParams.progressBar.valueRectWidth = valueRect.width(); | 499 extraParams.progressBar.valueRectWidth = valueRect.width(); |
| 500 extraParams.progressBar.valueRectHeight = valueRect.height(); | 500 extraParams.progressBar.valueRectHeight = valueRect.height(); |
| 501 | 501 |
| 502 DirectionFlippingScope scope(o, i, rect); | 502 DirectionFlippingScope scope(o, i, rect); |
| 503 blink::WebCanvas* canvas = i.context->canvas(); | 503 WebCanvas* canvas = i.context->canvas(); |
| 504 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartProgressBar, getWebThemeState(this, o), blink::WebRect(rect), &extraPara
ms); | 504 Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartProgre
ssBar, getWebThemeState(this, o), WebRect(rect), &extraParams); |
| 505 return false; | 505 return false; |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const | 508 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const |
| 509 { | 509 { |
| 510 return true; | 510 return true; |
| 511 } | 511 } |
| 512 | 512 |
| 513 bool RenderThemeChromiumDefault::shouldUseFallbackTheme(RenderStyle* style) cons
t | 513 bool RenderThemeChromiumDefault::shouldUseFallbackTheme(RenderStyle* style) cons
t |
| 514 { | 514 { |
| 515 if (useMockTheme()) { | 515 if (useMockTheme()) { |
| 516 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. | 516 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. |
| 517 ControlPart part = style->appearance(); | 517 ControlPart part = style->appearance(); |
| 518 if (part == CheckboxPart || part == RadioPart) | 518 if (part == CheckboxPart || part == RadioPart) |
| 519 return style->effectiveZoom() != 1; | 519 return style->effectiveZoom() != 1; |
| 520 } | 520 } |
| 521 return RenderTheme::shouldUseFallbackTheme(style); | 521 return RenderTheme::shouldUseFallbackTheme(style); |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace blink | 524 } // namespace blink |
| OLD | NEW |