| Index: ui/views/controls/button/label_button.cc
|
| diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
|
| index 0387e1d641e64caa1bb93dc934811e27945bee58..b7d696054d3e3e830e24eb5af85b2bf4ce2a865c 100644
|
| --- a/ui/views/controls/button/label_button.cc
|
| +++ b/ui/views/controls/button/label_button.cc
|
| @@ -287,8 +287,15 @@ void LabelButton::Layout() {
|
| adjusted_alignment = (adjusted_alignment == gfx::ALIGN_LEFT) ?
|
| gfx::ALIGN_RIGHT : gfx::ALIGN_LEFT;
|
|
|
| + // By default, GetChildAreaBounds() ignores the top and bottom border, but we
|
| + // want the image to respect it.
|
| gfx::Rect child_area(GetChildAreaBounds());
|
| - child_area.Inset(GetInsets());
|
| + gfx::Rect label_area(child_area);
|
| +
|
| + gfx::Insets insets(GetInsets());
|
| + child_area.Inset(insets);
|
| + // Labels can paint over the vertical component of the border insets.
|
| + label_area.Inset(insets.left(), 0, insets.right(), 0);
|
|
|
| gfx::Size image_size(image_->GetPreferredSize());
|
| image_size.SetToMin(child_area.size());
|
| @@ -296,8 +303,7 @@ void LabelButton::Layout() {
|
| // The label takes any remaining width after sizing the image, unless both
|
| // views are centered. In that case, using the tighter preferred label width
|
| // avoids wasted space within the label that would look like awkward padding.
|
| - // Labels can paint over the full button height, including the border height.
|
| - gfx::Size label_size(child_area.width(), height());
|
| + gfx::Size label_size(label_area.size());
|
| if (!image_size.IsEmpty() && !label_size.IsEmpty()) {
|
| label_size.set_width(std::max(child_area.width() -
|
| image_size.width() - image_label_spacing_, 0));
|
| @@ -320,7 +326,7 @@ void LabelButton::Layout() {
|
| image_origin.Offset(child_area.width() - image_size.width(), 0);
|
| }
|
|
|
| - gfx::Point label_origin(child_area.x(), 0);
|
| + gfx::Point label_origin(label_area.origin());
|
| if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) {
|
| label_origin.set_x(image_origin.x() + image_size.width() +
|
| image_label_spacing_);
|
| @@ -512,7 +518,7 @@ ui::NativeTheme::State LabelButton::GetForegroundThemeState(
|
|
|
| void LabelButton::ResetCachedPreferredSize() {
|
| cached_preferred_size_valid_ = false;
|
| - cached_preferred_size_= gfx::Size();
|
| + cached_preferred_size_ = gfx::Size();
|
| }
|
|
|
| } // namespace views
|
|
|