Commit ff82906e authored by Katie D's avatar Katie D Committed by Commit Bot

Fix ink drop size on larger Autoclick menu buttons.

The ink drop was the default tray buttons size instead of the
larger size of the menu button. Updates the ink drop calculation
to ensure the size is set properly, fixing the ink drop's
appearance on the switch position menu button.

Bug: 966151
Change-Id: I4e65932dc9b2e90e81746454e084feaac1148956
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626014Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662731}
parent d0413080
......@@ -19,6 +19,7 @@
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/separator.h"
......@@ -59,6 +60,13 @@ class AutoclickMenuButton : public TopShortcutButton {
// views::Button:
const char* GetClassName() const override { return "AutoclickMenuButton"; }
// views::ImageButton:
std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override {
gfx::Rect bounds = GetContentsBounds();
return std::make_unique<views::CircleInkDropMask>(
size(), bounds.CenterPoint(), bounds.width() / 2);
}
// Set the vector icon shown in a circle.
void SetVectorIcon(const gfx::VectorIcon& icon) {
icon_ = &icon;
......@@ -87,6 +95,10 @@ class AutoclickMenuButton : public TopShortcutButton {
views::ImageButton::PaintButtonContents(canvas);
}
gfx::Size CalculatePreferredSize() const override {
return gfx::Size(size_, size_);
}
void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
if (!GetEnabled())
return;
......
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