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

Side by Side Diff: ui/views/controls/menu/menu_item_view.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 "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 const gfx::Font& font = GetFont(); 734 const gfx::Font& font = GetFont();
735 int available_height = height() - GetTopMargin() - GetBottomMargin(); 735 int available_height = height() - GetTopMargin() - GetBottomMargin();
736 int max_accel_width = 736 int max_accel_width =
737 parent_menu_item_->GetSubmenu()->max_accelerator_width(); 737 parent_menu_item_->GetSubmenu()->max_accelerator_width();
738 const MenuConfig& config = GetMenuConfig(); 738 const MenuConfig& config = GetMenuConfig();
739 int accel_right_margin = config.align_arrow_and_shortcut ? 739 int accel_right_margin = config.align_arrow_and_shortcut ?
740 config.arrow_to_edge_padding : item_right_margin_; 740 config.arrow_to_edge_padding : item_right_margin_;
741 gfx::Rect accel_bounds(width() - accel_right_margin - max_accel_width, 741 gfx::Rect accel_bounds(width() - accel_right_margin - max_accel_width,
742 GetTopMargin(), max_accel_width, available_height); 742 GetTopMargin(), max_accel_width, available_height);
743 accel_bounds.set_x(GetMirroredXForRect(accel_bounds)); 743 accel_bounds.set_x(GetMirroredXForRect(accel_bounds));
744 int flags = GetRootMenuItem()->GetDrawStringFlags() | 744 int flags = GetRootMenuItem()->GetDrawStringFlags();
745 gfx::Canvas::TEXT_VALIGN_MIDDLE;
746 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); 745 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT);
747 if (base::i18n::IsRTL()) 746 if (base::i18n::IsRTL())
748 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; 747 flags |= gfx::Canvas::TEXT_ALIGN_LEFT;
749 else 748 else
750 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; 749 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
751 canvas->DrawStringInt( 750 canvas->DrawStringInt(
752 accel_text, font, ui::NativeTheme::instance()->GetSystemColor( 751 accel_text, font, ui::NativeTheme::instance()->GetSystemColor(
753 ui::NativeTheme::kColorId_TextButtonDisabledColor), 752 ui::NativeTheme::kColorId_TextButtonDisabledColor),
754 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), 753 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(),
755 accel_bounds.height(), flags); 754 accel_bounds.height(), flags);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 temp_width = menu_item->GetMaxIconViewWidth(); 883 temp_width = menu_item->GetMaxIconViewWidth();
885 } else if (menu_item->icon_view()) { 884 } else if (menu_item->icon_view()) {
886 temp_width = menu_item->icon_view()->GetPreferredSize().width(); 885 temp_width = menu_item->icon_view()->GetPreferredSize().width();
887 } 886 }
888 width = std::max(width, temp_width); 887 width = std::max(width, temp_width);
889 } 888 }
890 return width; 889 return width;
891 } 890 }
892 891
893 } // namespace views 892 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698