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

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

Issue 11362070: Remove unused custom vertical text alignment in CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase. 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
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | ui/views/controls/menu/menu_item_view_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/base/native_theme/native_theme.h" 10 #include "ui/base/native_theme/native_theme.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Render the foreground. 68 // Render the foreground.
69 SkColor fg_color = native_theme->GetSystemColor( 69 SkColor fg_color = native_theme->GetSystemColor(
70 enabled() ? ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor 70 enabled() ? ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor
71 : ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); 71 : ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor);
72 72
73 const gfx::Font& font = GetFont(); 73 const gfx::Font& font = GetFont();
74 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); 74 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
75 int width = this->width() - item_right_margin_ - label_start_ - accel_width; 75 int width = this->width() - item_right_margin_ - label_start_ - accel_width;
76 gfx::Rect text_bounds(label_start_, top_margin, width, available_height); 76 gfx::Rect text_bounds(label_start_, top_margin, width, available_height);
77 text_bounds.set_x(GetMirroredXForRect(text_bounds)); 77 text_bounds.set_x(GetMirroredXForRect(text_bounds));
78 int flags = GetDrawStringFlags() | gfx::Canvas::TEXT_VALIGN_MIDDLE; 78 int flags = GetDrawStringFlags();
79 if (mode == PB_FOR_DRAG) 79 if (mode == PB_FOR_DRAG)
80 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; 80 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING;
81 canvas->DrawStringInt(title(), font, fg_color, 81 canvas->DrawStringInt(title(), font, fg_color,
82 text_bounds.x(), text_bounds.y(), text_bounds.width(), 82 text_bounds.x(), text_bounds.y(), text_bounds.width(),
83 text_bounds.height(), flags); 83 text_bounds.height(), flags);
84 84
85 PaintAccelerator(canvas); 85 PaintAccelerator(canvas);
86 86
87 // Render the submenu indicator (arrow). 87 // Render the submenu indicator (arrow).
88 if (HasSubmenu()) { 88 if (HasSubmenu()) {
89 gfx::Rect arrow_bounds(this->width() - config.arrow_width - 89 gfx::Rect arrow_bounds(this->width() - config.arrow_width -
90 config.arrow_to_edge_padding, 90 config.arrow_to_edge_padding,
91 top_margin + (available_height - 91 top_margin + (available_height -
92 config.arrow_width) / 2, 92 config.arrow_width) / 2,
93 config.arrow_width, height()); 93 config.arrow_width, height());
94 AdjustBoundsForRTLUI(&arrow_bounds); 94 AdjustBoundsForRTLUI(&arrow_bounds);
95 canvas->DrawImageInt(*GetSubmenuArrowImage(), 95 canvas->DrawImageInt(*GetSubmenuArrowImage(),
96 arrow_bounds.x(), arrow_bounds.y()); 96 arrow_bounds.x(), arrow_bounds.y());
97 } 97 }
98 } 98 }
99 99
100 } // namespace views 100 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | ui/views/controls/menu/menu_item_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698