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

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 14367021: Rename ClampToMin and ClampToMax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 (is_extension_icon_ ? LocationBarView::kIconInternalPadding : 0), 0, 71 (is_extension_icon_ ? LocationBarView::kIconInternalPadding : 0), 0,
72 image_->GetPreferredSize().width(), height()); 72 image_->GetPreferredSize().width(), height());
73 const int pre_label_width = GetPreLabelWidth(); 73 const int pre_label_width = GetPreLabelWidth();
74 label_->SetBounds(pre_label_width, 0, 74 label_->SetBounds(pre_label_width, 0,
75 width() - pre_label_width - GetBubbleOuterPadding(), 75 width() - pre_label_width - GetBubbleOuterPadding(),
76 label_->GetPreferredSize().height()); 76 label_->GetPreferredSize().height());
77 } 77 }
78 78
79 gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const { 79 gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const {
80 gfx::Size size(GetPreLabelWidth() + width + GetBubbleOuterPadding(), 0); 80 gfx::Size size(GetPreLabelWidth() + width + GetBubbleOuterPadding(), 0);
81 size.ClampToMin(background_painter_->GetMinimumSize()); 81 size.SetToMax(background_painter_->GetMinimumSize());
82 return size; 82 return size;
83 } 83 }
84 84
85 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { 85 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) {
86 background_painter_->Paint(canvas, size()); 86 background_painter_->Paint(canvas, size());
87 } 87 }
88 88
89 int IconLabelBubbleView::GetPreLabelWidth() const { 89 int IconLabelBubbleView::GetPreLabelWidth() const {
90 const int image_width = image_->GetPreferredSize().width(); 90 const int image_width = image_->GetPreferredSize().width();
91 return GetBubbleOuterPadding() + 91 return GetBubbleOuterPadding() +
92 (image_width ? (image_width + LocationBarView::GetItemPadding()) : 0); 92 (image_width ? (image_width + LocationBarView::GetItemPadding()) : 0);
93 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698