2 * This file is part of the WebKit project.
4 * Copyright (C) 2006 Apple Computer, Inc.
5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
6 * Copyright (C) 2007 Holger Hans Peter Freyther
7 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
8 * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
9 * Copyright (C) 2009-2010 ProFUSION embedded systems
10 * Copyright (C) 2009-2010 Samsung Electronics
11 * All rights reserved.
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA.
30 #ifndef RenderThemeEfl_h
31 #define RenderThemeEfl_h
34 #include "MediaControlElements.h"
36 #include "RenderTheme.h"
40 typedef struct _Ecore_Evas Ecore_Evas;
41 typedef struct _Evas_Object Evas_Object;
45 enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType()
51 #if ENABLE(PROGRESS_ELEMENT)
55 SearchFieldDecoration,
56 SearchFieldResultsButton,
57 SearchFieldResultsDecoration,
58 SearchFieldCancelButton,
62 SliderThumbHorizontal,
75 class RenderThemeEfl : public RenderTheme {
77 RenderThemeEfl(Page*);
81 static PassRefPtr<RenderTheme> create(Page*);
83 // A method asking if the theme's controls actually care about redrawing when hovered.
84 virtual bool supportsHover(const RenderStyle*) const { return true; }
86 // A method asking if the theme is able to draw the focus ring.
87 virtual bool supportsFocusRing(const RenderStyle*) const;
89 // A method asking if the control changes its tint when the window has focus or not.
90 virtual bool controlSupportsTints(const RenderObject*) const;
92 // A general method asking if any control tinting is supported at all.
93 virtual bool supportsControlTints() const { return true; }
95 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
96 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
97 // controls that need to do this.
98 virtual LayoutUnit baselinePosition(const RenderObject*) const;
100 virtual Color platformActiveSelectionBackgroundColor() const { return m_activeSelectionBackgroundColor; }
101 virtual Color platformInactiveSelectionBackgroundColor() const { return m_inactiveSelectionBackgroundColor; }
102 virtual Color platformActiveSelectionForegroundColor() const { return m_activeSelectionForegroundColor; }
103 virtual Color platformInactiveSelectionForegroundColor() const { return m_inactiveSelectionForegroundColor; }
104 virtual Color platformFocusRingColor() const { return m_focusRingColor; }
106 virtual bool supportsSelectionForegroundColors() const { return m_supportsSelectionForegroundColors; }
108 virtual void themeChanged();
110 // Set platform colors and notify they changed
111 void setSelectionForegroundColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
112 void setSelectionBackgroundColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
113 void setFocusRingColor(int r, int g, int b, int a);
115 void setButtonTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
116 void setComboTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
117 void setEntryTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
118 void setSearchTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
120 void adjustSizeConstraints(RenderStyle*, FormType) const;
124 virtual void systemFont(int propId, FontDescription&) const;
126 virtual void adjustCheckboxStyle(StyleResolver*, RenderStyle*, Element*) const;
127 virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
129 virtual void adjustRadioStyle(StyleResolver*, RenderStyle*, Element*) const;
130 virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
132 virtual void adjustButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
133 virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
135 virtual void adjustTextFieldStyle(StyleResolver*, RenderStyle*, Element*) const;
136 virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
138 virtual void adjustTextAreaStyle(StyleResolver*, RenderStyle*, Element*) const;
139 virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
141 virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
142 virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
144 virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
145 virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
147 virtual void adjustSearchFieldResultsDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
148 virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
150 virtual void adjustSearchFieldDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
151 virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&);
153 virtual void adjustSearchFieldStyle(StyleResolver*, RenderStyle*, Element*) const;
154 virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
156 virtual void adjustSearchFieldResultsButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
157 virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&);
159 virtual void adjustSearchFieldCancelButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
160 virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
162 virtual void adjustSliderTrackStyle(StyleResolver*, RenderStyle*, Element*) const;
163 virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
165 virtual void adjustSliderThumbStyle(StyleResolver*, RenderStyle*, Element*) const;
167 virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
169 #if ENABLE(DATALIST_ELEMENT)
170 virtual IntSize sliderTickSize() const OVERRIDE;
171 virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
174 virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
176 virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
177 virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
179 static void setDefaultFontSize(int fontsize);
181 #if ENABLE(PROGRESS_ELEMENT)
182 virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const;
183 virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
184 virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
185 virtual double animationDurationForProgressBar(RenderProgress*) const;
189 virtual String extraMediaControlsStyleSheet();
190 #if ENABLE(FULLSCREEN_API)
191 #if ENABLE(TIZEN_MEDIA_CONTROL_USER_AGENT_SHEET)
192 virtual String extraFullScreenHorizontalStyleSheet();
193 virtual String extraFullScreenVerticalStyleSheet();
195 virtual String extraFullScreenStyleSheet();
198 virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
199 virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
201 virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
202 virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
203 virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
204 virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&);
205 virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&);
206 virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
207 virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
208 virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
209 virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
210 virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
211 virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&);
212 #if ENABLE(TIZEN_GSTREAMER_VIDEO)
213 virtual bool paintMediaTimeRemaining(RenderObject* object, const PaintInfo& info, const IntRect& rect);
216 virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE { return true; }
218 #if ENABLE(TIZEN_MULTIPLE_SELECT)
219 virtual bool delegatesMenuListRendering() const { return true; }
221 void setThemePath(const String&);
222 String themePath() { return m_themePath; }
224 #if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
225 virtual Color platformTapHighlightColor() const OVERRIDE
227 return RenderThemeEfl::defaultTapHighlightColor;
232 static float defaultFontSize;
237 void applyEdjeColors();
238 void applyPartDescriptions();
239 const char* edjeGroupFromFormType(FormType) const;
240 void applyEdjeStateFromForm(Evas_Object*, ControlStates);
241 bool paintThemePart(RenderObject*, FormType, const PaintInfo&, const IntRect&);
242 bool isFormElementTooLargeToDisplay(const IntSize&);
243 #if ENABLE(TIZEN_THEME_STYLE_WORKAROUND)
244 bool paintTransparentMenuList(RenderObject*, const PaintInfo&, const IntRect&);
248 bool emitMediaButtonSignal(FormType, MediaControlElementType, const IntRect&);
252 Color m_activeSelectionBackgroundColor;
253 Color m_activeSelectionForegroundColor;
254 Color m_inactiveSelectionBackgroundColor;
255 Color m_inactiveSelectionForegroundColor;
256 Color m_focusRingColor;
257 Color m_sliderThumbColor;
260 Color m_mediaPanelColor;
261 Color m_mediaSliderColor;
262 #if ENABLE(TIZEN_GSTREAMER_VIDEO)
263 Color m_mediaBufferingColor;
264 Color m_mediaPlayingColor;
269 Ecore_Evas* m_canvas;
272 bool m_supportsSelectionForegroundColors;
274 struct ThemePartDesc {
280 void applyPartDescriptionFallback(struct ThemePartDesc*);
281 void applyPartDescription(Evas_Object*, struct ThemePartDesc*);
283 struct ThemePartCacheEntry {
288 cairo_surface_t* surface;
291 struct ThemePartDesc m_partDescs[FormTypeLast];
293 // this should be small and not so frequently used,
294 // so use a vector and do linear searches
295 Vector<struct ThemePartCacheEntry *> m_partCache;
297 // get (use, create or replace) entry from cache
298 struct ThemePartCacheEntry* cacheThemePartGet(FormType, const IntSize&);
299 // flush cache, deleting all entries
300 void cacheThemePartFlush();
302 // internal, used by cacheThemePartGet()
303 bool themePartCacheEntryReset(struct ThemePartCacheEntry*, FormType);
304 bool themePartCacheEntrySurfaceCreate(struct ThemePartCacheEntry*);
305 struct ThemePartCacheEntry* cacheThemePartNew(FormType, const IntSize&);
306 struct ThemePartCacheEntry* cacheThemePartReset(FormType, struct ThemePartCacheEntry*);
307 struct ThemePartCacheEntry* cacheThemePartResizeAndReset(FormType, const IntSize&, struct ThemePartCacheEntry*);
309 #if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
310 static const RGBA32 defaultTapHighlightColor = 0x99ff8f25;
316 #endif // RenderThemeEfl_h