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

Side by Side Diff: ui/views/controls/menu/menu_item_view_win.cc

Issue 11362070: Remove unused custom vertical text alignment in CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove now unused kVerticalAlignments array for TextExample. Created 8 years, 1 month 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/views/controls/menu/menu_item_view.h" 5 #include "ui/views/controls/menu/menu_item_view.h"
6 6
7 #include <uxtheme.h> 7 #include <uxtheme.h>
8 #include <Vssym32.h> 8 #include <Vssym32.h>
9 9
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Render the foreground. 80 // Render the foreground.
81 // Menu color is specific to Vista, fallback to classic colors if can't 81 // Menu color is specific to Vista, fallback to classic colors if can't
82 // get color. 82 // get color.
83 SkColor fg_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( 83 SkColor fg_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault(
84 ui::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, 84 ui::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR,
85 default_sys_color); 85 default_sys_color);
86 const gfx::Font& font = GetFont(); 86 const gfx::Font& font = GetFont();
87 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); 87 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
88 int width = this->width() - item_right_margin_ - label_start_ - accel_width; 88 int width = this->width() - item_right_margin_ - label_start_ - accel_width;
89 int height = this->height() - GetTopMargin() - GetBottomMargin(); 89 int height = this->height() - GetTopMargin() - GetBottomMargin();
90 int flags = gfx::Canvas::TEXT_VALIGN_MIDDLE | 90 int flags = GetRootMenuItem()->GetDrawStringFlags();
91 GetRootMenuItem()->GetDrawStringFlags();
92 gfx::Rect text_bounds(label_start_, top_margin, width, height); 91 gfx::Rect text_bounds(label_start_, top_margin, width, height);
93 text_bounds.set_x(GetMirroredXForRect(text_bounds)); 92 text_bounds.set_x(GetMirroredXForRect(text_bounds));
94 if (mode == PB_FOR_DRAG) { 93 if (mode == PB_FOR_DRAG) {
95 // With different themes, it's difficult to tell what the correct 94 // With different themes, it's difficult to tell what the correct
96 // foreground and background colors are for the text to draw the correct 95 // foreground and background colors are for the text to draw the correct
97 // halo. Instead, just draw black on white, which will look good in most 96 // halo. Instead, just draw black on white, which will look good in most
98 // cases. 97 // cases.
99 canvas->DrawStringWithHalo(title(), font, 0x00000000, 0xFFFFFFFF, 98 canvas->DrawStringWithHalo(title(), font, 0x00000000, 0xFFFFFFFF,
100 text_bounds.x(), text_bounds.y(), text_bounds.width(), 99 text_bounds.x(), text_bounds.y(), text_bounds.width(),
101 text_bounds.height(), flags); 100 text_bounds.height(), flags);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); 153 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra);
155 154
156 // And the check. 155 // And the check.
157 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); 156 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height);
158 AdjustBoundsForRTLUI(&icon_bounds); 157 AdjustBoundsForRTLUI(&icon_bounds);
159 NativeTheme::instance()->Paint(canvas->sk_canvas(), 158 NativeTheme::instance()->Paint(canvas->sk_canvas(),
160 NativeTheme::kMenuCheck, state, bg_bounds, extra); 159 NativeTheme::kMenuCheck, state, bg_bounds, extra);
161 } 160 }
162 161
163 } // namespace views 162 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698