| Differences between
and this patch
- Source/WebCore/ChangeLog +39 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2012-09-26  Mark Pilgrim  <pilgrim@chromium.org>
2
3
        [Chromium] Move UNIX-specific theme functions out of PlatformSupport
4
        https://bugs.webkit.org/show_bug.cgi?id=96516
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Call WebThemeEngine functions and use WebThemeEngine enums
9
        directly from the new Platform/ directly; remove all intermediate
10
        functions and enums and conversion functions from PlatformSupport.
11
        Part of a refactoring series; see tracking bug 82948.
12
13
        * WebCore.gyp/WebCore.gyp:
14
        * platform/chromium/PlatformSupport.h:
15
        (PlatformSupport):
16
        * platform/chromium/ScrollbarThemeChromiumLinux.cpp:
17
        (WebCore::ScrollbarThemeChromiumLinux::scrollbarThickness):
18
        (WebCore::ScrollbarThemeChromiumLinux::paintTrackPiece):
19
        (WebCore::ScrollbarThemeChromiumLinux::paintButton):
20
        (WebCore::ScrollbarThemeChromiumLinux::paintThumb):
21
        (WebCore::ScrollbarThemeChromiumLinux::buttonSize):
22
        (WebCore::ScrollbarThemeChromiumLinux::minimumThumbLength):
23
        * rendering/RenderThemeChromiumLinux.cpp:
24
        (WebCore::getWebThemeState):
25
        (WebCore):
26
        (WebCore::RenderThemeChromiumLinux::adjustSliderThumbSize):
27
        (WebCore::RenderThemeChromiumLinux::paintCheckbox):
28
        (WebCore::RenderThemeChromiumLinux::setCheckboxSize):
29
        (WebCore::RenderThemeChromiumLinux::paintRadio):
30
        (WebCore::RenderThemeChromiumLinux::setRadioSize):
31
        (WebCore::RenderThemeChromiumLinux::paintButton):
32
        (WebCore::RenderThemeChromiumLinux::paintTextField):
33
        (WebCore::RenderThemeChromiumLinux::paintMenuList):
34
        (WebCore::RenderThemeChromiumLinux::paintSliderTrack):
35
        (WebCore::RenderThemeChromiumLinux::paintSliderThumb):
36
        (WebCore::RenderThemeChromiumLinux::adjustInnerSpinButtonStyle):
37
        (WebCore::RenderThemeChromiumLinux::paintInnerSpinButton):
38
        (WebCore::RenderThemeChromiumLinux::paintProgressBar):
39
1
2012-09-26  Christophe Dumez  <christophe.dumez@intel.com>
40
2012-09-26  Christophe Dumez  <christophe.dumez@intel.com>
2
41
3
        [EFL] Volume button should not be shown for videos without audio
42
        [EFL] Volume button should not be shown for videos without audio
- Source/WebCore/WebCore.gyp/WebCore.gyp +3 lines
Lines 1950-1955 Source/WebCore/WebCore.gyp/WebCore.gyp_sec1
1950
      'dependencies': [
1950
      'dependencies': [
1951
        'webcore_prerequisites',
1951
        'webcore_prerequisites',
1952
      ],
1952
      ],
1953
      'defines': [
1954
        'WEBKIT_IMPLEMENTATION=1',
1955
      ],
1953
      'sources': [
1956
      'sources': [
1954
        '<@(webcore_privateheader_files)',
1957
        '<@(webcore_privateheader_files)',
1955
        '<@(webcore_files)',
1958
        '<@(webcore_files)',
- Source/WebCore/platform/chromium/PlatformSupport.h -97 lines
Lines 151-253 public: Source/WebCore/platform/chromium/PlatformSupport.h_sec1
151
    };
151
    };
152
152
153
    static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
153
    static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
154
#elif OS(UNIX)
155
    // The UI part which is being accessed.
156
    enum ThemePart {
157
        // ScrollbarTheme parts
158
        PartScrollbarDownArrow,
159
        PartScrollbarLeftArrow,
160
        PartScrollbarRightArrow,
161
        PartScrollbarUpArrow,
162
        PartScrollbarHorizontalThumb,
163
        PartScrollbarVerticalThumb,
164
        PartScrollbarHorizontalTrack,
165
        PartScrollbarVerticalTrack,
166
167
        // RenderTheme parts
168
        PartCheckbox,
169
        PartRadio,
170
        PartButton,
171
        PartTextField,
172
        PartMenuList,
173
        PartSliderTrack,
174
        PartSliderThumb,
175
        PartInnerSpinButton,
176
        PartProgressBar
177
    };
178
179
    // The current state of the associated Part.
180
    enum ThemePaintState {
181
        StateDisabled,
182
        StateHover,
183
        StateNormal,
184
        StatePressed
185
    };
186
187
    struct ScrollbarTrackExtraParams {
188
        // The bounds of the entire track, as opposed to the part being painted.
189
        int trackX;
190
        int trackY;
191
        int trackWidth;
192
        int trackHeight;
193
    };
194
195
    struct ButtonExtraParams {
196
        bool checked;
197
        bool indeterminate; // Whether the button state is indeterminate.
198
        bool isDefault; // Whether the button is default button.
199
        bool hasBorder;
200
        unsigned backgroundColor;
201
    };
202
203
    struct TextFieldExtraParams {
204
        bool isTextArea;
205
        bool isListbox;
206
        unsigned backgroundColor;
207
    };
208
209
    struct MenuListExtraParams {
210
        bool hasBorder;
211
        bool hasBorderRadius;
212
        int arrowX;
213
        int arrowY;
214
        unsigned backgroundColor;
215
    };
216
217
    struct SliderExtraParams {
218
        bool vertical;
219
        bool inDrag;
220
    };
221
222
    struct InnerSpinButtonExtraParams {
223
        bool spinUp;
224
        bool readOnly;
225
    };
226
227
    struct ProgressBarExtraParams {
228
        bool determinate;
229
        int valueRectX;
230
        int valueRectY;
231
        int valueRectWidth;
232
        int valueRectHeight;
233
    };
234
235
    union ThemePaintExtraParams {
236
        ScrollbarTrackExtraParams scrollbarTrack;
237
        ButtonExtraParams button;
238
        TextFieldExtraParams textField;
239
        MenuListExtraParams menuList;
240
        SliderExtraParams slider;
241
        InnerSpinButtonExtraParams innerSpin;
242
        ProgressBarExtraParams progressBar;
243
    };
244
245
    // Gets the size of the given theme part. For variable sized items
246
    // like vertical scrollbar thumbs, the width will be the required width of
247
    // the track while the height will be the minimum height.
248
    static IntSize getThemePartSize(ThemePart);
249
    // Paint the given the given theme part.
250
    static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*);
251
#endif
154
#endif
252
};
155
};
253
156
- Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp -31 / +42 lines
Lines 31-40 Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp_sec1
31
#include "config.h"
31
#include "config.h"
32
#include "ScrollbarThemeChromiumLinux.h"
32
#include "ScrollbarThemeChromiumLinux.h"
33
33
34
#include "PlatformSupport.h"
34
#include "PlatformContextSkia.h"
35
#include "PlatformMouseEvent.h"
35
#include "PlatformMouseEvent.h"
36
#include "Scrollbar.h"
36
#include "Scrollbar.h"
37
37
38
#include <public/Platform.h>
39
#include <public/WebRect.h>
40
#include <public/linux/WebThemeEngine.h>
41
38
namespace WebCore {
42
namespace WebCore {
39
43
40
ScrollbarTheme* ScrollbarTheme::nativeTheme()
44
ScrollbarTheme* ScrollbarTheme::nativeTheme()
Lines 46-122 ScrollbarTheme* ScrollbarTheme::nativeTh Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp_sec2
46
int ScrollbarThemeChromiumLinux::scrollbarThickness(ScrollbarControlSize controlSize)
50
int ScrollbarThemeChromiumLinux::scrollbarThickness(ScrollbarControlSize controlSize)
47
{
51
{
48
    // Horiz and Vert scrollbars are the same thickness.
52
    // Horiz and Vert scrollbars are the same thickness.
49
    IntSize scrollbarSize = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarVerticalTrack);
53
    IntSize scrollbarSize = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarVerticalTrack);
50
    return scrollbarSize.width();
54
    return scrollbarSize.width();
51
}
55
}
52
56
53
void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType)
57
void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType)
54
{
58
{
55
    PlatformSupport::ThemePaintState state = scrollbar->hoveredPart() == partType ? PlatformSupport::StateHover : PlatformSupport::StateNormal;
59
    WebKit::WebThemeEngine::State state = scrollbar->hoveredPart() == partType ? WebKit::WebThemeEngine::StateHover : WebKit::WebThemeEngine::StateNormal;
56
    IntRect alignRect = trackRect(scrollbar, false);
60
    IntRect alignRect = trackRect(scrollbar, false);
57
    PlatformSupport::ThemePaintExtraParams extraParams;
61
    WebKit::WebThemeEngine::ExtraParams extraParams;
62
    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
58
    extraParams.scrollbarTrack.trackX = alignRect.x();
63
    extraParams.scrollbarTrack.trackX = alignRect.x();
59
    extraParams.scrollbarTrack.trackY = alignRect.y();
64
    extraParams.scrollbarTrack.trackY = alignRect.y();
60
    extraParams.scrollbarTrack.trackWidth = alignRect.width();
65
    extraParams.scrollbarTrack.trackWidth = alignRect.width();
61
    extraParams.scrollbarTrack.trackHeight = alignRect.height();
66
    extraParams.scrollbarTrack.trackHeight = alignRect.height();
62
    PlatformSupport::paintThemePart(
67
    WebKit::Platform::current()->themeEngine()->paint(
63
        gc,
68
        canvas,
64
        scrollbar->orientation() == HorizontalScrollbar ? PlatformSupport::PartScrollbarHorizontalTrack : PlatformSupport::PartScrollbarVerticalTrack,
69
        scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::PartScrollbarHorizontalTrack : WebKit::WebThemeEngine::PartScrollbarVerticalTrack,
65
        state,
70
        state,
66
        rect,
71
        WebKit::WebRect(rect),
67
        &extraParams);
72
        &extraParams);
68
}
73
}
69
74
70
void ScrollbarThemeChromiumLinux::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part)
75
void ScrollbarThemeChromiumLinux::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part)
71
{
76
{
72
    PlatformSupport::ThemePart paintPart;
77
    WebKit::WebThemeEngine::Part paintPart;
73
    PlatformSupport::ThemePaintState state = PlatformSupport::StateNormal;
78
    WebKit::WebThemeEngine::State state = WebKit::WebThemeEngine::StateNormal;
79
    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
74
    bool checkMin = false;
80
    bool checkMin = false;
75
    bool checkMax = false;
81
    bool checkMax = false;
76
    if (scrollbar->orientation() == HorizontalScrollbar) {
82
    if (scrollbar->orientation() == HorizontalScrollbar) {
77
        if (part == BackButtonStartPart) {
83
        if (part == BackButtonStartPart) {
78
            paintPart = PlatformSupport::PartScrollbarLeftArrow;
84
            paintPart = WebKit::WebThemeEngine::PartScrollbarLeftArrow;
79
            checkMin = true;
85
            checkMin = true;
80
        } else {
86
        } else {
81
            paintPart = PlatformSupport::PartScrollbarRightArrow;
87
            paintPart = WebKit::WebThemeEngine::PartScrollbarRightArrow;
82
            checkMax = true;
88
            checkMax = true;
83
        }
89
        }
84
    } else {
90
    } else {
85
        if (part == BackButtonStartPart) {
91
        if (part == BackButtonStartPart) {
86
            paintPart = PlatformSupport::PartScrollbarUpArrow;
92
            paintPart = WebKit::WebThemeEngine::PartScrollbarUpArrow;
87
            checkMin = true;
93
            checkMin = true;
88
        } else {
94
        } else {
89
            paintPart = PlatformSupport::PartScrollbarDownArrow;
95
            paintPart = WebKit::WebThemeEngine::PartScrollbarDownArrow;
90
            checkMax = true;
96
            checkMax = true;
91
        }
97
        }
92
    }
98
    }
93
    if ((checkMin && (scrollbar->currentPos() <= 0))
99
    if ((checkMin && (scrollbar->currentPos() <= 0))
94
        || (checkMax && scrollbar->currentPos() == scrollbar->maximum())) {
100
        || (checkMax && scrollbar->currentPos() == scrollbar->maximum())) {
95
        state = PlatformSupport::StateDisabled;
101
        state = WebKit::WebThemeEngine::StateDisabled;
96
    } else {
102
    } else {
97
        if (part == scrollbar->pressedPart())
103
        if (part == scrollbar->pressedPart())
98
            state = PlatformSupport::StatePressed;
104
            state = WebKit::WebThemeEngine::StatePressed;
99
        else if (part == scrollbar->hoveredPart())
105
        else if (part == scrollbar->hoveredPart())
100
            state = PlatformSupport::StateHover;
106
            state = WebKit::WebThemeEngine::StateHover;
101
    }
107
    }
102
    PlatformSupport::paintThemePart(gc, paintPart, state, rect, 0);
108
    WebKit::Platform::current()->themeEngine()->paint(
109
        canvas,
110
        paintPart,
111
        state,
112
        WebKit::WebRect(rect),
113
        0);
103
}
114
}
104
115
105
void ScrollbarThemeChromiumLinux::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect)
116
void ScrollbarThemeChromiumLinux::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect)
106
{
117
{
107
    PlatformSupport::ThemePaintState state;
118
    WebKit::WebThemeEngine::State state;
108
119
    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
109
    if (scrollbar->pressedPart() == ThumbPart)
120
    if (scrollbar->pressedPart() == ThumbPart)
110
        state = PlatformSupport::StatePressed;
121
        state = WebKit::WebThemeEngine::StatePressed;
111
    else if (scrollbar->hoveredPart() == ThumbPart)
122
    else if (scrollbar->hoveredPart() == ThumbPart)
112
        state = PlatformSupport::StateHover;
123
        state = WebKit::WebThemeEngine::StateHover;
113
    else
124
    else
114
        state = PlatformSupport::StateNormal;
125
        state = WebKit::WebThemeEngine::StateNormal;
115
    PlatformSupport::paintThemePart(
126
    WebKit::Platform::current()->themeEngine()->paint(
116
        gc,
127
        canvas,
117
        scrollbar->orientation() == HorizontalScrollbar ? PlatformSupport::PartScrollbarHorizontalThumb : PlatformSupport::PartScrollbarVerticalThumb,
128
        scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::PartScrollbarHorizontalThumb : WebKit::WebThemeEngine::PartScrollbarVerticalThumb,
118
        state,
129
        state,
119
        rect,
130
        WebKit::WebRect(rect),
120
        0);
131
        0);
121
}
132
}
122
133
Lines 128-150 bool ScrollbarThemeChromiumLinux::should Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp_sec3
128
IntSize ScrollbarThemeChromiumLinux::buttonSize(ScrollbarThemeClient* scrollbar)
139
IntSize ScrollbarThemeChromiumLinux::buttonSize(ScrollbarThemeClient* scrollbar)
129
{
140
{
130
    if (scrollbar->orientation() == VerticalScrollbar) {
141
    if (scrollbar->orientation() == VerticalScrollbar) {
131
        IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarUpArrow);
142
        IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarUpArrow);
132
        return IntSize(size.width(), scrollbar->height() < 2 * size.height() ? scrollbar->height() / 2 : size.height());
143
        return IntSize(size.width(), scrollbar->height() < 2 * size.height() ? scrollbar->height() / 2 : size.height());
133
    }
144
    }
134
145
135
    // HorizontalScrollbar
146
    // HorizontalScrollbar
136
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarLeftArrow);
147
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarLeftArrow);
137
    return IntSize(scrollbar->width() < 2 * size.width() ? scrollbar->width() / 2 : size.width(), size.height());
148
    return IntSize(scrollbar->width() < 2 * size.width() ? scrollbar->width() / 2 : size.width(), size.height());
138
}
149
}
139
150
140
int ScrollbarThemeChromiumLinux::minimumThumbLength(ScrollbarThemeClient* scrollbar)
151
int ScrollbarThemeChromiumLinux::minimumThumbLength(ScrollbarThemeClient* scrollbar)
141
{
152
{
142
    if (scrollbar->orientation() == VerticalScrollbar) {
153
    if (scrollbar->orientation() == VerticalScrollbar) {
143
        IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarVerticalThumb);
154
        IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarVerticalThumb);
144
        return size.height();
155
        return size.height();
145
    }
156
    }
146
157
147
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarHorizontalThumb);
158
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarHorizontalThumb);
148
    return size.width();
159
    return size.width();
149
}
160
}
150
161
- Source/WebCore/rendering/RenderThemeChromiumLinux.cpp -32 / +90 lines
Lines 28-40 Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec1
28
#include "CSSValueKeywords.h"
28
#include "CSSValueKeywords.h"
29
#include "Color.h"
29
#include "Color.h"
30
#include "PaintInfo.h"
30
#include "PaintInfo.h"
31
#include "PlatformSupport.h"
31
#include "PlatformContextSkia.h"
32
#include "RenderObject.h"
32
#include "RenderObject.h"
33
#include "RenderProgress.h"
33
#include "RenderProgress.h"
34
#include "RenderSlider.h"
34
#include "RenderSlider.h"
35
#include "ScrollbarTheme.h"
35
#include "ScrollbarTheme.h"
36
#include "UserAgentStyleSheets.h"
36
#include "UserAgentStyleSheets.h"
37
37
38
#include <public/Platform.h>
39
#include <public/WebRect.h>
40
#include <public/linux/WebThemeEngine.h>
41
38
namespace WebCore {
42
namespace WebCore {
39
43
40
unsigned RenderThemeChromiumLinux::m_activeSelectionBackgroundColor =
44
unsigned RenderThemeChromiumLinux::m_activeSelectionBackgroundColor =
Lines 50-68 double RenderThemeChromiumLinux::m_caret Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec2
50
54
51
static const unsigned defaultButtonBackgroundColor = 0xffdddddd;
55
static const unsigned defaultButtonBackgroundColor = 0xffdddddd;
52
56
53
static PlatformSupport::ThemePaintState getWebThemeState(const RenderTheme* theme, const RenderObject* o)
57
static WebKit::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, const RenderObject* o)
54
{
58
    {
55
    if (!theme->isEnabled(o))
59
        if (!theme->isEnabled(o))
56
        return PlatformSupport::StateDisabled;
60
            return WebKit::WebThemeEngine::StateDisabled;
57
    if (theme->isPressed(o))
61
        if (theme->isPressed(o))
58
        return PlatformSupport::StatePressed;
62
            return WebKit::WebThemeEngine::StatePressed;
59
    if (theme->isHovered(o))
63
    if (theme->isHovered(o))
60
        return PlatformSupport::StateHover;
64
        return WebKit::WebThemeEngine::StateHover;
61
65
62
    return PlatformSupport::StateNormal;
66
    return WebKit::WebThemeEngine::StateNormal;
63
}
67
}
64
68
65
66
PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create()
69
PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create()
67
{
70
{
68
    return adoptRef(new RenderThemeChromiumLinux());
71
    return adoptRef(new RenderThemeChromiumLinux());
Lines 160-166 int RenderThemeChromiumLinux::sliderTick Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec3
160
163
161
void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderStyle* style, Element* element) const
164
void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderStyle* style, Element* element) const
162
{
165
{
163
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartSliderThumb);
166
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartSliderThumb);
164
167
165
    if (style->appearance() == SliderThumbHorizontalPart) {
168
    if (style->appearance() == SliderThumbHorizontalPart) {
166
        style->setWidth(Length(size.width(), Fixed));
169
        style->setWidth(Length(size.width(), Fixed));
Lines 201-211 void RenderThemeChromiumLinux::setSelect Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec4
201
204
202
bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
205
bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
203
{
206
{
204
    PlatformSupport::ThemePaintExtraParams extraParams;
207
    WebKit::WebThemeEngine::ExtraParams extraParams;
208
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
205
    extraParams.button.checked = isChecked(o);
209
    extraParams.button.checked = isChecked(o);
206
    extraParams.button.indeterminate = isIndeterminate(o);
210
    extraParams.button.indeterminate = isIndeterminate(o);
207
211
208
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartCheckbox, getWebThemeState(this, o), rect, &extraParams);
212
    WebKit::Platform::current()->themeEngine()->paint(
213
                                                      canvas,
214
                                                      WebKit::WebThemeEngine::PartCheckbox,
215
                                                      getWebThemeState(this, o),
216
                                                      WebKit::WebRect(rect),
217
                                                      &extraParams);
209
    return false;
218
    return false;
210
}
219
}
211
220
Lines 215-230 void RenderThemeChromiumLinux::setCheckb Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec5
215
    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
224
    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
216
        return;
225
        return;
217
226
218
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartCheckbox);
227
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartCheckbox);
219
    setSizeIfAuto(style, size);
228
    setSizeIfAuto(style, size);
220
}
229
}
221
230
222
bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
231
bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
223
{
232
{
224
    PlatformSupport::ThemePaintExtraParams extraParams;
233
    WebKit::WebThemeEngine::ExtraParams extraParams;
234
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
225
    extraParams.button.checked = isChecked(o);
235
    extraParams.button.checked = isChecked(o);
226
236
227
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartRadio, getWebThemeState(this, o), rect, &extraParams);
237
    WebKit::Platform::current()->themeEngine()->paint(
238
                                                      canvas,
239
                                                      WebKit::WebThemeEngine::PartRadio,
240
                                                      getWebThemeState(this, o),
241
                                                      WebKit::WebRect(rect),
242
                                                      &extraParams);
228
    return false;
243
    return false;
229
}
244
}
230
245
Lines 234-253 void RenderThemeChromiumLinux::setRadioS Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec6
234
    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
249
    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
235
        return;
250
        return;
236
251
237
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartRadio);
252
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartRadio);
238
    setSizeIfAuto(style, size);
253
    setSizeIfAuto(style, size);
239
}
254
}
240
255
241
bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
256
bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
242
{
257
{
243
    PlatformSupport::ThemePaintExtraParams extraParams;
258
    WebKit::WebThemeEngine::ExtraParams extraParams;
259
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
244
    extraParams.button.isDefault = isDefault(o);
260
    extraParams.button.isDefault = isDefault(o);
245
    extraParams.button.hasBorder = true;
261
    extraParams.button.hasBorder = true;
246
    extraParams.button.backgroundColor = defaultButtonBackgroundColor;
262
    extraParams.button.backgroundColor = defaultButtonBackgroundColor;
247
    if (o->hasBackground())
263
    if (o->hasBackground())
248
        extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
264
        extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
249
265
250
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartButton, getWebThemeState(this, o), rect, &extraParams);
266
    WebKit::Platform::current()->themeEngine()->paint(
267
                                                      canvas,
268
                                                      WebKit::WebThemeEngine::PartButton,
269
                                                      getWebThemeState(this, o),
270
                                                      WebKit::WebRect(rect),
271
                                                      &extraParams);
251
    return false;
272
    return false;
252
}
273
}
253
274
Lines 260-276 bool RenderThemeChromiumLinux::paintText Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec7
260
281
261
    ControlPart part = o->style()->appearance();
282
    ControlPart part = o->style()->appearance();
262
283
263
    PlatformSupport::ThemePaintExtraParams extraParams;
284
    WebKit::WebThemeEngine::ExtraParams extraParams;
264
    extraParams.textField.isTextArea = part == TextAreaPart;
285
    extraParams.textField.isTextArea = part == TextAreaPart;
265
    extraParams.textField.isListbox = part == ListboxPart;
286
    extraParams.textField.isListbox = part == ListboxPart;
266
287
288
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
289
267
    // Fallback to white if the specified color object is invalid.
290
    // Fallback to white if the specified color object is invalid.
268
    Color backgroundColor(Color::white);
291
    Color backgroundColor(Color::white);
269
    if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
292
    if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
270
        backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
293
        backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
271
    extraParams.textField.backgroundColor = backgroundColor.rgb();
294
    extraParams.textField.backgroundColor = backgroundColor.rgb();
272
295
273
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartTextField, getWebThemeState(this, o), rect, &extraParams);
296
    WebKit::Platform::current()->themeEngine()->paint(
297
                                                      canvas,
298
                                                      WebKit::WebThemeEngine::PartTextField,
299
                                                      getWebThemeState(this, o),
300
                                                      WebKit::WebRect(rect),
301
                                                      &extraParams);
274
    return false;
302
    return false;
275
}
303
}
276
304
Lines 282-288 bool RenderThemeChromiumLinux::paintMenu Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec8
282
    const int right = rect.x() + rect.width();
310
    const int right = rect.x() + rect.width();
283
    const int middle = rect.y() + rect.height() / 2;
311
    const int middle = rect.y() + rect.height() / 2;
284
312
285
    PlatformSupport::ThemePaintExtraParams extraParams;
313
    WebKit::WebThemeEngine::ExtraParams extraParams;
286
    extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
314
    extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
287
    extraParams.menuList.arrowY = middle;
315
    extraParams.menuList.arrowY = middle;
288
    const RenderBox* box = toRenderBox(o);
316
    const RenderBox* box = toRenderBox(o);
Lines 294-309 bool RenderThemeChromiumLinux::paintMenu Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec9
294
    if (o->hasBackground())
322
    if (o->hasBackground())
295
        extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
323
        extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
296
324
297
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartMenuList, getWebThemeState(this, o), rect, &extraParams);
325
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
326
327
    WebKit::Platform::current()->themeEngine()->paint(
328
                                                      canvas,
329
                                                      WebKit::WebThemeEngine::PartMenuList,
330
                                                      getWebThemeState(this, o),
331
                                                      WebKit::WebRect(rect),
332
                                                      &extraParams);
298
    return false;
333
    return false;
299
}
334
}
300
335
301
bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
336
bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
302
{
337
{
303
    PlatformSupport::ThemePaintExtraParams extraParams;
338
    WebKit::WebThemeEngine::ExtraParams extraParams;
339
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
304
    extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;
340
    extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;
305
341
306
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams);
342
    WebKit::Platform::current()->themeEngine()->paint(
343
                                                      canvas,
344
                                                      WebKit::WebThemeEngine::PartSliderTrack,
345
                                                      getWebThemeState(this, o),
346
                                                      WebKit::WebRect(rect),
347
                                                      &extraParams);
307
348
308
#if ENABLE(DATALIST_ELEMENT)
349
#if ENABLE(DATALIST_ELEMENT)
309
    paintSliderTicks(o, i, rect);
350
    paintSliderTicks(o, i, rect);
Lines 314-330 bool RenderThemeChromiumLinux::paintSlid Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec10
314
355
315
bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
356
bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
316
{
357
{
317
    PlatformSupport::ThemePaintExtraParams extraParams;
358
    WebKit::WebThemeEngine::ExtraParams extraParams;
359
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
318
    extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
360
    extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
319
    extraParams.slider.inDrag = isPressed(o);
361
    extraParams.slider.inDrag = isPressed(o);
320
362
321
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderThumb, getWebThemeState(this, o), rect, &extraParams);
363
    WebKit::Platform::current()->themeEngine()->paint(canvas,
364
                                                      WebKit::WebThemeEngine::PartSliderThumb,
365
                                                      getWebThemeState(this, o),
366
                                                      WebKit::WebRect(rect),
367
                                                      &extraParams);
322
    return false;
368
    return false;
323
}
369
}
324
370
325
void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
371
void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
326
{
372
{
327
    IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartInnerSpinButton);
373
    IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartInnerSpinButton);
328
374
329
    style->setWidth(Length(size.width(), Fixed));
375
    style->setWidth(Length(size.width(), Fixed));
330
    style->setMinWidth(Length(size.width(), Fixed));
376
    style->setMinWidth(Length(size.width(), Fixed));
Lines 332-342 void RenderThemeChromiumLinux::adjustInn Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec11
332
378
333
bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
379
bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
334
{
380
{
335
    PlatformSupport::ThemePaintExtraParams extraParams;
381
    WebKit::WebThemeEngine::ExtraParams extraParams;
382
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
336
    extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
383
    extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
337
    extraParams.innerSpin.readOnly = isReadOnlyControl(o);
384
    extraParams.innerSpin.readOnly = isReadOnlyControl(o);
338
385
339
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartInnerSpinButton, getWebThemeState(this, o), rect, &extraParams);
386
    WebKit::Platform::current()->themeEngine()->paint(
387
                                                      canvas,
388
                                                      WebKit::WebThemeEngine::PartInnerSpinButton,
389
                                                      getWebThemeState(this, o),
390
                                                      WebKit::WebRect(rect),
391
                                                      &extraParams);
340
    return false;
392
    return false;
341
}
393
}
342
394
Lines 350-356 bool RenderThemeChromiumLinux::paintProg Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec12
350
    RenderProgress* renderProgress = toRenderProgress(o);
402
    RenderProgress* renderProgress = toRenderProgress(o);
351
    IntRect valueRect = progressValueRectFor(renderProgress, rect);
403
    IntRect valueRect = progressValueRectFor(renderProgress, rect);
352
404
353
    PlatformSupport::ThemePaintExtraParams extraParams;
405
    WebKit::WebThemeEngine::ExtraParams extraParams;
354
    extraParams.progressBar.determinate = renderProgress->isDeterminate();
406
    extraParams.progressBar.determinate = renderProgress->isDeterminate();
355
    extraParams.progressBar.valueRectX = valueRect.x();
407
    extraParams.progressBar.valueRectX = valueRect.x();
356
    extraParams.progressBar.valueRectY = valueRect.y();
408
    extraParams.progressBar.valueRectY = valueRect.y();
Lines 358-364 bool RenderThemeChromiumLinux::paintProg Source/WebCore/rendering/RenderThemeChromiumLinux.cpp_sec13
358
    extraParams.progressBar.valueRectHeight = valueRect.height();
410
    extraParams.progressBar.valueRectHeight = valueRect.height();
359
411
360
    DirectionFlippingScope scope(o, i, rect);
412
    DirectionFlippingScope scope(o, i, rect);
361
    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartProgressBar, getWebThemeState(this, o), rect, &extraParams);
413
    WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
414
    WebKit::Platform::current()->themeEngine()->paint(
415
                                                      canvas,
416
                                                      WebKit::WebThemeEngine::PartProgressBar,
417
                                                      getWebThemeState(this, o),
418
                                                      WebKit::WebRect(rect),
419
                                                      &extraParams);
362
    return false;
420
    return false;
363
}
421
}
364
422
- Source/WebKit/chromium/ChangeLog +15 lines
Lines 1-3 Source/WebKit/chromium/ChangeLog_sec1
1
2012-09-26  Mark Pilgrim  <pilgrim@chromium.org>
2
3
        [Chromium] Move UNIX-specific theme functions out of PlatformSupport
4
        https://bugs.webkit.org/show_bug.cgi?id=96516
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Call WebThemeEngine functions and use WebThemeEngine enums
9
        directly from the new Platform/ directly; remove all intermediate
10
        functions and enums and conversion functions from PlatformSupport.
11
        Part of a refactoring series; see tracking bug 82948.
12
13
        * src/PlatformSupport.cpp:
14
        (WebCore):
15
1
2012-09-26  Sadrul Habib Chowdhury  <sadrul@chromium.org>
16
2012-09-26  Sadrul Habib Chowdhury  <sadrul@chromium.org>
2
17
3
        [chromium] Do not dispatch touch-events to plugins unless they explicitly request for touch-events.
18
        [chromium] Do not dispatch touch-events to plugins unless they explicitly request for touch-events.
- Source/WebKit/chromium/src/PlatformSupport.cpp -108 lines
Lines 342-455 void PlatformSupport::paintScrollbarThum Source/WebKit/chromium/src/PlatformSupport.cpp_sec1
342
        webThemeScrollbarInfo);
342
        webThemeScrollbarInfo);
343
}
343
}
344
344
345
#elif OS(UNIX)
346
347
static WebThemeEngine::Part WebThemePart(PlatformSupport::ThemePart part)
348
{
349
    switch (part) {
350
    case PlatformSupport::PartScrollbarDownArrow: return WebThemeEngine::PartScrollbarDownArrow;
351
    case PlatformSupport::PartScrollbarLeftArrow: return WebThemeEngine::PartScrollbarLeftArrow;
352
    case PlatformSupport::PartScrollbarRightArrow: return WebThemeEngine::PartScrollbarRightArrow;
353
    case PlatformSupport::PartScrollbarUpArrow: return WebThemeEngine::PartScrollbarUpArrow;
354
    case PlatformSupport::PartScrollbarHorizontalThumb: return WebThemeEngine::PartScrollbarHorizontalThumb;
355
    case PlatformSupport::PartScrollbarVerticalThumb: return WebThemeEngine::PartScrollbarVerticalThumb;
356
    case PlatformSupport::PartScrollbarHorizontalTrack: return WebThemeEngine::PartScrollbarHorizontalTrack;
357
    case PlatformSupport::PartScrollbarVerticalTrack: return WebThemeEngine::PartScrollbarVerticalTrack;
358
    case PlatformSupport::PartCheckbox: return WebThemeEngine::PartCheckbox;
359
    case PlatformSupport::PartRadio: return WebThemeEngine::PartRadio;
360
    case PlatformSupport::PartButton: return WebThemeEngine::PartButton;
361
    case PlatformSupport::PartTextField: return WebThemeEngine::PartTextField;
362
    case PlatformSupport::PartMenuList: return WebThemeEngine::PartMenuList;
363
    case PlatformSupport::PartSliderTrack: return WebThemeEngine::PartSliderTrack;
364
    case PlatformSupport::PartSliderThumb: return WebThemeEngine::PartSliderThumb;
365
    case PlatformSupport::PartInnerSpinButton: return WebThemeEngine::PartInnerSpinButton;
366
    case PlatformSupport::PartProgressBar: return WebThemeEngine::PartProgressBar;
367
    }
368
    ASSERT_NOT_REACHED();
369
    return WebThemeEngine::PartScrollbarDownArrow;
370
}
371
372
static WebThemeEngine::State WebThemeState(PlatformSupport::ThemePaintState state)
373
{
374
    switch (state) {
375
    case PlatformSupport::StateDisabled: return WebThemeEngine::StateDisabled;
376
    case PlatformSupport::StateHover: return WebThemeEngine::StateHover;
377
    case PlatformSupport::StateNormal: return WebThemeEngine::StateNormal;
378
    case PlatformSupport::StatePressed: return WebThemeEngine::StatePressed;
379
    }
380
    ASSERT_NOT_REACHED();
381
    return WebThemeEngine::StateDisabled;
382
}
383
384
static void GetWebThemeExtraParams(PlatformSupport::ThemePart part, PlatformSupport::ThemePaintState state, const PlatformSupport::ThemePaintExtraParams* extraParams, WebThemeEngine::ExtraParams* webThemeExtraParams)
385
{
386
    switch (part) {
387
    case PlatformSupport::PartScrollbarHorizontalTrack:
388
    case PlatformSupport::PartScrollbarVerticalTrack:
389
        webThemeExtraParams->scrollbarTrack.trackX = extraParams->scrollbarTrack.trackX;
390
        webThemeExtraParams->scrollbarTrack.trackY = extraParams->scrollbarTrack.trackY;
391
        webThemeExtraParams->scrollbarTrack.trackWidth = extraParams->scrollbarTrack.trackWidth;
392
        webThemeExtraParams->scrollbarTrack.trackHeight = extraParams->scrollbarTrack.trackHeight;
393
        break;
394
    case PlatformSupport::PartCheckbox:
395
        webThemeExtraParams->button.checked = extraParams->button.checked;
396
        webThemeExtraParams->button.indeterminate = extraParams->button.indeterminate;
397
        break;
398
    case PlatformSupport::PartRadio:
399
        webThemeExtraParams->button.checked = extraParams->button.checked;
400
        break;
401
    case PlatformSupport::PartButton:
402
        webThemeExtraParams->button.isDefault = extraParams->button.isDefault;
403
        webThemeExtraParams->button.hasBorder = extraParams->button.hasBorder;
404
        webThemeExtraParams->button.backgroundColor = extraParams->button.backgroundColor;
405
        break;
406
    case PlatformSupport::PartTextField:
407
        webThemeExtraParams->textField.isTextArea = extraParams->textField.isTextArea;
408
        webThemeExtraParams->textField.isListbox = extraParams->textField.isListbox;
409
        webThemeExtraParams->textField.backgroundColor = extraParams->textField.backgroundColor;
410
        break;
411
    case PlatformSupport::PartMenuList:
412
        webThemeExtraParams->menuList.hasBorder = extraParams->menuList.hasBorder;
413
        webThemeExtraParams->menuList.hasBorderRadius = extraParams->menuList.hasBorderRadius;
414
        webThemeExtraParams->menuList.arrowX = extraParams->menuList.arrowX;
415
        webThemeExtraParams->menuList.arrowY = extraParams->menuList.arrowY;
416
        webThemeExtraParams->menuList.backgroundColor = extraParams->menuList.backgroundColor;
417
        break;
418
    case PlatformSupport::PartSliderTrack:
419
    case PlatformSupport::PartSliderThumb:
420
        webThemeExtraParams->slider.vertical = extraParams->slider.vertical;
421
        webThemeExtraParams->slider.inDrag = extraParams->slider.inDrag;
422
        break;
423
    case PlatformSupport::PartInnerSpinButton:
424
        webThemeExtraParams->innerSpin.spinUp = extraParams->innerSpin.spinUp;
425
        webThemeExtraParams->innerSpin.readOnly = extraParams->innerSpin.readOnly;
426
        break;
427
    case PlatformSupport::PartProgressBar:
428
        webThemeExtraParams->progressBar.determinate = extraParams->progressBar.determinate;
429
        webThemeExtraParams->progressBar.valueRectX = extraParams->progressBar.valueRectX;
430
        webThemeExtraParams->progressBar.valueRectY = extraParams->progressBar.valueRectY;
431
        webThemeExtraParams->progressBar.valueRectWidth = extraParams->progressBar.valueRectWidth;
432
        webThemeExtraParams->progressBar.valueRectHeight = extraParams->progressBar.valueRectHeight;
433
        break;
434
    default:
435
        break; // Parts that have no extra params get here.
436
    }
437
}
438
439
IntSize PlatformSupport::getThemePartSize(ThemePart part)
440
{
441
     return WebKit::Platform::current()->themeEngine()->getSize(WebThemePart(part));
442
}
443
444
void PlatformSupport::paintThemePart(
445
    GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams)
446
{
447
    WebThemeEngine::ExtraParams webThemeExtraParams;
448
    GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams);
449
    WebKit::Platform::current()->themeEngine()->paint(
450
        gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams);
451
}
452
453
#endif
345
#endif
454
346
455
// These are temporary methods that the WebKit layer can use to call to the
347
// These are temporary methods that the WebKit layer can use to call to the

Return to Bug 96516