diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 13:46:43 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 13:46:43 +0000 |
commit | 552d67df8c38db1a7097ef1af632d8b36459df81 (patch) | |
tree | 364a305dabf4cb25dc37d2c5fc8eb7ee241b4d71 /views/grid_layout.cc | |
parent | aa43b4d1623f3480929e8e5d659702a3eaacb769 (diff) | |
download | chromium_src-552d67df8c38db1a7097ef1af632d8b36459df81.zip chromium_src-552d67df8c38db1a7097ef1af632d8b36459df81.tar.gz chromium_src-552d67df8c38db1a7097ef1af632d8b36459df81.tar.bz2 |
Auto-size the views version of the options dialog.
This adds support for auto-sizing tab controls, adjusts the options dialog to
use it and takes care of any fallout due to the new layout handling. Also fixes
a couple of small bugs in the views Layout() machinery and sanitizes layouting
of options pages.
BUG=36497
TEST=unit tests in tabbed_pane_unittest.cc and grid_layout_unittest.cc, as well as checking the options dialog in any supported language.
Review URL: http://codereview.chromium.org/2812026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/grid_layout.cc')
-rw-r--r-- | views/grid_layout.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/views/grid_layout.cc b/views/grid_layout.cc index b3f0625..5e685ac 100644 --- a/views/grid_layout.cc +++ b/views/grid_layout.cc @@ -844,22 +844,26 @@ void GridLayout::SizeRowsAndColumns(bool layout, int width, int height, if (rows_.empty()) return; - // 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. + // 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. 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_); @@ -1063,4 +1067,3 @@ views::GridLayout* CreatePanelGridLayout(views::View* host) { kPanelVertMargin, kPanelHorizMargin); return layout; } - |