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 ed09f59f1616ebb12ab6dd6e5a0d9b8c75f9f557..a22cd61f21254d1dfd1b38cf405a5e095c1a25e8 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 |
| @@ -6,6 +6,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/ui/views/layout_constants.h" |
| +#include "ui/base/resource/material_design/material_design_controller.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/color_utils.h" |
| @@ -46,6 +47,8 @@ IconLabelBubbleView::IconLabelBubbleView(int contained_image, |
| image_->set_interactive(false); |
| AddChildView(image_); |
| + if (ui::MaterialDesignController::IsModeMaterial()) |
| + label_->SetAutoColorReadabilityEnabled(false); |
|
Peter Kasting
2015/10/01 01:12:17
You shouldn't need to do this; if you do something
jonross
2015/10/01 15:46:50
Yeah it is rejecting White text on all three backg
|
| label_->SetEnabledColor(text_color); |
| if (elide_in_middle) |
| @@ -101,11 +104,18 @@ gfx::Size IconLabelBubbleView::GetPreferredSize() const { |
| void IconLabelBubbleView::Layout() { |
| const int image_width = image()->GetPreferredSize().width(); |
| - image_->SetBounds(std::min((width() - image_width) / 2, |
| - GetBubbleOuterPadding(!is_extension_icon_)), |
| - 0, image_->GetPreferredSize().width(), height()); |
| + const int image_x = std::min((width() - image_width) / 2, |
| + GetBubbleOuterPadding(!is_extension_icon_)); |
| + if (ui::MaterialDesignController::IsModeMaterial()) { |
| + const int image_height = image()->GetPreferredSize().height(); |
| + const int image_veritcal_padding = (height() - image_height) / 2; |
|
Peter Kasting
2015/10/01 01:12:17
Nit: vertical -- but I'd probably just inline this
|
| + image_->SetBounds(image_x, image_veritcal_padding, image_width, |
| + image_height); |
| + } else { |
| + image_->SetBounds(image_x, 0, image_width, height()); |
| + } |
| - const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING); |
| + const int padding = GetLayoutConstant(ICON_LABEL_VIEW_INTERNAL_PADDING); |
| int pre_label_width = |
| GetBubbleOuterPadding(true) + (image_width ? (image_width + padding) : 0); |
| label_->SetBounds(pre_label_width, 0, |
| @@ -117,7 +127,7 @@ gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const { |
| gfx::Size size(image_->GetPreferredSize()); |
| if (ShouldShowBackground()) { |
| const int image_width = image_->GetPreferredSize().width(); |
| - const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING); |
| + const int padding = GetLayoutConstant(ICON_LABEL_VIEW_INTERNAL_PADDING); |
| const int non_label_width = |
| GetBubbleOuterPadding(true) + |
| (image_width ? (image_width + padding) : 0) + |