summaryrefslogtreecommitdiffstats
path: root/ui/views/bubble
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-30 00:18:00 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-30 00:18:00 +0000
commita4a08d0b3d83eae6b232636e4d07a9b0e70594ed (patch)
treee114801e823f885d91437929ebc349e28dc25281 /ui/views/bubble
parent1764980dfa80e1f3e61e283de71ed3c3a707700c (diff)
downloadchromium_src-a4a08d0b3d83eae6b232636e4d07a9b0e70594ed.zip
chromium_src-a4a08d0b3d83eae6b232636e4d07a9b0e70594ed.tar.gz
chromium_src-a4a08d0b3d83eae6b232636e4d07a9b0e70594ed.tar.bz2
Rename ClampToMin and ClampToMax
I find these function names confusing. I have to stop and read the code each time I try to use them to figure out what they're going to do. Part of the confusion is that ClampToMin sets the components to the _maximum_ of the two sizes/vectors. It's also not clear from the function name which of the two objects is acting as the 'Min'. This is mitigated by the parameter names and local variables passed to the function, but it would be nice if the name of the function itself made this clear. a.ClampToLowerBound(b) makes it clear both that b is acting as the lower bound and how and when a is going to be altered. Other names I've considered (for ClampToMin -- the suggestions for ClampToMax are analagous): ClampIfSmallerThan(other) SetComponentsToMax(other) Union(other) (for sizes) R=danakj,sky BUG=None Review URL: https://chromiumcodereview.appspot.com/14367021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r--ui/views/bubble/bubble_border.cc6
-rw-r--r--ui/views/bubble/bubble_frame_view.cc6
2 files changed, 6 insertions, 6 deletions
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc
index 37a8eb1..8b9a612 100644
--- a/ui/views/bubble/bubble_border.cc
+++ b/ui/views/bubble/bubble_border.cc
@@ -158,11 +158,11 @@ gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& anchor_rect,
std::max(images_->arrow_thickness + images_->border_interior_thickness,
images_->border_thickness);
if (is_arrow_on_horizontal(arrow_))
- size.ClampToMin(gfx::Size(min_with_arrow_width, min_with_arrow_thickness));
+ size.SetToMax(gfx::Size(min_with_arrow_width, min_with_arrow_thickness));
else if (has_arrow(arrow_))
- size.ClampToMin(gfx::Size(min_with_arrow_thickness, min_with_arrow_width));
+ size.SetToMax(gfx::Size(min_with_arrow_thickness, min_with_arrow_width));
else
- size.ClampToMin(gfx::Size(min, min));
+ size.SetToMax(gfx::Size(min, min));
int x = anchor_rect.x();
int y = anchor_rect.y();
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index 050a408..a6e56ad 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -146,7 +146,7 @@ gfx::Size BubbleFrameView::GetPreferredSize() {
close_->width() + 1;
if (titlebar_extra_view_ != NULL)
title_bar_width += titlebar_extra_view_->GetPreferredSize().width();
- size.ClampToMin(gfx::Size(title_bar_width, 0));
+ size.SetToMax(gfx::Size(title_bar_width, 0));
return size;
}
@@ -161,14 +161,14 @@ void BubbleFrameView::Layout() {
title_bounds.Inset(kTitleLeftInset, kTitleTopInset, 0, 0);
gfx::Size title_size(title_->GetPreferredSize());
const int title_width = std::max(0, close_->bounds().x() - title_bounds.x());
- title_size.ClampToMax(gfx::Size(title_width, title_size.height()));
+ title_size.SetToMin(gfx::Size(title_width, title_size.height()));
title_bounds.set_size(title_size);
title_->SetBoundsRect(title_bounds);
if (titlebar_extra_view_) {
const int extra_width = close_->bounds().x() - title_->bounds().right();
gfx::Size size = titlebar_extra_view_->GetPreferredSize();
- size.ClampToMax(gfx::Size(std::max(0, extra_width), size.height()));
+ size.SetToMin(gfx::Size(std::max(0, extra_width), size.height()));
gfx::Rect titlebar_extra_view_bounds(
bounds.right() - size.width(),
title_bounds.y(),