Commit 1278dfb9 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: make TabCloseButton a square

Without any stored images, TabCloseButton falls back to the default sizing for
ImageButton, which is 16x14. This change makes it always a square, which makes
the focus ring and ink drop circles instead of ovals.

Bug: 873063
Change-Id: I5c2deec54f768d64be14ee0f9c0adcb52a8d754e
Reviewed-on: https://chromium-review.googlesource.com/1172506Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582903}
parent 5202b90d
......@@ -119,6 +119,14 @@ void TabCloseButton::Layout() {
}
}
gfx::Size TabCloseButton::CalculatePreferredSize() const {
int width = GetWidth();
gfx::Size size(width, width);
gfx::Insets insets = GetInsets();
size.Enlarge(insets.width(), insets.height());
return size;
}
void TabCloseButton::PaintButtonContents(gfx::Canvas* canvas) {
canvas->SaveLayerAlpha(GetOpacity());
ButtonState button_state = state();
......
......@@ -49,6 +49,7 @@ class TabCloseButton : public views::ImageButton,
void OnGestureEvent(ui::GestureEvent* event) override;
const char* GetClassName() const override;
void Layout() override;
gfx::Size CalculatePreferredSize() const override;
protected:
void PaintButtonContents(gfx::Canvas* canvas) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment