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

Unified Diff: views/controls/menu/menu_item_view_gtk.cc

Issue 2741004: Makes it so child views of menuitemview can be traversed with the (Closed)
Patch Set: Tweaks Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: views/controls/menu/menu_item_view_gtk.cc
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index a4c72161548995639dbbe0eb60a96e0800176dc0..3f0a830db541f336f4f1bee3836ad5272a05930d 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -28,7 +28,8 @@ gfx::Size MenuItemView::GetPreferredSize() {
// kFavIconSize if we're showing icons.
int content_height = std::max(kFavIconSize, font.height());
return gfx::Size(
- font.GetStringWidth(title_) + label_start_ + item_right_margin_,
+ font.GetStringWidth(title_) + label_start_ + item_right_margin_ +
+ GetChildPreferredWidth(),
content_height + GetBottomMargin() + GetTopMargin());
}
@@ -36,7 +37,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
const MenuConfig& config = MenuConfig::instance();
bool render_selection =
(!for_drag && IsSelected() &&
- parent_menu_item_->GetSubmenu()->GetShowSelection(this));
+ parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
+ GetChildViewCount() == 0);
int icon_x = config.item_left_margin;
int top_margin = GetTopMargin();
@@ -71,7 +73,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
IsEnabled() ? TextButton::kEnabledColor : TextButton::kDisabledColor;
#endif
int width = this->width() - item_right_margin_ - label_start_;
- const gfx::Font& font = MenuConfig::instance().font;
+ const gfx::Font& font = GetChildViewCount() > 0 ?
+ MenuConfig::instance().font_with_controls : MenuConfig::instance().font;
gfx::Rect text_bounds(label_start_, top_margin +
(available_height - font.height()) / 2, width,
font.height());

Powered by Google App Engine
This is Rietveld 408576698