Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/animation/flood_fill_ink_drop_ripple.h" | 5 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 AnimateToOpacity(kHiddenOpacity, GetAnimationDuration(HIDDEN_FADE_OUT), | 202 AnimateToOpacity(kHiddenOpacity, GetAnimationDuration(HIDDEN_FADE_OUT), |
| 203 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 203 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 204 gfx::Tween::EASE_IN_OUT, animation_observer); | 204 gfx::Tween::EASE_IN_OUT, animation_observer); |
| 205 const gfx::Transform transform = CalculateTransform(kMinRadius); | 205 const gfx::Transform transform = CalculateTransform(kMinRadius); |
| 206 AnimateToTransform(transform, GetAnimationDuration(HIDDEN_TRANSFORM), | 206 AnimateToTransform(transform, GetAnimationDuration(HIDDEN_TRANSFORM), |
| 207 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 207 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 208 gfx::Tween::EASE_IN_OUT, animation_observer); | 208 gfx::Tween::EASE_IN_OUT, animation_observer); |
| 209 } | 209 } |
| 210 break; | 210 break; |
| 211 case InkDropState::ACTION_PENDING: { | 211 case InkDropState::ACTION_PENDING: { |
| 212 DCHECK(old_ink_drop_state == InkDropState::HIDDEN); | 212 DCHECK_EQ(InkDropState::HIDDEN, old_ink_drop_state) |
| 213 << " old_ink_drop_state=" << ToString(old_ink_drop_state); | |
|
msw
2017/01/18 23:37:08
q: won't DCHECK_EQ already print the actual value
bruthig
2017/01/18 23:53:17
You're right it will print the int values. e.g. "
| |
| 213 | 214 |
| 214 AnimateToOpacity(visible_opacity_, | 215 AnimateToOpacity(visible_opacity_, |
| 215 GetAnimationDuration(ACTION_PENDING_FADE_IN), | 216 GetAnimationDuration(ACTION_PENDING_FADE_IN), |
| 216 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 217 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 217 gfx::Tween::EASE_IN, animation_observer); | 218 gfx::Tween::EASE_IN, animation_observer); |
| 218 PauseOpacityAnimation(GetAnimationDuration(ACTION_PENDING_TRANSFORM) - | 219 PauseOpacityAnimation(GetAnimationDuration(ACTION_PENDING_TRANSFORM) - |
| 219 GetAnimationDuration(ACTION_PENDING_FADE_IN), | 220 GetAnimationDuration(ACTION_PENDING_FADE_IN), |
| 220 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, | 221 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, |
| 221 animation_observer); | 222 animation_observer); |
| 222 | 223 |
| 223 AnimateToTransform(GetMaxSizeTargetTransform(), | 224 AnimateToTransform(GetMaxSizeTargetTransform(), |
| 224 GetAnimationDuration(ACTION_PENDING_TRANSFORM), | 225 GetAnimationDuration(ACTION_PENDING_TRANSFORM), |
| 225 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 226 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 226 gfx::Tween::FAST_OUT_SLOW_IN, animation_observer); | 227 gfx::Tween::FAST_OUT_SLOW_IN, animation_observer); |
| 227 break; | 228 break; |
| 228 } | 229 } |
| 229 case InkDropState::ACTION_TRIGGERED: { | 230 case InkDropState::ACTION_TRIGGERED: { |
| 230 DCHECK(old_ink_drop_state == InkDropState::HIDDEN || | 231 DCHECK(old_ink_drop_state == InkDropState::HIDDEN || |
| 231 old_ink_drop_state == InkDropState::ACTION_PENDING); | 232 old_ink_drop_state == InkDropState::ACTION_PENDING) |
| 233 << " old_ink_drop_state=" << ToString(old_ink_drop_state); | |
|
msw
2017/01/18 23:37:08
(this one is ok, since it's not a DCHECK_EQ)
| |
| 232 if (old_ink_drop_state == InkDropState::HIDDEN) { | 234 if (old_ink_drop_state == InkDropState::HIDDEN) { |
| 233 AnimateStateChange(old_ink_drop_state, InkDropState::ACTION_PENDING, | 235 AnimateStateChange(old_ink_drop_state, InkDropState::ACTION_PENDING, |
| 234 animation_observer); | 236 animation_observer); |
| 235 } | 237 } |
| 236 AnimateToOpacity(kHiddenOpacity, | 238 AnimateToOpacity(kHiddenOpacity, |
| 237 GetAnimationDuration(ACTION_TRIGGERED_FADE_OUT), | 239 GetAnimationDuration(ACTION_TRIGGERED_FADE_OUT), |
| 238 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, | 240 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, |
| 239 gfx::Tween::EASE_IN_OUT, animation_observer); | 241 gfx::Tween::EASE_IN_OUT, animation_observer); |
| 240 break; | 242 break; |
| 241 } | 243 } |
| 242 case InkDropState::ALTERNATE_ACTION_PENDING: { | 244 case InkDropState::ALTERNATE_ACTION_PENDING: { |
| 243 DCHECK(old_ink_drop_state == InkDropState::ACTION_PENDING); | 245 DCHECK_EQ(InkDropState::ACTION_PENDING, old_ink_drop_state) |
| 246 << " old_ink_drop_state=" << ToString(old_ink_drop_state); | |
| 244 AnimateToOpacity(visible_opacity_, | 247 AnimateToOpacity(visible_opacity_, |
| 245 GetAnimationDuration(ALTERNATE_ACTION_PENDING), | 248 GetAnimationDuration(ALTERNATE_ACTION_PENDING), |
| 246 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 249 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 247 gfx::Tween::EASE_IN, animation_observer); | 250 gfx::Tween::EASE_IN, animation_observer); |
| 248 AnimateToTransform(GetMaxSizeTargetTransform(), | 251 AnimateToTransform(GetMaxSizeTargetTransform(), |
| 249 GetAnimationDuration(ALTERNATE_ACTION_PENDING), | 252 GetAnimationDuration(ALTERNATE_ACTION_PENDING), |
| 250 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, | 253 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET, |
| 251 gfx::Tween::EASE_IN_OUT, animation_observer); | 254 gfx::Tween::EASE_IN_OUT, animation_observer); |
| 252 break; | 255 break; |
| 253 } | 256 } |
| 254 case InkDropState::ALTERNATE_ACTION_TRIGGERED: | 257 case InkDropState::ALTERNATE_ACTION_TRIGGERED: |
| 255 DCHECK(old_ink_drop_state == InkDropState::ALTERNATE_ACTION_PENDING); | 258 DCHECK_EQ(InkDropState::ALTERNATE_ACTION_PENDING, old_ink_drop_state) |
| 259 << " old_ink_drop_state=" << ToString(old_ink_drop_state); | |
| 256 AnimateToOpacity(kHiddenOpacity, GetAnimationDuration( | 260 AnimateToOpacity(kHiddenOpacity, GetAnimationDuration( |
| 257 ALTERNATE_ACTION_TRIGGERED_FADE_OUT), | 261 ALTERNATE_ACTION_TRIGGERED_FADE_OUT), |
| 258 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, | 262 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION, |
| 259 gfx::Tween::EASE_IN_OUT, animation_observer); | 263 gfx::Tween::EASE_IN_OUT, animation_observer); |
| 260 break; | 264 break; |
| 261 case InkDropState::ACTIVATED: { | 265 case InkDropState::ACTIVATED: { |
| 262 if (old_ink_drop_state == InkDropState::ACTION_PENDING) { | 266 if (old_ink_drop_state == InkDropState::ACTION_PENDING) { |
| 263 // The final state of pending animation is the same as the final state | 267 // The final state of pending animation is the same as the final state |
| 264 // of activated animation. We only need to enqueue a zero-length pause | 268 // of activated animation. We only need to enqueue a zero-length pause |
| 265 // so that animation observers are notified in order. | 269 // so that animation observers are notified in order. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 (bounds.bottom_right() - point).Length(); | 427 (bounds.bottom_right() - point).Length(); |
| 424 | 428 |
| 425 float largest_distance = | 429 float largest_distance = |
| 426 std::max(distance_to_top_left, distance_to_top_right); | 430 std::max(distance_to_top_left, distance_to_top_right); |
| 427 largest_distance = std::max(largest_distance, distance_to_bottom_left); | 431 largest_distance = std::max(largest_distance, distance_to_bottom_left); |
| 428 largest_distance = std::max(largest_distance, distance_to_bottom_right); | 432 largest_distance = std::max(largest_distance, distance_to_bottom_right); |
| 429 return largest_distance; | 433 return largest_distance; |
| 430 } | 434 } |
| 431 | 435 |
| 432 } // namespace views | 436 } // namespace views |
| OLD | NEW |