summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 19:38:18 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 19:38:18 +0000
commit11700330f14f3a8991340fe412903ed5e771d015 (patch)
treeedcda44b7c2f4eaa5507d4773603bcb182764f7e /chrome
parent8f1c6797e37207b284380f054696b68270132f85 (diff)
downloadchromium_src-11700330f14f3a8991340fe412903ed5e771d015.zip
chromium_src-11700330f14f3a8991340fe412903ed5e771d015.tar.gz
chromium_src-11700330f14f3a8991340fe412903ed5e771d015.tar.bz2
Landing http://codereview.chromium.org/14450 for m0 (Mohamed Mansour).
BUG=2186 TEST=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/views/grid_layout.cc26
-rw-r--r--chrome/views/grid_layout.h3
2 files changed, 15 insertions, 14 deletions
diff --git a/chrome/views/grid_layout.cc b/chrome/views/grid_layout.cc
index c43ef0e..fd36e61 100644
--- a/chrome/views/grid_layout.cc
+++ b/chrome/views/grid_layout.cc
@@ -763,7 +763,7 @@ void GridLayout::Layout(View* host) {
DCHECK(host_ == host);
// SizeRowsAndColumns sets the size and location of each row/column, but
// not of the views.
- CSize pref;
+ gfx::Size pref;
SizeRowsAndColumns(true, host_->width(), host_->height(), &pref);
// Size each view.
@@ -790,23 +790,23 @@ void GridLayout::Layout(View* host) {
gfx::Size GridLayout::GetPreferredSize(View* host) {
DCHECK(host_ == host);
- CSize out;
+ gfx::Size out;
SizeRowsAndColumns(false, 0, 0, &out);
- return gfx::Size(out.cx, out.cy);
+ return out;
}
int GridLayout::GetPreferredHeightForWidth(View* host, int width) {
DCHECK(host_ == host);
- CSize pref;
+ gfx::Size pref;
SizeRowsAndColumns(false, width, 0, &pref);
- return pref.cy;
+ return pref.height();
}
void GridLayout::SizeRowsAndColumns(bool layout, int width, int height,
- CSize* pref) {
+ gfx::Size* pref) {
// Make sure the master columns have been calculated.
CalculateMasterColumnsIfNecessary();
- pref->cx = pref->cy = 0;
+ pref->SetSize(0, 0);
if (rows_.empty())
return;
@@ -822,9 +822,9 @@ void GridLayout::SizeRowsAndColumns(bool layout, int width, int height,
// And reset the x coordinates.
(*i)->ResetColumnXCoordinates();
}
- pref->cx = std::max(static_cast<int>(pref->cx), (*i)->LayoutWidth());
+ pref->set_width(std::max(pref->width(), (*i)->LayoutWidth()));
}
- pref->cx += left_inset_ + right_inset_;
+ pref->set_width(pref->width() + left_inset_ + right_inset_);
// Reset the height of each row.
LayoutElement::ResetSizes(&rows_);
@@ -879,13 +879,13 @@ void GridLayout::SizeRowsAndColumns(bool layout, int width, int height,
LayoutElement::CalculateLocationsFromSize(&rows_);
// We now know the preferred height, set it here.
- pref->cy = rows_[rows_.size() - 1]->Location() +
- rows_[rows_.size() - 1]->Size() + top_inset_ + bottom_inset_;
+ pref->set_height(rows_[rows_.size() - 1]->Location() +
+ rows_[rows_.size() - 1]->Size() + top_inset_ + bottom_inset_);
- if (layout && height != pref->cy) {
+ if (layout && height != pref->height()) {
// We're doing a layout, and the height differs from the preferred height,
// divy up the extra space.
- LayoutElement::DistributeDelta(height - pref->cy, &rows_);
+ LayoutElement::DistributeDelta(height - pref->height(), &rows_);
// Reset y locations.
LayoutElement::CalculateLocationsFromSize(&rows_);
diff --git a/chrome/views/grid_layout.h b/chrome/views/grid_layout.h
index 85284a9..358422a 100644
--- a/chrome/views/grid_layout.h
+++ b/chrome/views/grid_layout.h
@@ -174,7 +174,8 @@ class GridLayout : public LayoutManager {
// they both call into this method. This sizes the Columns/Rows as
// appropriate. If layout is true, width/height give the width/height the
// of the host, otherwise they are ignored.
- void SizeRowsAndColumns(bool layout, int width, int height, CSize* pref);
+ void SizeRowsAndColumns(bool layout, int width, int height,
+ gfx::Size* pref);
// Calculates the master columns of all the column sets. See Column for
// a description of what a master column is.