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

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

Issue 2628043002: Gtk3: Render a GtkHeaderBar as the background of the tab strip (Closed)
Patch Set: Handle incognito Created 3 years, 11 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 #include "ui/native_theme/native_theme_base.h" 5 #include "ui/native_theme/native_theme_base.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return; 165 return;
166 166
167 canvas->save(); 167 canvas->save();
168 canvas->clipRect(gfx::RectToSkRect(rect)); 168 canvas->clipRect(gfx::RectToSkRect(rect));
169 169
170 switch (part) { 170 switch (part) {
171 // Please keep these in the order of NativeTheme::Part. 171 // Please keep these in the order of NativeTheme::Part.
172 case kCheckbox: 172 case kCheckbox:
173 PaintCheckbox(canvas, state, rect, extra.button); 173 PaintCheckbox(canvas, state, rect, extra.button);
174 break; 174 break;
175 case kFrameTopArea:
176 PaintFrameTopArea(canvas, state, rect, extra.frame_top_area);
177 break;
175 case kInnerSpinButton: 178 case kInnerSpinButton:
176 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin); 179 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin);
177 break; 180 break;
178 case kMenuList: 181 case kMenuList:
179 PaintMenuList(canvas, state, rect, extra.menu_list); 182 PaintMenuList(canvas, state, rect, extra.menu_list);
180 break; 183 break;
181 case kMenuPopupBackground: 184 case kMenuPopupBackground:
182 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background); 185 PaintMenuPopupBackground(canvas, rect.size(), extra.menu_background);
183 break; 186 break;
184 case kMenuItemBackground: 187 case kMenuItemBackground:
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 progress_paint.setStyle(SkPaint::kFill_Style); 894 progress_paint.setStyle(SkPaint::kFill_Style);
892 canvas->drawRect(gfx::RectToSkRect(progress_rect), progress_paint); 895 canvas->drawRect(gfx::RectToSkRect(progress_rect), progress_paint);
893 896
894 // Draw the border. 897 // Draw the border.
895 gfx::RectF border_rect(rect); 898 gfx::RectF border_rect(rect);
896 border_rect.Inset(stroke_width / 2.0f, stroke_width / 2.0f); 899 border_rect.Inset(stroke_width / 2.0f, stroke_width / 2.0f);
897 stroke_paint.setColor(kProgressBorderColor); 900 stroke_paint.setColor(kProgressBorderColor);
898 canvas->drawRect(gfx::RectFToSkRect(border_rect), stroke_paint); 901 canvas->drawRect(gfx::RectFToSkRect(border_rect), stroke_paint);
899 } 902 }
900 903
904 void NativeThemeBase::PaintFrameTopArea(
905 SkCanvas* canvas,
906 State state,
907 const gfx::Rect& rect,
908 const FrameTopAreaExtraParams& frame_top_area) const {
909 SkPaint paint;
910 paint.setColor(frame_top_area.default_background_color);
911 canvas->drawRect(gfx::RectToSkRect(rect), paint);
912 }
913
901 void NativeThemeBase::AdjustCheckboxRadioRectForPadding(SkRect* rect) const { 914 void NativeThemeBase::AdjustCheckboxRadioRectForPadding(SkRect* rect) const {
902 // By default we only take 1px from right and bottom for the drop shadow. 915 // By default we only take 1px from right and bottom for the drop shadow.
903 rect->iset(rect->x(), rect->y(), rect->right() - 1, rect->bottom() - 1); 916 rect->iset(rect->x(), rect->y(), rect->right() - 1, rect->bottom() - 1);
904 } 917 }
905 918
906 SkColor NativeThemeBase::SaturateAndBrighten(SkScalar* hsv, 919 SkColor NativeThemeBase::SaturateAndBrighten(SkScalar* hsv,
907 SkScalar saturate_amount, 920 SkScalar saturate_amount,
908 SkScalar brighten_amount) const { 921 SkScalar brighten_amount) const {
909 SkScalar color[3]; 922 SkScalar color[3];
910 color[0] = hsv[0]; 923 color[0] = hsv[0];
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1005 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
993 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1006 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
994 1007
995 if (hsv1[2] + hsv2[2] > 1.0) 1008 if (hsv1[2] + hsv2[2] > 1.0)
996 diff = -diff; 1009 diff = -diff;
997 1010
998 return SaturateAndBrighten(hsv2, -0.2f, diff); 1011 return SaturateAndBrighten(hsv2, -0.2f, diff);
999 } 1012 }
1000 1013
1001 } // namespace ui 1014 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698