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

Unified Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 1830343003: When animating a content setting bubble smaller, hide the background later. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Resync Created 4 years, 9 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/icon_label_bubble_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
index aacf4163b5429f975027aab01d2a7346e0b8695a..691c093e157a0614e61e881391133873c47b99a3 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
@@ -120,21 +120,7 @@ gfx::Size IconLabelBubbleView::GetPreferredSize() const {
}
void IconLabelBubbleView::Layout() {
- // Compute the label bounds. The label gets whatever size is left over after
- // accounting for the preferred image width and padding amounts. Note that if
- // the label has zero size it doesn't actually matter what we compute its X
- // value to be, since it won't be visible, so the X value can be "wrong"
- // compared to where the right edge of the image is computed to be below.
- // This means doing this layout doesn't doesn't depend on any of the layout
- // below. That layout, however, may need for this layout to have already
- // happened, since the value of ShouldShowBackground() we read below may
- // depend on whether the label has nonzero size. Therefore, we do this first.
- const int label_x = GetOuterPadding(true) + GetImageAndPaddingWidth();
- const int label_width =
- std::max(0, width() - label_x - GetOuterPadding(false));
- label_->SetBounds(label_x, 0, label_width, height());
-
- // Now compute the image bounds. In non-MD, the leading padding depends on
+ // Compute the image bounds. In non-MD, the leading padding depends on
// whether this is an extension icon, since extension icons and
// Chrome-provided icons are different sizes. In MD, these sizes are the
// same, so it's not necessary to handle the two types differently.
@@ -167,6 +153,15 @@ void IconLabelBubbleView::Layout() {
std::min(image_preferred_width,
std::max(0, width() - image_x - bubble_trailing_padding));
image_->SetBounds(image_x, 0, image_width, height());
+
+ // Compute the label bounds. The label gets whatever size is left over after
+ // accounting for the preferred image width and padding amounts. Note that if
+ // the label has zero size it doesn't actually matter what we compute its X
+ // value to be, since it won't be visible.
+ const int label_x = image_x + GetImageAndPaddingWidth();
+ const int label_width =
+ std::max(0, width() - label_x - bubble_trailing_padding);
Peter Kasting 2016/03/25 10:13:05 Despite using |image_x| and |bubble_trailing_paddi
+ label_->SetBounds(label_x, 0, label_width, height());
}
void IconLabelBubbleView::OnNativeThemeChanged(
« no previous file with comments | « chrome/browser/ui/views/location_bar/icon_label_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698