| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 void Layer::SetPosition(const gfx::PointF& position) { | 580 void Layer::SetPosition(const gfx::PointF& position) { |
| 581 DCHECK(IsPropertyChangeAllowed()); | 581 DCHECK(IsPropertyChangeAllowed()); |
| 582 if (position_ == position) | 582 if (position_ == position) |
| 583 return; | 583 return; |
| 584 position_ = position; | 584 position_ = position; |
| 585 | 585 |
| 586 if (!layer_tree_host_) | 586 if (!layer_tree_host_) |
| 587 return; | 587 return; |
| 588 | 588 |
| 589 SetSubtreePropertyChanged(); | 589 SetSubtreePropertyChanged(); |
| 590 if (TransformNode* transform_node = | 590 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 591 layer_tree_host_->property_trees()->transform_tree.Node( | 591 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 592 transform_tree_index())) { | 592 id())) { |
| 593 if (transform_node->owner_id == id()) { | 593 TransformNode* transform_node = |
| 594 transform_node->data.update_post_local_transform(position, | 594 property_trees->transform_tree.Node(transform_tree_index()); |
| 595 transform_origin()); | 595 transform_node->data.update_post_local_transform(position, |
| 596 transform_node->data.needs_local_transform_update = true; | 596 transform_origin()); |
| 597 transform_node->data.transform_changed = true; | 597 transform_node->data.needs_local_transform_update = true; |
| 598 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); | 598 transform_node->data.transform_changed = true; |
| 599 SetNeedsCommitNoRebuild(); | 599 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); |
| 600 return; | 600 SetNeedsCommitNoRebuild(); |
| 601 } | 601 return; |
| 602 } | 602 } |
| 603 | 603 |
| 604 SetNeedsCommit(); | 604 SetNeedsCommit(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 bool Layer::IsContainerForFixedPositionLayers() const { | 607 bool Layer::IsContainerForFixedPositionLayers() const { |
| 608 if (!transform_.IsIdentityOrTranslation()) | 608 if (!transform_.IsIdentityOrTranslation()) |
| 609 return true; | 609 return true; |
| 610 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) | 610 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) |
| 611 return true; | 611 return true; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 void Layer::SetTransform(const gfx::Transform& transform) { | 630 void Layer::SetTransform(const gfx::Transform& transform) { |
| 631 DCHECK(IsPropertyChangeAllowed()); | 631 DCHECK(IsPropertyChangeAllowed()); |
| 632 if (transform_ == transform) | 632 if (transform_ == transform) |
| 633 return; | 633 return; |
| 634 | 634 |
| 635 SetSubtreePropertyChanged(); | 635 SetSubtreePropertyChanged(); |
| 636 if (layer_tree_host_) { | 636 if (layer_tree_host_) { |
| 637 if (TransformNode* transform_node = | 637 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 638 layer_tree_host_->property_trees()->transform_tree.Node( | 638 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 639 transform_tree_index())) { | 639 id())) { |
| 640 if (transform_node->owner_id == id()) { | 640 // We need to trigger a rebuild if we could have affected 2d axis |
| 641 // We need to trigger a rebuild if we could have affected 2d axis | 641 // alignment. We'll check to see if transform and transform_ are axis |
| 642 // alignment. We'll check to see if transform and transform_ are axis | 642 // align with respect to one another. |
| 643 // align with respect to one another. | 643 TransformNode* transform_node = |
| 644 bool preserves_2d_axis_alignment = | 644 property_trees->transform_tree.Node(transform_tree_index()); |
| 645 Are2dAxisAligned(transform_, transform); | 645 bool preserves_2d_axis_alignment = |
| 646 transform_node->data.local = transform; | 646 Are2dAxisAligned(transform_, transform); |
| 647 transform_node->data.needs_local_transform_update = true; | 647 transform_node->data.local = transform; |
| 648 transform_node->data.transform_changed = true; | 648 transform_node->data.needs_local_transform_update = true; |
| 649 layer_tree_host_->property_trees()->transform_tree.set_needs_update( | 649 transform_node->data.transform_changed = true; |
| 650 true); | 650 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); |
| 651 if (preserves_2d_axis_alignment) | 651 if (preserves_2d_axis_alignment) |
| 652 SetNeedsCommitNoRebuild(); | 652 SetNeedsCommitNoRebuild(); |
| 653 else | 653 else |
| 654 SetNeedsCommit(); | 654 SetNeedsCommit(); |
| 655 transform_ = transform; | 655 transform_ = transform; |
| 656 return; | 656 return; |
| 657 } | |
| 658 } | 657 } |
| 659 } | 658 } |
| 660 | 659 |
| 661 transform_ = transform; | 660 transform_ = transform; |
| 662 | 661 |
| 663 SetNeedsCommit(); | 662 SetNeedsCommit(); |
| 664 } | 663 } |
| 665 | 664 |
| 666 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { | 665 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { |
| 667 DCHECK(IsPropertyChangeAllowed()); | 666 DCHECK(IsPropertyChangeAllowed()); |
| 668 if (transform_origin_ == transform_origin) | 667 if (transform_origin_ == transform_origin) |
| 669 return; | 668 return; |
| 670 transform_origin_ = transform_origin; | 669 transform_origin_ = transform_origin; |
| 671 | 670 |
| 672 if (!layer_tree_host_) | 671 if (!layer_tree_host_) |
| 673 return; | 672 return; |
| 674 | 673 |
| 675 SetSubtreePropertyChanged(); | 674 SetSubtreePropertyChanged(); |
| 676 if (TransformNode* transform_node = | 675 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 677 layer_tree_host_->property_trees()->transform_tree.Node( | 676 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 678 transform_tree_index())) { | 677 id())) { |
| 679 if (transform_node->owner_id == id()) { | 678 TransformNode* transform_node = |
| 680 transform_node->data.update_pre_local_transform(transform_origin); | 679 property_trees->transform_tree.Node(transform_tree_index()); |
| 681 transform_node->data.update_post_local_transform(position(), | 680 transform_node->data.update_pre_local_transform(transform_origin); |
| 682 transform_origin); | 681 transform_node->data.update_post_local_transform(position(), |
| 683 transform_node->data.needs_local_transform_update = true; | 682 transform_origin); |
| 684 transform_node->data.transform_changed = true; | 683 transform_node->data.needs_local_transform_update = true; |
| 685 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); | 684 transform_node->data.transform_changed = true; |
| 686 SetNeedsCommitNoRebuild(); | 685 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); |
| 687 return; | 686 SetNeedsCommitNoRebuild(); |
| 688 } | 687 return; |
| 689 } | 688 } |
| 690 | 689 |
| 691 SetNeedsCommit(); | 690 SetNeedsCommit(); |
| 692 } | 691 } |
| 693 | 692 |
| 694 bool Layer::AnimationsPreserveAxisAlignment() const { | 693 bool Layer::AnimationsPreserveAxisAlignment() const { |
| 695 DCHECK(layer_tree_host_); | 694 DCHECK(layer_tree_host_); |
| 696 return layer_tree_host_->AnimationsPreserveAxisAlignment(this); | 695 return layer_tree_host_->AnimationsPreserveAxisAlignment(this); |
| 697 } | 696 } |
| 698 | 697 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { | 791 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { |
| 793 DCHECK(IsPropertyChangeAllowed()); | 792 DCHECK(IsPropertyChangeAllowed()); |
| 794 | 793 |
| 795 if (scroll_offset_ == scroll_offset) | 794 if (scroll_offset_ == scroll_offset) |
| 796 return; | 795 return; |
| 797 scroll_offset_ = scroll_offset; | 796 scroll_offset_ = scroll_offset; |
| 798 | 797 |
| 799 if (!layer_tree_host_) | 798 if (!layer_tree_host_) |
| 800 return; | 799 return; |
| 801 | 800 |
| 801 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 802 if (scroll_tree_index() != -1 && scrollable()) | 802 if (scroll_tree_index() != -1 && scrollable()) |
| 803 layer_tree_host_->property_trees()->scroll_tree.SetScrollOffset( | 803 property_trees->scroll_tree.SetScrollOffset(id(), scroll_offset); |
| 804 id(), scroll_offset); | |
| 805 | 804 |
| 806 if (TransformNode* transform_node = | 805 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 807 layer_tree_host_->property_trees()->transform_tree.Node( | 806 id())) { |
| 808 transform_tree_index())) { | 807 TransformNode* transform_node = |
| 809 if (transform_node->owner_id == id()) { | 808 property_trees->transform_tree.Node(transform_tree_index()); |
| 810 transform_node->data.scroll_offset = CurrentScrollOffset(); | 809 transform_node->data.scroll_offset = CurrentScrollOffset(); |
| 811 transform_node->data.needs_local_transform_update = true; | 810 transform_node->data.needs_local_transform_update = true; |
| 812 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); | 811 property_trees->transform_tree.set_needs_update(true); |
| 813 SetNeedsCommitNoRebuild(); | 812 SetNeedsCommitNoRebuild(); |
| 814 return; | 813 return; |
| 815 } | |
| 816 } | 814 } |
| 817 | 815 |
| 818 SetNeedsCommit(); | 816 SetNeedsCommit(); |
| 819 } | 817 } |
| 820 | 818 |
| 821 void Layer::SetScrollOffsetFromImplSide( | 819 void Layer::SetScrollOffsetFromImplSide( |
| 822 const gfx::ScrollOffset& scroll_offset) { | 820 const gfx::ScrollOffset& scroll_offset) { |
| 823 DCHECK(IsPropertyChangeAllowed()); | 821 DCHECK(IsPropertyChangeAllowed()); |
| 824 // This function only gets called during a BeginMainFrame, so there | 822 // This function only gets called during a BeginMainFrame, so there |
| 825 // is no need to call SetNeedsUpdate here. | 823 // is no need to call SetNeedsUpdate here. |
| 826 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 824 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
| 827 if (scroll_offset_ == scroll_offset) | 825 if (scroll_offset_ == scroll_offset) |
| 828 return; | 826 return; |
| 829 scroll_offset_ = scroll_offset; | 827 scroll_offset_ = scroll_offset; |
| 830 SetNeedsPushProperties(); | 828 SetNeedsPushProperties(); |
| 831 | 829 |
| 832 bool needs_rebuild = true; | 830 bool needs_rebuild = true; |
| 833 | 831 |
| 832 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 834 if (scroll_tree_index() != -1 && scrollable()) | 833 if (scroll_tree_index() != -1 && scrollable()) |
| 835 layer_tree_host_->property_trees()->scroll_tree.SetScrollOffset( | 834 property_trees->scroll_tree.SetScrollOffset(id(), scroll_offset); |
| 836 id(), scroll_offset); | |
| 837 | 835 |
| 838 if (TransformNode* transform_node = | 836 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 839 layer_tree_host_->property_trees()->transform_tree.Node( | 837 id())) { |
| 840 transform_tree_index())) { | 838 TransformNode* transform_node = |
| 841 if (transform_node->owner_id == id()) { | 839 property_trees->transform_tree.Node(transform_tree_index()); |
| 842 transform_node->data.scroll_offset = CurrentScrollOffset(); | 840 transform_node->data.scroll_offset = CurrentScrollOffset(); |
| 843 transform_node->data.needs_local_transform_update = true; | 841 transform_node->data.needs_local_transform_update = true; |
| 844 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); | 842 property_trees->transform_tree.set_needs_update(true); |
| 845 needs_rebuild = false; | 843 needs_rebuild = false; |
| 846 } | |
| 847 } | 844 } |
| 848 | 845 |
| 849 if (needs_rebuild) | 846 if (needs_rebuild) |
| 850 layer_tree_host_->property_trees()->needs_rebuild = true; | 847 property_trees->needs_rebuild = true; |
| 851 | 848 |
| 852 if (!did_scroll_callback_.is_null()) | 849 if (!did_scroll_callback_.is_null()) |
| 853 did_scroll_callback_.Run(); | 850 did_scroll_callback_.Run(); |
| 854 // The callback could potentially change the layer structure: | 851 // The callback could potentially change the layer structure: |
| 855 // "this" may have been destroyed during the process. | 852 // "this" may have been destroyed during the process. |
| 856 } | 853 } |
| 857 | 854 |
| 858 void Layer::SetScrollClipLayerId(int clip_layer_id) { | 855 void Layer::SetScrollClipLayerId(int clip_layer_id) { |
| 859 DCHECK(IsPropertyChangeAllowed()); | 856 DCHECK(IsPropertyChangeAllowed()); |
| 860 if (scroll_clip_layer_id_ == clip_layer_id) | 857 if (scroll_clip_layer_id_ == clip_layer_id) |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 } | 1602 } |
| 1606 | 1603 |
| 1607 void Layer::OnOpacityAnimated(float opacity) { | 1604 void Layer::OnOpacityAnimated(float opacity) { |
| 1608 if (opacity_ == opacity) | 1605 if (opacity_ == opacity) |
| 1609 return; | 1606 return; |
| 1610 opacity_ = opacity; | 1607 opacity_ = opacity; |
| 1611 // Changing the opacity may make a previously hidden layer visible, so a new | 1608 // Changing the opacity may make a previously hidden layer visible, so a new |
| 1612 // recording may be needed. | 1609 // recording may be needed. |
| 1613 SetNeedsUpdate(); | 1610 SetNeedsUpdate(); |
| 1614 if (layer_tree_host_) { | 1611 if (layer_tree_host_) { |
| 1615 if (EffectNode* node = layer_tree_host_->property_trees()->effect_tree.Node( | 1612 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1616 effect_tree_index())) { | 1613 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, |
| 1617 if (node->owner_id == id()) { | 1614 id())) { |
| 1618 node->data.opacity = opacity; | 1615 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index()); |
| 1619 layer_tree_host_->property_trees()->effect_tree.set_needs_update(true); | 1616 node->data.opacity = opacity; |
| 1620 } | 1617 property_trees->effect_tree.set_needs_update(true); |
| 1621 } | 1618 } |
| 1622 } | 1619 } |
| 1623 } | 1620 } |
| 1624 | 1621 |
| 1625 void Layer::OnTransformAnimated(const gfx::Transform& transform) { | 1622 void Layer::OnTransformAnimated(const gfx::Transform& transform) { |
| 1626 if (transform_ == transform) | 1623 if (transform_ == transform) |
| 1627 return; | 1624 return; |
| 1628 transform_ = transform; | 1625 transform_ = transform; |
| 1629 // Changing the transform may change the visible part of this layer, so a new | 1626 // Changing the transform may change the visible part of this layer, so a new |
| 1630 // recording may be needed. | 1627 // recording may be needed. |
| 1631 SetNeedsUpdate(); | 1628 SetNeedsUpdate(); |
| 1632 if (layer_tree_host_) { | 1629 if (layer_tree_host_) { |
| 1633 if (TransformNode* node = | 1630 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1634 layer_tree_host_->property_trees()->transform_tree.Node( | 1631 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 1635 transform_tree_index())) { | 1632 id())) { |
| 1636 if (node->owner_id == id()) { | 1633 TransformNode* node = |
| 1637 node->data.local = transform; | 1634 property_trees->transform_tree.Node(transform_tree_index()); |
| 1638 node->data.needs_local_transform_update = true; | 1635 node->data.local = transform; |
| 1639 node->data.has_potential_animation = true; | 1636 node->data.needs_local_transform_update = true; |
| 1640 layer_tree_host_->property_trees()->transform_tree.set_needs_update( | 1637 node->data.has_potential_animation = true; |
| 1641 true); | 1638 property_trees->transform_tree.set_needs_update(true); |
| 1642 } | |
| 1643 } | 1639 } |
| 1644 } | 1640 } |
| 1645 } | 1641 } |
| 1646 | 1642 |
| 1647 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { | 1643 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { |
| 1648 // Do nothing. Scroll deltas will be sent from the compositor thread back | 1644 // Do nothing. Scroll deltas will be sent from the compositor thread back |
| 1649 // to the main thread in the same manner as during non-animated | 1645 // to the main thread in the same manner as during non-animated |
| 1650 // compositor-driven scrolling. | 1646 // compositor-driven scrolling. |
| 1651 } | 1647 } |
| 1652 | 1648 |
| 1653 void Layer::OnTransformIsCurrentlyAnimatingChanged( | 1649 void Layer::OnTransformIsCurrentlyAnimatingChanged( |
| 1654 bool is_currently_animating) { | 1650 bool is_currently_animating) { |
| 1655 DCHECK(layer_tree_host_); | 1651 DCHECK(layer_tree_host_); |
| 1656 TransformTree& transform_tree = | 1652 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1657 layer_tree_host_->property_trees()->transform_tree; | 1653 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 1658 TransformNode* node = transform_tree.Node(transform_tree_index()); | 1654 id())) |
| 1659 if (!node) | |
| 1660 return; | 1655 return; |
| 1661 | 1656 TransformNode* node = |
| 1662 if (node->owner_id == id()) | 1657 property_trees->transform_tree.Node(transform_tree_index()); |
| 1663 node->data.is_currently_animating = is_currently_animating; | 1658 node->data.is_currently_animating = is_currently_animating; |
| 1664 } | 1659 } |
| 1665 | 1660 |
| 1666 void Layer::OnTransformIsPotentiallyAnimatingChanged( | 1661 void Layer::OnTransformIsPotentiallyAnimatingChanged( |
| 1667 bool has_potential_animation) { | 1662 bool has_potential_animation) { |
| 1668 if (!layer_tree_host_) | 1663 if (!layer_tree_host_) |
| 1669 return; | 1664 return; |
| 1670 TransformTree& transform_tree = | 1665 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1671 layer_tree_host_->property_trees()->transform_tree; | 1666 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
| 1672 TransformNode* node = transform_tree.Node(transform_tree_index()); | 1667 id())) |
| 1673 if (!node) | |
| 1674 return; | 1668 return; |
| 1669 TransformNode* node = |
| 1670 property_trees->transform_tree.Node(transform_tree_index()); |
| 1675 | 1671 |
| 1676 if (node->owner_id == id()) { | 1672 node->data.has_potential_animation = has_potential_animation; |
| 1677 node->data.has_potential_animation = has_potential_animation; | 1673 if (has_potential_animation) { |
| 1678 if (has_potential_animation) { | 1674 float maximum_target_scale = 0.f; |
| 1679 float maximum_target_scale = 0.f; | 1675 node->data.local_maximum_animation_target_scale = |
| 1680 node->data.local_maximum_animation_target_scale = | 1676 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale : 0.f; |
| 1681 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale | 1677 |
| 1678 float animation_start_scale = 0.f; |
| 1679 node->data.local_starting_animation_scale = |
| 1680 AnimationStartScale(&animation_start_scale) ? animation_start_scale |
| 1682 : 0.f; | 1681 : 0.f; |
| 1683 | 1682 |
| 1684 float animation_start_scale = 0.f; | 1683 node->data.has_only_translation_animations = HasOnlyTranslationTransforms(); |
| 1685 node->data.local_starting_animation_scale = | |
| 1686 AnimationStartScale(&animation_start_scale) ? animation_start_scale | |
| 1687 : 0.f; | |
| 1688 | |
| 1689 node->data.has_only_translation_animations = | |
| 1690 HasOnlyTranslationTransforms(); | |
| 1691 | 1684 |
| 1692 } else { | 1685 } else { |
| 1693 node->data.local_maximum_animation_target_scale = 0.f; | 1686 node->data.local_maximum_animation_target_scale = 0.f; |
| 1694 node->data.local_starting_animation_scale = 0.f; | 1687 node->data.local_starting_animation_scale = 0.f; |
| 1695 node->data.has_only_translation_animations = true; | 1688 node->data.has_only_translation_animations = true; |
| 1696 } | 1689 } |
| 1697 transform_tree.set_needs_update(true); | 1690 property_trees->transform_tree.set_needs_update(true); |
| 1698 } | |
| 1699 } | 1691 } |
| 1700 | 1692 |
| 1701 void Layer::OnOpacityIsCurrentlyAnimatingChanged(bool is_currently_animating) { | 1693 void Layer::OnOpacityIsCurrentlyAnimatingChanged(bool is_currently_animating) { |
| 1702 DCHECK(layer_tree_host_); | 1694 DCHECK(layer_tree_host_); |
| 1703 EffectTree& effect_tree = layer_tree_host_->property_trees()->effect_tree; | 1695 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1704 EffectNode* node = effect_tree.Node(effect_tree_index()); | 1696 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) |
| 1705 if (!node) | |
| 1706 return; | 1697 return; |
| 1707 | 1698 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index()); |
| 1708 if (node->owner_id == id()) | 1699 node->data.is_currently_animating_opacity = is_currently_animating; |
| 1709 node->data.is_currently_animating_opacity = is_currently_animating; | |
| 1710 } | 1700 } |
| 1711 | 1701 |
| 1712 void Layer::OnOpacityIsPotentiallyAnimatingChanged( | 1702 void Layer::OnOpacityIsPotentiallyAnimatingChanged( |
| 1713 bool has_potential_animation) { | 1703 bool has_potential_animation) { |
| 1714 DCHECK(layer_tree_host_); | 1704 DCHECK(layer_tree_host_); |
| 1715 EffectTree& effect_tree = layer_tree_host_->property_trees()->effect_tree; | 1705 PropertyTrees* property_trees = layer_tree_host_->property_trees(); |
| 1716 EffectNode* node = effect_tree.Node(effect_tree_index()); | 1706 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) |
| 1717 if (!node) | |
| 1718 return; | 1707 return; |
| 1719 if (node->owner_id == id()) { | 1708 EffectNode* node = property_trees->effect_tree.Node(effect_tree_index()); |
| 1720 node->data.has_potential_opacity_animation = | 1709 node->data.has_potential_opacity_animation = |
| 1721 has_potential_animation || OpacityCanAnimateOnImplThread(); | 1710 has_potential_animation || OpacityCanAnimateOnImplThread(); |
| 1722 effect_tree.set_needs_update(true); | 1711 property_trees->effect_tree.set_needs_update(true); |
| 1723 } | |
| 1724 } | 1712 } |
| 1725 | 1713 |
| 1726 bool Layer::HasActiveAnimationForTesting() const { | 1714 bool Layer::HasActiveAnimationForTesting() const { |
| 1727 return layer_tree_host_ ? layer_tree_host_->HasActiveAnimationForTesting(this) | 1715 return layer_tree_host_ ? layer_tree_host_->HasActiveAnimationForTesting(this) |
| 1728 : false; | 1716 : false; |
| 1729 } | 1717 } |
| 1730 | 1718 |
| 1731 void Layer::SetHasWillChangeTransformHint(bool has_will_change) { | 1719 void Layer::SetHasWillChangeTransformHint(bool has_will_change) { |
| 1732 if (has_will_change_transform_hint_ == has_will_change) | 1720 if (has_will_change_transform_hint_ == has_will_change) |
| 1733 return; | 1721 return; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 ->data.num_copy_requests_in_subtree; | 1803 ->data.num_copy_requests_in_subtree; |
| 1816 } | 1804 } |
| 1817 | 1805 |
| 1818 gfx::Transform Layer::screen_space_transform() const { | 1806 gfx::Transform Layer::screen_space_transform() const { |
| 1819 DCHECK_NE(transform_tree_index_, -1); | 1807 DCHECK_NE(transform_tree_index_, -1); |
| 1820 return draw_property_utils::ScreenSpaceTransform( | 1808 return draw_property_utils::ScreenSpaceTransform( |
| 1821 this, layer_tree_host_->property_trees()->transform_tree); | 1809 this, layer_tree_host_->property_trees()->transform_tree); |
| 1822 } | 1810 } |
| 1823 | 1811 |
| 1824 } // namespace cc | 1812 } // namespace cc |
| OLD | NEW |