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

Unified Diff: ui/views/layout/box_layout.cc

Issue 494273003: Add a minimum cross axis size to BoxLayout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | ui/views/layout/box_layout_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/layout/box_layout.cc
diff --git a/ui/views/layout/box_layout.cc b/ui/views/layout/box_layout.cc
index 59c21c52f4a8c9c89eae094a1af48d8f562fcc7b..51d42267621d3289ff8f715a8bbb0800f368e84c 100644
--- a/ui/views/layout/box_layout.cc
+++ b/ui/views/layout/box_layout.cc
@@ -162,6 +162,7 @@ gfx::Size BoxLayout::GetPreferredSize(const View* host) const {
width = std::max(width, child->GetPreferredSize().width());
}
+ width = std::max(width, minimum_cross_axis_size_);
}
return GetPreferredSizeForChildWidth(host, width);
@@ -169,7 +170,7 @@ gfx::Size BoxLayout::GetPreferredSize(const View* host) const {
int BoxLayout::GetPreferredHeightForWidth(const View* host, int width) const {
DCHECK_EQ(host_, host);
- int child_width = width - NonChildSize(host).width();
benwells 2014/08/26 07:22:16 Why has this changed?
calamity 2014/08/26 08:38:24 Removed.
+ int child_width = width;
return GetPreferredSizeForChildWidth(host, child_width).height();
}
@@ -278,6 +279,8 @@ gfx::Size BoxLayout::GetPreferredSizeForChildWidth(const View* host,
child_area_bounds.Union(child_bounds);
position += size.width() + between_child_spacing_;
}
+ child_area_bounds.set_height(
+ std::max(child_area_bounds.height(), minimum_cross_axis_size_));
} else {
int height = 0;
for (int i = 0; i < host->child_count(); ++i) {
« no previous file with comments | « ui/views/layout/box_layout.h ('k') | ui/views/layout/box_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698