Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 2094343005: Fix MD button hover shadow effect on odd-sized buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), 446 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(),
447 GetInkDropBaseColor(), ink_drop_visible_opacity())); 447 GetInkDropBaseColor(), ink_drop_visible_opacity()));
448 } 448 }
449 449
450 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight() 450 std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight()
451 const { 451 const {
452 if (!ShouldShowInkDropHighlight()) 452 if (!ShouldShowInkDropHighlight())
453 return nullptr; 453 return nullptr;
454 return GetText().empty() 454 return GetText().empty()
455 ? CreateDefaultInkDropHighlight( 455 ? CreateDefaultInkDropHighlight(
456 image()->GetMirroredBounds().CenterPoint()) 456 gfx::RectF(image()->GetMirroredBounds()).CenterPoint())
457 : base::WrapUnique(new views::InkDropHighlight( 457 : base::WrapUnique(new views::InkDropHighlight(
458 size(), kInkDropSmallCornerRadius, 458 size(), kInkDropSmallCornerRadius,
459 GetLocalBounds().CenterPoint(), GetInkDropBaseColor())); 459 gfx::RectF(GetLocalBounds()).CenterPoint(),
460 GetInkDropBaseColor()));
460 } 461 }
461 462
462 void LabelButton::StateChanged() { 463 void LabelButton::StateChanged() {
463 const gfx::Size previous_image_size(image_->GetPreferredSize()); 464 const gfx::Size previous_image_size(image_->GetPreferredSize());
464 UpdateImage(); 465 UpdateImage();
465 ResetLabelEnabledColor(); 466 ResetLabelEnabledColor();
466 label_->SetEnabled(state() != STATE_DISABLED); 467 label_->SetEnabled(state() != STATE_DISABLED);
467 if (image_->GetPreferredSize() != previous_image_size) 468 if (image_->GetPreferredSize() != previous_image_size)
468 Layout(); 469 Layout();
469 } 470 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 void LabelButton::ResetLabelEnabledColor() { 588 void LabelButton::ResetLabelEnabledColor() {
588 const SkColor color = 589 const SkColor color =
589 explicitly_set_colors_[state()] 590 explicitly_set_colors_[state()]
590 ? button_state_colors_[state()] 591 ? button_state_colors_[state()]
591 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 592 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
592 if (state() != STATE_DISABLED && label_->enabled_color() != color) 593 if (state() != STATE_DISABLED && label_->enabled_color() != color)
593 label_->SetEnabledColor(color); 594 label_->SetEnabledColor(color);
594 } 595 }
595 596
596 } // namespace views 597 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698