Chromium Code Reviews| 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( |