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

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

Issue 1477253002: Use a single views::MenuConfig instance for each platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add menu_config_android Created 5 years 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
« no previous file with comments | « ui/views/controls/menu/menu_separator_views.cc ('k') | ui/views/views.gyp » ('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/submenu_view.h" 5 #include "ui/views/controls/menu/submenu_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 max_simple_width, dimensions.standard_width); 153 max_simple_width, dimensions.standard_width);
154 max_minor_text_width_ = 154 max_minor_text_width_ =
155 std::max(max_minor_text_width_, dimensions.minor_text_width); 155 std::max(max_minor_text_width_, dimensions.minor_text_width);
156 max_complex_width = std::max(max_complex_width, 156 max_complex_width = std::max(max_complex_width,
157 dimensions.standard_width + dimensions.children_width); 157 dimensions.standard_width + dimensions.children_width);
158 } else { 158 } else {
159 max_complex_width = std::max(max_complex_width, 159 max_complex_width = std::max(max_complex_width,
160 child->GetPreferredSize().width()); 160 child->GetPreferredSize().width());
161 } 161 }
162 } 162 }
163 if (max_minor_text_width_ > 0) { 163 if (max_minor_text_width_ > 0)
164 max_minor_text_width_ += 164 max_minor_text_width_ += MenuConfig::instance().label_to_minor_text_padding;
165 GetMenuItem()->GetMenuConfig().label_to_minor_text_padding; 165
166 }
167 // Finish calculating our optimum width. 166 // Finish calculating our optimum width.
168 gfx::Insets insets = GetInsets(); 167 gfx::Insets insets = GetInsets();
169 int width = std::max(max_complex_width, 168 int width = std::max(max_complex_width,
170 std::max(max_simple_width + max_minor_text_width_ + 169 std::max(max_simple_width + max_minor_text_width_ +
171 insets.width(), 170 insets.width(),
172 minimum_preferred_width_ - 2 * insets.width())); 171 minimum_preferred_width_ - 2 * insets.width()));
173 172
174 // Then, the height for that width. 173 // Then, the height for that width.
175 int height = 0; 174 int height = 0;
176 int menu_item_width = width - insets.width(); 175 int menu_item_width = width - insets.width();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 y = std::max(y, 0); 509 y = std::max(y, 0);
511 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 510 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
512 if (new_vis_bounds != vis_bounds) { 511 if (new_vis_bounds != vis_bounds) {
513 ScrollRectToVisible(new_vis_bounds); 512 ScrollRectToVisible(new_vis_bounds);
514 return true; 513 return true;
515 } 514 }
516 return false; 515 return false;
517 } 516 }
518 517
519 } // namespace views 518 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_separator_views.cc ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698