summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-21 22:56:25 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-21 22:56:25 +0000
commit73cef7cc9da81a929c6a44042bac03146d95079d (patch)
tree9b284158b13bfca5b39e37d6c5e260170073aaac
parent74eaf356b0e486abab9db7196659dde34bc8ac48 (diff)
downloadchromium_src-73cef7cc9da81a929c6a44042bac03146d95079d.zip
chromium_src-73cef7cc9da81a929c6a44042bac03146d95079d.tar.gz
chromium_src-73cef7cc9da81a929c6a44042bac03146d95079d.tar.bz2
Size the EV bubble after calculating the space taken by the star/page actions/content settings, so we won't take as much space for users with a lot of these.
BUG=42856 TEST=Elided EV bubble should take less space when there are lots of icons in the omnibox. Review URL: http://codereview.chromium.org/2073019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47963 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/location_bar/location_bar_view.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc
index 10e561d..2e46146 100644
--- a/chrome/browser/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/views/location_bar/location_bar_view.cc
@@ -377,16 +377,7 @@ void LocationBarView::Layout() {
ev_bubble_view_->SetVisible(true);
ev_bubble_view_->SetLabel(model_->GetEVCertName());
ev_bubble_width = ev_bubble_view_->GetPreferredSize().width();
-
- // Try to elide the bubble to be no larger than half the total available
- // space, but never elide it any smaller than 150 px.
- static const int kMinElidedBubbleWidth = 150;
- static const double kMaxBubbleFraction = 0.5;
- ev_bubble_width = std::min(ev_bubble_width, std::max(kMinElidedBubbleWidth,
- static_cast<int>((entry_width - kBubblePadding - kViewPadding) *
- kMaxBubbleFraction)));
-
- entry_width -= kBubblePadding + ev_bubble_width + kViewPadding;
+ // We'll adjust this width and take it out of |entry_width| below.
} else {
location_icon_view_->SetVisible(true);
location_icon_width = location_icon_view_->GetPreferredSize().width();
@@ -407,6 +398,20 @@ void LocationBarView::Layout() {
entry_width -= (*i)->GetPreferredSize().width() + kViewPadding;
}
+ // Size the EV bubble. We do this after taking the star/page actions/content
+ // settings out of |entry_width| so we won't take too much space.
+ if (ev_bubble_width) {
+ // Try to elide the bubble to be no larger than half the total available
+ // space, but never elide it any smaller than 150 px.
+ static const int kMinElidedBubbleWidth = 150;
+ static const double kMaxBubbleFraction = 0.5;
+ ev_bubble_width = std::min(ev_bubble_width, std::max(kMinElidedBubbleWidth,
+ static_cast<int>((entry_width - kBubblePadding - kViewPadding) *
+ kMaxBubbleFraction)));
+
+ entry_width -= kBubblePadding + ev_bubble_width + kViewPadding;
+ }
+
#if defined(OS_WIN)
RECT formatting_rect;
location_entry_->GetRect(&formatting_rect);