| 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/square_ink_drop_ripple.h" | 5 #include "ui/views/animation/square_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 "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| 11 #include "ui/compositor/layer_animation_sequence.h" | 11 #include "ui/compositor/layer_animation_sequence.h" |
| 12 #include "ui/compositor/scoped_layer_animation_settings.h" | 12 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 13 #include "ui/gfx/animation/animation.h" | |
| 14 #include "ui/gfx/geometry/point3_f.h" | 13 #include "ui/gfx/geometry/point3_f.h" |
| 15 #include "ui/gfx/geometry/point_conversions.h" | 14 #include "ui/gfx/geometry/point_conversions.h" |
| 16 #include "ui/gfx/geometry/point_f.h" | 15 #include "ui/gfx/geometry/point_f.h" |
| 17 #include "ui/gfx/geometry/vector3d_f.h" | 16 #include "ui/gfx/geometry/vector3d_f.h" |
| 18 #include "ui/gfx/transform_util.h" | 17 #include "ui/gfx/transform_util.h" |
| 19 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" | 18 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" |
| 20 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 150, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT | 119 150, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT |
| 121 200, // ALTERNATE_ACTION_TRIGGERED_TRANSFORM | 120 200, // ALTERNATE_ACTION_TRIGGERED_TRANSFORM |
| 122 200, // ACTIVATED_CIRCLE_TRANSFORM | 121 200, // ACTIVATED_CIRCLE_TRANSFORM |
| 123 160, // ACTIVATED_RECT_TRANSFORM | 122 160, // ACTIVATED_RECT_TRANSFORM |
| 124 150, // DEACTIVATED_FADE_OUT | 123 150, // DEACTIVATED_FADE_OUT |
| 125 200, // DEACTIVATED_TRANSFORM | 124 200, // DEACTIVATED_TRANSFORM |
| 126 }; | 125 }; |
| 127 | 126 |
| 128 // Returns the InkDropState sub animation duration for the given |state|. | 127 // Returns the InkDropState sub animation duration for the given |state|. |
| 129 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { | 128 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { |
| 130 // Ink drop animations are controlled by the system animation settings for | |
| 131 // accessibility reasons."See https://crbug.com/658384. | |
| 132 if (!gfx::Animation::ShouldRenderRichAnimation()) | |
| 133 return base::TimeDelta(); | |
| 134 return base::TimeDelta::FromMilliseconds( | 129 return base::TimeDelta::FromMilliseconds( |
| 135 (views::InkDropRipple::UseFastAnimations() | 130 (views::InkDropRipple::UseFastAnimations() |
| 136 ? 1 | 131 ? 1 |
| 137 : views::InkDropRipple::kSlowAnimationDurationFactor) * | 132 : views::InkDropRipple::kSlowAnimationDurationFactor) * |
| 138 kAnimationDurationInMs[state]); | 133 kAnimationDurationInMs[state]); |
| 139 } | 134 } |
| 140 | 135 |
| 141 // Calculates a Transform for a circle layer. The transform will be set up to | 136 // Calculates a Transform for a circle layer. The transform will be set up to |
| 142 // translate by -|center_offset|, scale, and then translate to the target point | 137 // translate by -|center_offset|, scale, and then translate to the target point |
| 143 // defined by |target_center_x| and |target_center_y|. | 138 // defined by |target_center_x| and |target_center_y|. |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 layer->set_delegate(delegate); | 639 layer->set_delegate(delegate); |
| 645 layer->SetVisible(true); | 640 layer->SetVisible(true); |
| 646 layer->SetOpacity(1.0); | 641 layer->SetOpacity(1.0); |
| 647 layer->SetMasksToBounds(false); | 642 layer->SetMasksToBounds(false); |
| 648 layer->set_name("PAINTED_SHAPE_COUNT:" + ToLayerName(painted_shape)); | 643 layer->set_name("PAINTED_SHAPE_COUNT:" + ToLayerName(painted_shape)); |
| 649 | 644 |
| 650 painted_layers_[painted_shape].reset(layer); | 645 painted_layers_[painted_shape].reset(layer); |
| 651 } | 646 } |
| 652 | 647 |
| 653 } // namespace views | 648 } // namespace views |
| OLD | NEW |