| OLD | NEW |
| 1 /** | 1 /** |
| 2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
| 3 * | 3 * |
| 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "core/html/HTMLInputElement.h" | 28 #include "core/html/HTMLInputElement.h" |
| 29 #include "core/html/HTMLOptionElement.h" | 29 #include "core/html/HTMLOptionElement.h" |
| 30 #include "core/html/parser/HTMLParserIdioms.h" | 30 #include "core/html/parser/HTMLParserIdioms.h" |
| 31 #include "core/html/shadow/ShadowElementNames.h" | 31 #include "core/html/shadow/ShadowElementNames.h" |
| 32 #include "core/layout/LayoutMeter.h" | 32 #include "core/layout/LayoutMeter.h" |
| 33 #include "core/layout/LayoutTheme.h" | 33 #include "core/layout/LayoutTheme.h" |
| 34 #include "core/layout/LayoutView.h" | 34 #include "core/layout/LayoutView.h" |
| 35 #include "core/paint/MediaControlsPainter.h" | 35 #include "core/paint/MediaControlsPainter.h" |
| 36 #include "core/paint/PaintInfo.h" | 36 #include "core/paint/PaintInfo.h" |
| 37 #include "core/style/ComputedStyle.h" | 37 #include "core/style/ComputedStyle.h" |
| 38 #include "platform/Theme.h" |
| 38 #include "platform/graphics/GraphicsContextStateSaver.h" | 39 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 39 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
| 40 #include "public/platform/WebFallbackThemeEngine.h" | 41 #include "public/platform/WebFallbackThemeEngine.h" |
| 41 #include "public/platform/WebRect.h" | 42 #include "public/platform/WebRect.h" |
| 42 | 43 |
| 43 #if USE(NEW_THEME) | |
| 44 #include "platform/Theme.h" | |
| 45 #endif | |
| 46 | |
| 47 // The methods in this file are shared by all themes on every platform. | 44 // The methods in this file are shared by all themes on every platform. |
| 48 | 45 |
| 49 namespace blink { | 46 namespace blink { |
| 50 | 47 |
| 51 static WebFallbackThemeEngine::State getWebFallbackThemeState(const LayoutObject
& o) | 48 static WebFallbackThemeEngine::State getWebFallbackThemeState(const LayoutObject
& o) |
| 52 { | 49 { |
| 53 if (!LayoutTheme::isEnabled(o)) | 50 if (!LayoutTheme::isEnabled(o)) |
| 54 return WebFallbackThemeEngine::StateDisabled; | 51 return WebFallbackThemeEngine::StateDisabled; |
| 55 if (LayoutTheme::isPressed(o)) | 52 if (LayoutTheme::isPressed(o)) |
| 56 return WebFallbackThemeEngine::StatePressed; | 53 return WebFallbackThemeEngine::StatePressed; |
| 57 if (LayoutTheme::isHovered(o)) | 54 if (LayoutTheme::isHovered(o)) |
| 58 return WebFallbackThemeEngine::StateHover; | 55 return WebFallbackThemeEngine::StateHover; |
| 59 | 56 |
| 60 return WebFallbackThemeEngine::StateNormal; | 57 return WebFallbackThemeEngine::StateNormal; |
| 61 } | 58 } |
| 62 | 59 |
| 60 ThemePainter::ThemePainter(Theme* platformTheme) |
| 61 : m_platformTheme(platformTheme) |
| 62 { |
| 63 } |
| 64 |
| 63 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons
t IntRect&r) | 65 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons
t IntRect&r) |
| 64 { | 66 { |
| 65 ControlPart part = o.styleRef().appearance(); | 67 ControlPart part = o.styleRef().appearance(); |
| 66 | 68 |
| 67 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef())) | 69 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef())) |
| 68 return paintUsingFallbackTheme(o, paintInfo, r); | 70 return paintUsingFallbackTheme(o, paintInfo, r); |
| 69 | 71 |
| 70 #if USE(NEW_THEME) | 72 if (m_platformTheme) { |
| 71 switch (part) { | 73 switch (part) { |
| 72 case CheckboxPart: | 74 case CheckboxPart: |
| 73 case RadioPart: | 75 case RadioPart: |
| 74 case PushButtonPart: | 76 case PushButtonPart: |
| 75 case SquareButtonPart: | 77 case SquareButtonPart: |
| 76 case ButtonPart: | 78 case ButtonPart: |
| 77 case InnerSpinButtonPart: | 79 case InnerSpinButtonPart: |
| 78 platformTheme()->paint(part, LayoutTheme::controlStatesForLayoutObject(o
), const_cast<GraphicsContext&>(paintInfo.context), r, o.styleRef().effectiveZoo
m(), o.view()->frameView()); | 80 m_platformTheme->paint(part, LayoutTheme::controlStatesForLayoutObje
ct(o), const_cast<GraphicsContext&>(paintInfo.context), r, o.styleRef().effectiv
eZoom(), o.view()->frameView()); |
| 79 return false; | 81 return false; |
| 80 default: | 82 default: |
| 81 break; | 83 break; |
| 84 } |
| 82 } | 85 } |
| 83 #endif | |
| 84 | 86 |
| 85 // Call the appropriate paint method based off the appearance value. | 87 // Call the appropriate paint method based off the appearance value. |
| 86 switch (part) { | 88 switch (part) { |
| 87 #if !USE(NEW_THEME) | |
| 88 case CheckboxPart: | 89 case CheckboxPart: |
| 89 return paintCheckbox(o, paintInfo, r); | 90 return paintCheckbox(o, paintInfo, r); |
| 90 case RadioPart: | 91 case RadioPart: |
| 91 return paintRadio(o, paintInfo, r); | 92 return paintRadio(o, paintInfo, r); |
| 92 case PushButtonPart: | 93 case PushButtonPart: |
| 93 case SquareButtonPart: | 94 case SquareButtonPart: |
| 94 case ButtonPart: | 95 case ButtonPart: |
| 95 return paintButton(o, paintInfo, r); | 96 return paintButton(o, paintInfo, r); |
| 96 case InnerSpinButtonPart: | 97 case InnerSpinButtonPart: |
| 97 return paintInnerSpinButton(o, paintInfo, r); | 98 return paintInnerSpinButton(o, paintInfo, r); |
| 98 #endif | |
| 99 case MenulistPart: | 99 case MenulistPart: |
| 100 return paintMenuList(o, paintInfo, r); | 100 return paintMenuList(o, paintInfo, r); |
| 101 case MeterPart: | 101 case MeterPart: |
| 102 case RelevancyLevelIndicatorPart: | 102 case RelevancyLevelIndicatorPart: |
| 103 case ContinuousCapacityLevelIndicatorPart: | 103 case ContinuousCapacityLevelIndicatorPart: |
| 104 case DiscreteCapacityLevelIndicatorPart: | 104 case DiscreteCapacityLevelIndicatorPart: |
| 105 case RatingLevelIndicatorPart: | 105 case RatingLevelIndicatorPart: |
| 106 return paintMeter(o, paintInfo, r); | 106 return paintMeter(o, paintInfo, r); |
| 107 case ProgressBarPart: | 107 case ProgressBarPart: |
| 108 return paintProgressBar(o, paintInfo, r); | 108 return paintProgressBar(o, paintInfo, r); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 i.context.translate(unzoomedRect.x(), unzoomedRect.y()); | 369 i.context.translate(unzoomedRect.x(), unzoomedRect.y()); |
| 370 i.context.scale(zoomLevel, zoomLevel); | 370 i.context.scale(zoomLevel, zoomLevel); |
| 371 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y()); | 371 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 372 } | 372 } |
| 373 | 373 |
| 374 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn
gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam
s); | 374 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn
gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam
s); |
| 375 return false; | 375 return false; |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |