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

Unified Diff: chrome/views/grid_layout.cc

Issue 14450: Some cleanup, using gfx::Size instead of CSize for ... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/views/grid_layout.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/grid_layout.cc
===================================================================
--- chrome/views/grid_layout.cc (revision 6997)
+++ chrome/views/grid_layout.cc (working copy)
@@ -763,7 +763,7 @@
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 @@
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 @@
// 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 @@
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_);
« no previous file with comments | « chrome/views/grid_layout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698