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

Unified Diff: cc/animation/scroll_offset_animations_impl.cc

Issue 1950243005: Communicate MT changes to impl-only scroll offset animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: attempt to fix rebase issue Created 4 years, 7 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 | « cc/animation/scroll_offset_animations_impl.h ('k') | cc/cc.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/scroll_offset_animations_impl.cc
diff --git a/cc/animation/scroll_offset_animations_impl.cc b/cc/animation/scroll_offset_animations_impl.cc
index ba7d1801d29f914bf41f8ae0604c5f8cd400de2f..91cb0ab11e27151036e6f8e68b67068419bfbbbe 100644
--- a/cc/animation/scroll_offset_animations_impl.cc
+++ b/cc/animation/scroll_offset_animations_impl.cc
@@ -92,6 +92,42 @@ bool ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget(
return true;
}
+void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment(
+ ElementId element_id,
+ const gfx::Vector2dF& adjustment) {
+ DCHECK(scroll_offset_animation_player_);
+ if (element_id != scroll_offset_animation_player_->element_id())
+ return;
+
+ if (!scroll_offset_animation_player_->element_animations())
+ return;
+
+ Animation* animation =
+ scroll_offset_animation_player_->element_animations()->GetAnimation(
+ TargetProperty::SCROLL_OFFSET);
+ if (!animation)
+ return;
+
+ std::unique_ptr<ScrollOffsetAnimationCurve> new_curve =
+ animation->curve()
+ ->ToScrollOffsetAnimationCurve()
+ ->CloneToScrollOffsetAnimationCurve();
+ new_curve->ApplyAdjustment(adjustment);
+
+ std::unique_ptr<Animation> new_animation = Animation::Create(
+ std::move(new_curve), AnimationIdProvider::NextAnimationId(),
+ AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET);
+ new_animation->set_start_time(animation->start_time());
+ new_animation->set_is_impl_only(true);
+ new_animation->set_affects_active_elements(false);
+
+ // Abort the old animation.
+ ScrollAnimationAbort(/* needs_completion */ false);
+
+ // Start a new one with the adjusment.
+ scroll_offset_animation_player_->AddAnimation(std::move(new_animation));
+}
+
void ScrollOffsetAnimationsImpl::ScrollAnimationAbort(bool needs_completion) {
DCHECK(scroll_offset_animation_player_);
scroll_offset_animation_player_->AbortAnimations(
« no previous file with comments | « cc/animation/scroll_offset_animations_impl.h ('k') | cc/cc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698