Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/core/layout/LayoutThemeDefault.h

Issue 1102353008: Split ThemePainter out of LayoutTheme (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: themePainter() -> theme().painter() Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutThemeAndroid.cpp ('k') | Source/core/layout/LayoutThemeDefault.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the WebKit project. 2 * This file is part of the WebKit project.
3 * 3 *
4 * Copyright (C) 2006 Apple Computer, Inc. 4 * Copyright (C) 2006 Apple Computer, Inc.
5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
6 * Copyright (C) 2007 Holger Hans Peter Freyther 6 * Copyright (C) 2007 Holger Hans Peter Freyther
7 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
8 * Copyright (C) 2008, 2009 Google, Inc. 8 * Copyright (C) 2008, 2009 Google, Inc.
9 * All rights reserved. 9 * All rights reserved.
10 * Copyright (C) 2009 Kenneth Rohde Christiansen 10 * Copyright (C) 2009 Kenneth Rohde Christiansen
(...skipping 13 matching lines...) Expand all
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA. 25 * Boston, MA 02110-1301, USA.
26 * 26 *
27 */ 27 */
28 28
29 #ifndef LayoutThemeDefault_h 29 #ifndef LayoutThemeDefault_h
30 #define LayoutThemeDefault_h 30 #define LayoutThemeDefault_h
31 31
32 #include "core/CoreExport.h" 32 #include "core/CoreExport.h"
33 #include "core/layout/LayoutTheme.h" 33 #include "core/layout/LayoutTheme.h"
34 #include "core/paint/ThemePainterDefault.h"
34 35
35 namespace blink { 36 namespace blink {
36 37
37 class LayoutProgress; 38 class LayoutProgress;
38 39
39 class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { 40 class CORE_EXPORT LayoutThemeDefault : public LayoutTheme {
40 public: 41 public:
41 virtual String extraDefaultStyleSheet() override; 42 virtual String extraDefaultStyleSheet() override;
42 virtual String extraQuirksStyleSheet() override; 43 virtual String extraQuirksStyleSheet() override;
43 44
(...skipping 11 matching lines...) Expand all
55 virtual Color platformInactiveSelectionBackgroundColor() const override; 56 virtual Color platformInactiveSelectionBackgroundColor() const override;
56 virtual Color platformActiveSelectionForegroundColor() const override; 57 virtual Color platformActiveSelectionForegroundColor() const override;
57 virtual Color platformInactiveSelectionForegroundColor() const override; 58 virtual Color platformInactiveSelectionForegroundColor() const override;
58 59
59 virtual IntSize sliderTickSize() const override; 60 virtual IntSize sliderTickSize() const override;
60 virtual int sliderTickOffsetFromTrackCenter() const override; 61 virtual int sliderTickOffsetFromTrackCenter() const override;
61 virtual void adjustSliderThumbSize(ComputedStyle&, Element*) const override; 62 virtual void adjustSliderThumbSize(ComputedStyle&, Element*) const override;
62 63
63 static void setCaretBlinkInterval(double); 64 static void setCaretBlinkInterval(double);
64 65
65 virtual bool paintCheckbox(LayoutObject*, const PaintInfo&, const IntRect&) override;
66 virtual void setCheckboxSize(ComputedStyle&) const override; 66 virtual void setCheckboxSize(ComputedStyle&) const override;
67
68 virtual bool paintRadio(LayoutObject*, const PaintInfo&, const IntRect&) ove rride;
69 virtual void setRadioSize(ComputedStyle&) const override; 67 virtual void setRadioSize(ComputedStyle&) const override;
70
71 virtual bool paintButton(LayoutObject*, const PaintInfo&, const IntRect&) ov erride;
72 virtual bool paintTextField(LayoutObject*, const PaintInfo&, const IntRect&) override;
73 virtual bool paintMenuList(LayoutObject*, const PaintInfo&, const IntRect&) override;
74 virtual bool paintMenuListButton(LayoutObject*, const PaintInfo&, const IntR ect&) override;
75 virtual bool paintSliderTrack(LayoutObject*, const PaintInfo&, const IntRect &) override;
76 virtual bool paintSliderThumb(LayoutObject*, const PaintInfo&, const IntRect &) override;
77
78 virtual void adjustInnerSpinButtonStyle(ComputedStyle&, Element*) const over ride; 68 virtual void adjustInnerSpinButtonStyle(ComputedStyle&, Element*) const over ride;
79 virtual bool paintInnerSpinButton(LayoutObject*, const PaintInfo&, const Int Rect&) override;
80 69
81 virtual bool popsMenuBySpaceKey() const override final { return true; } 70 virtual bool popsMenuBySpaceKey() const override final { return true; }
82 virtual bool popsMenuByReturnKey() const override final { return true; } 71 virtual bool popsMenuByReturnKey() const override final { return true; }
83 virtual bool popsMenuByAltDownUpOrF4Key() const override { return true; } 72 virtual bool popsMenuByAltDownUpOrF4Key() const override { return true; }
84 73
85 virtual bool paintProgressBar(LayoutObject*, const PaintInfo&, const IntRect &) override;
86
87 virtual bool shouldOpenPickerWithF4Key() const override; 74 virtual bool shouldOpenPickerWithF4Key() const override;
88 75
89 virtual Color platformTapHighlightColor() const override 76 virtual Color platformTapHighlightColor() const override
90 { 77 {
91 return Color(defaultTapHighlightColor); 78 return Color(defaultTapHighlightColor);
92 } 79 }
93 80
94 // A method asking if the theme's controls actually care about redrawing 81 // A method asking if the theme's controls actually care about redrawing
95 // when hovered. 82 // when hovered.
96 virtual bool supportsHover(const ComputedStyle&) const override final; 83 virtual bool supportsHover(const ComputedStyle&) const override final;
97 84
98 virtual Color platformFocusRingColor() const override; 85 virtual Color platformFocusRingColor() const override;
99 86
100 virtual double caretBlinkInterval() const final; 87 virtual double caretBlinkInterval() const final;
101 88
102 // System fonts. 89 // System fonts.
103 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl oat& fontSize, AtomicString& fontFamily) const; 90 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl oat& fontSize, AtomicString& fontFamily) const;
104 91
105 virtual int minimumMenuListSize(const ComputedStyle&) const override; 92 virtual int minimumMenuListSize(const ComputedStyle&) const override;
106 93
107 virtual void adjustButtonStyle(ComputedStyle&, Element*) const override; 94 virtual void adjustButtonStyle(ComputedStyle&, Element*) const override;
108
109 virtual bool paintTextArea(LayoutObject*, const PaintInfo&, const IntRect&) override;
110
111 virtual void adjustSearchFieldStyle(ComputedStyle&, Element*) const override ; 95 virtual void adjustSearchFieldStyle(ComputedStyle&, Element*) const override ;
112 virtual bool paintSearchField(LayoutObject*, const PaintInfo&, const IntRect &) override;
113
114 virtual void adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) co nst override; 96 virtual void adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) co nst override;
115 virtual bool paintSearchFieldCancelButton(LayoutObject*, const PaintInfo&, c onst IntRect&) override;
116
117 virtual void adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) cons t override; 97 virtual void adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) cons t override;
118
119 virtual void adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Element *) const override; 98 virtual void adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Element *) const override;
120 virtual bool paintSearchFieldResultsDecoration(LayoutObject*, const PaintInf o&, const IntRect&) override;
121
122 virtual bool paintMediaSliderTrack(LayoutObject*, const PaintInfo&, const In tRect&) override;
123 virtual bool paintMediaVolumeSliderTrack(LayoutObject*, const PaintInfo&, co nst IntRect&) override;
124 virtual bool paintMediaSliderThumb(LayoutObject*, const PaintInfo&, const In tRect&) override;
125 virtual bool paintMediaToggleClosedCaptionsButton(LayoutObject*, const Paint Info&, const IntRect&) override;
126 virtual bool paintMediaCastButton(LayoutObject*, const PaintInfo&, const Int Rect&) override;
127 virtual bool paintMediaVolumeSliderThumb(LayoutObject*, const PaintInfo&, co nst IntRect&) override;
128 virtual bool paintMediaPlayButton(LayoutObject*, const PaintInfo&, const Int Rect&) override;
129 virtual bool paintMediaOverlayPlayButton(LayoutObject*, const PaintInfo&, co nst IntRect&) override;
130 virtual bool paintMediaMuteButton(LayoutObject*, const PaintInfo&, const Int Rect&) override;
131 virtual String formatMediaControlsTime(float time) const override;
132 virtual String formatMediaControlsCurrentTime(float currentTime, float durat ion) const override;
133 virtual bool paintMediaFullscreenButton(LayoutObject*, const PaintInfo&, con st IntRect&) override;
134 99
135 // MenuList refers to an unstyled menulist (meaning a menulist without 100 // MenuList refers to an unstyled menulist (meaning a menulist without
136 // background-color or border set) and MenuListButton refers to a styled 101 // background-color or border set) and MenuListButton refers to a styled
137 // menulist (a menulist with background-color or border set). They have 102 // menulist (a menulist with background-color or border set). They have
138 // this distinction to support showing aqua style themes whenever they 103 // this distinction to support showing aqua style themes whenever they
139 // possibly can, which is something we don't want to replicate. 104 // possibly can, which is something we don't want to replicate.
140 // 105 //
141 // In short, we either go down the MenuList code path or the MenuListButton 106 // In short, we either go down the MenuList code path or the MenuListButton
142 // codepath. We never go down both. And in both cases, they layout the 107 // codepath. We never go down both. And in both cases, they layout the
143 // entire menulist. 108 // entire menulist.
(...skipping 19 matching lines...) Expand all
163 static void setSelectionColors(unsigned activeBackgroundColor, unsigned acti veForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForeground Color); 128 static void setSelectionColors(unsigned activeBackgroundColor, unsigned acti veForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForeground Color);
164 129
165 protected: 130 protected:
166 LayoutThemeDefault(); 131 LayoutThemeDefault();
167 virtual ~LayoutThemeDefault(); 132 virtual ~LayoutThemeDefault();
168 virtual bool shouldUseFallbackTheme(const ComputedStyle&) const override; 133 virtual bool shouldUseFallbackTheme(const ComputedStyle&) const override;
169 virtual int menuListArrowPadding() const; 134 virtual int menuListArrowPadding() const;
170 135
171 IntRect determinateProgressValueRectFor(LayoutProgress*, const IntRect&) con st; 136 IntRect determinateProgressValueRectFor(LayoutProgress*, const IntRect&) con st;
172 IntRect indeterminateProgressValueRectFor(LayoutProgress*, const IntRect&) c onst; 137 IntRect indeterminateProgressValueRectFor(LayoutProgress*, const IntRect&) c onst;
173 IntRect progressValueRectFor(LayoutProgress*, const IntRect&) const;
174
175 class DirectionFlippingScope {
176 public:
177 DirectionFlippingScope(LayoutObject*, const PaintInfo&, const IntRect&);
178 ~DirectionFlippingScope();
179
180 private:
181 bool m_needsFlipping;
182 const PaintInfo& m_paintInfo;
183 };
184 138
185 private: 139 private:
186 virtual bool shouldShowPlaceholderWhenFocused() const override; 140 virtual bool shouldShowPlaceholderWhenFocused() const override;
187 141
142 virtual ThemePainter& painter() override { return m_painter; }
143
188 int menuListInternalPadding(const ComputedStyle&, int paddingType) const; 144 int menuListInternalPadding(const ComputedStyle&, int paddingType) const;
189 bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
190 IntRect convertToPaintingRect(LayoutObject* inputLayoutObject, const LayoutO bject* partLayoutObject, LayoutRect partRect, const IntRect& localOffset) const;
191 145
192 static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black. 146 static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black.
193 static double m_caretBlinkInterval; 147 static double m_caretBlinkInterval;
194 148
195 static unsigned m_activeSelectionBackgroundColor; 149 static unsigned m_activeSelectionBackgroundColor;
196 static unsigned m_activeSelectionForegroundColor; 150 static unsigned m_activeSelectionForegroundColor;
197 static unsigned m_inactiveSelectionBackgroundColor; 151 static unsigned m_inactiveSelectionBackgroundColor;
198 static unsigned m_inactiveSelectionForegroundColor; 152 static unsigned m_inactiveSelectionForegroundColor;
153
154 ThemePainterDefault m_painter;
199 }; 155 };
200 156
201 } // namespace blink 157 } // namespace blink
202 158
203 #endif // LayoutThemeDefault_h 159 #endif // LayoutThemeDefault_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutThemeAndroid.cpp ('k') | Source/core/layout/LayoutThemeDefault.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698