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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2339583002: cc: Move OnScrollOffsetAnimated to scroll tree (Closed)
Patch Set: Created 4 years, 3 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/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { 535 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) {
536 UpdatePropertyTreeTransformIsAnimated( 536 UpdatePropertyTreeTransformIsAnimated(
537 HasPotentiallyRunningTransformAnimation()); 537 HasPotentiallyRunningTransformAnimation());
538 } 538 }
539 } 539 }
540 540
541 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { 541 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const {
542 return CurrentScrollOffset(); 542 return CurrentScrollOffset();
543 } 543 }
544 544
545 void LayerImpl::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
546 // Only layers in the active tree should need to do anything here, since
547 // layers in the pending tree will find out about these changes as a
548 // result of the shared SyncedProperty.
549 if (!IsActive())
550 return;
551
552 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset));
553
554 layer_tree_impl_->DidAnimateScrollOffset();
555 }
556
557 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged( 545 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged(
558 bool is_currently_animating) { 546 bool is_currently_animating) {
559 DCHECK(layer_tree_impl_); 547 DCHECK(layer_tree_impl_);
560 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); 548 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
561 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, 549 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
562 id())) 550 id()))
563 return; 551 return;
564 TransformNode* node = property_trees->transform_tree.Node( 552 TransformNode* node = property_trees->transform_tree.Node(
565 property_trees->transform_id_to_index_map[id()]); 553 property_trees->transform_id_to_index_map[id()]);
566 node->is_currently_animating = is_currently_animating; 554 node->is_currently_animating = is_currently_animating;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 .layer_transforms_should_scale_layer_contents) { 1107 .layer_transforms_should_scale_layer_contents) {
1120 return default_scale; 1108 return default_scale;
1121 } 1109 }
1122 1110
1123 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1111 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1124 ScreenSpaceTransform(), default_scale); 1112 ScreenSpaceTransform(), default_scale);
1125 return std::max(transform_scales.x(), transform_scales.y()); 1113 return std::max(transform_scales.x(), transform_scales.y());
1126 } 1114 }
1127 1115
1128 } // namespace cc 1116 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698