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

Side by Side Diff: ui/native_theme/native_theme_base.h

Issue 2426793002: Aura overlay scrollbars adjust color for dark backgrounds (Closed)
Patch Set: update Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_NATIVE_THEME_NATIVE_THEME_BASE_H_ 5 #ifndef UI_NATIVE_THEME_NATIVE_THEME_BASE_H_
6 #define UI_NATIVE_THEME_NATIVE_THEME_BASE_H_ 6 #define UI_NATIVE_THEME_NATIVE_THEME_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 22 matching lines...) Expand all
33 Part part, 33 Part part,
34 State state, 34 State state,
35 const gfx::Rect& rect, 35 const gfx::Rect& rect,
36 const ExtraParams& extra) const override; 36 const ExtraParams& extra) const override;
37 37
38 void PaintStateTransition(SkCanvas* canvas, 38 void PaintStateTransition(SkCanvas* canvas,
39 Part part, 39 Part part,
40 State startState, 40 State startState,
41 State endState, 41 State endState,
42 double progress, 42 double progress,
43 const gfx::Rect& rect) const override; 43 const gfx::Rect& rect,
44 ScrollbarOverlayStyle style) const override;
44 45
45 protected: 46 protected:
46 NativeThemeBase(); 47 NativeThemeBase();
47 ~NativeThemeBase() override; 48 ~NativeThemeBase() override;
48 49
49 // Draw the arrow. Used by scrollbar and inner spin button. 50 // Draw the arrow. Used by scrollbar and inner spin button.
50 virtual void PaintArrowButton( 51 virtual void PaintArrowButton(
51 SkCanvas* gc, 52 SkCanvas* gc,
52 const gfx::Rect& rect, 53 const gfx::Rect& rect,
53 Part direction, 54 Part direction,
54 State state) const; 55 State state) const;
55 // Paint the scrollbar track. Done before the thumb so that it can contain 56 // Paint the scrollbar track. Done before the thumb so that it can contain
56 // alpha. 57 // alpha.
57 virtual void PaintScrollbarTrack( 58 virtual void PaintScrollbarTrack(
58 SkCanvas* canvas, 59 SkCanvas* canvas,
59 Part part, 60 Part part,
60 State state, 61 State state,
61 const ScrollbarTrackExtraParams& extra_params, 62 const ScrollbarTrackExtraParams& extra_params,
62 const gfx::Rect& rect) const; 63 const gfx::Rect& rect) const;
63 // Draw the scrollbar thumb over the track. 64 // Draw the scrollbar thumb over the track.
64 virtual void PaintScrollbarThumb( 65 virtual void PaintScrollbarThumb(
65 SkCanvas* canvas, 66 SkCanvas* canvas,
66 Part part, 67 Part part,
67 State state, 68 State state,
68 const gfx::Rect& rect) const; 69 const gfx::Rect& rect,
70 NativeTheme::ScrollbarOverlayStyle style) const;
69 71
70 virtual void PaintScrollbarCorner(SkCanvas* canvas, 72 virtual void PaintScrollbarCorner(SkCanvas* canvas,
71 State state, 73 State state,
72 const gfx::Rect& rect) const; 74 const gfx::Rect& rect) const;
73 75
74 virtual void PaintCheckbox( 76 virtual void PaintCheckbox(
75 SkCanvas* canvas, 77 SkCanvas* canvas,
76 State state, 78 State state,
77 const gfx::Rect& rect, 79 const gfx::Rect& rect,
78 const ButtonExtraParams& button) const; 80 const ButtonExtraParams& button) const;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 State state, 131 State state,
130 const gfx::Rect& rect, 132 const gfx::Rect& rect,
131 const InnerSpinButtonExtraParams& spin_button) const; 133 const InnerSpinButtonExtraParams& spin_button) const;
132 134
133 virtual void PaintProgressBar( 135 virtual void PaintProgressBar(
134 SkCanvas* canvas, 136 SkCanvas* canvas,
135 State state, 137 State state,
136 const gfx::Rect& rect, 138 const gfx::Rect& rect,
137 const ProgressBarExtraParams& progress_bar) const; 139 const ProgressBarExtraParams& progress_bar) const;
138 140
139 virtual void PaintScrollbarThumbStateTransition(SkCanvas* canvas, 141 virtual void PaintScrollbarThumbStateTransition(
140 Part part, 142 SkCanvas* canvas,
141 State startState, 143 Part part,
142 State endState, 144 State startState,
143 double progress, 145 State endState,
144 const gfx::Rect& rect) const { 146 double progress,
145 } 147 const gfx::Rect& rect,
148 ScrollbarOverlayStyle style) const {}
146 149
147 // Shrinks checkbox/radio button rect, if necessary, to make room for padding 150 // Shrinks checkbox/radio button rect, if necessary, to make room for padding
148 // and drop shadow. 151 // and drop shadow.
149 // TODO(mohsen): This is needed because checkboxes/radio buttons on Android 152 // TODO(mohsen): This is needed because checkboxes/radio buttons on Android
150 // have different padding from those on desktop Chrome. Get rid of this when 153 // have different padding from those on desktop Chrome. Get rid of this when
151 // crbug.com/530746 is resolved. 154 // crbug.com/530746 is resolved.
152 virtual void AdjustCheckboxRadioRectForPadding(SkRect* rect) const; 155 virtual void AdjustCheckboxRadioRectForPadding(SkRect* rect) const;
153 156
154 void set_scrollbar_button_length(unsigned int length) { 157 void set_scrollbar_button_length(unsigned int length) {
155 scrollbar_button_length_ = length; 158 scrollbar_button_length_ = length;
156 } 159 }
157 int scrollbar_button_length() const { return scrollbar_button_length_; } 160 int scrollbar_button_length() const { return scrollbar_button_length_; }
158 161
159 SkColor SaturateAndBrighten(SkScalar* hsv, 162 SkColor SaturateAndBrighten(SkScalar* hsv,
160 SkScalar saturate_amount, 163 SkScalar saturate_amount,
161 SkScalar brighten_amount) const; 164 SkScalar brighten_amount) const;
162 165
163 // Paints the arrow used on the scrollbar and spinner. 166 // Paints the arrow used on the scrollbar and spinner.
164 void PaintArrow(SkCanvas* canvas, 167 void PaintArrow(SkCanvas* canvas,
165 const gfx::Rect& rect, 168 const gfx::Rect& rect,
166 Part direction, 169 Part direction,
167 SkColor color) const; 170 SkColor color) const;
168 171
169 // Returns the color used to draw the arrow. 172 // Returns the color used to draw the arrow.
170 SkColor GetArrowColor(State state) const; 173 SkColor GetArrowColor(State state) const;
171 174
175 unsigned int scrollbar_width_;
176
172 private: 177 private:
173 friend class NativeThemeAuraTest; 178 friend class NativeThemeAuraTest;
174 179
175 SkPath PathForArrow(const gfx::Rect& rect, Part direction) const; 180 SkPath PathForArrow(const gfx::Rect& rect, Part direction) const;
176 gfx::Rect BoundingRectForArrow(const gfx::Rect& rect) const; 181 gfx::Rect BoundingRectForArrow(const gfx::Rect& rect) const;
177 182
178 void DrawVertLine(SkCanvas* canvas, 183 void DrawVertLine(SkCanvas* canvas,
179 int x, 184 int x,
180 int y1, 185 int y1,
181 int y2, 186 int y2,
(...skipping 12 matching lines...) Expand all
194 SkColor OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const; 199 SkColor OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const;
195 200
196 // Paint the common parts of the checkboxes and radio buttons. 201 // Paint the common parts of the checkboxes and radio buttons.
197 // borderRadius specifies how rounded the corners should be. 202 // borderRadius specifies how rounded the corners should be.
198 SkRect PaintCheckboxRadioCommon( 203 SkRect PaintCheckboxRadioCommon(
199 SkCanvas* canvas, 204 SkCanvas* canvas,
200 State state, 205 State state,
201 const gfx::Rect& rect, 206 const gfx::Rect& rect,
202 const SkScalar borderRadius) const; 207 const SkScalar borderRadius) const;
203 208
204 unsigned int scrollbar_width_;
205
206 // The length of the arrow buttons, 0 means no buttons are drawn. 209 // The length of the arrow buttons, 0 means no buttons are drawn.
207 unsigned int scrollbar_button_length_; 210 unsigned int scrollbar_button_length_;
208 211
209 DISALLOW_COPY_AND_ASSIGN(NativeThemeBase); 212 DISALLOW_COPY_AND_ASSIGN(NativeThemeBase);
210 }; 213 };
211 214
212 } // namespace ui 215 } // namespace ui
213 216
214 #endif // UI_NATIVE_THEME_NATIVE_THEME_BASE_H_ 217 #endif // UI_NATIVE_THEME_NATIVE_THEME_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698