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

Side by Side Diff: cc/animation/scroll_offset_animations_impl.cc

Issue 1950613004: Fix bounds clamping during composited smooth scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test 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 unified diff | Download patch
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.cc ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/animation/scroll_offset_animations_impl.h" 5 #include "cc/animation/scroll_offset_animations_impl.h"
6 6
7 #include "cc/animation/animation_events.h" 7 #include "cc/animation/animation_events.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 DCHECK_EQ(element_id, scroll_offset_animation_player_->element_id()); 68 DCHECK_EQ(element_id, scroll_offset_animation_player_->element_id());
69 69
70 Animation* animation = 70 Animation* animation =
71 scroll_offset_animation_player_->element_animations()->GetAnimation( 71 scroll_offset_animation_player_->element_animations()->GetAnimation(
72 TargetProperty::SCROLL_OFFSET); 72 TargetProperty::SCROLL_OFFSET);
73 if (!animation) { 73 if (!animation) {
74 scroll_offset_animation_player_->DetachElement(); 74 scroll_offset_animation_player_->DetachElement();
75 return false; 75 return false;
76 } 76 }
77 if (scroll_delta.IsZero())
78 return true;
77 79
78 ScrollOffsetAnimationCurve* curve = 80 ScrollOffsetAnimationCurve* curve =
79 animation->curve()->ToScrollOffsetAnimationCurve(); 81 animation->curve()->ToScrollOffsetAnimationCurve();
80 82
81 gfx::ScrollOffset new_target = 83 gfx::ScrollOffset new_target =
82 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); 84 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta);
83 new_target.SetToMax(gfx::ScrollOffset()); 85 new_target.SetToMax(gfx::ScrollOffset());
84 new_target.SetToMin(max_scroll_offset); 86 new_target.SetToMin(max_scroll_offset);
85 87
86 curve->UpdateTarget( 88 curve->UpdateTarget(
(...skipping 22 matching lines...) Expand all
109 ElementId element_id) { 111 ElementId element_id) {
110 if (scroll_offset_animation_player_->element_id() != element_id) { 112 if (scroll_offset_animation_player_->element_id() != element_id) {
111 if (scroll_offset_animation_player_->element_id()) 113 if (scroll_offset_animation_player_->element_id())
112 scroll_offset_animation_player_->DetachElement(); 114 scroll_offset_animation_player_->DetachElement();
113 if (element_id) 115 if (element_id)
114 scroll_offset_animation_player_->AttachElement(element_id); 116 scroll_offset_animation_player_->AttachElement(element_id);
115 } 117 }
116 } 118 }
117 119
118 } // namespace cc 120 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.cc ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698