Skip to content

Commit

Permalink
Clean-up: Remove unnecessary autoclick ring animation state.
Browse files Browse the repository at this point in the history
The autoclick ring animation was spending 0ms in the GROWING
state and then immediately entering the SHRINKING state, where
both states were exactly the same. Removes the SHRINKING state
and switches to spend the correct amount of time animating in
GROWING.

The extra state was a holdover from an earlier version of
Autoclick which did have two animation states.

This will also increase test coverage as SHRINKING was
not covered.

TEST: manual
Relnotes: N/A
Bug: 1067399
Change-Id: I2e349ee4cca8c10c7753b8b37ac8cf3ab2696fe8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134393
Reviewed-by: Anastasia Helfinstein <anastasi@google.com>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Auto-Submit: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756299}
  • Loading branch information
Katie D authored and Commit Bot committed Apr 3, 2020
1 parent 17ccd40 commit 1e4cecc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
25 changes: 2 additions & 23 deletions ash/autoclick/autoclick_ring_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ class AutoclickRingHandler::AutoclickRingView : public views::View {
SchedulePaint();
}

void UpdateWithShrinkAnimation(gfx::Animation* animation) {
current_angle_ = animation->CurrentValueBetween(
kAutoclickRingAngleStartValue, kAutoclickRingAngleEndValue);
SchedulePaint();
}

void SetSize(int radius) { radius_ = radius; }

private:
Expand Down Expand Up @@ -166,7 +160,7 @@ void AutoclickRingHandler::StartGesture(
ring_widget_ = widget;
current_animation_type_ = AnimationType::GROW_ANIMATION;
animation_duration_ = duration;
StartAnimation(base::TimeDelta());
StartAnimation(animation_duration_);
}

void AutoclickRingHandler::StopGesture() {
Expand Down Expand Up @@ -197,13 +191,6 @@ void AutoclickRingHandler::StartAnimation(base::TimeDelta delay) {
Start();
break;
}
case AnimationType::SHRINK_ANIMATION: {
view_.reset(
new AutoclickRingView(tap_down_location_, ring_widget_, radius_));
SetDuration(delay);
Start();
break;
}
case AnimationType::NONE:
NOTREACHED();
break;
Expand All @@ -226,10 +213,6 @@ void AutoclickRingHandler::AnimateToState(double state) {
view_->SetLocation(tap_down_location_);
view_->UpdateWithGrowAnimation(this);
break;
case AnimationType::SHRINK_ANIMATION:
view_->SetLocation(tap_down_location_);
view_->UpdateWithShrinkAnimation(this);
break;
case AnimationType::NONE:
NOTREACHED();
break;
Expand All @@ -239,14 +222,10 @@ void AutoclickRingHandler::AnimateToState(double state) {
void AutoclickRingHandler::AnimationStopped() {
switch (current_animation_type_) {
case AnimationType::GROW_ANIMATION:
current_animation_type_ = AnimationType::SHRINK_ANIMATION;
StartAnimation(animation_duration_);
break;
case AnimationType::SHRINK_ANIMATION:
current_animation_type_ = AnimationType::NONE;
break;
case AnimationType::NONE:
// fall through to reset the view.
// Fall through to reset the view.
view_.reset();
break;
}
Expand Down
5 changes: 2 additions & 3 deletions ash/autoclick/autoclick_ring_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace ash {

// AutoclickRingHandler displays an animated affordance that is shown
// on autoclick gesture. The animation sequence consists of two circles which
// shrink towards the spot the autoclick will generate a mouse event.
// on autoclick gesture. The animation is a semi-transparent ring which
// fills with white.
class AutoclickRingHandler : public gfx::LinearAnimation {
public:
AutoclickRingHandler();
Expand All @@ -36,7 +36,6 @@ class AutoclickRingHandler : public gfx::LinearAnimation {
enum class AnimationType {
NONE,
GROW_ANIMATION,
SHRINK_ANIMATION,
};

void StartAnimation(base::TimeDelta duration);
Expand Down

0 comments on commit 1e4cecc

Please sign in to comment.