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

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: 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/gfx/pango_util.cc ('k') | ui/views/controls/menu/menu_item_view_views.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/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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 const gfx::Font& font = GetFont(); 740 const gfx::Font& font = GetFont();
741 int available_height = height() - GetTopMargin() - GetBottomMargin(); 741 int available_height = height() - GetTopMargin() - GetBottomMargin();
742 int max_accel_width = 742 int max_accel_width =
743 parent_menu_item_->GetSubmenu()->max_accelerator_width(); 743 parent_menu_item_->GetSubmenu()->max_accelerator_width();
744 const MenuConfig& config = GetMenuConfig(); 744 const MenuConfig& config = GetMenuConfig();
745 int accel_right_margin = config.align_arrow_and_shortcut ? 745 int accel_right_margin = config.align_arrow_and_shortcut ?
746 config.arrow_to_edge_padding : item_right_margin_; 746 config.arrow_to_edge_padding : item_right_margin_;
747 gfx::Rect accel_bounds(width() - accel_right_margin - max_accel_width, 747 gfx::Rect accel_bounds(width() - accel_right_margin - max_accel_width,
748 GetTopMargin(), max_accel_width, available_height); 748 GetTopMargin(), max_accel_width, available_height);
749 accel_bounds.set_x(GetMirroredXForRect(accel_bounds)); 749 accel_bounds.set_x(GetMirroredXForRect(accel_bounds));
750 int flags = GetDrawStringFlags() | gfx::Canvas::TEXT_VALIGN_MIDDLE; 750 int flags = GetDrawStringFlags();
751 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT); 751 flags &= ~(gfx::Canvas::TEXT_ALIGN_RIGHT | gfx::Canvas::TEXT_ALIGN_LEFT);
752 if (base::i18n::IsRTL()) 752 if (base::i18n::IsRTL())
753 flags |= gfx::Canvas::TEXT_ALIGN_LEFT; 753 flags |= gfx::Canvas::TEXT_ALIGN_LEFT;
754 else 754 else
755 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; 755 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
756 canvas->DrawStringInt( 756 canvas->DrawStringInt(
757 accel_text, font, GetNativeTheme()->GetSystemColor( 757 accel_text, font, GetNativeTheme()->GetSystemColor(
758 ui::NativeTheme::kColorId_TextButtonDisabledColor), 758 ui::NativeTheme::kColorId_TextButtonDisabledColor),
759 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), 759 accel_bounds.x(), accel_bounds.y(), accel_bounds.width(),
760 accel_bounds.height(), flags); 760 accel_bounds.height(), flags);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 temp_width = menu_item->GetMaxIconViewWidth(); 889 temp_width = menu_item->GetMaxIconViewWidth();
890 } else if (menu_item->icon_view()) { 890 } else if (menu_item->icon_view()) {
891 temp_width = menu_item->icon_view()->GetPreferredSize().width(); 891 temp_width = menu_item->icon_view()->GetPreferredSize().width();
892 } 892 }
893 width = std::max(width, temp_width); 893 width = std::max(width, temp_width);
894 } 894 }
895 return width; 895 return width;
896 } 896 }
897 897
898 } // namespace views 898 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/pango_util.cc ('k') | ui/views/controls/menu/menu_item_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698