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

Unified Diff: cc/test/animation_test_common.cc

Issue 2251933002: Fix smooth scroll animation flake on janky pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix UpdateTarget while animation is not started Created 4 years, 4 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
Index: cc/test/animation_test_common.cc
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 7ab2497e598abee7ecff5a1902354bd4f3cc0fe4..da3487bfd20a7fd1b96738d9294d97b395b53490 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -10,6 +10,7 @@
#include "cc/animation/animation_player.h"
#include "cc/animation/element_animations.h"
#include "cc/animation/keyframed_animation_curve.h"
+#include "cc/animation/scroll_offset_animation_curve.h"
#include "cc/animation/timing_function.h"
#include "cc/animation/transform_operations.h"
#include "cc/base/time_util.h"
@@ -216,6 +217,28 @@ std::unique_ptr<AnimationCurve> FakeFloatTransition::Clone() const {
return base::WrapUnique(new FakeFloatTransition(*this));
}
+int AddScrollOffsetAnimationToElementAnimations(ElementAnimations* target,
+ gfx::ScrollOffset initial_value,
+ gfx::ScrollOffset target_value,
+ bool impl_only) {
+ std::unique_ptr<ScrollOffsetAnimationCurve> curve(
+ ScrollOffsetAnimationCurve::Create(
+ target_value, CubicBezierTimingFunction::CreatePreset(
+ CubicBezierTimingFunction::EaseType::EASE_IN_OUT)));
+ curve->SetInitialValue(initial_value);
+
+ int id = AnimationIdProvider::NextAnimationId();
+
+ std::unique_ptr<Animation> animation(Animation::Create(
+ std::move(curve), id, AnimationIdProvider::NextGroupId(),
+ TargetProperty::SCROLL_OFFSET));
+ animation->set_is_impl_only(impl_only);
+
+ target->AddAnimation(std::move(animation));
+
+ return id;
+}
+
int AddOpacityTransitionToElementAnimations(ElementAnimations* target,
double duration,
float start_opacity,

Powered by Google App Engine
This is Rietveld 408576698