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

Side by Side Diff: ui/views/animation/square_ink_drop_ripple.cc

Issue 2520353004: Disabled ink drop animations based on gfx::Animation::ShouldRenderRichAnimation(). (Closed)
Patch Set: Updated comment wording. Created 4 years 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 unified diff | Download patch
« no previous file with comments | « ui/views/animation/ink_drop_highlight.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 #include "ui/gfx/geometry/point3_f.h" 14 #include "ui/gfx/geometry/point3_f.h"
14 #include "ui/gfx/geometry/point_conversions.h" 15 #include "ui/gfx/geometry/point_conversions.h"
15 #include "ui/gfx/geometry/point_f.h" 16 #include "ui/gfx/geometry/point_f.h"
16 #include "ui/gfx/geometry/vector3d_f.h" 17 #include "ui/gfx/geometry/vector3d_f.h"
17 #include "ui/gfx/transform_util.h" 18 #include "ui/gfx/transform_util.h"
18 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" 19 #include "ui/views/animation/ink_drop_painted_layer_delegates.h"
19 #include "ui/views/view.h" 20 #include "ui/views/view.h"
20 21
21 namespace { 22 namespace {
22 23
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 150, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT 120 150, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT
120 200, // ALTERNATE_ACTION_TRIGGERED_TRANSFORM 121 200, // ALTERNATE_ACTION_TRIGGERED_TRANSFORM
121 200, // ACTIVATED_CIRCLE_TRANSFORM 122 200, // ACTIVATED_CIRCLE_TRANSFORM
122 160, // ACTIVATED_RECT_TRANSFORM 123 160, // ACTIVATED_RECT_TRANSFORM
123 150, // DEACTIVATED_FADE_OUT 124 150, // DEACTIVATED_FADE_OUT
124 200, // DEACTIVATED_TRANSFORM 125 200, // DEACTIVATED_TRANSFORM
125 }; 126 };
126 127
127 // Returns the InkDropState sub animation duration for the given |state|. 128 // Returns the InkDropState sub animation duration for the given |state|.
128 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { 129 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();
129 return base::TimeDelta::FromMilliseconds( 134 return base::TimeDelta::FromMilliseconds(
130 (views::InkDropRipple::UseFastAnimations() 135 (views::InkDropRipple::UseFastAnimations()
131 ? 1 136 ? 1
132 : views::InkDropRipple::kSlowAnimationDurationFactor) * 137 : views::InkDropRipple::kSlowAnimationDurationFactor) *
133 kAnimationDurationInMs[state]); 138 kAnimationDurationInMs[state]);
134 } 139 }
135 140
136 // Calculates a Transform for a circle layer. The transform will be set up to 141 // Calculates a Transform for a circle layer. The transform will be set up to
137 // translate by -|center_offset|, scale, and then translate to the target point 142 // translate by -|center_offset|, scale, and then translate to the target point
138 // defined by |target_center_x| and |target_center_y|. 143 // defined by |target_center_x| and |target_center_y|.
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 layer->set_delegate(delegate); 644 layer->set_delegate(delegate);
640 layer->SetVisible(true); 645 layer->SetVisible(true);
641 layer->SetOpacity(1.0); 646 layer->SetOpacity(1.0);
642 layer->SetMasksToBounds(false); 647 layer->SetMasksToBounds(false);
643 layer->set_name("PAINTED_SHAPE_COUNT:" + ToLayerName(painted_shape)); 648 layer->set_name("PAINTED_SHAPE_COUNT:" + ToLayerName(painted_shape));
644 649
645 painted_layers_[painted_shape].reset(layer); 650 painted_layers_[painted_shape].reset(layer);
646 } 651 }
647 652
648 } // namespace views 653 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_highlight.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698