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

Unified Diff: chrome/browser/views/info_bubble.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_bubble.cc
===================================================================
--- chrome/browser/views/info_bubble.cc (revision 3391)
+++ chrome/browser/views/info_bubble.cc (working copy)
@@ -236,14 +236,15 @@
return CalculateWindowBounds(position_relative_to);
}
-void InfoBubble::ContentView::GetPreferredSize(CSize* pref) {
+gfx::Size InfoBubble::ContentView::GetPreferredSize() {
DCHECK(GetChildViewCount() == 1);
View* content = GetChildViewAt(0);
- content->GetPreferredSize(pref);
- pref->cx += kBorderSize + kBorderSize + kInfoBubbleViewLeftMargin +
- kInfoBubbleViewRightMargin;
- pref->cy += kBorderSize + kBorderSize + kArrowSize +
- kInfoBubbleViewTopMargin + kInfoBubbleViewBottomMargin;
+ gfx::Size pref = content->GetPreferredSize();
+ pref.Enlarge(kBorderSize + kBorderSize + kInfoBubbleViewLeftMargin +
+ kInfoBubbleViewRightMargin,
+ kBorderSize + kBorderSize + kArrowSize +
+ kInfoBubbleViewTopMargin + kInfoBubbleViewBottomMargin);
+ return pref;
}
void InfoBubble::ContentView::Layout() {
@@ -405,19 +406,18 @@
gfx::Rect InfoBubble::ContentView::CalculateWindowBounds(
const gfx::Rect& position_relative_to) {
- CSize pref;
- GetPreferredSize(&pref);
+ gfx::Size pref = GetPreferredSize();
int x = position_relative_to.x() + position_relative_to.width() / 2;
int y;
if (IsLeft())
x -= kArrowXOffset;
else
- x = x + kArrowXOffset - pref.cx;
+ x = x + kArrowXOffset - pref.width();
if (IsTop()) {
y = position_relative_to.bottom() + kArrowToContentPadding;
} else {
- y = position_relative_to.y() - kArrowToContentPadding - pref.cy;
+ y = position_relative_to.y() - kArrowToContentPadding - pref.height();
}
- return gfx::Rect(x, y, pref.cx, pref.cy);
+ return gfx::Rect(x, y, pref.width(), pref.height());
}

Powered by Google App Engine
This is Rietveld 408576698