| 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" |
| 11 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
| 12 #include "ui/compositor/layer_animation_sequence.h" | 12 #include "ui/compositor/layer_animation_sequence.h" |
| 13 #include "ui/compositor/scoped_layer_animation_settings.h" | 13 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 14 #include "ui/gfx/animation/animation.h" | |
| 15 #include "ui/gfx/geometry/point_conversions.h" | 14 #include "ui/gfx/geometry/point_conversions.h" |
| 16 #include "ui/gfx/geometry/vector2d_f.h" | 15 #include "ui/gfx/geometry/vector2d_f.h" |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 // The minimum radius to use when scaling the painted layers. Smaller values | 19 // The minimum radius to use when scaling the painted layers. Smaller values |
| 21 // were causing visual anomalies. | 20 // were causing visual anomalies. |
| 22 const float kMinRadius = 1.f; | 21 const float kMinRadius = 1.f; |
| 23 | 22 |
| 24 // All the sub animations that are used to animate each of the InkDropStates. | 23 // All the sub animations that are used to animate each of the InkDropStates. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 300, // ACTION_TRIGGERED_FADE_OUT | 88 300, // ACTION_TRIGGERED_FADE_OUT |
| 90 200, // ALTERNATE_ACTION_PENDING | 89 200, // ALTERNATE_ACTION_PENDING |
| 91 300, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT | 90 300, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT |
| 92 150, // ACTIVATED_FADE_IN | 91 150, // ACTIVATED_FADE_IN |
| 93 200, // ACTIVATED_TRANSFORM | 92 200, // ACTIVATED_TRANSFORM |
| 94 300, // DEACTIVATED_FADE_OUT | 93 300, // DEACTIVATED_FADE_OUT |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 // Returns the InkDropState sub animation duration for the given |state|. | 96 // Returns the InkDropState sub animation duration for the given |state|. |
| 98 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { | 97 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { |
| 99 // Ink drop animations are controlled by the system animation settings for | |
| 100 // accessibility reasons."See https://crbug.com/658384. | |
| 101 if (!gfx::Animation::ShouldRenderRichAnimation()) | |
| 102 return base::TimeDelta(); | |
| 103 return base::TimeDelta::FromMilliseconds( | 98 return base::TimeDelta::FromMilliseconds( |
| 104 (views::InkDropRipple::UseFastAnimations() | 99 (views::InkDropRipple::UseFastAnimations() |
| 105 ? 1 | 100 ? 1 |
| 106 : views::InkDropRipple::kSlowAnimationDurationFactor) * | 101 : views::InkDropRipple::kSlowAnimationDurationFactor) * |
| 107 kAnimationDurationInMs[state]); | 102 kAnimationDurationInMs[state]); |
| 108 } | 103 } |
| 109 | 104 |
| 110 } // namespace | 105 } // namespace |
| 111 | 106 |
| 112 namespace views { | 107 namespace views { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 (bounds.bottom_right() - point).Length(); | 329 (bounds.bottom_right() - point).Length(); |
| 335 | 330 |
| 336 float largest_distance = | 331 float largest_distance = |
| 337 std::max(distance_to_top_left, distance_to_top_right); | 332 std::max(distance_to_top_left, distance_to_top_right); |
| 338 largest_distance = std::max(largest_distance, distance_to_bottom_left); | 333 largest_distance = std::max(largest_distance, distance_to_bottom_left); |
| 339 largest_distance = std::max(largest_distance, distance_to_bottom_right); | 334 largest_distance = std::max(largest_distance, distance_to_bottom_right); |
| 340 return largest_distance; | 335 return largest_distance; |
| 341 } | 336 } |
| 342 | 337 |
| 343 } // namespace views | 338 } // namespace views |
| OLD | NEW |