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

Unified Diff: cc/layers/layer_impl.cc

Issue 95763002: cc: Support animating scroll offset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index f8882291dd32f9a0b1e6451b0d23485091f77786..48958ee6c527814ba2b0cf65172a238b0d288843 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -74,13 +74,17 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
layer_animation_controller_ =
registrar->GetAnimationControllerForId(layer_id_);
layer_animation_controller_->AddValueObserver(this);
+ if (IsActive())
+ layer_animation_controller_->set_value_provider(this);
}
LayerImpl::~LayerImpl() {
DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
- layer_tree_impl_->UnregisterLayer(this);
layer_animation_controller_->RemoveValueObserver(this);
+ layer_animation_controller_->remove_value_provider(this);
+
+ layer_tree_impl_->UnregisterLayer(this);
if (scroll_children_) {
for (std::set<LayerImpl*>::iterator it = scroll_children_->begin();
@@ -687,6 +691,10 @@ bool LayerImpl::LayerIsAlwaysDamaged() const {
return false;
}
+gfx::Vector2dF LayerImpl::ScrollOffsetForAnimation() const {
+ return TotalScrollOffset();
+}
+
void LayerImpl::OnFilterAnimated(const FilterOperations& filters) {
SetFilters(filters);
}
@@ -699,6 +707,18 @@ void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
SetTransform(transform);
}
+void LayerImpl::OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) {
+ // Only layers in the active tree should need to do anything here, since
+ // layers in the pending tree will find out about these changes as a
+ // result of the call to SetScrollDelta.
+ if (!IsActive())
+ return;
+
+ SetScrollDelta(scroll_offset - scroll_offset_);
+
+ layer_tree_impl_->DidAnimateScrollOffset();
+}
+
void LayerImpl::OnAnimationWaitingForDeletion() {}
bool LayerImpl::IsActive() const {
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698