|
Lines 1-5
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec1
|
| 1 |
/* |
1 |
/* |
| 2 |
* Copyright (C) 2012-2013 Nokia Corporation and/or its subsidiary(-ies). |
2 |
* Copyright (C) 2012, 2013 Nokia Corporation and/or its subsidiary(-ies). |
| 3 |
* |
3 |
* |
| 4 |
* Redistribution and use in source and binary forms, with or without |
4 |
* Redistribution and use in source and binary forms, with or without |
| 5 |
* modification, are permitted provided that the following conditions |
5 |
* modification, are permitted provided that the following conditions |
|
Lines 26-31
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec2
|
| 26 |
#include "config.h" |
26 |
#include "config.h" |
| 27 |
#include "RenderThemeNix.h" |
27 |
#include "RenderThemeNix.h" |
| 28 |
|
28 |
|
|
|
29 |
#include "HTMLMediaElement.h" |
| 29 |
#include "InputTypeNames.h" |
30 |
#include "InputTypeNames.h" |
| 30 |
#include "PaintInfo.h" |
31 |
#include "PaintInfo.h" |
| 31 |
#include "PlatformContextCairo.h" |
32 |
#include "PlatformContextCairo.h" |
|
Lines 40-50
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec3
|
| 40 |
#include "HTMLMeterElement.h" |
41 |
#include "HTMLMeterElement.h" |
| 41 |
#include "RenderMeter.h" |
42 |
#include "RenderMeter.h" |
| 42 |
#endif |
43 |
#endif |
|
|
44 |
#include "UserAgentStyleSheets.h" |
| 43 |
|
45 |
|
| 44 |
namespace WebCore { |
46 |
namespace WebCore { |
| 45 |
|
47 |
|
| 46 |
static const unsigned defaultButtonBackgroundColor = 0xffdddddd; |
|
|
| 47 |
|
| 48 |
static void setSizeIfAuto(RenderStyle* style, const IntSize& size) |
48 |
static void setSizeIfAuto(RenderStyle* style, const IntSize& size) |
| 49 |
{ |
49 |
{ |
| 50 |
if (style->width().isIntrinsicOrAuto()) |
50 |
if (style->width().isIntrinsicOrAuto()) |
|
Lines 53-63
static void setSizeIfAuto(RenderStyle* style, const IntSize& size)
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec4
|
| 53 |
style->setHeight(Length(size.height(), Fixed)); |
53 |
style->setHeight(Length(size.height(), Fixed)); |
| 54 |
} |
54 |
} |
| 55 |
|
55 |
|
| 56 |
Color toColor(const Nix::Color& color) |
|
|
| 57 |
{ |
| 58 |
return WebCore::Color(RGBA32(color)); |
| 59 |
} |
| 60 |
|
| 61 |
static Nix::ThemeEngine* themeEngine() |
56 |
static Nix::ThemeEngine* themeEngine() |
| 62 |
{ |
57 |
{ |
| 63 |
return Nix::Platform::current()->themeEngine(); |
58 |
return Nix::Platform::current()->themeEngine(); |
|
Lines 68-73
static Nix::Canvas* webCanvas(const PaintInfo& info)
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec5
|
| 68 |
return info.context->platformContext()->cr(); |
63 |
return info.context->platformContext()->cr(); |
| 69 |
} |
64 |
} |
| 70 |
|
65 |
|
|
|
66 |
static IntSize toIntSize(const Nix::Size& size) |
| 67 |
{ |
| 68 |
return IntSize(size.width, size.height); |
| 69 |
} |
| 70 |
|
| 71 |
static Nix::Rect toNixRect(const IntRect& rect) |
| 72 |
{ |
| 73 |
return Nix::Rect(rect.x(), rect.y(), rect.width(), rect.height()); |
| 74 |
} |
| 75 |
|
| 71 |
PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) |
76 |
PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) |
| 72 |
{ |
77 |
{ |
| 73 |
return RenderThemeNix::create(); |
78 |
return RenderThemeNix::create(); |
|
Lines 105-167
String RenderThemeNix::extraPlugInsStyleSheet()
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec6
|
| 105 |
|
110 |
|
| 106 |
Color RenderThemeNix::platformActiveSelectionBackgroundColor() const |
111 |
Color RenderThemeNix::platformActiveSelectionBackgroundColor() const |
| 107 |
{ |
112 |
{ |
| 108 |
return toColor(themeEngine()->activeSelectionBackgroundColor()); |
113 |
return themeEngine()->activeSelectionBackgroundColor().argb32(); |
| 109 |
} |
114 |
} |
| 110 |
|
115 |
|
| 111 |
Color RenderThemeNix::platformInactiveSelectionBackgroundColor() const |
116 |
Color RenderThemeNix::platformInactiveSelectionBackgroundColor() const |
| 112 |
{ |
117 |
{ |
| 113 |
return toColor(themeEngine()->inactiveSelectionBackgroundColor()); |
118 |
return themeEngine()->inactiveSelectionBackgroundColor().argb32(); |
| 114 |
} |
119 |
} |
| 115 |
|
120 |
|
| 116 |
Color RenderThemeNix::platformActiveSelectionForegroundColor() const |
121 |
Color RenderThemeNix::platformActiveSelectionForegroundColor() const |
| 117 |
{ |
122 |
{ |
| 118 |
return toColor(themeEngine()->activeSelectionForegroundColor()); |
123 |
return themeEngine()->activeSelectionForegroundColor().argb32(); |
| 119 |
} |
124 |
} |
| 120 |
|
125 |
|
| 121 |
Color RenderThemeNix::platformInactiveSelectionForegroundColor() const |
126 |
Color RenderThemeNix::platformInactiveSelectionForegroundColor() const |
| 122 |
{ |
127 |
{ |
| 123 |
return toColor(themeEngine()->inactiveSelectionForegroundColor()); |
128 |
return themeEngine()->inactiveSelectionForegroundColor().argb32(); |
| 124 |
} |
129 |
} |
| 125 |
|
130 |
|
| 126 |
Color RenderThemeNix::platformActiveListBoxSelectionBackgroundColor() const |
131 |
Color RenderThemeNix::platformActiveListBoxSelectionBackgroundColor() const |
| 127 |
{ |
132 |
{ |
| 128 |
return toColor(themeEngine()->activeListBoxSelectionBackgroundColor()); |
133 |
return themeEngine()->activeListBoxSelectionBackgroundColor().argb32(); |
| 129 |
} |
134 |
} |
| 130 |
|
135 |
|
| 131 |
Color RenderThemeNix::platformInactiveListBoxSelectionBackgroundColor() const |
136 |
Color RenderThemeNix::platformInactiveListBoxSelectionBackgroundColor() const |
| 132 |
{ |
137 |
{ |
| 133 |
return toColor(themeEngine()->inactiveListBoxSelectionBackgroundColor()); |
138 |
return themeEngine()->inactiveListBoxSelectionBackgroundColor().argb32(); |
| 134 |
} |
139 |
} |
| 135 |
|
140 |
|
| 136 |
Color RenderThemeNix::platformActiveListBoxSelectionForegroundColor() const |
141 |
Color RenderThemeNix::platformActiveListBoxSelectionForegroundColor() const |
| 137 |
{ |
142 |
{ |
| 138 |
return toColor(themeEngine()->activeListBoxSelectionForegroundColor()); |
143 |
return themeEngine()->activeListBoxSelectionForegroundColor().argb32(); |
| 139 |
} |
144 |
} |
| 140 |
|
145 |
|
| 141 |
Color RenderThemeNix::platformInactiveListBoxSelectionForegroundColor() const |
146 |
Color RenderThemeNix::platformInactiveListBoxSelectionForegroundColor() const |
| 142 |
{ |
147 |
{ |
| 143 |
return toColor(themeEngine()->inactiveListBoxSelectionForegroundColor()); |
148 |
return themeEngine()->inactiveListBoxSelectionForegroundColor().argb32(); |
| 144 |
} |
149 |
} |
| 145 |
|
150 |
|
| 146 |
Color RenderThemeNix::platformActiveTextSearchHighlightColor() const |
151 |
Color RenderThemeNix::platformActiveTextSearchHighlightColor() const |
| 147 |
{ |
152 |
{ |
| 148 |
return toColor(themeEngine()->activeTextSearchHighlightColor()); |
153 |
return themeEngine()->activeTextSearchHighlightColor().argb32(); |
| 149 |
} |
154 |
} |
| 150 |
|
155 |
|
| 151 |
Color RenderThemeNix::platformInactiveTextSearchHighlightColor() const |
156 |
Color RenderThemeNix::platformInactiveTextSearchHighlightColor() const |
| 152 |
{ |
157 |
{ |
| 153 |
return toColor(themeEngine()->inactiveTextSearchHighlightColor()); |
158 |
return themeEngine()->inactiveTextSearchHighlightColor().argb32(); |
| 154 |
} |
159 |
} |
| 155 |
|
160 |
|
| 156 |
Color RenderThemeNix::platformFocusRingColor() const |
161 |
Color RenderThemeNix::platformFocusRingColor() const |
| 157 |
{ |
162 |
{ |
| 158 |
return toColor(themeEngine()->focusRingColor()); |
163 |
return themeEngine()->focusRingColor().argb32(); |
| 159 |
} |
164 |
} |
| 160 |
|
165 |
|
| 161 |
#if ENABLE(TOUCH_EVENTS) |
166 |
#if ENABLE(TOUCH_EVENTS) |
| 162 |
Color RenderThemeNix::platformTapHighlightColor() const |
167 |
Color RenderThemeNix::platformTapHighlightColor() const |
| 163 |
{ |
168 |
{ |
| 164 |
return toColor(themeEngine()->tapHighlightColor()); |
169 |
return themeEngine()->tapHighlightColor().argb32(); |
| 165 |
} |
170 |
} |
| 166 |
#endif |
171 |
#endif |
| 167 |
|
172 |
|
|
Lines 186-196
bool RenderThemeNix::paintButton(RenderObject* o, const PaintInfo& i, const IntR
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec7
|
| 186 |
Nix::ThemeEngine::ButtonExtraParams extraParams; |
191 |
Nix::ThemeEngine::ButtonExtraParams extraParams; |
| 187 |
extraParams.isDefault = isDefault(o); |
192 |
extraParams.isDefault = isDefault(o); |
| 188 |
extraParams.hasBorder = true; |
193 |
extraParams.hasBorder = true; |
| 189 |
extraParams.backgroundColor = defaultButtonBackgroundColor; |
194 |
themeEngine()->paintButton(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 190 |
if (o->hasBackground()) |
|
|
| 191 |
extraParams.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); |
| 192 |
|
| 193 |
themeEngine()->paintButton(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect), extraParams); |
| 194 |
return false; |
195 |
return false; |
| 195 |
} |
196 |
} |
| 196 |
|
197 |
|
|
Lines 198-207
bool RenderThemeNix::paintTextField(RenderObject* o, const PaintInfo& i, const I
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec8
|
| 198 |
{ |
199 |
{ |
| 199 |
// WebThemeEngine does not handle border rounded corner and background image |
200 |
// WebThemeEngine does not handle border rounded corner and background image |
| 200 |
// so return true to draw CSS border and background. |
201 |
// so return true to draw CSS border and background. |
| 201 |
if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) |
202 |
if (o->style().hasBorderRadius() || o->style().hasBackgroundImage()) |
| 202 |
return true; |
203 |
return true; |
| 203 |
|
204 |
|
| 204 |
themeEngine()->paintTextField(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect)); |
205 |
themeEngine()->paintTextField(webCanvas(i), getWebThemeState(this, o), toNixRect(rect)); |
| 205 |
return false; |
206 |
return false; |
| 206 |
} |
207 |
} |
| 207 |
|
208 |
|
|
Lines 216-222
bool RenderThemeNix::paintCheckbox(RenderObject* o, const PaintInfo& i, const In
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec9
|
| 216 |
extraParams.checked = isChecked(o); |
217 |
extraParams.checked = isChecked(o); |
| 217 |
extraParams.indeterminate = isIndeterminate(o); |
218 |
extraParams.indeterminate = isIndeterminate(o); |
| 218 |
|
219 |
|
| 219 |
themeEngine()->paintCheckbox(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect), extraParams); |
220 |
themeEngine()->paintCheckbox(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 220 |
return false; |
221 |
return false; |
| 221 |
} |
222 |
} |
| 222 |
|
223 |
|
|
Lines 226-232
void RenderThemeNix::setCheckboxSize(RenderStyle* style) const
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec10
|
| 226 |
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
227 |
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 227 |
return; |
228 |
return; |
| 228 |
|
229 |
|
| 229 |
IntSize size = themeEngine()->getCheckboxSize(); |
230 |
IntSize size = toIntSize(themeEngine()->getCheckboxSize()); |
| 230 |
setSizeIfAuto(style, size); |
231 |
setSizeIfAuto(style, size); |
| 231 |
} |
232 |
} |
| 232 |
|
233 |
|
|
Lines 236-242
bool RenderThemeNix::paintRadio(RenderObject* o, const PaintInfo& i, const IntRe
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec11
|
| 236 |
extraParams.checked = isChecked(o); |
237 |
extraParams.checked = isChecked(o); |
| 237 |
extraParams.indeterminate = isIndeterminate(o); |
238 |
extraParams.indeterminate = isIndeterminate(o); |
| 238 |
|
239 |
|
| 239 |
themeEngine()->paintRadio(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect), extraParams); |
240 |
themeEngine()->paintRadio(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 240 |
return false; |
241 |
return false; |
| 241 |
} |
242 |
} |
| 242 |
|
243 |
|
|
Lines 246-258
void RenderThemeNix::setRadioSize(RenderStyle* style) const
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec12
|
| 246 |
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
247 |
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) |
| 247 |
return; |
248 |
return; |
| 248 |
|
249 |
|
| 249 |
IntSize size = themeEngine()->getRadioSize(); |
250 |
IntSize size = toIntSize(themeEngine()->getRadioSize()); |
| 250 |
setSizeIfAuto(style, size); |
251 |
setSizeIfAuto(style, size); |
| 251 |
} |
252 |
} |
| 252 |
|
253 |
|
| 253 |
bool RenderThemeNix::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) |
254 |
bool RenderThemeNix::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) |
| 254 |
{ |
255 |
{ |
| 255 |
themeEngine()->paintMenuList(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect)); |
256 |
themeEngine()->paintMenuList(webCanvas(i), getWebThemeState(this, o), toNixRect(rect)); |
| 256 |
return false; |
257 |
return false; |
| 257 |
} |
258 |
} |
| 258 |
|
259 |
|
|
Lines 286-292
bool RenderThemeNix::paintProgressBar(RenderObject* o, const PaintInfo& i, const
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec13
|
| 286 |
extraParams.position = renderProgress->position(); |
287 |
extraParams.position = renderProgress->position(); |
| 287 |
extraParams.animationProgress = renderProgress->animationProgress(); |
288 |
extraParams.animationProgress = renderProgress->animationProgress(); |
| 288 |
extraParams.animationStartTime = renderProgress->animationStartTime(); |
289 |
extraParams.animationStartTime = renderProgress->animationStartTime(); |
| 289 |
themeEngine()->paintProgressBar(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect), extraParams); |
290 |
themeEngine()->paintProgressBar(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 290 |
|
291 |
|
| 291 |
return false; |
292 |
return false; |
| 292 |
} |
293 |
} |
|
Lines 304-310
double RenderThemeNix::animationDurationForProgressBar(RenderProgress*) const
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec14
|
| 304 |
|
305 |
|
| 305 |
bool RenderThemeNix::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect) |
306 |
bool RenderThemeNix::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect) |
| 306 |
{ |
307 |
{ |
| 307 |
themeEngine()->paintSliderTrack(webCanvas(info), getWebThemeState(this, object), rect); |
308 |
themeEngine()->paintSliderTrack(webCanvas(info), getWebThemeState(this, object), toNixRect(rect)); |
| 308 |
#if ENABLE(DATALIST_ELEMENT) |
309 |
#if ENABLE(DATALIST_ELEMENT) |
| 309 |
paintSliderTicks(object, info, rect); |
310 |
paintSliderTicks(object, info, rect); |
| 310 |
#endif |
311 |
#endif |
|
Lines 318-324
void RenderThemeNix::adjustSliderTrackStyle(StyleResolver*, RenderStyle* style,
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec15
|
| 318 |
|
319 |
|
| 319 |
bool RenderThemeNix::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) |
320 |
bool RenderThemeNix::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) |
| 320 |
{ |
321 |
{ |
| 321 |
themeEngine()->paintSliderThumb(webCanvas(info), getWebThemeState(this, object), rect); |
322 |
themeEngine()->paintSliderThumb(webCanvas(info), getWebThemeState(this, object), toNixRect(rect)); |
| 322 |
|
323 |
|
| 323 |
return false; |
324 |
return false; |
| 324 |
} |
325 |
} |
|
Lines 388-394
bool RenderThemeNix::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, c
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec16
|
| 388 |
extraParams.spinUp = isSpinUpButtonPartPressed(o); |
389 |
extraParams.spinUp = isSpinUpButtonPartPressed(o); |
| 389 |
extraParams.readOnly = isReadOnlyControl(o); |
390 |
extraParams.readOnly = isReadOnlyControl(o); |
| 390 |
|
391 |
|
| 391 |
themeEngine()->paintInnerSpinButton(webCanvas(i), getWebThemeState(this, o), Nix::Rect(rect), extraParams); |
392 |
themeEngine()->paintInnerSpinButton(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 392 |
return false; |
393 |
return false; |
| 393 |
} |
394 |
} |
| 394 |
|
395 |
|
|
Lines 432-441
bool RenderThemeNix::paintMeter(RenderObject* o, const PaintInfo& i, const IntRe
a/Source/WebCore/platform/nix/RenderThemeNix.cpp_sec17
|
| 432 |
extraParams.high = e->high(); |
433 |
extraParams.high = e->high(); |
| 433 |
extraParams.optimum = e->optimum(); |
434 |
extraParams.optimum = e->optimum(); |
| 434 |
|
435 |
|
| 435 |
themeEngine()->paintMeter(webCanvas(i), getWebThemeState(this, o), rect, extraParams); |
436 |
themeEngine()->paintMeter(webCanvas(i), getWebThemeState(this, o), toNixRect(rect), extraParams); |
| 436 |
|
437 |
|
| 437 |
return false; |
438 |
return false; |
| 438 |
} |
439 |
} |
| 439 |
#endif |
440 |
#endif |
| 440 |
|
441 |
|
|
|
442 |
#if ENABLE(VIDEO) |
| 443 |
String RenderThemeNix::extraMediaControlsStyleSheet() |
| 444 |
{ |
| 445 |
return String(mediaControlsNixUserAgentStyleSheet, sizeof(mediaControlsNixUserAgentStyleSheet)); |
| 446 |
} |
| 447 |
|
| 448 |
bool RenderThemeNix::paintMediaPlayButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) |
| 449 |
{ |
| 450 |
auto state = toHTMLMediaElement(o->node()->shadowHost())->canPlay() ? Nix::ThemeEngine::StatePaused : Nix::ThemeEngine::StatePlaying; |
| 451 |
themeEngine()->paintMediaPlayButton(webCanvas(i), state, toNixRect(rect)); |
| 452 |
return false; |
| 453 |
} |
| 454 |
|
| 455 |
bool RenderThemeNix::paintMediaMuteButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) |
| 456 |
{ |
| 457 |
auto state = toHTMLMediaElement(o->node()->shadowHost())->muted() ? Nix::ThemeEngine::StateMuted : Nix::ThemeEngine::StateNotMuted; |
| 458 |
themeEngine()->paintMediaMuteButton(webCanvas(i), state, toNixRect(rect)); |
| 459 |
return false; |
| 460 |
} |
| 461 |
|
| 462 |
bool RenderThemeNix::paintMediaSeekBackButton(RenderObject*, const PaintInfo& i, const IntRect& rect) |
| 463 |
{ |
| 464 |
themeEngine()->paintMediaSeekBackButton(webCanvas(i), toNixRect(rect)); |
| 465 |
return false; |
| 466 |
} |
| 467 |
|
| 468 |
bool RenderThemeNix::paintMediaSeekForwardButton(RenderObject*, const PaintInfo& i, const IntRect& rect) |
| 469 |
{ |
| 470 |
themeEngine()->paintMediaSeekForwardButton(webCanvas(i), toNixRect(rect)); |
| 471 |
return false; |
| 472 |
} |
| 473 |
|
| 474 |
bool RenderThemeNix::paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) |
| 475 |
{ |
| 476 |
return false; |
| 441 |
} |
477 |
} |
|
|
478 |
|
| 479 |
bool RenderThemeNix::paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&) |
| 480 |
{ |
| 481 |
return false; |
| 482 |
} |
| 483 |
|
| 484 |
bool RenderThemeNix::paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) |
| 485 |
{ |
| 486 |
return false; |
| 487 |
} |
| 488 |
|
| 489 |
bool RenderThemeNix::paintMediaRewindButton(RenderObject*, const PaintInfo& i, const IntRect& rect) |
| 490 |
{ |
| 491 |
themeEngine()->paintMediaRewindButton(webCanvas(i), toNixRect(rect)); |
| 492 |
return false; |
| 493 |
} |
| 494 |
#endif // ENABLE(VIDEO) |
| 495 |
|
| 496 |
} // namespace WebCore |
| 497 |
|