From 59c23b4553b683f8fca3707f50be185cafcee052 Mon Sep 17 00:00:00 2001 From: ajuma Date: Mon, 25 May 2015 13:18:37 -0700 Subject: cc: Update property trees when there are compositor animations This updates property trees for changes caused by compositor-driven transform and opacity animations. This fixes 20 tests that fail when verification is turned on. BUG=481585 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1152033002 Cr-Commit-Position: refs/heads/master@{#331301} --- cc/layers/layer_impl.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cc/layers/layer_impl.cc') diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 46a4c95..5541a00 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -806,6 +806,34 @@ void LayerImpl::ResetAllChangeTrackingForSubtree() { num_dependents_need_push_properties_ = 0; } +void LayerImpl::UpdatePropertyTreeTransform() { + if (transform_tree_index_ != -1) { + TransformTree& transform_tree = + layer_tree_impl()->property_trees()->transform_tree; + TransformNode* node = transform_tree.Node(transform_tree_index_); + if (node->data.local != transform_) { + node->data.local = transform_; + node->data.needs_local_transform_update = true; + transform_tree.set_needs_update(true); + // TODO(ajuma): The current criteria for creating clip nodes means that + // property trees may need to be rebuilt when the new transform isn't + // axis-aligned wrt the old transform (see Layer::SetTransform). Since + // rebuilding property trees every frame of a transform animation is + // something we should try to avoid, change property tree-building so that + // it doesn't depend on axis aliginment. + } + } +} + +void LayerImpl::UpdatePropertyTreeOpacity() { + if (opacity_tree_index_ != -1) { + OpacityTree& opacity_tree = + layer_tree_impl()->property_trees()->opacity_tree; + OpacityNode* node = opacity_tree.Node(opacity_tree_index_); + node->data = opacity_; + } +} + gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { return CurrentScrollOffset(); } @@ -816,10 +844,12 @@ void LayerImpl::OnFilterAnimated(const FilterOperations& filters) { void LayerImpl::OnOpacityAnimated(float opacity) { SetOpacity(opacity); + UpdatePropertyTreeOpacity(); } void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) { SetTransform(transform); + UpdatePropertyTreeTransform(); } void LayerImpl::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { -- cgit v1.1