summaryrefslogtreecommitdiffstats
path: root/views/grid_layout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/grid_layout.cc')
-rw-r--r--views/grid_layout.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/views/grid_layout.cc b/views/grid_layout.cc
index 5e685ac..b3f0625 100644
--- a/views/grid_layout.cc
+++ b/views/grid_layout.cc
@@ -844,26 +844,22 @@ void GridLayout::SizeRowsAndColumns(bool layout, int width, int height,
if (rows_.empty())
return;
- // Calculate the preferred width of each of the columns. Some views'
- // preferred heights are derived from their width, as such we need to
- // calculate the size of the columns first.
+ // Calculate the size of each of the columns. Some views preferred heights are
+ // derived from their width, as such we need to calculate the size of the
+ // columns first.
for (std::vector<ColumnSet*>::iterator i = column_sets_.begin();
i != column_sets_.end(); ++i) {
(*i)->CalculateSize();
+ if (layout || width > 0) {
+ // We're doing a layout, divy up any extra space.
+ (*i)->Resize(width - (*i)->LayoutWidth() - left_inset_ - right_inset_);
+ // And reset the x coordinates.
+ (*i)->ResetColumnXCoordinates();
+ }
pref->set_width(std::max(pref->width(), (*i)->LayoutWidth()));
}
pref->set_width(pref->width() + left_inset_ + right_inset_);
- // Go over the columns again and set them all to the size we settled for.
- width = width ? width : pref->width();
- for (std::vector<ColumnSet*>::iterator i = column_sets_.begin();
- i != column_sets_.end(); ++i) {
- // We're doing a layout, divy up any extra space.
- (*i)->Resize(width - (*i)->LayoutWidth() - left_inset_ - right_inset_);
- // And reset the x coordinates.
- (*i)->ResetColumnXCoordinates();
- }
-
// Reset the height of each row.
LayoutElement::ResetSizes(&rows_);
@@ -1067,3 +1063,4 @@ views::GridLayout* CreatePanelGridLayout(views::View* host) {
kPanelVertMargin, kPanelHorizMargin);
return layout;
}
+