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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 extraParams.button.indeterminate = isIndeterminate(o); | 252 extraParams.button.indeterminate = isIndeterminate(o); |
253 | 253 |
254 float zoomLevel = o->style()->effectiveZoom(); | 254 float zoomLevel = o->style()->effectiveZoom(); |
255 GraphicsContextStateSaver stateSaver(*i.context, false); | 255 GraphicsContextStateSaver stateSaver(*i.context, false); |
256 IntRect unzoomedRect = rect; | 256 IntRect unzoomedRect = rect; |
257 if (zoomLevel != 1) { | 257 if (zoomLevel != 1) { |
258 stateSaver.save(); | 258 stateSaver.save(); |
259 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 259 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
260 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 260 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
261 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 261 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
262 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 262 i.context->scale(zoomLevel, zoomLevel); |
263 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 263 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
264 } | 264 } |
265 | 265 |
266 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartCheckbox, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extr
aParams); | 266 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartCheckbox, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &extr
aParams); |
267 return false; | 267 return false; |
268 } | 268 } |
269 | 269 |
270 void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const | 270 void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const |
271 { | 271 { |
272 // If the width and height are both specified, then we have nothing to do. | 272 // If the width and height are both specified, then we have nothing to do. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 // FIXME: Mock theme doesn't handle zoomed sliders. | 436 // FIXME: Mock theme doesn't handle zoomed sliders. |
437 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 437 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
438 GraphicsContextStateSaver stateSaver(*i.context, false); | 438 GraphicsContextStateSaver stateSaver(*i.context, false); |
439 IntRect unzoomedRect = rect; | 439 IntRect unzoomedRect = rect; |
440 if (zoomLevel != 1) { | 440 if (zoomLevel != 1) { |
441 stateSaver.save(); | 441 stateSaver.save(); |
442 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 442 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
443 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 443 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
444 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 444 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
445 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 445 i.context->scale(zoomLevel, zoomLevel); |
446 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 446 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
447 } | 447 } |
448 | 448 |
449 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); | 449 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderTrack, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); |
450 | 450 |
451 return false; | 451 return false; |
452 } | 452 } |
453 | 453 |
454 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) | 454 bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintIn
fo& i, const IntRect& rect) |
455 { | 455 { |
456 if (i.context->paintingDisabled()) | 456 if (i.context->paintingDisabled()) |
457 return false; | 457 return false; |
458 blink::WebThemeEngine::ExtraParams extraParams; | 458 blink::WebThemeEngine::ExtraParams extraParams; |
459 blink::WebCanvas* canvas = i.context->canvas(); | 459 blink::WebCanvas* canvas = i.context->canvas(); |
460 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; | 460 extraParams.slider.vertical = o->style()->appearance() == SliderThumbVertica
lPart; |
461 extraParams.slider.inDrag = isPressed(o); | 461 extraParams.slider.inDrag = isPressed(o); |
462 | 462 |
463 // FIXME: Mock theme doesn't handle zoomed sliders. | 463 // FIXME: Mock theme doesn't handle zoomed sliders. |
464 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); | 464 float zoomLevel = useMockTheme() ? 1 : o->style()->effectiveZoom(); |
465 GraphicsContextStateSaver stateSaver(*i.context, false); | 465 GraphicsContextStateSaver stateSaver(*i.context, false); |
466 IntRect unzoomedRect = rect; | 466 IntRect unzoomedRect = rect; |
467 if (zoomLevel != 1) { | 467 if (zoomLevel != 1) { |
468 stateSaver.save(); | 468 stateSaver.save(); |
469 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 469 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
470 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 470 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
471 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 471 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
472 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 472 i.context->scale(zoomLevel, zoomLevel); |
473 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 473 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
474 } | 474 } |
475 | 475 |
476 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderThumb, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); | 476 blink::Platform::current()->themeEngine()->paint(canvas, blink::WebThemeEngi
ne::PartSliderThumb, getWebThemeState(this, o), blink::WebRect(unzoomedRect), &e
xtraParams); |
477 return false; | 477 return false; |
478 } | 478 } |
479 | 479 |
480 void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const | 480 void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(RenderStyle* style,
Element*) const |
481 { | 481 { |
482 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartInnerSpinButton); | 482 IntSize size = blink::Platform::current()->themeEngine()->getSize(blink::Web
ThemeEngine::PartInnerSpinButton); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 if (useMockTheme()) { | 531 if (useMockTheme()) { |
532 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. | 532 // The mock theme can't handle zoomed controls, so we fall back to the "
fallback" theme. |
533 ControlPart part = style->appearance(); | 533 ControlPart part = style->appearance(); |
534 if (part == CheckboxPart || part == RadioPart) | 534 if (part == CheckboxPart || part == RadioPart) |
535 return style->effectiveZoom() != 1; | 535 return style->effectiveZoom() != 1; |
536 } | 536 } |
537 return RenderTheme::shouldUseFallbackTheme(style); | 537 return RenderTheme::shouldUseFallbackTheme(style); |
538 } | 538 } |
539 | 539 |
540 } // namespace WebCore | 540 } // namespace WebCore |
OLD | NEW |