|
1 /** |
|
2 * This file is part of the theme implementation for form controls in WebCore. |
|
3 * |
|
4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Library General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Library General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Library General Public License |
|
17 * along with this library; see the file COPYING.LIB. If not, write to |
|
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 * Boston, MA 02110-1301, USA. |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "RenderTheme.h" |
|
24 |
|
25 #include "CSSValueKeywords.h" |
|
26 #include "Document.h" |
|
27 #include "FloatConversion.h" |
|
28 #include "FocusController.h" |
|
29 #include "FontSelector.h" |
|
30 #include "Frame.h" |
|
31 #include "GraphicsContext.h" |
|
32 #include "HTMLInputElement.h" |
|
33 #include "HTMLNames.h" |
|
34 #include "MediaControlElements.h" |
|
35 #include "Page.h" |
|
36 #include "RenderStyle.h" |
|
37 #include "RenderView.h" |
|
38 #include "SelectionController.h" |
|
39 #include "Settings.h" |
|
40 #include "TextControlInnerElements.h" |
|
41 |
|
42 #if ENABLE(METER_TAG) |
|
43 #include "HTMLMeterElement.h" |
|
44 #include "RenderMeter.h" |
|
45 #endif |
|
46 |
|
47 #if ENABLE(INPUT_SPEECH) |
|
48 #include "RenderInputSpeech.h" |
|
49 #endif |
|
50 |
|
51 // The methods in this file are shared by all themes on every platform. |
|
52 |
|
53 namespace WebCore { |
|
54 |
|
55 using namespace HTMLNames; |
|
56 |
|
57 static Color& customFocusRingColor() |
|
58 { |
|
59 DEFINE_STATIC_LOCAL(Color, color, ()); |
|
60 return color; |
|
61 } |
|
62 |
|
63 RenderTheme::RenderTheme() |
|
64 #if USE(NEW_THEME) |
|
65 : m_theme(platformTheme()) |
|
66 #endif |
|
67 { |
|
68 } |
|
69 |
|
70 void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e, |
|
71 bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor) |
|
72 { |
|
73 // Force inline and table display styles to be inline-block (except for table- which is block) |
|
74 ControlPart part = style->appearance(); |
|
75 if (style->display() == INLINE || style->display() == INLINE_TABLE || style->display() == TABLE_ROW_GROUP || |
|
76 style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_FOOTER_GROUP || |
|
77 style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_COLUMN || |
|
78 style->display() == TABLE_CELL || style->display() == TABLE_CAPTION) |
|
79 style->setDisplay(INLINE_BLOCK); |
|
80 else if (style->display() == COMPACT || style->display() == RUN_IN || style->display() == LIST_ITEM || style->display() == TABLE) |
|
81 style->setDisplay(BLOCK); |
|
82 |
|
83 if (UAHasAppearance && isControlStyled(style, border, background, backgroundColor)) { |
|
84 if (part == MenulistPart) { |
|
85 style->setAppearance(MenulistButtonPart); |
|
86 part = MenulistButtonPart; |
|
87 } else |
|
88 style->setAppearance(NoControlPart); |
|
89 } |
|
90 |
|
91 if (!style->hasAppearance()) |
|
92 return; |
|
93 |
|
94 // Never support box-shadow on native controls. |
|
95 style->setBoxShadow(0); |
|
96 |
|
97 #if USE(NEW_THEME) |
|
98 switch (part) { |
|
99 case ListButtonPart: |
|
100 case CheckboxPart: |
|
101 case InnerSpinButtonPart: |
|
102 case OuterSpinButtonPart: |
|
103 case RadioPart: |
|
104 case PushButtonPart: |
|
105 case SquareButtonPart: |
|
106 case DefaultButtonPart: |
|
107 case ButtonPart: { |
|
108 // Border |
|
109 LengthBox borderBox(style->borderTopWidth(), style->borderRightWidth(), style->borderBottomWidth(), style->borderLeftWidth()); |
|
110 borderBox = m_theme->controlBorder(part, style->font(), borderBox, style->effectiveZoom()); |
|
111 if (borderBox.top().value() != style->borderTopWidth()) { |
|
112 if (borderBox.top().value()) |
|
113 style->setBorderTopWidth(borderBox.top().value()); |
|
114 else |
|
115 style->resetBorderTop(); |
|
116 } |
|
117 if (borderBox.right().value() != style->borderRightWidth()) { |
|
118 if (borderBox.right().value()) |
|
119 style->setBorderRightWidth(borderBox.right().value()); |
|
120 else |
|
121 style->resetBorderRight(); |
|
122 } |
|
123 if (borderBox.bottom().value() != style->borderBottomWidth()) { |
|
124 style->setBorderBottomWidth(borderBox.bottom().value()); |
|
125 if (borderBox.bottom().value()) |
|
126 style->setBorderBottomWidth(borderBox.bottom().value()); |
|
127 else |
|
128 style->resetBorderBottom(); |
|
129 } |
|
130 if (borderBox.left().value() != style->borderLeftWidth()) { |
|
131 style->setBorderLeftWidth(borderBox.left().value()); |
|
132 if (borderBox.left().value()) |
|
133 style->setBorderLeftWidth(borderBox.left().value()); |
|
134 else |
|
135 style->resetBorderLeft(); |
|
136 } |
|
137 |
|
138 // Padding |
|
139 LengthBox paddingBox = m_theme->controlPadding(part, style->font(), style->paddingBox(), style->effectiveZoom()); |
|
140 if (paddingBox != style->paddingBox()) |
|
141 style->setPaddingBox(paddingBox); |
|
142 |
|
143 // Whitespace |
|
144 if (m_theme->controlRequiresPreWhiteSpace(part)) |
|
145 style->setWhiteSpace(PRE); |
|
146 |
|
147 // Width / Height |
|
148 // The width and height here are affected by the zoom. |
|
149 // FIXME: Check is flawed, since it doesn't take min-width/max-width into account. |
|
150 LengthSize controlSize = m_theme->controlSize(part, style->font(), LengthSize(style->width(), style->height()), style->effectiveZoom()); |
|
151 if (controlSize.width() != style->width()) |
|
152 style->setWidth(controlSize.width()); |
|
153 if (controlSize.height() != style->height()) |
|
154 style->setHeight(controlSize.height()); |
|
155 |
|
156 // Min-Width / Min-Height |
|
157 LengthSize minControlSize = m_theme->minimumControlSize(part, style->font(), style->effectiveZoom()); |
|
158 if (minControlSize.width() != style->minWidth()) |
|
159 style->setMinWidth(minControlSize.width()); |
|
160 if (minControlSize.height() != style->minHeight()) |
|
161 style->setMinHeight(minControlSize.height()); |
|
162 |
|
163 // Font |
|
164 FontDescription controlFont = m_theme->controlFont(part, style->font(), style->effectiveZoom()); |
|
165 if (controlFont != style->font().fontDescription()) { |
|
166 // Reset our line-height |
|
167 style->setLineHeight(RenderStyle::initialLineHeight()); |
|
168 |
|
169 // Now update our font. |
|
170 if (style->setFontDescription(controlFont)) |
|
171 style->font().update(0); |
|
172 } |
|
173 } |
|
174 default: |
|
175 break; |
|
176 } |
|
177 #endif |
|
178 |
|
179 // Call the appropriate style adjustment method based off the appearance value. |
|
180 switch (style->appearance()) { |
|
181 #if !USE(NEW_THEME) |
|
182 case CheckboxPart: |
|
183 return adjustCheckboxStyle(selector, style, e); |
|
184 case RadioPart: |
|
185 return adjustRadioStyle(selector, style, e); |
|
186 case PushButtonPart: |
|
187 case SquareButtonPart: |
|
188 case ListButtonPart: |
|
189 case DefaultButtonPart: |
|
190 case ButtonPart: |
|
191 return adjustButtonStyle(selector, style, e); |
|
192 case InnerSpinButtonPart: |
|
193 return adjustInnerSpinButtonStyle(selector, style, e); |
|
194 case OuterSpinButtonPart: |
|
195 return adjustOuterSpinButtonStyle(selector, style, e); |
|
196 #endif |
|
197 case TextFieldPart: |
|
198 return adjustTextFieldStyle(selector, style, e); |
|
199 case TextAreaPart: |
|
200 return adjustTextAreaStyle(selector, style, e); |
|
201 case MenulistPart: |
|
202 return adjustMenuListStyle(selector, style, e); |
|
203 case MenulistButtonPart: |
|
204 return adjustMenuListButtonStyle(selector, style, e); |
|
205 case MediaSliderPart: |
|
206 case MediaVolumeSliderPart: |
|
207 case SliderHorizontalPart: |
|
208 case SliderVerticalPart: |
|
209 return adjustSliderTrackStyle(selector, style, e); |
|
210 case SliderThumbHorizontalPart: |
|
211 case SliderThumbVerticalPart: |
|
212 return adjustSliderThumbStyle(selector, style, e); |
|
213 case SearchFieldPart: |
|
214 return adjustSearchFieldStyle(selector, style, e); |
|
215 case SearchFieldCancelButtonPart: |
|
216 return adjustSearchFieldCancelButtonStyle(selector, style, e); |
|
217 case SearchFieldDecorationPart: |
|
218 return adjustSearchFieldDecorationStyle(selector, style, e); |
|
219 case SearchFieldResultsDecorationPart: |
|
220 return adjustSearchFieldResultsDecorationStyle(selector, style, e); |
|
221 case SearchFieldResultsButtonPart: |
|
222 return adjustSearchFieldResultsButtonStyle(selector, style, e); |
|
223 #if ENABLE(PROGRESS_TAG) |
|
224 case ProgressBarPart: |
|
225 return adjustProgressBarStyle(selector, style, e); |
|
226 #endif |
|
227 #if ENABLE(METER_TAG) |
|
228 case MeterPart: |
|
229 case RelevancyLevelIndicatorPart: |
|
230 case ContinuousCapacityLevelIndicatorPart: |
|
231 case DiscreteCapacityLevelIndicatorPart: |
|
232 case RatingLevelIndicatorPart: |
|
233 return adjustMeterStyle(selector, style, e); |
|
234 #endif |
|
235 #if ENABLE(INPUT_SPEECH) |
|
236 case InputSpeechButtonPart: |
|
237 return adjustInputFieldSpeechButtonStyle(selector, style, e); |
|
238 #endif |
|
239 default: |
|
240 break; |
|
241 } |
|
242 } |
|
243 |
|
244 bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) |
|
245 { |
|
246 // If painting is disabled, but we aren't updating control tints, then just bail. |
|
247 // If we are updating control tints, just schedule a repaint if the theme supports tinting |
|
248 // for that control. |
|
249 if (paintInfo.context->updatingControlTints()) { |
|
250 if (controlSupportsTints(o)) |
|
251 o->repaint(); |
|
252 return false; |
|
253 } |
|
254 if (paintInfo.context->paintingDisabled()) |
|
255 return false; |
|
256 |
|
257 ControlPart part = o->style()->appearance(); |
|
258 |
|
259 #if USE(NEW_THEME) |
|
260 switch (part) { |
|
261 case CheckboxPart: |
|
262 case RadioPart: |
|
263 case PushButtonPart: |
|
264 case SquareButtonPart: |
|
265 case ListButtonPart: |
|
266 case DefaultButtonPart: |
|
267 case ButtonPart: |
|
268 case InnerSpinButtonPart: |
|
269 case OuterSpinButtonPart: |
|
270 m_theme->paint(part, controlStatesForRenderer(o), const_cast<GraphicsContext*>(paintInfo.context), r, o->style()->effectiveZoom(), o->view()->frameView()); |
|
271 return false; |
|
272 default: |
|
273 break; |
|
274 } |
|
275 #endif |
|
276 |
|
277 // Call the appropriate paint method based off the appearance value. |
|
278 switch (part) { |
|
279 #if !USE(NEW_THEME) |
|
280 case CheckboxPart: |
|
281 return paintCheckbox(o, paintInfo, r); |
|
282 case RadioPart: |
|
283 return paintRadio(o, paintInfo, r); |
|
284 case PushButtonPart: |
|
285 case SquareButtonPart: |
|
286 case ListButtonPart: |
|
287 case DefaultButtonPart: |
|
288 case ButtonPart: |
|
289 return paintButton(o, paintInfo, r); |
|
290 case InnerSpinButtonPart: |
|
291 return paintInnerSpinButton(o, paintInfo, r); |
|
292 case OuterSpinButtonPart: |
|
293 return paintOuterSpinButton(o, paintInfo, r); |
|
294 #endif |
|
295 case MenulistPart: |
|
296 return paintMenuList(o, paintInfo, r); |
|
297 #if ENABLE(METER_TAG) |
|
298 case MeterPart: |
|
299 case RelevancyLevelIndicatorPart: |
|
300 case ContinuousCapacityLevelIndicatorPart: |
|
301 case DiscreteCapacityLevelIndicatorPart: |
|
302 case RatingLevelIndicatorPart: |
|
303 return paintMeter(o, paintInfo, r); |
|
304 #endif |
|
305 #if ENABLE(PROGRESS_TAG) |
|
306 case ProgressBarPart: |
|
307 return paintProgressBar(o, paintInfo, r); |
|
308 #endif |
|
309 case SliderHorizontalPart: |
|
310 case SliderVerticalPart: |
|
311 return paintSliderTrack(o, paintInfo, r); |
|
312 case SliderThumbHorizontalPart: |
|
313 case SliderThumbVerticalPart: |
|
314 if (o->parent()->isSlider()) |
|
315 return paintSliderThumb(o, paintInfo, r); |
|
316 // We don't support drawing a slider thumb without a parent slider |
|
317 break; |
|
318 case MediaFullscreenButtonPart: |
|
319 return paintMediaFullscreenButton(o, paintInfo, r); |
|
320 case MediaPlayButtonPart: |
|
321 return paintMediaPlayButton(o, paintInfo, r); |
|
322 case MediaMuteButtonPart: |
|
323 return paintMediaMuteButton(o, paintInfo, r); |
|
324 case MediaSeekBackButtonPart: |
|
325 return paintMediaSeekBackButton(o, paintInfo, r); |
|
326 case MediaSeekForwardButtonPart: |
|
327 return paintMediaSeekForwardButton(o, paintInfo, r); |
|
328 case MediaRewindButtonPart: |
|
329 return paintMediaRewindButton(o, paintInfo, r); |
|
330 case MediaReturnToRealtimeButtonPart: |
|
331 return paintMediaReturnToRealtimeButton(o, paintInfo, r); |
|
332 case MediaToggleClosedCaptionsButtonPart: |
|
333 return paintMediaToggleClosedCaptionsButton(o, paintInfo, r); |
|
334 case MediaSliderPart: |
|
335 return paintMediaSliderTrack(o, paintInfo, r); |
|
336 case MediaSliderThumbPart: |
|
337 if (o->parent()->isSlider()) |
|
338 return paintMediaSliderThumb(o, paintInfo, r); |
|
339 break; |
|
340 case MediaVolumeSliderMuteButtonPart: |
|
341 return paintMediaMuteButton(o, paintInfo, r); |
|
342 case MediaVolumeSliderContainerPart: |
|
343 return paintMediaVolumeSliderContainer(o, paintInfo, r); |
|
344 case MediaVolumeSliderPart: |
|
345 return paintMediaVolumeSliderTrack(o, paintInfo, r); |
|
346 case MediaVolumeSliderThumbPart: |
|
347 if (o->parent()->isSlider()) |
|
348 return paintMediaVolumeSliderThumb(o, paintInfo, r); |
|
349 break; |
|
350 case MediaTimeRemainingPart: |
|
351 return paintMediaTimeRemaining(o, paintInfo, r); |
|
352 case MediaCurrentTimePart: |
|
353 return paintMediaCurrentTime(o, paintInfo, r); |
|
354 case MediaControlsBackgroundPart: |
|
355 return paintMediaControlsBackground(o, paintInfo, r); |
|
356 case MenulistButtonPart: |
|
357 case TextFieldPart: |
|
358 case TextAreaPart: |
|
359 case ListboxPart: |
|
360 return true; |
|
361 case SearchFieldPart: |
|
362 return paintSearchField(o, paintInfo, r); |
|
363 case SearchFieldCancelButtonPart: |
|
364 return paintSearchFieldCancelButton(o, paintInfo, r); |
|
365 case SearchFieldDecorationPart: |
|
366 return paintSearchFieldDecoration(o, paintInfo, r); |
|
367 case SearchFieldResultsDecorationPart: |
|
368 return paintSearchFieldResultsDecoration(o, paintInfo, r); |
|
369 case SearchFieldResultsButtonPart: |
|
370 return paintSearchFieldResultsButton(o, paintInfo, r); |
|
371 #if ENABLE(INPUT_SPEECH) |
|
372 case InputSpeechButtonPart: |
|
373 return paintInputFieldSpeechButton(o, paintInfo, r); |
|
374 #endif |
|
375 default: |
|
376 break; |
|
377 } |
|
378 |
|
379 return true; // We don't support the appearance, so let the normal background/border paint. |
|
380 } |
|
381 |
|
382 bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) |
|
383 { |
|
384 if (paintInfo.context->paintingDisabled()) |
|
385 return false; |
|
386 |
|
387 // Call the appropriate paint method based off the appearance value. |
|
388 switch (o->style()->appearance()) { |
|
389 case TextFieldPart: |
|
390 return paintTextField(o, paintInfo, r); |
|
391 case ListboxPart: |
|
392 case TextAreaPart: |
|
393 return paintTextArea(o, paintInfo, r); |
|
394 case MenulistButtonPart: |
|
395 case SearchFieldPart: |
|
396 return true; |
|
397 case CheckboxPart: |
|
398 case RadioPart: |
|
399 case PushButtonPart: |
|
400 case SquareButtonPart: |
|
401 case ListButtonPart: |
|
402 case DefaultButtonPart: |
|
403 case ButtonPart: |
|
404 case MenulistPart: |
|
405 #if ENABLE(METER_TAG) |
|
406 case MeterPart: |
|
407 case RelevancyLevelIndicatorPart: |
|
408 case ContinuousCapacityLevelIndicatorPart: |
|
409 case DiscreteCapacityLevelIndicatorPart: |
|
410 case RatingLevelIndicatorPart: |
|
411 #endif |
|
412 #if ENABLE(PROGRESS_TAG) |
|
413 case ProgressBarPart: |
|
414 #endif |
|
415 case SliderHorizontalPart: |
|
416 case SliderVerticalPart: |
|
417 case SliderThumbHorizontalPart: |
|
418 case SliderThumbVerticalPart: |
|
419 case SearchFieldCancelButtonPart: |
|
420 case SearchFieldDecorationPart: |
|
421 case SearchFieldResultsDecorationPart: |
|
422 case SearchFieldResultsButtonPart: |
|
423 #if ENABLE(INPUT_SPEECH) |
|
424 case InputSpeechButtonPart: |
|
425 #endif |
|
426 default: |
|
427 break; |
|
428 } |
|
429 |
|
430 return false; |
|
431 } |
|
432 |
|
433 bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) |
|
434 { |
|
435 if (paintInfo.context->paintingDisabled()) |
|
436 return false; |
|
437 |
|
438 // Call the appropriate paint method based off the appearance value. |
|
439 switch (o->style()->appearance()) { |
|
440 case MenulistButtonPart: |
|
441 return paintMenuListButton(o, paintInfo, r); |
|
442 case TextFieldPart: |
|
443 case TextAreaPart: |
|
444 case ListboxPart: |
|
445 case CheckboxPart: |
|
446 case RadioPart: |
|
447 case PushButtonPart: |
|
448 case SquareButtonPart: |
|
449 case ListButtonPart: |
|
450 case DefaultButtonPart: |
|
451 case ButtonPart: |
|
452 case MenulistPart: |
|
453 #if ENABLE(METER_TAG) |
|
454 case MeterPart: |
|
455 case RelevancyLevelIndicatorPart: |
|
456 case ContinuousCapacityLevelIndicatorPart: |
|
457 case DiscreteCapacityLevelIndicatorPart: |
|
458 case RatingLevelIndicatorPart: |
|
459 #endif |
|
460 #if ENABLE(PROGRESS_TAG) |
|
461 case ProgressBarPart: |
|
462 #endif |
|
463 case SliderHorizontalPart: |
|
464 case SliderVerticalPart: |
|
465 case SliderThumbHorizontalPart: |
|
466 case SliderThumbVerticalPart: |
|
467 case SearchFieldPart: |
|
468 case SearchFieldCancelButtonPart: |
|
469 case SearchFieldDecorationPart: |
|
470 case SearchFieldResultsDecorationPart: |
|
471 case SearchFieldResultsButtonPart: |
|
472 #if ENABLE(INPUT_SPEECH) |
|
473 case InputSpeechButtonPart: |
|
474 #endif |
|
475 default: |
|
476 break; |
|
477 } |
|
478 |
|
479 return false; |
|
480 } |
|
481 |
|
482 #if ENABLE(VIDEO) |
|
483 bool RenderTheme::hitTestMediaControlPart(RenderObject* o, const IntPoint& absPoint) |
|
484 { |
|
485 if (!o->isBox()) |
|
486 return false; |
|
487 |
|
488 FloatPoint localPoint = o->absoluteToLocal(absPoint, false, true); // respect transforms |
|
489 return toRenderBox(o)->borderBoxRect().contains(roundedIntPoint(localPoint)); |
|
490 } |
|
491 |
|
492 bool RenderTheme::shouldRenderMediaControlPart(ControlPart part, Element* e) |
|
493 { |
|
494 HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(e); |
|
495 switch (part) { |
|
496 case MediaMuteButtonPart: |
|
497 return mediaElement->hasAudio(); |
|
498 case MediaRewindButtonPart: |
|
499 return mediaElement->movieLoadType() != MediaPlayer::LiveStream; |
|
500 case MediaReturnToRealtimeButtonPart: |
|
501 return mediaElement->movieLoadType() == MediaPlayer::LiveStream; |
|
502 case MediaFullscreenButtonPart: |
|
503 return mediaElement->supportsFullscreen(); |
|
504 case MediaToggleClosedCaptionsButtonPart: |
|
505 return mediaElement->hasClosedCaptions(); |
|
506 default: |
|
507 return true; |
|
508 } |
|
509 } |
|
510 |
|
511 String RenderTheme::formatMediaControlsTime(float time) const |
|
512 { |
|
513 if (!isfinite(time)) |
|
514 time = 0; |
|
515 int seconds = (int)fabsf(time); |
|
516 int hours = seconds / (60 * 60); |
|
517 int minutes = (seconds / 60) % 60; |
|
518 seconds %= 60; |
|
519 if (hours) { |
|
520 if (hours > 9) |
|
521 return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); |
|
522 |
|
523 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); |
|
524 } |
|
525 |
|
526 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); |
|
527 } |
|
528 |
|
529 String RenderTheme::formatMediaControlsCurrentTime(float currentTime, float /*duration*/) const |
|
530 { |
|
531 return formatMediaControlsTime(currentTime); |
|
532 } |
|
533 |
|
534 String RenderTheme::formatMediaControlsRemainingTime(float currentTime, float duration) const |
|
535 { |
|
536 return formatMediaControlsTime(currentTime - duration); |
|
537 } |
|
538 |
|
539 IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(Node* muteButton, const IntSize& size) const |
|
540 { |
|
541 int y = -size.height(); |
|
542 FloatPoint absPoint = muteButton->renderer()->localToAbsolute(FloatPoint(muteButton->renderBox()->offsetLeft(), y), true, true); |
|
543 if (absPoint.y() < 0) |
|
544 y = muteButton->renderBox()->height(); |
|
545 return IntPoint(0, y); |
|
546 } |
|
547 |
|
548 #endif |
|
549 |
|
550 Color RenderTheme::activeSelectionBackgroundColor() const |
|
551 { |
|
552 if (!m_activeSelectionBackgroundColor.isValid()) |
|
553 m_activeSelectionBackgroundColor = platformActiveSelectionBackgroundColor().blendWithWhite(); |
|
554 return m_activeSelectionBackgroundColor; |
|
555 } |
|
556 |
|
557 Color RenderTheme::inactiveSelectionBackgroundColor() const |
|
558 { |
|
559 if (!m_inactiveSelectionBackgroundColor.isValid()) |
|
560 m_inactiveSelectionBackgroundColor = platformInactiveSelectionBackgroundColor().blendWithWhite(); |
|
561 return m_inactiveSelectionBackgroundColor; |
|
562 } |
|
563 |
|
564 Color RenderTheme::activeSelectionForegroundColor() const |
|
565 { |
|
566 if (!m_activeSelectionForegroundColor.isValid() && supportsSelectionForegroundColors()) |
|
567 m_activeSelectionForegroundColor = platformActiveSelectionForegroundColor(); |
|
568 return m_activeSelectionForegroundColor; |
|
569 } |
|
570 |
|
571 Color RenderTheme::inactiveSelectionForegroundColor() const |
|
572 { |
|
573 if (!m_inactiveSelectionForegroundColor.isValid() && supportsSelectionForegroundColors()) |
|
574 m_inactiveSelectionForegroundColor = platformInactiveSelectionForegroundColor(); |
|
575 return m_inactiveSelectionForegroundColor; |
|
576 } |
|
577 |
|
578 Color RenderTheme::activeListBoxSelectionBackgroundColor() const |
|
579 { |
|
580 if (!m_activeListBoxSelectionBackgroundColor.isValid()) |
|
581 m_activeListBoxSelectionBackgroundColor = platformActiveListBoxSelectionBackgroundColor(); |
|
582 return m_activeListBoxSelectionBackgroundColor; |
|
583 } |
|
584 |
|
585 Color RenderTheme::inactiveListBoxSelectionBackgroundColor() const |
|
586 { |
|
587 if (!m_inactiveListBoxSelectionBackgroundColor.isValid()) |
|
588 m_inactiveListBoxSelectionBackgroundColor = platformInactiveListBoxSelectionBackgroundColor(); |
|
589 return m_inactiveListBoxSelectionBackgroundColor; |
|
590 } |
|
591 |
|
592 Color RenderTheme::activeListBoxSelectionForegroundColor() const |
|
593 { |
|
594 if (!m_activeListBoxSelectionForegroundColor.isValid() && supportsListBoxSelectionForegroundColors()) |
|
595 m_activeListBoxSelectionForegroundColor = platformActiveListBoxSelectionForegroundColor(); |
|
596 return m_activeListBoxSelectionForegroundColor; |
|
597 } |
|
598 |
|
599 Color RenderTheme::inactiveListBoxSelectionForegroundColor() const |
|
600 { |
|
601 if (!m_inactiveListBoxSelectionForegroundColor.isValid() && supportsListBoxSelectionForegroundColors()) |
|
602 m_inactiveListBoxSelectionForegroundColor = platformInactiveListBoxSelectionForegroundColor(); |
|
603 return m_inactiveListBoxSelectionForegroundColor; |
|
604 } |
|
605 |
|
606 Color RenderTheme::platformActiveSelectionBackgroundColor() const |
|
607 { |
|
608 // Use a blue color by default if the platform theme doesn't define anything. |
|
609 return Color(0, 0, 255); |
|
610 } |
|
611 |
|
612 Color RenderTheme::platformActiveSelectionForegroundColor() const |
|
613 { |
|
614 // Use a white color by default if the platform theme doesn't define anything. |
|
615 return Color::white; |
|
616 } |
|
617 |
|
618 Color RenderTheme::platformInactiveSelectionBackgroundColor() const |
|
619 { |
|
620 // Use a grey color by default if the platform theme doesn't define anything. |
|
621 // This color matches Firefox's inactive color. |
|
622 return Color(176, 176, 176); |
|
623 } |
|
624 |
|
625 Color RenderTheme::platformInactiveSelectionForegroundColor() const |
|
626 { |
|
627 // Use a black color by default. |
|
628 return Color::black; |
|
629 } |
|
630 |
|
631 Color RenderTheme::platformActiveListBoxSelectionBackgroundColor() const |
|
632 { |
|
633 return platformActiveSelectionBackgroundColor(); |
|
634 } |
|
635 |
|
636 Color RenderTheme::platformActiveListBoxSelectionForegroundColor() const |
|
637 { |
|
638 return platformActiveSelectionForegroundColor(); |
|
639 } |
|
640 |
|
641 Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor() const |
|
642 { |
|
643 return platformInactiveSelectionBackgroundColor(); |
|
644 } |
|
645 |
|
646 Color RenderTheme::platformInactiveListBoxSelectionForegroundColor() const |
|
647 { |
|
648 return platformInactiveSelectionForegroundColor(); |
|
649 } |
|
650 |
|
651 int RenderTheme::baselinePosition(const RenderObject* o) const |
|
652 { |
|
653 if (!o->isBox()) |
|
654 return 0; |
|
655 |
|
656 const RenderBox* box = toRenderBox(o); |
|
657 |
|
658 #if USE(NEW_THEME) |
|
659 return box->height() + box->marginTop() + m_theme->baselinePositionAdjustment(o->style()->appearance()) * o->style()->effectiveZoom(); |
|
660 #else |
|
661 return box->height() + box->marginTop(); |
|
662 #endif |
|
663 } |
|
664 |
|
665 bool RenderTheme::isControlContainer(ControlPart appearance) const |
|
666 { |
|
667 // There are more leaves than this, but we'll patch this function as we add support for |
|
668 // more controls. |
|
669 return appearance != CheckboxPart && appearance != RadioPart; |
|
670 } |
|
671 |
|
672 bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background, |
|
673 const Color& backgroundColor) const |
|
674 { |
|
675 switch (style->appearance()) { |
|
676 case PushButtonPart: |
|
677 case SquareButtonPart: |
|
678 case DefaultButtonPart: |
|
679 case ButtonPart: |
|
680 case ListboxPart: |
|
681 case MenulistPart: |
|
682 case ProgressBarPart: |
|
683 case MeterPart: |
|
684 case RelevancyLevelIndicatorPart: |
|
685 case ContinuousCapacityLevelIndicatorPart: |
|
686 case DiscreteCapacityLevelIndicatorPart: |
|
687 case RatingLevelIndicatorPart: |
|
688 // FIXME: Uncomment this when making search fields style-able. |
|
689 // case SearchFieldPart: |
|
690 case TextFieldPart: |
|
691 case TextAreaPart: |
|
692 // Test the style to see if the UA border and background match. |
|
693 return (style->border() != border || |
|
694 *style->backgroundLayers() != background || |
|
695 style->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor); |
|
696 default: |
|
697 return false; |
|
698 } |
|
699 } |
|
700 |
|
701 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) |
|
702 { |
|
703 #if USE(NEW_THEME) |
|
704 m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), r, o->style()->effectiveZoom()); |
|
705 #endif |
|
706 } |
|
707 |
|
708 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const |
|
709 { |
|
710 return (style->hasAppearance() && style->appearance() != TextFieldPart && style->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart && style->appearance() != ListboxPart); |
|
711 } |
|
712 |
|
713 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const |
|
714 { |
|
715 // Default implementation assumes the controls don't respond to changes in :hover state |
|
716 if (state == HoverState && !supportsHover(o->style())) |
|
717 return false; |
|
718 |
|
719 // Assume pressed state is only responded to if the control is enabled. |
|
720 if (state == PressedState && !isEnabled(o)) |
|
721 return false; |
|
722 |
|
723 // Repaint the control. |
|
724 o->repaint(); |
|
725 return true; |
|
726 } |
|
727 |
|
728 ControlStates RenderTheme::controlStatesForRenderer(const RenderObject* o) const |
|
729 { |
|
730 ControlStates result = 0; |
|
731 if (isHovered(o)) { |
|
732 result |= HoverState; |
|
733 if (isSpinUpButtonPartHovered(o)) |
|
734 result |= SpinUpState; |
|
735 } |
|
736 if (isPressed(o)) { |
|
737 result |= PressedState; |
|
738 if (isSpinUpButtonPartPressed(o)) |
|
739 result |= SpinUpState; |
|
740 } |
|
741 if (isFocused(o) && o->style()->outlineStyleIsAuto()) |
|
742 result |= FocusState; |
|
743 if (isEnabled(o)) |
|
744 result |= EnabledState; |
|
745 if (isChecked(o)) |
|
746 result |= CheckedState; |
|
747 if (isReadOnlyControl(o)) |
|
748 result |= ReadOnlyState; |
|
749 if (isDefault(o)) |
|
750 result |= DefaultState; |
|
751 if (!isActive(o)) |
|
752 result |= WindowInactiveState; |
|
753 if (isIndeterminate(o)) |
|
754 result |= IndeterminateState; |
|
755 return result; |
|
756 } |
|
757 |
|
758 bool RenderTheme::isActive(const RenderObject* o) const |
|
759 { |
|
760 Node* node = o->node(); |
|
761 if (!node) |
|
762 return false; |
|
763 |
|
764 Frame* frame = node->document()->frame(); |
|
765 if (!frame) |
|
766 return false; |
|
767 |
|
768 Page* page = frame->page(); |
|
769 if (!page) |
|
770 return false; |
|
771 |
|
772 return page->focusController()->isActive(); |
|
773 } |
|
774 |
|
775 bool RenderTheme::isChecked(const RenderObject* o) const |
|
776 { |
|
777 if (!o->node() || !o->node()->isElementNode()) |
|
778 return false; |
|
779 |
|
780 InputElement* inputElement = toInputElement(static_cast<Element*>(o->node())); |
|
781 if (!inputElement) |
|
782 return false; |
|
783 |
|
784 return inputElement->isChecked(); |
|
785 } |
|
786 |
|
787 bool RenderTheme::isIndeterminate(const RenderObject* o) const |
|
788 { |
|
789 if (!o->node() || !o->node()->isElementNode()) |
|
790 return false; |
|
791 |
|
792 InputElement* inputElement = toInputElement(static_cast<Element*>(o->node())); |
|
793 if (!inputElement) |
|
794 return false; |
|
795 |
|
796 return inputElement->isIndeterminate(); |
|
797 } |
|
798 |
|
799 bool RenderTheme::isEnabled(const RenderObject* o) const |
|
800 { |
|
801 Node* node = o->node(); |
|
802 if (!node || !node->isElementNode()) |
|
803 return true; |
|
804 return static_cast<Element*>(node)->isEnabledFormControl(); |
|
805 } |
|
806 |
|
807 bool RenderTheme::isFocused(const RenderObject* o) const |
|
808 { |
|
809 Node* node = o->node(); |
|
810 if (!node) |
|
811 return false; |
|
812 Document* document = node->document(); |
|
813 Frame* frame = document->frame(); |
|
814 return node == document->focusedNode() && frame && frame->selection()->isFocusedAndActive(); |
|
815 } |
|
816 |
|
817 bool RenderTheme::isPressed(const RenderObject* o) const |
|
818 { |
|
819 if (!o->node()) |
|
820 return false; |
|
821 return o->node()->active(); |
|
822 } |
|
823 |
|
824 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const |
|
825 { |
|
826 Node* node = o->node(); |
|
827 if (!node || !node->active() || !node->isElementNode() |
|
828 || !static_cast<Element*>(node)->isSpinButtonElement()) |
|
829 return false; |
|
830 SpinButtonElement* element = static_cast<SpinButtonElement*>(node); |
|
831 return element->upDownState() == SpinButtonElement::Up; |
|
832 } |
|
833 |
|
834 bool RenderTheme::isReadOnlyControl(const RenderObject* o) const |
|
835 { |
|
836 Node* node = o->node(); |
|
837 if (!node || !node->isElementNode()) |
|
838 return false; |
|
839 return static_cast<Element*>(node)->isReadOnlyFormControl(); |
|
840 } |
|
841 |
|
842 bool RenderTheme::isHovered(const RenderObject* o) const |
|
843 { |
|
844 Node* node = o->node(); |
|
845 if (!node) |
|
846 return false; |
|
847 if (!node->isElementNode() || !static_cast<Element*>(node)->isSpinButtonElement()) |
|
848 return node->hovered(); |
|
849 SpinButtonElement* element = static_cast<SpinButtonElement*>(node); |
|
850 return element->hovered() && element->upDownState() != SpinButtonElement::Indeterminate; |
|
851 } |
|
852 |
|
853 bool RenderTheme::isSpinUpButtonPartHovered(const RenderObject* o) const |
|
854 { |
|
855 Node* node = o->node(); |
|
856 if (!node || !node->isElementNode() || !static_cast<Element*>(node)->isSpinButtonElement()) |
|
857 return false; |
|
858 SpinButtonElement* element = static_cast<SpinButtonElement*>(node); |
|
859 return element->upDownState() == SpinButtonElement::Up; |
|
860 } |
|
861 |
|
862 bool RenderTheme::isDefault(const RenderObject* o) const |
|
863 { |
|
864 // A button should only have the default appearance if the page is active |
|
865 if (!isActive(o)) |
|
866 return false; |
|
867 |
|
868 if (!o->document()) |
|
869 return false; |
|
870 |
|
871 Settings* settings = o->document()->settings(); |
|
872 if (!settings || !settings->inApplicationChromeMode()) |
|
873 return false; |
|
874 |
|
875 return o->style()->appearance() == DefaultButtonPart; |
|
876 } |
|
877 |
|
878 #if !USE(NEW_THEME) |
|
879 |
|
880 void RenderTheme::adjustCheckboxStyle(CSSStyleSelector*, RenderStyle* style, Element*) const |
|
881 { |
|
882 // A summary of the rules for checkbox designed to match WinIE: |
|
883 // width/height - honored (WinIE actually scales its control for small widths, but lets it overflow for small heights.) |
|
884 // font-size - not honored (control has no text), but we use it to decide which control size to use. |
|
885 setCheckboxSize(style); |
|
886 |
|
887 // padding - not honored by WinIE, needs to be removed. |
|
888 style->resetPadding(); |
|
889 |
|
890 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) |
|
891 // for now, we will not honor it. |
|
892 style->resetBorder(); |
|
893 |
|
894 style->setBoxShadow(0); |
|
895 } |
|
896 |
|
897 void RenderTheme::adjustRadioStyle(CSSStyleSelector*, RenderStyle* style, Element*) const |
|
898 { |
|
899 // A summary of the rules for checkbox designed to match WinIE: |
|
900 // width/height - honored (WinIE actually scales its control for small widths, but lets it overflow for small heights.) |
|
901 // font-size - not honored (control has no text), but we use it to decide which control size to use. |
|
902 setRadioSize(style); |
|
903 |
|
904 // padding - not honored by WinIE, needs to be removed. |
|
905 style->resetPadding(); |
|
906 |
|
907 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) |
|
908 // for now, we will not honor it. |
|
909 style->resetBorder(); |
|
910 |
|
911 style->setBoxShadow(0); |
|
912 } |
|
913 |
|
914 void RenderTheme::adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const |
|
915 { |
|
916 // Most platforms will completely honor all CSS, and so we have no need to adjust the style |
|
917 // at all by default. We will still allow the theme a crack at setting up a desired vertical size. |
|
918 setButtonSize(style); |
|
919 } |
|
920 |
|
921 void RenderTheme::adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
922 { |
|
923 } |
|
924 |
|
925 void RenderTheme::adjustOuterSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
926 { |
|
927 } |
|
928 |
|
929 #endif |
|
930 |
|
931 void RenderTheme::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
932 { |
|
933 } |
|
934 |
|
935 void RenderTheme::adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
936 { |
|
937 } |
|
938 |
|
939 void RenderTheme::adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
940 { |
|
941 } |
|
942 |
|
943 #if ENABLE(INPUT_SPEECH) |
|
944 void RenderTheme::adjustInputFieldSpeechButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* element) const |
|
945 { |
|
946 RenderInputSpeech::adjustInputFieldSpeechButtonStyle(selector, style, element); |
|
947 } |
|
948 |
|
949 bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) |
|
950 { |
|
951 return RenderInputSpeech::paintInputFieldSpeechButton(object, paintInfo, rect); |
|
952 } |
|
953 #endif |
|
954 |
|
955 #if ENABLE(METER_TAG) |
|
956 void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Element*) const |
|
957 { |
|
958 style->setBoxShadow(0); |
|
959 } |
|
960 |
|
961 IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const |
|
962 { |
|
963 return bounds.size(); |
|
964 } |
|
965 |
|
966 bool RenderTheme::supportsMeter(ControlPart, bool) const |
|
967 { |
|
968 return false; |
|
969 } |
|
970 |
|
971 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) |
|
972 { |
|
973 return true; |
|
974 } |
|
975 |
|
976 #endif |
|
977 |
|
978 #if ENABLE(PROGRESS_TAG) |
|
979 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const |
|
980 { |
|
981 return 0; |
|
982 } |
|
983 |
|
984 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const |
|
985 { |
|
986 return 0; |
|
987 } |
|
988 |
|
989 void RenderTheme::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
990 { |
|
991 } |
|
992 #endif |
|
993 |
|
994 void RenderTheme::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
995 { |
|
996 } |
|
997 |
|
998 void RenderTheme::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
999 { |
|
1000 } |
|
1001 |
|
1002 void RenderTheme::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1003 { |
|
1004 } |
|
1005 |
|
1006 void RenderTheme::adjustSliderThumbSize(RenderObject*) const |
|
1007 { |
|
1008 } |
|
1009 |
|
1010 void RenderTheme::adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1011 { |
|
1012 } |
|
1013 |
|
1014 void RenderTheme::adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1015 { |
|
1016 } |
|
1017 |
|
1018 void RenderTheme::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1019 { |
|
1020 } |
|
1021 |
|
1022 void RenderTheme::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1023 { |
|
1024 } |
|
1025 |
|
1026 void RenderTheme::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const |
|
1027 { |
|
1028 } |
|
1029 |
|
1030 void RenderTheme::platformColorsDidChange() |
|
1031 { |
|
1032 m_activeSelectionForegroundColor = Color(); |
|
1033 m_inactiveSelectionForegroundColor = Color(); |
|
1034 m_activeSelectionBackgroundColor = Color(); |
|
1035 m_inactiveSelectionBackgroundColor = Color(); |
|
1036 |
|
1037 m_activeListBoxSelectionForegroundColor = Color(); |
|
1038 m_inactiveListBoxSelectionForegroundColor = Color(); |
|
1039 m_activeListBoxSelectionBackgroundColor = Color(); |
|
1040 m_inactiveListBoxSelectionForegroundColor = Color(); |
|
1041 } |
|
1042 |
|
1043 Color RenderTheme::systemColor(int cssValueId) const |
|
1044 { |
|
1045 switch (cssValueId) { |
|
1046 case CSSValueActiveborder: |
|
1047 return 0xFFFFFFFF; |
|
1048 case CSSValueActivecaption: |
|
1049 return 0xFFCCCCCC; |
|
1050 case CSSValueAppworkspace: |
|
1051 return 0xFFFFFFFF; |
|
1052 case CSSValueBackground: |
|
1053 return 0xFF6363CE; |
|
1054 case CSSValueButtonface: |
|
1055 return 0xFFC0C0C0; |
|
1056 case CSSValueButtonhighlight: |
|
1057 return 0xFFDDDDDD; |
|
1058 case CSSValueButtonshadow: |
|
1059 return 0xFF888888; |
|
1060 case CSSValueButtontext: |
|
1061 return 0xFF000000; |
|
1062 case CSSValueCaptiontext: |
|
1063 return 0xFF000000; |
|
1064 case CSSValueGraytext: |
|
1065 return 0xFF808080; |
|
1066 case CSSValueHighlight: |
|
1067 return 0xFFB5D5FF; |
|
1068 case CSSValueHighlighttext: |
|
1069 return 0xFF000000; |
|
1070 case CSSValueInactiveborder: |
|
1071 return 0xFFFFFFFF; |
|
1072 case CSSValueInactivecaption: |
|
1073 return 0xFFFFFFFF; |
|
1074 case CSSValueInactivecaptiontext: |
|
1075 return 0xFF7F7F7F; |
|
1076 case CSSValueInfobackground: |
|
1077 return 0xFFFBFCC5; |
|
1078 case CSSValueInfotext: |
|
1079 return 0xFF000000; |
|
1080 case CSSValueMenu: |
|
1081 return 0xFFC0C0C0; |
|
1082 case CSSValueMenutext: |
|
1083 return 0xFF000000; |
|
1084 case CSSValueScrollbar: |
|
1085 return 0xFFFFFFFF; |
|
1086 case CSSValueText: |
|
1087 return 0xFF000000; |
|
1088 case CSSValueThreeddarkshadow: |
|
1089 return 0xFF666666; |
|
1090 case CSSValueThreedface: |
|
1091 return 0xFFC0C0C0; |
|
1092 case CSSValueThreedhighlight: |
|
1093 return 0xFFDDDDDD; |
|
1094 case CSSValueThreedlightshadow: |
|
1095 return 0xFFC0C0C0; |
|
1096 case CSSValueThreedshadow: |
|
1097 return 0xFF888888; |
|
1098 case CSSValueWindow: |
|
1099 return 0xFFFFFFFF; |
|
1100 case CSSValueWindowframe: |
|
1101 return 0xFFCCCCCC; |
|
1102 case CSSValueWindowtext: |
|
1103 return 0xFF000000; |
|
1104 } |
|
1105 return Color(); |
|
1106 } |
|
1107 |
|
1108 Color RenderTheme::platformActiveTextSearchHighlightColor() const |
|
1109 { |
|
1110 return Color(255, 150, 50); // Orange. |
|
1111 } |
|
1112 |
|
1113 Color RenderTheme::platformInactiveTextSearchHighlightColor() const |
|
1114 { |
|
1115 return Color(255, 255, 0); // Yellow. |
|
1116 } |
|
1117 |
|
1118 void RenderTheme::setCustomFocusRingColor(const Color& c) |
|
1119 { |
|
1120 customFocusRingColor() = c; |
|
1121 } |
|
1122 |
|
1123 Color RenderTheme::focusRingColor() |
|
1124 { |
|
1125 return customFocusRingColor().isValid() ? customFocusRingColor() : defaultTheme()->platformFocusRingColor(); |
|
1126 } |
|
1127 |
|
1128 } // namespace WebCore |