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

Unified Diff: ui/views/controls/button/label_button.cc

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed LocatedEvent::AsLocatedIfLocatedEvent() as FromIfValid(). Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a1c7843f59a566da97856fc697fd7f8a1800a3fc..332911b254a19bccc5cb280852f48450954ac348 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -21,6 +21,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_highlight.h"
+#include "ui/views/animation/square_ink_drop_ripple.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/painter.h"
@@ -439,27 +440,25 @@ void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
}
std::unique_ptr<views::InkDropRipple> LabelButton::CreateInkDropRipple() const {
- return GetText().empty() ? CustomButton::CreateInkDropRipple()
- : base::WrapUnique(new views::FloodFillInkDropRipple(
- GetLocalBounds(), GetInkDropCenter(),
- GetInkDropBaseColor()));
+ return GetText().empty()
+ ? CreateDefaultInkDropRipple(
+ image()->GetMirroredBounds().CenterPoint())
+ : std::unique_ptr<views::InkDropRipple>(
+ new views::FloodFillInkDropRipple(
+ GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(),
+ GetInkDropBaseColor()));
}
std::unique_ptr<views::InkDropHighlight> LabelButton::CreateInkDropHighlight()
const {
if (!ShouldShowInkDropHighlight())
return nullptr;
- return GetText().empty() ? CustomButton::CreateInkDropHighlight()
- : base::WrapUnique(new views::InkDropHighlight(
- size(), kInkDropSmallCornerRadius,
- GetInkDropCenter(), GetInkDropBaseColor()));
-}
-
-gfx::Point LabelButton::GetInkDropCenter() const {
- // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent
- // that triggered them.
- return GetText().empty() ? image()->GetMirroredBounds().CenterPoint()
- : CustomButton::GetInkDropCenter();
+ return GetText().empty()
+ ? CreateDefaultInkDropHighlight(
+ image()->GetMirroredBounds().CenterPoint())
+ : base::WrapUnique(new views::InkDropHighlight(
+ size(), kInkDropSmallCornerRadius,
+ GetLocalBounds().CenterPoint(), GetInkDropBaseColor()));
}
void LabelButton::StateChanged() {
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698