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

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

Issue 1761443003: [MD] simplify and unify some ink drop center calculations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: works in rtl Created 4 years, 10 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') | no next file » | 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 f192e1282b258644d0a913accb63245831b2b5e4..0f1bd6239ff4c95896c7ee75de85f4e9567d8ef5 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -420,8 +420,6 @@ void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
scoped_ptr<views::InkDropAnimation> LabelButton::CreateInkDropAnimation()
const {
- // TODO(bruthig): Make the flood fill ink drops centered on the LocatedEvent
- // that triggered them.
return GetText().empty()
? CustomButton::CreateInkDropAnimation()
: make_scoped_ptr(new views::FloodFillInkDropAnimation(
@@ -437,6 +435,13 @@ scoped_ptr<views::InkDropHover> LabelButton::CreateInkDropHover() const {
size(), 0, 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()
sky 2016/03/03 23:37:16 It's worth a comment as to why this uses GetMirror
Evan Stade 2016/03/04 04:07:52 What comment content would you suggest? I sorta th
sky 2016/03/04 16:37:29 Ya, ok, fair enough.
varkha 2016/03/04 17:40:26 What GetMirroredBounds does is indeed obvious here
varkha 2016/03/04 19:39:21 Exactly, I would suggest something like: "Some but
+ : CustomButton::GetInkDropCenter();
+}
+
void LabelButton::StateChanged() {
const gfx::Size previous_image_size(image_->GetPreferredSize());
UpdateImage();
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698