OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // This method is called whenever style has been computed for an element and
the appearance | 70 // This method is called whenever style has been computed for an element and
the appearance |
71 // property has been set to a value other than "none". The theme should map
in all of the appropriate | 71 // property has been set to a value other than "none". The theme should map
in all of the appropriate |
72 // metrics and defaults given the contents of the style. This includes soph
isticated operations like | 72 // metrics and defaults given the contents of the style. This includes soph
isticated operations like |
73 // selection of control size based off the font, the disabling of appearance
when certain other properties like | 73 // selection of control size based off the font, the disabling of appearance
when certain other properties like |
74 // "border" are set, or if the appearance is not supported by the theme. | 74 // "border" are set, or if the appearance is not supported by the theme. |
75 void adjustStyle(RenderStyle*, Element*, const CachedUAStyle&); | 75 void adjustStyle(RenderStyle*, Element*, const CachedUAStyle&); |
76 | 76 |
77 // This method is called to paint the widget as a background of the RenderOb
ject. A widget's foreground, e.g., the | 77 // This method is called to paint the widget as a background of the RenderOb
ject. A widget's foreground, e.g., the |
78 // text of a button, is always rendered by the engine itself. The boolean r
eturn value indicates | 78 // text of a button, is always rendered by the engine itself. The boolean r
eturn value indicates |
79 // whether the CSS border/background should also be painted. | 79 // whether the CSS border/background should also be painted. |
80 bool paint(RenderObject*, const PaintInfo&, const IntRect&); | 80 bool paint(RenderObject*, PaintInfo&, const IntRect&); |
81 bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); | 81 bool paintBorderOnly(RenderObject*, PaintInfo&, const IntRect&); |
82 bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); | 82 bool paintDecorations(RenderObject*, PaintInfo&, const IntRect&); |
83 | 83 |
84 // The remaining methods should be implemented by the platform-specific port
ion of the theme, e.g., | 84 // The remaining methods should be implemented by the platform-specific port
ion of the theme, e.g., |
85 // RenderThemeMac.cpp for Mac OS X. | 85 // RenderThemeMac.cpp for Mac OS X. |
86 | 86 |
87 // These methods return the theme's extra style sheets rules, to let each pl
atform | 87 // These methods return the theme's extra style sheets rules, to let each pl
atform |
88 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css
. | 88 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css
. |
89 virtual String extraDefaultStyleSheet(); | 89 virtual String extraDefaultStyleSheet(); |
90 virtual String extraQuirksStyleSheet() { return String(); } | 90 virtual String extraQuirksStyleSheet() { return String(); } |
91 virtual String extraMediaControlsStyleSheet() { return String(); } | 91 virtual String extraMediaControlsStyleSheet() { return String(); } |
92 virtual String extraFullScreenStyleSheet() { return String(); } | 92 virtual String extraFullScreenStyleSheet() { return String(); } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; } | 170 virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; } |
171 virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; } | 171 virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; } |
172 virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; } | 172 virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; } |
173 virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; } | 173 virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; } |
174 virtual bool popupOptionSupportsTextIndent() const { return false; } | 174 virtual bool popupOptionSupportsTextIndent() const { return false; } |
175 | 175 |
176 virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { retu
rn RegularScrollbar; } | 176 virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { retu
rn RegularScrollbar; } |
177 | 177 |
178 // Method for painting the caps lock indicator | 178 // Method for painting the caps lock indicator |
179 virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const I
ntRect&) { return 0; }; | 179 virtual bool paintCapsLockIndicator(RenderObject*, PaintInfo&, const IntRect
&) { return 0; }; |
180 | 180 |
181 // Returns the repeat interval of the animation for the progress bar. | 181 // Returns the repeat interval of the animation for the progress bar. |
182 virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; | 182 virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; |
183 // Returns the duration of the animation for the progress bar. | 183 // Returns the duration of the animation for the progress bar. |
184 virtual double animationDurationForProgressBar(RenderProgress*) const; | 184 virtual double animationDurationForProgressBar(RenderProgress*) const; |
185 | 185 |
186 // Media controls | 186 // Media controls |
187 virtual bool supportsClosedCaptioning() const { return false; } | 187 virtual bool supportsClosedCaptioning() const { return false; } |
188 virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return fals
e; } | 188 virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return fals
e; } |
189 virtual bool usesMediaControlStatusDisplay() { return false; } | 189 virtual bool usesMediaControlStatusDisplay() { return false; } |
190 virtual bool usesMediaControlVolumeSlider() const { return true; } | 190 virtual bool usesMediaControlVolumeSlider() const { return true; } |
191 virtual bool usesVerticalVolumeSlider() const { return true; } | 191 virtual bool usesVerticalVolumeSlider() const { return true; } |
192 virtual double mediaControlsFadeInDuration() { return 0.1; } | 192 virtual double mediaControlsFadeInDuration() { return 0.1; } |
193 virtual double mediaControlsFadeOutDuration() { return 0.3; } | 193 virtual double mediaControlsFadeOutDuration() { return 0.3; } |
194 virtual String formatMediaControlsTime(float time) const; | 194 virtual String formatMediaControlsTime(float time) const; |
195 virtual String formatMediaControlsCurrentTime(float currentTime, float durat
ion) const; | 195 virtual String formatMediaControlsCurrentTime(float currentTime, float durat
ion) const; |
196 | 196 |
197 virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const
; | 197 virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const
; |
198 virtual bool supportsMeter(ControlPart) const; | 198 virtual bool supportsMeter(ControlPart) const; |
199 | 199 |
200 // Returns the threshold distance for snapping to a slider tick mark. | 200 // Returns the threshold distance for snapping to a slider tick mark. |
201 virtual LayoutUnit sliderTickSnappingThreshold() const; | 201 virtual LayoutUnit sliderTickSnappingThreshold() const; |
202 // Returns size of one slider tick mark for a horizontal track. | 202 // Returns size of one slider tick mark for a horizontal track. |
203 // For vertical tracks we rotate it and use it. i.e. Width is always length
along the track. | 203 // For vertical tracks we rotate it and use it. i.e. Width is always length
along the track. |
204 virtual IntSize sliderTickSize() const = 0; | 204 virtual IntSize sliderTickSize() const = 0; |
205 // Returns the distance of slider tick origin from the slider track center. | 205 // Returns the distance of slider tick origin from the slider track center. |
206 virtual int sliderTickOffsetFromTrackCenter() const = 0; | 206 virtual int sliderTickOffsetFromTrackCenter() const = 0; |
207 void paintSliderTicks(RenderObject*, const PaintInfo&, const IntRect&); | 207 void paintSliderTicks(RenderObject*, PaintInfo&, const IntRect&); |
208 | 208 |
209 virtual bool shouldShowPlaceholderWhenFocused() const { return false; } | 209 virtual bool shouldShowPlaceholderWhenFocused() const { return false; } |
210 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; | 210 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; |
211 | 211 |
212 // Functions for <select> elements. | 212 // Functions for <select> elements. |
213 virtual bool delegatesMenuListRendering() const { return false; } | 213 virtual bool delegatesMenuListRendering() const { return false; } |
214 virtual bool popsMenuByArrowKeys() const { return false; } | 214 virtual bool popsMenuByArrowKeys() const { return false; } |
215 virtual bool popsMenuBySpaceOrReturn() const { return false; } | 215 virtual bool popsMenuBySpaceOrReturn() const { return false; } |
216 | 216 |
217 virtual String fileListDefaultLabel(bool multipleFilesAllowed) const; | 217 virtual String fileListDefaultLabel(bool multipleFilesAllowed) const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 virtual void adjustTextAreaStyle(RenderStyle*, Element*) const; | 260 virtual void adjustTextAreaStyle(RenderStyle*, Element*) const; |
261 virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&)
{ return true; } | 261 virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&)
{ return true; } |
262 | 262 |
263 virtual void adjustMenuListStyle(RenderStyle*, Element*) const; | 263 virtual void adjustMenuListStyle(RenderStyle*, Element*) const; |
264 virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&)
{ return true; } | 264 virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&)
{ return true; } |
265 | 265 |
266 virtual void adjustMenuListButtonStyle(RenderStyle*, Element*) const; | 266 virtual void adjustMenuListButtonStyle(RenderStyle*, Element*) const; |
267 virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntR
ect&) { return true; } | 267 virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntR
ect&) { return true; } |
268 | 268 |
269 virtual void adjustMeterStyle(RenderStyle*, Element*) const; | 269 virtual void adjustMeterStyle(RenderStyle*, Element*) const; |
270 virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); | 270 virtual bool paintMeter(RenderObject*, PaintInfo&, const IntRect&); |
271 | 271 |
272 virtual void adjustProgressBarStyle(RenderStyle*, Element*) const; | 272 virtual void adjustProgressBarStyle(RenderStyle*, Element*) const; |
273 virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } | 273 virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } |
274 | 274 |
275 #if ENABLE(INPUT_SPEECH) | 275 #if ENABLE(INPUT_SPEECH) |
276 virtual void adjustInputFieldSpeechButtonStyle(RenderStyle*, Element*) const
; | 276 virtual void adjustInputFieldSpeechButtonStyle(RenderStyle*, Element*) const
; |
277 virtual bool paintInputFieldSpeechButton(RenderObject*, const PaintInfo&, co
nst IntRect&); | 277 virtual bool paintInputFieldSpeechButton(RenderObject*, PaintInfo&, const In
tRect&); |
278 #endif | 278 #endif |
279 | 279 |
280 virtual void adjustSliderTrackStyle(RenderStyle*, Element*) const; | 280 virtual void adjustSliderTrackStyle(RenderStyle*, Element*) const; |
281 virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } | 281 virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } |
282 | 282 |
283 virtual void adjustSliderThumbStyle(RenderStyle*, Element*) const; | 283 virtual void adjustSliderThumbStyle(RenderStyle*, Element*) const; |
284 virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } | 284 virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } |
285 | 285 |
286 virtual void adjustSearchFieldStyle(RenderStyle*, Element*) const; | 286 virtual void adjustSearchFieldStyle(RenderStyle*, Element*) const; |
287 virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } | 287 virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect
&) { return true; } |
(...skipping 23 matching lines...) Expand all Loading... |
311 virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const PaintInfo
&, const IntRect&) { return true; } | 311 virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const PaintInfo
&, const IntRect&) { return true; } |
312 virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const Paint
Info&, const IntRect&) { return true; } | 312 virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const Paint
Info&, const IntRect&) { return true; } |
313 virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, c
onst IntRect&) { return true; } | 313 virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, c
onst IntRect&) { return true; } |
314 virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const In
tRect&) { return true; } | 314 virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const In
tRect&) { return true; } |
315 virtual bool paintMediaTimeRemaining(RenderObject*, const PaintInfo&, const
IntRect&) { return true; } | 315 virtual bool paintMediaTimeRemaining(RenderObject*, const PaintInfo&, const
IntRect&) { return true; } |
316 virtual bool paintMediaFullScreenVolumeSliderTrack(RenderObject*, const Pain
tInfo&, const IntRect&) { return true; } | 316 virtual bool paintMediaFullScreenVolumeSliderTrack(RenderObject*, const Pain
tInfo&, const IntRect&) { return true; } |
317 virtual bool paintMediaFullScreenVolumeSliderThumb(RenderObject*, const Pain
tInfo&, const IntRect&) { return true; } | 317 virtual bool paintMediaFullScreenVolumeSliderThumb(RenderObject*, const Pain
tInfo&, const IntRect&) { return true; } |
318 | 318 |
319 virtual bool shouldUseFallbackTheme(RenderStyle*) const; | 319 virtual bool shouldUseFallbackTheme(RenderStyle*) const; |
320 void adjustStyleUsingFallbackTheme(RenderStyle*, Element*); | 320 void adjustStyleUsingFallbackTheme(RenderStyle*, Element*); |
321 bool paintUsingFallbackTheme(RenderObject*, const PaintInfo&, const IntRect&
); | 321 bool paintUsingFallbackTheme(RenderObject*, PaintInfo&, const IntRect&); |
322 void adjustCheckboxStyleUsingFallbackTheme(RenderStyle*, Element*) const; | 322 void adjustCheckboxStyleUsingFallbackTheme(RenderStyle*, Element*) const; |
323 bool paintCheckboxUsingFallbackTheme(RenderObject*, const PaintInfo&, const
IntRect&); | 323 bool paintCheckboxUsingFallbackTheme(RenderObject*, PaintInfo&, const IntRec
t&); |
324 void adjustRadioStyleUsingFallbackTheme(RenderStyle*, Element*) const; | 324 void adjustRadioStyleUsingFallbackTheme(RenderStyle*, Element*) const; |
325 bool paintRadioUsingFallbackTheme(RenderObject*, const PaintInfo&, const Int
Rect&); | 325 bool paintRadioUsingFallbackTheme(RenderObject*, PaintInfo&, const IntRect&)
; |
326 | 326 |
327 public: | 327 public: |
328 // Methods for state querying | 328 // Methods for state querying |
329 ControlStates controlStatesForRenderer(const RenderObject* o) const; | 329 ControlStates controlStatesForRenderer(const RenderObject* o) const; |
330 bool isActive(const RenderObject*) const; | 330 bool isActive(const RenderObject*) const; |
331 bool isChecked(const RenderObject*) const; | 331 bool isChecked(const RenderObject*) const; |
332 bool isIndeterminate(const RenderObject*) const; | 332 bool isIndeterminate(const RenderObject*) const; |
333 bool isEnabled(const RenderObject*) const; | 333 bool isEnabled(const RenderObject*) const; |
334 bool isFocused(const RenderObject*) const; | 334 bool isFocused(const RenderObject*) const; |
335 bool isPressed(const RenderObject*) const; | 335 bool isPressed(const RenderObject*) const; |
(...skipping 20 matching lines...) Expand all Loading... |
356 static const RGBA32 defaultTapHighlightColor = 0x66000000; | 356 static const RGBA32 defaultTapHighlightColor = 0x66000000; |
357 | 357 |
358 #if USE(NEW_THEME) | 358 #if USE(NEW_THEME) |
359 Theme* m_theme; // The platform-specific theme. | 359 Theme* m_theme; // The platform-specific theme. |
360 #endif | 360 #endif |
361 }; | 361 }; |
362 | 362 |
363 } // namespace WebCore | 363 } // namespace WebCore |
364 | 364 |
365 #endif // RenderTheme_h | 365 #endif // RenderTheme_h |
OLD | NEW |