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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 public: | 53 public: |
54 virtual ~LayoutTheme() {} | 54 virtual ~LayoutTheme() {} |
55 | 55 |
56 static LayoutTheme& theme(); | 56 static LayoutTheme& theme(); |
57 | 57 |
58 virtual ThemePainter& painter() = 0; | 58 virtual ThemePainter& painter() = 0; |
59 | 59 |
60 static void setSizeIfAuto(ComputedStyle&, const IntSize&); | 60 static void setSizeIfAuto(ComputedStyle&, const IntSize&); |
61 | 61 |
62 // This method is called whenever style has been computed for an element and t
he appearance | 62 // This method is called whenever style has been computed for an element and |
63 // property has been set to a value other than "none". The theme should map i
n all of the appropriate | 63 // the appearance property has been set to a value other than "none". |
64 // metrics and defaults given the contents of the style. This includes sophis
ticated operations like | 64 // The theme should map in all of the appropriate metrics and defaults given |
65 // selection of control size based off the font, the disabling of appearance w
hen certain other properties like | 65 // the contents of the style. This includes sophisticated operations like |
66 // "border" are set, or if the appearance is not supported by the theme. | 66 // selection of control size based off the font, the disabling of appearance |
| 67 // when certain other properties like "border" are set, or if the appearance |
| 68 // is not supported by the theme. |
67 void adjustStyle(ComputedStyle&, Element*); | 69 void adjustStyle(ComputedStyle&, Element*); |
68 | 70 |
69 // The remaining methods should be implemented by the platform-specific portio
n of the theme, e.g., | 71 // The remaining methods should be implemented by the platform-specific |
70 // LayoutThemeMac.cpp for Mac OS X. | 72 // portion of the theme, e.g., LayoutThemeMac.cpp for Mac OS X. |
71 | 73 |
72 // These methods return the theme's extra style sheets rules, to let each plat
form | 74 // These methods return the theme's extra style sheets rules, to let each |
73 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css. | 75 // platform adjust the default CSS rules in html.css, quirks.css or |
| 76 // mediaControls.css. |
74 virtual String extraDefaultStyleSheet(); | 77 virtual String extraDefaultStyleSheet(); |
75 virtual String extraQuirksStyleSheet() { return String(); } | 78 virtual String extraQuirksStyleSheet() { return String(); } |
76 virtual String extraMediaControlsStyleSheet() { return String(); } | 79 virtual String extraMediaControlsStyleSheet() { return String(); } |
77 virtual String extraFullscreenStyleSheet() { return String(); } | 80 virtual String extraFullscreenStyleSheet() { return String(); } |
78 | 81 |
79 // A method to obtain the baseline position for a "leaf" control. This will o
nly be used if a baseline | 82 // A method to obtain the baseline position for a "leaf" control. This will |
80 // position cannot be determined by examining child content. Checkboxes and ra
dio buttons are examples of | 83 // only be used if a baseline position cannot be determined by examining child |
81 // controls that need to do this. | 84 // content. Checkboxes and radio buttons are examples of controls that need to |
| 85 // do this. |
82 virtual int baselinePosition(const LayoutObject*) const; | 86 virtual int baselinePosition(const LayoutObject*) const; |
83 | 87 |
84 // A method for asking if a control is a container or not. Leaf controls have
to have some special behavior (like | 88 // A method for asking if a control is a container or not. Leaf controls have |
85 // the baseline position API above). | 89 // to have some special behavior (like the baseline position API above). |
86 bool isControlContainer(ControlPart) const; | 90 bool isControlContainer(ControlPart) const; |
87 | 91 |
88 // Whether or not the control has been styled enough by the author to disable
the native appearance. | 92 // Whether or not the control has been styled enough by the author to disable |
| 93 // the native appearance. |
89 virtual bool isControlStyled(const ComputedStyle&) const; | 94 virtual bool isControlStyled(const ComputedStyle&) const; |
90 | 95 |
91 // Some controls may spill out of their containers (e.g., the check on an OSX
10.9 checkbox). Add this | 96 // Some controls may spill out of their containers (e.g., the check on an OSX |
92 // "visual overflow" to the object's border box rect. | 97 // 10.9 checkbox). Add this "visual overflow" to the object's border box rect. |
93 virtual void addVisualOverflow(const LayoutObject&, IntRect& borderBox); | 98 virtual void addVisualOverflow(const LayoutObject&, IntRect& borderBox); |
94 | 99 |
95 // This method is called whenever a control state changes on a particular them
ed object, e.g., the mouse becomes pressed | 100 // This method is called whenever a control state changes on a particular |
96 // or a control becomes disabled. The ControlState parameter indicates which s
tate has changed (from having to not having, | 101 // themed object, e.g., the mouse becomes pressed or a control becomes |
97 // or vice versa). | 102 // disabled. The ControlState parameter indicates which state has changed |
| 103 // (from having to not having, or vice versa). |
98 bool controlStateChanged(LayoutObject&, ControlState) const; | 104 bool controlStateChanged(LayoutObject&, ControlState) const; |
99 | 105 |
100 bool shouldDrawDefaultFocusRing(const LayoutObject&) const; | 106 bool shouldDrawDefaultFocusRing(const LayoutObject&) const; |
101 | 107 |
102 // A method asking if the theme's controls actually care about redrawing when
hovered. | 108 // A method asking if the theme's controls actually care about redrawing when |
| 109 // hovered. |
103 virtual bool supportsHover(const ComputedStyle&) const { return false; } | 110 virtual bool supportsHover(const ComputedStyle&) const { return false; } |
104 | 111 |
105 // A method asking if the platform is able to show a calendar picker for a | 112 // A method asking if the platform is able to show a calendar picker for a |
106 // given input type. | 113 // given input type. |
107 virtual bool supportsCalendarPicker(const AtomicString&) const; | 114 virtual bool supportsCalendarPicker(const AtomicString&) const; |
108 | 115 |
109 // Text selection colors. | 116 // Text selection colors. |
110 Color activeSelectionBackgroundColor() const; | 117 Color activeSelectionBackgroundColor() const; |
111 Color inactiveSelectionBackgroundColor() const; | 118 Color inactiveSelectionBackgroundColor() const; |
112 Color activeSelectionForegroundColor() const; | 119 Color activeSelectionForegroundColor() const; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 virtual double animationRepeatIntervalForProgressBar() const; | 183 virtual double animationRepeatIntervalForProgressBar() const; |
177 // Returns the duration of the animation for the progress bar. | 184 // Returns the duration of the animation for the progress bar. |
178 virtual double animationDurationForProgressBar() const; | 185 virtual double animationDurationForProgressBar() const; |
179 | 186 |
180 // Media controls | 187 // Media controls |
181 String formatMediaControlsTime(float time) const; | 188 String formatMediaControlsTime(float time) const; |
182 String formatMediaControlsCurrentTime(float currentTime, | 189 String formatMediaControlsCurrentTime(float currentTime, |
183 float duration) const; | 190 float duration) const; |
184 | 191 |
185 // Returns size of one slider tick mark for a horizontal track. | 192 // Returns size of one slider tick mark for a horizontal track. |
186 // For vertical tracks we rotate it and use it. i.e. Width is always length al
ong the track. | 193 // For vertical tracks we rotate it and use it. i.e. Width is always length |
| 194 // along the track. |
187 virtual IntSize sliderTickSize() const = 0; | 195 virtual IntSize sliderTickSize() const = 0; |
188 // Returns the distance of slider tick origin from the slider track center. | 196 // Returns the distance of slider tick origin from the slider track center. |
189 virtual int sliderTickOffsetFromTrackCenter() const = 0; | 197 virtual int sliderTickOffsetFromTrackCenter() const = 0; |
190 | 198 |
191 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; | 199 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; |
192 | 200 |
193 // Functions for <select> elements. | 201 // Functions for <select> elements. |
194 virtual bool delegatesMenuListRendering() const { return false; } | 202 virtual bool delegatesMenuListRendering() const { return false; } |
195 virtual bool popsMenuByArrowKeys() const { return false; } | 203 virtual bool popsMenuByArrowKeys() const { return false; } |
196 virtual bool popsMenuBySpaceKey() const { return false; } | 204 virtual bool popsMenuBySpaceKey() const { return false; } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 static bool isIndeterminate(const LayoutObject&); | 262 static bool isIndeterminate(const LayoutObject&); |
255 static bool isEnabled(const LayoutObject&); | 263 static bool isEnabled(const LayoutObject&); |
256 static bool isFocused(const LayoutObject&); | 264 static bool isFocused(const LayoutObject&); |
257 static bool isPressed(const LayoutObject&); | 265 static bool isPressed(const LayoutObject&); |
258 static bool isSpinUpButtonPartPressed(const LayoutObject&); | 266 static bool isSpinUpButtonPartPressed(const LayoutObject&); |
259 static bool isHovered(const LayoutObject&); | 267 static bool isHovered(const LayoutObject&); |
260 static bool isSpinUpButtonPartHovered(const LayoutObject&); | 268 static bool isSpinUpButtonPartHovered(const LayoutObject&); |
261 static bool isReadOnlyControl(const LayoutObject&); | 269 static bool isReadOnlyControl(const LayoutObject&); |
262 | 270 |
263 private: | 271 private: |
264 // This function is to be implemented in your platform-specific theme implemen
tation to hand back the | 272 // This function is to be implemented in your platform-specific theme |
265 // appropriate platform theme. | 273 // implementation to hand back the appropriate platform theme. |
266 static LayoutTheme& nativeTheme(); | 274 static LayoutTheme& nativeTheme(); |
267 | 275 |
268 Color m_customFocusRingColor; | 276 Color m_customFocusRingColor; |
269 bool m_hasCustomFocusRingColor; | 277 bool m_hasCustomFocusRingColor; |
270 double m_caretBlinkInterval = 0.5; | 278 double m_caretBlinkInterval = 0.5; |
271 | 279 |
272 // This color is expected to be drawn on a semi-transparent overlay, | 280 // This color is expected to be drawn on a semi-transparent overlay, |
273 // making it more transparent than its alpha value indicates. | 281 // making it more transparent than its alpha value indicates. |
274 static const RGBA32 defaultTapHighlightColor = 0x66000000; | 282 static const RGBA32 defaultTapHighlightColor = 0x66000000; |
275 | 283 |
276 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; | 284 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; |
277 | 285 |
278 Theme* m_platformTheme; // The platform-specific theme. | 286 Theme* m_platformTheme; // The platform-specific theme. |
279 }; | 287 }; |
280 | 288 |
281 } // namespace blink | 289 } // namespace blink |
282 | 290 |
283 #endif // LayoutTheme_h | 291 #endif // LayoutTheme_h |
OLD | NEW |