• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2006, The Android Open Source Project
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *  * Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  *  * Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef RenderThemeAndroid_h
27 #define RenderThemeAndroid_h
28 
29 #include "PaintInfo.h"
30 #include "RenderTheme.h"
31 
32 namespace WebCore {
33 
34 struct ThemeData {
ThemeDataThemeData35     ThemeData()
36         : m_part(0)
37         , m_state(0)
38     {
39     }
40 
41     unsigned m_part;
42     unsigned m_state;
43 };
44 
45 class RenderThemeAndroid : public RenderTheme {
46 public:
47     static PassRefPtr<RenderTheme> create();
48     ~RenderThemeAndroid();
49 
50     virtual bool stateChanged(RenderObject*, ControlState) const;
51 
52     virtual bool supportsFocusRing(const RenderStyle*) const;
53     // A method asking if the theme's controls actually care about redrawing when hovered.
supportsHover(const RenderStyle * style)54     virtual bool supportsHover(const RenderStyle* style) const { return style->affectedByHoverRules(); }
55 
56     virtual int baselinePosition(const RenderObject*) const;
57 
58     virtual Color platformActiveSelectionBackgroundColor() const;
59     virtual Color platformInactiveSelectionBackgroundColor() const;
60     virtual Color platformActiveSelectionForegroundColor() const;
61     virtual Color platformInactiveSelectionForegroundColor() const;
62     virtual Color platformTextSearchHighlightColor() const;
63     virtual Color platformFocusRingColor() const;
64 
65     virtual Color platformActiveListBoxSelectionBackgroundColor() const;
66     virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
67     virtual Color platformActiveListBoxSelectionForegroundColor() const;
68     virtual Color platformInactiveListBoxSelectionForegroundColor() const;
69 
70     virtual Color platformActiveTextSearchHighlightColor() const;
71     virtual Color platformInactiveTextSearchHighlightColor() const;
72 
systemFont(int,WebCore::FontDescription &)73     virtual void systemFont(int, WebCore::FontDescription&) const {}
74 
minimumMenuListSize(RenderStyle *)75     virtual int minimumMenuListSize(RenderStyle*) const { return 0; }
76 
77 protected:
78     virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
79     virtual void setCheckboxSize(RenderStyle*) const;
80 
81 #if ENABLE(VIDEO)
82     virtual String extraMediaControlsStyleSheet();
83     virtual void adjustSliderThumbSize(RenderObject* o) const;
84     virtual bool shouldRenderMediaControlPart(ControlPart part, Element* e);
85     virtual bool paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
86     virtual bool paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
87     virtual bool paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
88     virtual bool paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
89     virtual bool paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
90     virtual bool paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
91     virtual bool paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r);
92     virtual bool paintMediaControlsBackground(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect);
mediaControlsFadeInDuration()93     virtual double mediaControlsFadeInDuration() { return 0.5; }
mediaControlsFadeOutDuration()94     virtual double mediaControlsFadeOutDuration() { return 0.5; }
95 #endif
96 
97     virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
98     virtual void setRadioSize(RenderStyle*) const;
99 
100     virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
101     virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
102 
103     virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
104     virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
105 
106     virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
107     virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
108 
109     bool paintCombo(RenderObject*, const PaintInfo&,  const IntRect&);
110 
111     virtual void adjustListboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
112     virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
113     virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
114 
115     virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
116     virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
117 
118     virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
119     virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
120 
121     virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
122     virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
123 
124 private:
125     RenderThemeAndroid();
126     void addIntrinsicMargins(RenderStyle*) const;
127     void close();
128 
129     bool supportsFocus(ControlPart);
130     friend RenderTheme* theme();
131 };
132 
133 } // namespace WebCore
134 
135 #endif // RenderThemeAndroid_h
136