Fix the issue that Web Audio test case fails on PR3.
[framework/web/webkit-efl.git] / Source / WebCore / rendering / RenderThemeChromiumSkia.h
1 /*
2  * This file is part of the WebKit project.
3  *
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, 2009 Google, Inc.
9  * All rights reserved.
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public License
22  * along with this library; see the file COPYING.LIB.  If not, write to
23  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  * Boston, MA 02110-1301, USA.
25  *
26  */
27
28 #ifndef RenderThemeChromiumSkia_h
29 #define RenderThemeChromiumSkia_h
30
31 #include "RenderTheme.h"
32 #include "RenderThemeChromiumCommon.h"
33
34 namespace WebCore {
35
36 class RenderProgress;
37
38 class RenderThemeChromiumSkia : public RenderTheme {
39     public:
40         RenderThemeChromiumSkia();
41         virtual ~RenderThemeChromiumSkia();
42
43         virtual String extraDefaultStyleSheet();
44         virtual String extraQuirksStyleSheet();
45 #if ENABLE(VIDEO)
46         virtual String extraMediaControlsStyleSheet();
47 #endif
48
49         // A method asking if the theme's controls actually care about redrawing when hovered.
50         virtual bool supportsHover(const RenderStyle*) const;
51
52         // A method asking if the theme is able to draw the focus ring.
53         virtual bool supportsFocusRing(const RenderStyle*) const;
54
55         virtual bool supportsDataListUI(const AtomicString& type) const OVERRIDE;
56
57 #if ENABLE(VIDEO_TRACK)
58         virtual bool supportsClosedCaptioning() const OVERRIDE;
59 #endif
60         // The platform selection color.
61         virtual Color platformActiveSelectionBackgroundColor() const;
62         virtual Color platformInactiveSelectionBackgroundColor() const;
63         virtual Color platformActiveSelectionForegroundColor() const;
64         virtual Color platformInactiveSelectionForegroundColor() const;
65         virtual Color platformFocusRingColor() const;
66
67         // To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
68         virtual double caretBlinkInterval() const;
69
70         // System fonts.
71         virtual void systemFont(int propId, FontDescription&) const;
72
73         virtual int minimumMenuListSize(RenderStyle*) const;
74
75         virtual void setCheckboxSize(RenderStyle*) const;
76
77         virtual void setRadioSize(RenderStyle*) const;
78
79         virtual void adjustButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
80
81         virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
82
83         virtual void adjustSearchFieldStyle(StyleResolver*, RenderStyle*, Element*) const;
84         virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
85
86         virtual void adjustSearchFieldCancelButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
87         virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
88
89         virtual void adjustSearchFieldDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
90
91         virtual void adjustSearchFieldResultsDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
92         virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
93
94         virtual void adjustSearchFieldResultsButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
95         virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&);
96
97         virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
98         virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
99         virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
100         virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
101         virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
102         virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
103         virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
104         virtual String formatMediaControlsTime(float time) const;
105         virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
106         virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
107         virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
108
109         // MenuList refers to an unstyled menulist (meaning a menulist without
110         // background-color or border set) and MenuListButton refers to a styled
111         // menulist (a menulist with background-color or border set). They have
112         // this distinction to support showing aqua style themes whenever they
113         // possibly can, which is something we don't want to replicate.
114         //
115         // In short, we either go down the MenuList code path or the MenuListButton
116         // codepath. We never go down both. And in both cases, they render the
117         // entire menulist.
118         virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
119         virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
120         virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
121
122 #if ENABLE(PROGRESS_ELEMENT)
123         virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
124         virtual double animationDurationForProgressBar(RenderProgress*) const;
125 #endif
126
127         // These methods define the padding for the MenuList's inner block.
128         virtual int popupInternalPaddingLeft(RenderStyle*) const;
129         virtual int popupInternalPaddingRight(RenderStyle*) const;
130         virtual int popupInternalPaddingTop(RenderStyle*) const;
131         virtual int popupInternalPaddingBottom(RenderStyle*) const;
132
133 #if ENABLE(VIDEO)
134         // Media controls
135         virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
136         virtual bool usesVerticalVolumeSlider() const { return false; }
137 #endif
138
139         // Provide a way to pass the default font size from the Settings object
140         // to the render theme.  FIXME: http://b/1129186 A cleaner way would be
141         // to remove the default font size from this object and have callers
142         // that need the value to get it directly from the appropriate Settings
143         // object.
144         static void setDefaultFontSize(int);
145
146     protected:
147         static const String& defaultGUIFont();
148
149         // The default variable-width font size.  We use this as the default font
150         // size for the "system font", and as a base size (which we then shrink) for
151         // form control fonts.
152         static float defaultFontSize;
153
154         virtual double caretBlinkIntervalInternal() const;
155
156         virtual int menuListArrowPadding() const;
157
158         static void setSizeIfAuto(RenderStyle*, const IntSize&);
159
160 #if ENABLE(PROGRESS_ELEMENT)
161         IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const;
162         IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const;
163         IntRect progressValueRectFor(RenderProgress*, const IntRect&) const;
164
165         class DirectionFlippingScope {
166         public:
167             DirectionFlippingScope(RenderObject*, const PaintInfo&, const IntRect&);
168             ~DirectionFlippingScope();
169
170         private:
171             bool m_needsFlipping;
172             const PaintInfo& m_paintInfo;
173         };
174 #endif
175
176 private:
177     virtual Color disabledTextColor(const Color& textColor, const Color&) const OVERRIDE { return textColor; }
178     virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE;
179
180     int menuListInternalPadding(RenderStyle*, int paddingType) const;
181     bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
182     IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
183 };
184
185 } // namespace WebCore
186
187 #endif // RenderThemeChromiumSkia_h