OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), | 2619 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), |
2620 gfx::PointF(), gfx::Size(10, 10), true, false, | 2620 gfx::PointF(), gfx::Size(10, 10), true, false, |
2621 false); | 2621 false); |
2622 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), | 2622 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), |
2623 gfx::PointF(), gfx::Size(10, 10), true, false, | 2623 gfx::PointF(), gfx::Size(10, 10), true, false, |
2624 false); | 2624 false); |
2625 | 2625 |
2626 // Add a transform animation with a start delay to |grand_child|. | 2626 // Add a transform animation with a start delay to |grand_child|. |
2627 scoped_ptr<Animation> animation = Animation::Create( | 2627 scoped_ptr<Animation> animation = Animation::Create( |
2628 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, | 2628 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, |
2629 Animation::TRANSFORM); | 2629 TargetProperty::TRANSFORM); |
2630 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 2630 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
2631 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 2631 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
2632 if (layer_settings().use_compositor_animation_timelines) { | 2632 if (layer_settings().use_compositor_animation_timelines) { |
2633 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), | 2633 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), |
2634 std::move(animation)); | 2634 std::move(animation)); |
2635 } else { | 2635 } else { |
2636 grand_child->layer_animation_controller()->AddAnimation( | 2636 grand_child->layer_animation_controller()->AddAnimation( |
2637 std::move(animation)); | 2637 std::move(animation)); |
2638 } | 2638 } |
2639 ExecuteCalculateDrawProperties(parent); | 2639 ExecuteCalculateDrawProperties(parent); |
(...skipping 4906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7546 EXPECT_EQ(0.f, | 7546 EXPECT_EQ(0.f, |
7547 parent_raw->draw_properties().starting_animation_contents_scale); | 7547 parent_raw->draw_properties().starting_animation_contents_scale); |
7548 EXPECT_EQ(0.f, | 7548 EXPECT_EQ(0.f, |
7549 child_raw->draw_properties().starting_animation_contents_scale); | 7549 child_raw->draw_properties().starting_animation_contents_scale); |
7550 EXPECT_EQ( | 7550 EXPECT_EQ( |
7551 0.f, | 7551 0.f, |
7552 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7552 grand_child_raw->draw_properties().starting_animation_contents_scale); |
7553 | 7553 |
7554 if (layer_settings().use_compositor_animation_timelines) { | 7554 if (layer_settings().use_compositor_animation_timelines) { |
7555 AbortAnimationsOnLayerWithPlayer(grand_parent->id(), timeline, | 7555 AbortAnimationsOnLayerWithPlayer(grand_parent->id(), timeline, |
7556 Animation::TRANSFORM); | 7556 TargetProperty::TRANSFORM); |
7557 AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, | 7557 AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline, |
7558 Animation::TRANSFORM); | 7558 TargetProperty::TRANSFORM); |
7559 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, | 7559 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
7560 Animation::TRANSFORM); | 7560 TargetProperty::TRANSFORM); |
7561 } else { | 7561 } else { |
7562 grand_parent->layer_animation_controller()->AbortAnimations( | 7562 grand_parent->layer_animation_controller()->AbortAnimations( |
7563 Animation::TRANSFORM); | 7563 TargetProperty::TRANSFORM); |
7564 parent_raw->layer_animation_controller()->AbortAnimations( | 7564 parent_raw->layer_animation_controller()->AbortAnimations( |
7565 Animation::TRANSFORM); | 7565 TargetProperty::TRANSFORM); |
7566 child_raw->layer_animation_controller()->AbortAnimations( | 7566 child_raw->layer_animation_controller()->AbortAnimations( |
7567 Animation::TRANSFORM); | 7567 TargetProperty::TRANSFORM); |
7568 } | 7568 } |
7569 | 7569 |
7570 TransformOperations perspective; | 7570 TransformOperations perspective; |
7571 perspective.AppendPerspective(10.f); | 7571 perspective.AppendPerspective(10.f); |
7572 | 7572 |
7573 if (layer_settings().use_compositor_animation_timelines) { | 7573 if (layer_settings().use_compositor_animation_timelines) { |
7574 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, | 7574 AddAnimatedTransformToLayerWithPlayer(child_raw->id(), timeline, 1.0, |
7575 TransformOperations(), perspective); | 7575 TransformOperations(), perspective); |
7576 } else { | 7576 } else { |
7577 AddAnimatedTransformToLayer(child_raw, 1.0, TransformOperations(), | 7577 AddAnimatedTransformToLayer(child_raw, 1.0, TransformOperations(), |
(...skipping 17 matching lines...) Expand all Loading... |
7595 EXPECT_EQ(0.f, | 7595 EXPECT_EQ(0.f, |
7596 parent_raw->draw_properties().starting_animation_contents_scale); | 7596 parent_raw->draw_properties().starting_animation_contents_scale); |
7597 EXPECT_EQ(0.f, | 7597 EXPECT_EQ(0.f, |
7598 child_raw->draw_properties().starting_animation_contents_scale); | 7598 child_raw->draw_properties().starting_animation_contents_scale); |
7599 EXPECT_EQ( | 7599 EXPECT_EQ( |
7600 0.f, | 7600 0.f, |
7601 grand_child_raw->draw_properties().starting_animation_contents_scale); | 7601 grand_child_raw->draw_properties().starting_animation_contents_scale); |
7602 | 7602 |
7603 if (layer_settings().use_compositor_animation_timelines) { | 7603 if (layer_settings().use_compositor_animation_timelines) { |
7604 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, | 7604 AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline, |
7605 Animation::TRANSFORM); | 7605 TargetProperty::TRANSFORM); |
7606 } else { | 7606 } else { |
7607 child_raw->layer_animation_controller()->AbortAnimations( | 7607 child_raw->layer_animation_controller()->AbortAnimations( |
7608 Animation::TRANSFORM); | 7608 TargetProperty::TRANSFORM); |
7609 } | 7609 } |
7610 gfx::Transform scale_matrix; | 7610 gfx::Transform scale_matrix; |
7611 scale_matrix.Scale(1.f, 2.f); | 7611 scale_matrix.Scale(1.f, 2.f); |
7612 grand_parent->SetTransform(scale_matrix); | 7612 grand_parent->SetTransform(scale_matrix); |
7613 parent_raw->SetTransform(scale_matrix); | 7613 parent_raw->SetTransform(scale_matrix); |
7614 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7614 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true; |
7615 | 7615 |
7616 if (layer_settings().use_compositor_animation_timelines) { | 7616 if (layer_settings().use_compositor_animation_timelines) { |
7617 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, | 7617 AddAnimatedTransformToLayerWithPlayer(parent_raw->id(), timeline, 1.0, |
7618 TransformOperations(), scale); | 7618 TransformOperations(), scale); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8515 KeyframedFilterAnimationCurve::Create()); | 8515 KeyframedFilterAnimationCurve::Create()); |
8516 FilterOperations start_filters; | 8516 FilterOperations start_filters; |
8517 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); | 8517 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); |
8518 FilterOperations end_filters; | 8518 FilterOperations end_filters; |
8519 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); | 8519 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); |
8520 curve->AddKeyframe( | 8520 curve->AddKeyframe( |
8521 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); | 8521 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); |
8522 curve->AddKeyframe(FilterKeyframe::Create( | 8522 curve->AddKeyframe(FilterKeyframe::Create( |
8523 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); | 8523 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); |
8524 scoped_ptr<Animation> animation = | 8524 scoped_ptr<Animation> animation = |
8525 Animation::Create(std::move(curve), 0, 1, Animation::FILTER); | 8525 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); |
8526 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 8526 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
8527 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8527 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
8528 | 8528 |
8529 if (layer_settings().use_compositor_animation_timelines) { | 8529 if (layer_settings().use_compositor_animation_timelines) { |
8530 AddAnimationToLayerWithPlayer(child->id(), timeline(), | 8530 AddAnimationToLayerWithPlayer(child->id(), timeline(), |
8531 std::move(animation)); | 8531 std::move(animation)); |
8532 } else { | 8532 } else { |
8533 child->layer_animation_controller()->AddAnimation(std::move(animation)); | 8533 child->layer_animation_controller()->AddAnimation(std::move(animation)); |
8534 } | 8534 } |
8535 ExecuteCalculateDrawProperties(root.get()); | 8535 ExecuteCalculateDrawProperties(root.get()); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8996 | 8996 |
8997 gfx::Transform zero_z_scale; | 8997 gfx::Transform zero_z_scale; |
8998 zero_z_scale.Scale3d(1, 1, 0); | 8998 zero_z_scale.Scale3d(1, 1, 0); |
8999 child->SetTransform(zero_z_scale); | 8999 child->SetTransform(zero_z_scale); |
9000 | 9000 |
9001 // Add a transform animation with a start delay. Now, even though |child| has | 9001 // Add a transform animation with a start delay. Now, even though |child| has |
9002 // a singular transform, the subtree should still get processed. | 9002 // a singular transform, the subtree should still get processed. |
9003 int animation_id = 0; | 9003 int animation_id = 0; |
9004 scoped_ptr<Animation> animation = Animation::Create( | 9004 scoped_ptr<Animation> animation = Animation::Create( |
9005 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), | 9005 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), |
9006 animation_id, 1, Animation::TRANSFORM); | 9006 animation_id, 1, TargetProperty::TRANSFORM); |
9007 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 9007 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
9008 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 9008 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
9009 if (layer_settings().use_compositor_animation_timelines) { | 9009 if (layer_settings().use_compositor_animation_timelines) { |
9010 AddAnimationToLayerWithPlayer(child->id(), timeline(), | 9010 AddAnimationToLayerWithPlayer(child->id(), timeline(), |
9011 std::move(animation)); | 9011 std::move(animation)); |
9012 } else { | 9012 } else { |
9013 child->AddAnimation(std::move(animation)); | 9013 child->AddAnimation(std::move(animation)); |
9014 } | 9014 } |
9015 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9015 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
9016 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9016 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
(...skipping 16 matching lines...) Expand all Loading... |
9033 grandchild->RequestCopyOfOutput( | 9033 grandchild->RequestCopyOfOutput( |
9034 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 9034 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
9035 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9035 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
9036 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9036 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
9037 greatgrandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 9037 greatgrandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
9038 | 9038 |
9039 // Add an opacity animation with a start delay. | 9039 // Add an opacity animation with a start delay. |
9040 animation_id = 1; | 9040 animation_id = 1; |
9041 animation = Animation::Create( | 9041 animation = Animation::Create( |
9042 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 9042 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
9043 animation_id, 1, Animation::OPACITY); | 9043 animation_id, 1, TargetProperty::OPACITY); |
9044 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 9044 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
9045 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 9045 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
9046 if (layer_settings().use_compositor_animation_timelines) { | 9046 if (layer_settings().use_compositor_animation_timelines) { |
9047 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), | 9047 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), |
9048 std::move(animation)); | 9048 std::move(animation)); |
9049 } else { | 9049 } else { |
9050 child->AddAnimation(std::move(animation)); | 9050 child->AddAnimation(std::move(animation)); |
9051 } | 9051 } |
9052 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9052 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
9053 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9053 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10159 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10159 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10160 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10160 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10161 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10161 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10162 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10162 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10163 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10163 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10164 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10164 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10165 } | 10165 } |
10166 | 10166 |
10167 } // namespace | 10167 } // namespace |
10168 } // namespace cc | 10168 } // namespace cc |
OLD | NEW |