| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 child->SetParent(this); | 118 child->SetParent(this); |
| 119 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); | 119 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); |
| 120 children_.push_back(child.get()); | 120 children_.push_back(child.get()); |
| 121 layer_tree_impl_->AddLayer(std::move(child)); | 121 layer_tree_impl_->AddLayer(std::move(child)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { | 124 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { |
| 125 auto it = std::find(children_.begin(), children_.end(), child); | 125 auto it = std::find(children_.begin(), children_.end(), child); |
| 126 if (it != children_.end()) | 126 if (it != children_.end()) |
| 127 children_.erase(it); | 127 children_.erase(it); |
| 128 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); | |
| 129 return layer_tree_impl_->RemoveLayer(child->id()); | 128 return layer_tree_impl_->RemoveLayer(child->id()); |
| 130 } | 129 } |
| 131 | 130 |
| 132 void LayerImpl::SetParent(LayerImpl* parent) { | 131 void LayerImpl::SetParent(LayerImpl* parent) { |
| 133 parent_ = parent; | 132 parent_ = parent; |
| 134 } | 133 } |
| 135 | 134 |
| 136 void LayerImpl::ClearChildList() { | 135 void LayerImpl::ClearChildList() { |
| 137 if (children_.empty()) | 136 if (children_.empty()) |
| 138 return; | 137 return; |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 617 } |
| 619 | 618 |
| 620 int LayerImpl::num_copy_requests_in_target_subtree() { | 619 int LayerImpl::num_copy_requests_in_target_subtree() { |
| 621 return layer_tree_impl() | 620 return layer_tree_impl() |
| 622 ->property_trees() | 621 ->property_trees() |
| 623 ->effect_tree.Node(effect_tree_index()) | 622 ->effect_tree.Node(effect_tree_index()) |
| 624 ->data.num_copy_requests_in_subtree; | 623 ->data.num_copy_requests_in_subtree; |
| 625 } | 624 } |
| 626 | 625 |
| 627 void LayerImpl::UpdatePropertyTreeTransform() { | 626 void LayerImpl::UpdatePropertyTreeTransform() { |
| 628 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 627 if (transform_tree_index_ != -1) { |
| 629 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, | 628 TransformTree& transform_tree = |
| 630 id())) { | 629 layer_tree_impl()->property_trees()->transform_tree; |
| 630 TransformNode* node = transform_tree.Node(transform_tree_index_); |
| 631 // A LayerImpl's own current state is insufficient for determining whether | 631 // A LayerImpl's own current state is insufficient for determining whether |
| 632 // it owns a TransformNode, since this depends on the state of the | 632 // it owns a TransformNode, since this depends on the state of the |
| 633 // corresponding Layer at the time of the last commit. For example, a | 633 // corresponding Layer at the time of the last commit. For example, a |
| 634 // transform animation might have been in progress at the time the last | 634 // transform animation might have been in progress at the time the last |
| 635 // commit started, but might have finished since then on the compositor | 635 // commit started, but might have finished since then on the compositor |
| 636 // thread. | 636 // thread. |
| 637 DCHECK_EQ(transform_tree_index(), | 637 if (node->owner_id != id()) |
| 638 property_trees->transform_id_to_index_map[id()]); | 638 return; |
| 639 TransformNode* node = | |
| 640 property_trees->transform_tree.Node(transform_tree_index()); | |
| 641 if (node->data.local != transform_) { | 639 if (node->data.local != transform_) { |
| 642 node->data.local = transform_; | 640 node->data.local = transform_; |
| 643 node->data.needs_local_transform_update = true; | 641 node->data.needs_local_transform_update = true; |
| 644 node->data.transform_changed = true; | 642 node->data.transform_changed = true; |
| 645 property_trees->changed = true; | 643 layer_tree_impl()->property_trees()->changed = true; |
| 646 property_trees->transform_tree.set_needs_update(true); | 644 transform_tree.set_needs_update(true); |
| 647 // TODO(ajuma): The current criteria for creating clip nodes means that | 645 // TODO(ajuma): The current criteria for creating clip nodes means that |
| 648 // property trees may need to be rebuilt when the new transform isn't | 646 // property trees may need to be rebuilt when the new transform isn't |
| 649 // axis-aligned wrt the old transform (see Layer::SetTransform). Since | 647 // axis-aligned wrt the old transform (see Layer::SetTransform). Since |
| 650 // rebuilding property trees every frame of a transform animation is | 648 // rebuilding property trees every frame of a transform animation is |
| 651 // something we should try to avoid, change property tree-building so that | 649 // something we should try to avoid, change property tree-building so that |
| 652 // it doesn't depend on axis aliginment. | 650 // it doesn't depend on axis aliginment. |
| 653 } | 651 } |
| 654 } | 652 } |
| 655 } | 653 } |
| 656 | 654 |
| 657 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) { | 655 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) { |
| 658 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 656 if (transform_tree_index_ != -1) { |
| 659 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, | 657 TransformTree& transform_tree = |
| 660 id())) { | 658 layer_tree_impl()->property_trees()->transform_tree; |
| 661 DCHECK_EQ(transform_tree_index(), | 659 TransformNode* node = transform_tree.Node(transform_tree_index_); |
| 662 property_trees->transform_id_to_index_map[id()]); | |
| 663 TransformNode* node = | |
| 664 property_trees->transform_tree.Node(transform_tree_index()); | |
| 665 // A LayerImpl's own current state is insufficient for determining whether | 660 // A LayerImpl's own current state is insufficient for determining whether |
| 666 // it owns a TransformNode, since this depends on the state of the | 661 // it owns a TransformNode, since this depends on the state of the |
| 667 // corresponding Layer at the time of the last commit. For example, if | 662 // corresponding Layer at the time of the last commit. For example, if |
| 668 // |is_animated| is false, this might mean a transform animation just ticked | 663 // |is_animated| is false, this might mean a transform animation just ticked |
| 669 // past its finish point (so the LayerImpl still owns a TransformNode) or it | 664 // past its finish point (so the LayerImpl still owns a TransformNode) or it |
| 670 // might mean that a transform animation was removed during commit or | 665 // might mean that a transform animation was removed during commit or |
| 671 // activation (and, in that case, the LayerImpl will no longer own a | 666 // activation (and, in that case, the LayerImpl will no longer own a |
| 672 // TransformNode, unless it has non-animation-related reasons for owning a | 667 // TransformNode, unless it has non-animation-related reasons for owning a |
| 673 // node). | 668 // node). |
| 669 if (node->owner_id != id()) |
| 670 return; |
| 674 if (node->data.has_potential_animation != is_animated) { | 671 if (node->data.has_potential_animation != is_animated) { |
| 675 node->data.has_potential_animation = is_animated; | 672 node->data.has_potential_animation = is_animated; |
| 676 if (is_animated) { | 673 if (is_animated) { |
| 677 float maximum_target_scale = 0.f; | 674 float maximum_target_scale = 0.f; |
| 678 node->data.local_maximum_animation_target_scale = | 675 node->data.local_maximum_animation_target_scale = |
| 679 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale | 676 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale |
| 680 : 0.f; | 677 : 0.f; |
| 681 | 678 |
| 682 float animation_start_scale = 0.f; | 679 float animation_start_scale = 0.f; |
| 683 node->data.local_starting_animation_scale = | 680 node->data.local_starting_animation_scale = |
| 684 AnimationStartScale(&animation_start_scale) ? animation_start_scale | 681 AnimationStartScale(&animation_start_scale) ? animation_start_scale |
| 685 : 0.f; | 682 : 0.f; |
| 686 | 683 |
| 687 node->data.has_only_translation_animations = | 684 node->data.has_only_translation_animations = |
| 688 HasOnlyTranslationTransforms(); | 685 HasOnlyTranslationTransforms(); |
| 689 } else { | 686 } else { |
| 690 node->data.local_maximum_animation_target_scale = 0.f; | 687 node->data.local_maximum_animation_target_scale = 0.f; |
| 691 node->data.local_starting_animation_scale = 0.f; | 688 node->data.local_starting_animation_scale = 0.f; |
| 692 node->data.has_only_translation_animations = true; | 689 node->data.has_only_translation_animations = true; |
| 693 } | 690 } |
| 694 | 691 |
| 695 property_trees->transform_tree.set_needs_update(true); | 692 transform_tree.set_needs_update(true); |
| 696 layer_tree_impl()->set_needs_update_draw_properties(); | 693 layer_tree_impl()->set_needs_update_draw_properties(); |
| 697 } | 694 } |
| 698 } | 695 } |
| 699 } | 696 } |
| 700 | 697 |
| 701 void LayerImpl::UpdatePropertyTreeOpacity() { | 698 void LayerImpl::UpdatePropertyTreeOpacity() { |
| 702 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 699 if (effect_tree_index_ != -1) { |
| 703 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) { | 700 EffectTree& effect_tree = layer_tree_impl()->property_trees()->effect_tree; |
| 701 if (effect_tree_index_ >= static_cast<int>(effect_tree.size())) |
| 702 return; |
| 703 EffectNode* node = effect_tree.Node(effect_tree_index_); |
| 704 // A LayerImpl's own current state is insufficient for determining whether | 704 // A LayerImpl's own current state is insufficient for determining whether |
| 705 // it owns an OpacityNode, since this depends on the state of the | 705 // it owns an OpacityNode, since this depends on the state of the |
| 706 // corresponding Layer at the time of the last commit. For example, an | 706 // corresponding Layer at the time of the last commit. For example, an |
| 707 // opacity animation might have been in progress at the time the last commit | 707 // opacity animation might have been in progress at the time the last commit |
| 708 // started, but might have finished since then on the compositor thread. | 708 // started, but might have finished since then on the compositor thread. |
| 709 DCHECK_EQ(effect_tree_index(), | 709 if (node->owner_id != id() || node->data.opacity == opacity_) |
| 710 property_trees->effect_id_to_index_map[id()]); | 710 return; |
| 711 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index_); | |
| 712 node->data.opacity = opacity_; | 711 node->data.opacity = opacity_; |
| 713 node->data.effect_changed = true; | 712 node->data.effect_changed = true; |
| 714 property_trees->changed = true; | 713 layer_tree_impl()->property_trees()->changed = true; |
| 715 property_trees->effect_tree.set_needs_update(true); | 714 effect_tree.set_needs_update(true); |
| 716 } | 715 } |
| 717 } | 716 } |
| 718 | 717 |
| 719 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() { | 718 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() { |
| 720 if (scrollable()) | 719 if (scrollable()) |
| 721 UpdatePropertyTreeScrollOffset(); | 720 UpdatePropertyTreeScrollOffset(); |
| 722 | 721 |
| 723 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { | 722 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { |
| 724 UpdatePropertyTreeTransform(); | 723 UpdatePropertyTreeTransform(); |
| 725 UpdatePropertyTreeTransformIsAnimated( | 724 UpdatePropertyTreeTransformIsAnimated( |
| 726 HasPotentiallyRunningTransformAnimation()); | 725 HasPotentiallyRunningTransformAnimation()); |
| 727 } | 726 } |
| 728 } | 727 } |
| 729 | 728 |
| 730 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { | 729 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { |
| 731 return CurrentScrollOffset(); | 730 return CurrentScrollOffset(); |
| 732 } | 731 } |
| 733 | 732 |
| 734 void LayerImpl::OnFilterAnimated(const FilterOperations& filters) { | 733 void LayerImpl::OnFilterAnimated(const FilterOperations& filters) { |
| 735 if (filters_ != filters) { | 734 if (filters_ != filters) { |
| 736 SetFilters(filters); | 735 SetFilters(filters); |
| 737 SetNeedsPushProperties(); | 736 SetNeedsPushProperties(); |
| 738 layer_tree_impl()->set_needs_update_draw_properties(); | 737 layer_tree_impl()->set_needs_update_draw_properties(); |
| 739 EffectTree& effect_tree = layer_tree_impl()->property_trees()->effect_tree; | 738 EffectTree& effect_tree = layer_tree_impl()->property_trees()->effect_tree; |
| 740 EffectNode* node = effect_tree.Node(effect_tree_index_); | 739 EffectNode* node = effect_tree.Node(effect_tree_index_); |
| 741 DCHECK(layer_tree_impl()->property_trees()->IsInIdToIndexMap( | 740 DCHECK_EQ(node->owner_id, id()); |
| 742 PropertyTrees::TreeType::EFFECT, id())); | |
| 743 node->data.effect_changed = true; | 741 node->data.effect_changed = true; |
| 744 layer_tree_impl()->property_trees()->changed = true; | 742 layer_tree_impl()->property_trees()->changed = true; |
| 745 effect_tree.set_needs_update(true); | 743 effect_tree.set_needs_update(true); |
| 746 } | 744 } |
| 747 } | 745 } |
| 748 | 746 |
| 749 void LayerImpl::OnOpacityAnimated(float opacity) { | 747 void LayerImpl::OnOpacityAnimated(float opacity) { |
| 750 SetOpacity(opacity); | 748 SetOpacity(opacity); |
| 751 UpdatePropertyTreeOpacity(); | 749 UpdatePropertyTreeOpacity(); |
| 752 SetNeedsPushProperties(); | 750 SetNeedsPushProperties(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 773 return; | 771 return; |
| 774 | 772 |
| 775 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset)); | 773 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset)); |
| 776 | 774 |
| 777 layer_tree_impl_->DidAnimateScrollOffset(); | 775 layer_tree_impl_->DidAnimateScrollOffset(); |
| 778 } | 776 } |
| 779 | 777 |
| 780 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged( | 778 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged( |
| 781 bool is_currently_animating) { | 779 bool is_currently_animating) { |
| 782 DCHECK(layer_tree_impl_); | 780 DCHECK(layer_tree_impl_); |
| 783 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 781 TransformTree& transform_tree = |
| 784 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, | 782 layer_tree_impl_->property_trees()->transform_tree; |
| 785 id())) | 783 TransformNode* node = transform_tree.Node(transform_tree_index()); |
| 784 if (!node) |
| 786 return; | 785 return; |
| 787 DCHECK_EQ(transform_tree_index(), | 786 |
| 788 property_trees->transform_id_to_index_map[id()]); | 787 if (node->owner_id == id()) |
| 789 TransformNode* node = | 788 node->data.is_currently_animating = is_currently_animating; |
| 790 property_trees->transform_tree.Node(transform_tree_index()); | |
| 791 node->data.is_currently_animating = is_currently_animating; | |
| 792 } | 789 } |
| 793 | 790 |
| 794 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged( | 791 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged( |
| 795 bool has_potential_animation) { | 792 bool has_potential_animation) { |
| 796 UpdatePropertyTreeTransformIsAnimated(has_potential_animation); | 793 UpdatePropertyTreeTransformIsAnimated(has_potential_animation); |
| 797 was_ever_ready_since_last_transform_animation_ = false; | 794 was_ever_ready_since_last_transform_animation_ = false; |
| 798 } | 795 } |
| 799 | 796 |
| 800 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( | 797 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( |
| 801 bool is_currently_animating) { | 798 bool is_currently_animating) { |
| 802 DCHECK(layer_tree_impl_); | 799 DCHECK(layer_tree_impl_); |
| 803 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 800 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; |
| 804 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 801 EffectNode* node = effect_tree.Node(effect_tree_index()); |
| 805 return; | |
| 806 DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]); | |
| 807 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index()); | |
| 808 | 802 |
| 809 node->data.is_currently_animating_opacity = is_currently_animating; | 803 if (node->owner_id == id()) |
| 804 node->data.is_currently_animating_opacity = is_currently_animating; |
| 810 } | 805 } |
| 811 | 806 |
| 812 void LayerImpl::OnOpacityIsPotentiallyAnimatingChanged( | 807 void LayerImpl::OnOpacityIsPotentiallyAnimatingChanged( |
| 813 bool has_potential_animation) { | 808 bool has_potential_animation) { |
| 814 DCHECK(layer_tree_impl_); | 809 DCHECK(layer_tree_impl_); |
| 815 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 810 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; |
| 816 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 811 EffectNode* node = effect_tree.Node(effect_tree_index()); |
| 817 return; | 812 if (node->owner_id == id()) { |
| 818 DCHECK_EQ(effect_tree_index(), property_trees->effect_id_to_index_map[id()]); | 813 node->data.has_potential_opacity_animation = has_potential_animation; |
| 819 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index()); | 814 effect_tree.set_needs_update(true); |
| 820 node->data.has_potential_opacity_animation = has_potential_animation; | 815 } |
| 821 property_trees->effect_tree.set_needs_update(true); | |
| 822 } | 816 } |
| 823 | 817 |
| 824 bool LayerImpl::IsActive() const { | 818 bool LayerImpl::IsActive() const { |
| 825 return layer_tree_impl_->IsActiveTree(); | 819 return layer_tree_impl_->IsActiveTree(); |
| 826 } | 820 } |
| 827 | 821 |
| 828 gfx::Size LayerImpl::bounds() const { | 822 gfx::Size LayerImpl::bounds() const { |
| 829 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); | 823 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); |
| 830 return gfx::Size(bounds_.width() + delta.x(), | 824 return gfx::Size(bounds_.width() + delta.x(), |
| 831 bounds_.height() + delta.y()); | 825 bounds_.height() + delta.y()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 861 property_trees->SetOuterViewportContainerBoundsDelta(bounds_delta); | 855 property_trees->SetOuterViewportContainerBoundsDelta(bounds_delta); |
| 862 else if (this == layer_tree_impl()->InnerViewportScrollLayer()) | 856 else if (this == layer_tree_impl()->InnerViewportScrollLayer()) |
| 863 property_trees->SetInnerViewportScrollBoundsDelta(bounds_delta); | 857 property_trees->SetInnerViewportScrollBoundsDelta(bounds_delta); |
| 864 | 858 |
| 865 layer_tree_impl()->DidUpdateScrollState(id()); | 859 layer_tree_impl()->DidUpdateScrollState(id()); |
| 866 | 860 |
| 867 if (masks_to_bounds()) { | 861 if (masks_to_bounds()) { |
| 868 // If layer is clipping, then update the clip node using the new bounds. | 862 // If layer is clipping, then update the clip node using the new bounds. |
| 869 ClipNode* clip_node = property_trees->clip_tree.Node(clip_tree_index()); | 863 ClipNode* clip_node = property_trees->clip_tree.Node(clip_tree_index()); |
| 870 if (clip_node) { | 864 if (clip_node) { |
| 871 DCHECK(property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::CLIP, | 865 DCHECK(id() == clip_node->owner_id); |
| 872 id())); | |
| 873 clip_node->data.clip = gfx::RectF( | 866 clip_node->data.clip = gfx::RectF( |
| 874 gfx::PointF() + offset_to_transform_parent(), gfx::SizeF(bounds())); | 867 gfx::PointF() + offset_to_transform_parent(), gfx::SizeF(bounds())); |
| 875 property_trees->clip_tree.set_needs_update(true); | 868 property_trees->clip_tree.set_needs_update(true); |
| 876 } | 869 } |
| 877 property_trees->full_tree_damaged = true; | 870 property_trees->full_tree_damaged = true; |
| 878 layer_tree_impl()->set_needs_update_draw_properties(); | 871 layer_tree_impl()->set_needs_update_draw_properties(); |
| 879 } else { | 872 } else { |
| 880 NoteLayerPropertyChanged(); | 873 NoteLayerPropertyChanged(); |
| 881 } | 874 } |
| 882 } | 875 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 } | 1141 } |
| 1149 | 1142 |
| 1150 gfx::ScrollOffset LayerImpl::CurrentScrollOffset() const { | 1143 gfx::ScrollOffset LayerImpl::CurrentScrollOffset() const { |
| 1151 return layer_tree_impl()->property_trees()->scroll_tree.current_scroll_offset( | 1144 return layer_tree_impl()->property_trees()->scroll_tree.current_scroll_offset( |
| 1152 id()); | 1145 id()); |
| 1153 } | 1146 } |
| 1154 | 1147 |
| 1155 void LayerImpl::UpdatePropertyTreeScrollOffset() { | 1148 void LayerImpl::UpdatePropertyTreeScrollOffset() { |
| 1156 // TODO(enne): in the future, scrolling should update the scroll tree | 1149 // TODO(enne): in the future, scrolling should update the scroll tree |
| 1157 // directly instead of going through layers. | 1150 // directly instead of going through layers. |
| 1158 TransformTree& transform_tree = | 1151 if (transform_tree_index_ != -1) { |
| 1159 layer_tree_impl()->property_trees()->transform_tree; | 1152 TransformTree& transform_tree = |
| 1160 TransformNode* node = transform_tree.Node(transform_tree_index_); | 1153 layer_tree_impl()->property_trees()->transform_tree; |
| 1161 gfx::ScrollOffset current_offset = CurrentScrollOffset(); | 1154 TransformNode* node = transform_tree.Node(transform_tree_index_); |
| 1162 if (node->data.scroll_offset != current_offset) { | 1155 gfx::ScrollOffset current_offset = CurrentScrollOffset(); |
| 1163 node->data.scroll_offset = current_offset; | 1156 if (node->data.scroll_offset != current_offset) { |
| 1164 node->data.needs_local_transform_update = true; | 1157 node->data.scroll_offset = current_offset; |
| 1165 transform_tree.set_needs_update(true); | 1158 node->data.needs_local_transform_update = true; |
| 1159 transform_tree.set_needs_update(true); |
| 1160 } |
| 1166 } | 1161 } |
| 1167 } | 1162 } |
| 1168 | 1163 |
| 1169 SimpleEnclosedRegion LayerImpl::VisibleOpaqueRegion() const { | 1164 SimpleEnclosedRegion LayerImpl::VisibleOpaqueRegion() const { |
| 1170 if (contents_opaque()) | 1165 if (contents_opaque()) |
| 1171 return SimpleEnclosedRegion(visible_layer_rect()); | 1166 return SimpleEnclosedRegion(visible_layer_rect()); |
| 1172 return SimpleEnclosedRegion(); | 1167 return SimpleEnclosedRegion(); |
| 1173 } | 1168 } |
| 1174 | 1169 |
| 1175 void LayerImpl::DidBeginTracing() {} | 1170 void LayerImpl::DidBeginTracing() {} |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 .layer_transforms_should_scale_layer_contents) { | 1414 .layer_transforms_should_scale_layer_contents) { |
| 1420 return default_scale; | 1415 return default_scale; |
| 1421 } | 1416 } |
| 1422 | 1417 |
| 1423 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1418 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1424 DrawTransform(), default_scale); | 1419 DrawTransform(), default_scale); |
| 1425 return std::max(transform_scales.x(), transform_scales.y()); | 1420 return std::max(transform_scales.x(), transform_scales.y()); |
| 1426 } | 1421 } |
| 1427 | 1422 |
| 1428 } // namespace cc | 1423 } // namespace cc |
| OLD | NEW |