| Index: ui/views/controls/button/md_text_button.cc
|
| diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc
|
| index c2de27edb5e766c91de149c37731d8dcc52c62aa..d7b444271e384f94c9893f0d37041bac0a2edc46 100644
|
| --- a/ui/views/controls/button/md_text_button.cc
|
| +++ b/ui/views/controls/button/md_text_button.cc
|
| @@ -54,39 +54,6 @@ const gfx::FontList& GetMdFontList() {
|
|
|
| } // namespace
|
|
|
| -namespace internal {
|
| -
|
| -class MdFocusRing : public View {
|
| - public:
|
| - MdFocusRing() {
|
| - SetPaintToLayer(true);
|
| - layer()->SetFillsBoundsOpaquely(false);
|
| - }
|
| - ~MdFocusRing() override {}
|
| -
|
| - // View:
|
| - bool CanProcessEventsWithinSubtree() const override { return false; }
|
| -
|
| - void OnPaint(gfx::Canvas* canvas) override {
|
| - SkPaint paint;
|
| - paint.setAntiAlias(true);
|
| - paint.setColor(
|
| - SkColorSetA(GetNativeTheme()->GetSystemColor(
|
| - ui::NativeTheme::kColorId_FocusedBorderColor),
|
| - 0x66));
|
| - paint.setStyle(SkPaint::kStroke_Style);
|
| - paint.setStrokeWidth(kFocusBorderThickness);
|
| - gfx::RectF rect(GetLocalBounds());
|
| - rect.Inset(gfx::InsetsF(kFocusBorderThickness / 2.f));
|
| - canvas->DrawRoundRect(rect, kFocusBorderCornerRadius, paint);
|
| - }
|
| -
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(MdFocusRing);
|
| -};
|
| -
|
| -} // namespace internal
|
| -
|
| // static
|
| LabelButton* MdTextButton::CreateStandardButton(ButtonListener* listener,
|
| const base::string16& text) {
|
| @@ -131,23 +98,6 @@ void MdTextButton::SetProminent(bool is_prominent) {
|
| UpdateColors();
|
| }
|
|
|
| -void MdTextButton::Layout() {
|
| - LabelButton::Layout();
|
| - gfx::Rect focus_bounds = GetLocalBounds();
|
| - focus_bounds.Inset(gfx::Insets(-kFocusBorderThickness));
|
| - focus_ring_->SetBoundsRect(focus_bounds);
|
| -}
|
| -
|
| -void MdTextButton::OnFocus() {
|
| - LabelButton::OnFocus();
|
| - focus_ring_->SetVisible(true);
|
| -}
|
| -
|
| -void MdTextButton::OnBlur() {
|
| - LabelButton::OnBlur();
|
| - focus_ring_->SetVisible(false);
|
| -}
|
| -
|
| void MdTextButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
|
| LabelButton::OnNativeThemeChanged(theme);
|
| UpdateColors();
|
| @@ -195,7 +145,7 @@ std::unique_ptr<views::InkDropHighlight> MdTextButton::CreateInkDropHighlight()
|
| }
|
|
|
| bool MdTextButton::ShouldShowInkDropForFocus() const {
|
| - // These types of button use |focus_ring_|.
|
| + // These types of button use an MdFocusRing.
|
| return false;
|
| }
|
|
|
| @@ -226,7 +176,6 @@ void MdTextButton::SetFontList(const gfx::FontList& font_list) {
|
|
|
| MdTextButton::MdTextButton(ButtonListener* listener)
|
| : LabelButton(listener, base::string16()),
|
| - focus_ring_(new internal::MdFocusRing()),
|
| is_prominent_(false) {
|
| SetInkDropMode(PlatformStyle::kUseRipples ? InkDropMode::ON
|
| : InkDropMode::OFF);
|
| @@ -236,8 +185,7 @@ MdTextButton::MdTextButton(ButtonListener* listener)
|
| SetMinSize(gfx::Size(kMinWidth, 0));
|
| SetFocusPainter(nullptr);
|
| label()->SetAutoColorReadabilityEnabled(false);
|
| - AddChildView(focus_ring_);
|
| - focus_ring_->SetVisible(false);
|
| + set_should_use_md_focus_ring(true);
|
| set_request_focus_on_press(false);
|
| LabelButton::SetFontList(GetMdFontList());
|
|
|
|
|