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

Unified Diff: chrome/views/combo_box.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/views/combo_box.cc
===================================================================
--- chrome/views/combo_box.cc (revision 3391)
+++ chrome/views/combo_box.cc (working copy)
@@ -30,10 +30,10 @@
listener_ = listener;
}
-void ComboBox::GetPreferredSize(CSize* out) {
+gfx::Size ComboBox::GetPreferredSize() {
HWND hwnd = GetNativeControlHWND();
if (!hwnd)
- return;
+ return gfx::Size();
COMBOBOXINFO cbi;
memset(reinterpret_cast<unsigned char*>(&cbi), 0, sizeof(cbi));
@@ -54,12 +54,14 @@
int item_to_button_distance = std::max(kItemOffset - border.width(), 0);
// The cx computation can be read as measuring from left to right.
- out->cx = std::max(kItemOffset + content_width_ + kComboboxExtraPaddingX +
- item_to_button_distance + rect_button.width() +
- border.width(), kMinComboboxWidth);
+ int pref_width = std::max(kItemOffset + content_width_ +
+ kComboboxExtraPaddingX +
+ item_to_button_distance + rect_button.width() +
+ border.width(), kMinComboboxWidth);
// The two arguments to ::max below should be typically be equal.
- out->cy = std::max(rect_item.height() + 2 * kItemOffset,
- rect_button.height() + 2 * border.height());
+ int pref_height = std::max(rect_item.height() + 2 * kItemOffset,
+ rect_button.height() + 2 * border.height());
+ return gfx::Size(pref_width, pref_height);
}
HWND ComboBox::CreateNativeControl(HWND parent_container) {

Powered by Google App Engine
This is Rietveld 408576698