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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2396133005: [ash-md] Animates ToggleButton highlight to move it in sync with the thumb (Closed)
Patch Set: Created 4 years, 2 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
Index: ui/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index 89f320d2a50664a66dac3f9aafdfd320ef91dceb..bcb43aca11570163a6fd7a764df2e971c22edb53 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -108,6 +108,7 @@ class InkDropHostView::InkDropGestureHandler : public ui::EventHandler {
InkDropHostView::InkDropHostView()
: ink_drop_(new InkDropStub()),
+ ink_drop_layer_(nullptr),
ink_drop_size_(kInkDropSize, kInkDropSize),
ink_drop_visible_opacity_(kInkDropVisibleOpacity),
old_paint_to_layer_(false),
@@ -125,6 +126,7 @@ void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
layer()->SetFillsBoundsOpaquely(false);
layer()->Add(ink_drop_layer);
layer()->StackAtBottom(ink_drop_layer);
+ ink_drop_layer_ = ink_drop_layer;
}
void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
@@ -133,6 +135,8 @@ void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
// would be wrong.
if (destroying_)
return;
+ DCHECK_EQ(ink_drop_layer_, ink_drop_layer);
+ ink_drop_layer_ = nullptr;
layer()->Remove(ink_drop_layer);
SetPaintToLayer(old_paint_to_layer_);
}
@@ -147,6 +151,14 @@ std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight()
gfx::RectF(GetLocalBounds()).CenterPoint());
}
+void InkDropHostView::OffsetInkDropRipple(const gfx::Vector2d& offset) {
+ if (!ink_drop_layer_)
+ return;
+ gfx::Transform transform;
+ transform.Translate(offset.x(), offset.y());
+ ink_drop_layer_->SetTransform(transform);
+}
+
std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple(
const gfx::Point& center_point) const {
std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(

Powered by Google App Engine
This is Rietveld 408576698