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

Unified Diff: chrome/browser/views/info_bar_view.cc

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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
Index: chrome/browser/views/info_bar_view.cc
===================================================================
--- chrome/browser/views/info_bar_view.cc (revision 3391)
+++ chrome/browser/views/info_bar_view.cc (working copy)
@@ -55,20 +55,19 @@
// Preferred size is equal to the max of the childrens horizontal sizes
// and the sum of their vertical sizes.
-void InfoBarView::GetPreferredSize(CSize *out) {
- out->cx = 0;
- out->cy = 0;
+gfx::Size InfoBarView::GetPreferredSize() {
+ gfx::Size prefsize;
// We count backwards so the most recently added view is on the top.
for (int i = GetChildViewCount() - 1; i >= 0; i--) {
View* v = GetChildViewAt(i);
if (v->IsVisible()) {
- CSize view_size;
- v->GetPreferredSize(&view_size);
- out->cx = std::max(static_cast<int>(out->cx), v->width());
- out->cy += static_cast<int>(view_size.cy) + kSeparatorHeight;
+ prefsize.set_width(std::max(prefsize.width(), v->width()));
+ prefsize.Enlarge(0, v->GetPreferredSize().height() + kSeparatorHeight);
}
}
+
+ return prefsize;
}
void InfoBarView::Layout() {
@@ -81,14 +80,10 @@
if (!v->IsVisible())
continue;
- CSize view_size;
- v->GetPreferredSize(&view_size);
- int view_width = std::max(static_cast<int>(view_size.cx), width());
- y = y - view_size.cy - kSeparatorHeight;
- v->SetBounds(x,
- y,
- view_width,
- view_size.cy);
+ gfx::Size view_size = v->GetPreferredSize();
+ int view_width = std::max(view_size.width(), width());
+ y = y - view_size.height() - kSeparatorHeight;
+ v->SetBounds(x, y, view_width, view_size.height());
}
}

Powered by Google App Engine
This is Rietveld 408576698