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

Unified Diff: ui/compositor/test/layer_animator_test_controller.cc

Issue 12226080: Thread ui transform animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@DefineThreadedLayerAnimationElements
Patch Set: Speed up animations in WebContentsViewAuraTest.QuickOverscrollDirectionChange Created 7 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/layer_animator_test_controller.cc
diff --git a/ui/compositor/test/layer_animator_test_controller.cc b/ui/compositor/test/layer_animator_test_controller.cc
index 5721cceae8cbe8884c9cc47f6c1691c6d1b06042..3b131acba4c54fbd9d439ed1e2b1f7e8daf4763d 100644
--- a/ui/compositor/test/layer_animator_test_controller.cc
+++ b/ui/compositor/test/layer_animator_test_controller.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "cc/animation.h"
#include "ui/compositor/test/layer_animator_test_controller.h"
#include "ui/compositor/layer_animation_sequence.h"
@@ -26,27 +27,33 @@ LayerAnimationSequence* LayerAnimatorTestController::GetRunningSequence(
}
void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
- LayerAnimationSequence* sequence =
- GetRunningSequence(LayerAnimationElement::OPACITY);
-
- if (!sequence)
- return;
-
- LayerAnimationElement* element = sequence->CurrentElement();
- if (element->properties().find(LayerAnimationElement::OPACITY) ==
- element->properties().end())
- return;
-
- if (!element->Started() ||
- element->effective_start_time() != base::TimeTicks())
- return;
-
- animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
- cc::AnimationEvent::Started,
- 0,
- element->animation_group_id(),
- cc::Animation::Opacity,
- (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
+ std::vector<cc::Animation::TargetProperty> threaded_properties;
+ threaded_properties.push_back(cc::Animation::Opacity);
+ threaded_properties.push_back(cc::Animation::Transform);
+
+ for (size_t i = 0; i < threaded_properties.size(); i++) {
+ LayerAnimationElement::AnimatableProperty animatable_property =
+ LayerAnimationElement::ToAnimatableProperty(threaded_properties[i]);
+ LayerAnimationSequence* sequence = GetRunningSequence(animatable_property);
+ if (!sequence)
+ continue;
+
+ LayerAnimationElement* element = sequence->CurrentElement();
+ if (element->properties().find(animatable_property) ==
+ element->properties().end())
+ continue;
+
+ if (!element->Started() ||
+ element->effective_start_time() != base::TimeTicks())
+ continue;
+
+ animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::Started,
+ 0,
+ element->animation_group_id(),
+ threaded_properties[i],
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
+ }
}
} // namespace ui
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698