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

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

Issue 12041085: Fix menu corners: the menu background was being painted as a rect when in fact, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 | Annotate | Revision Log
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_aura.h" 5 #include "ui/native_theme/native_theme_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/image/image_skia.h" 11 #include "ui/gfx/image/image_skia.h"
12 #include "ui/gfx/path.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
14 #include "ui/gfx/skbitmap_operations.h" 15 #include "ui/gfx/skbitmap_operations.h"
15 #include "ui/native_theme/common_theme.h" 16 #include "ui/native_theme/common_theme.h"
17 #include "ui/views/controls/menu/menu_config.h"
sky 2013/01/25 16:10:52 ui shouldn't depend upon views like this. Otherwis
varunjain 2013/01/25 18:50:40 Done as discussed offline.
18 #include "ui/views/round_rect_painter.h"
16 19
17 namespace { 20 namespace {
18 21
19 const SkColor kMenuBackgroundColor = SK_ColorWHITE; 22 const SkColor kMenuBackgroundColor = SK_ColorWHITE;
20 23
21 // Theme colors returned by GetSystemColor(). 24 // Theme colors returned by GetSystemColor().
22 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); 25 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
23 // Windows: 26 // Windows:
24 const SkColor kWindowBackgroundColor = SK_ColorWHITE; 27 const SkColor kWindowBackgroundColor = SK_ColorWHITE;
25 // Dialogs: 28 // Dialogs:
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 case kColorId_MenuBorderColor: 191 case kColorId_MenuBorderColor:
189 NOTREACHED(); 192 NOTREACHED();
190 break; 193 break;
191 } 194 }
192 195
193 return kInvalidColorIdColor; 196 return kInvalidColorIdColor;
194 } 197 }
195 198
196 void NativeThemeAura::PaintMenuPopupBackground(SkCanvas* canvas, 199 void NativeThemeAura::PaintMenuPopupBackground(SkCanvas* canvas,
197 const gfx::Size& size) const { 200 const gfx::Size& size) const {
198 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); 201 if (views::MenuConfig::instance(instance()).has_rounded_corners) {
202 SkPaint paint;
203 paint.setStyle(SkPaint::kFill_Style);
204 paint.setFlags(SkPaint::kAntiAlias_Flag);
205 paint.setColor(kMenuBackgroundColor);
206
207 gfx::Path path;
208 views::RoundRectPainter::CreateRoundRectPath(gfx::Rect(size), &path);
209
210 canvas->drawPath(path, paint);
211 } else {
212 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode);
213 }
199 } 214 }
200 215
201 void NativeThemeAura::PaintScrollbarTrack( 216 void NativeThemeAura::PaintScrollbarTrack(
202 SkCanvas* canvas, 217 SkCanvas* canvas,
203 Part part, 218 Part part,
204 State state, 219 State state,
205 const ScrollbarTrackExtraParams& extra_params, 220 const ScrollbarTrackExtraParams& extra_params,
206 const gfx::Rect& rect) const { 221 const gfx::Rect& rect) const {
207 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 222 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
208 if (part == kScrollbarVerticalTrack) { 223 if (part == kScrollbarVerticalTrack) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 DrawTiledImage(canvas, *center, 359 DrawTiledImage(canvas, *center,
345 0, 0, 1.0, 1.0, 360 0, 0, 1.0, 1.0,
346 rect.x() + left->width(), rect.y(), 361 rect.x() + left->width(), rect.y(),
347 rect.width() - left->width() - right->width(), 362 rect.width() - left->width() - right->width(),
348 center->height()); 363 center->height());
349 } 364 }
350 } 365 }
351 } 366 }
352 367
353 } // namespace ui 368 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_config.h » ('j') | ui/views/controls/menu/menu_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698