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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 layer_tree_host_ = nullptr; | 95 layer_tree_host_ = nullptr; |
96 } | 96 } |
97 | 97 |
98 // Serializes |src| to proto and back again to a Layer, then verifies that | 98 // Serializes |src| to proto and back again to a Layer, then verifies that |
99 // the two Layers are equal for serialization purposes. | 99 // the two Layers are equal for serialization purposes. |
100 void VerifyBaseLayerPropertiesSerializationAndDeserialization(Layer* src) { | 100 void VerifyBaseLayerPropertiesSerializationAndDeserialization(Layer* src) { |
101 // This is required to ensure that properties are serialized. | 101 // This is required to ensure that properties are serialized. |
102 src->SetNeedsPushProperties(); | 102 src->SetNeedsPushProperties(); |
103 src->SetLayerTreeHost(layer_tree_host_.get()); | 103 src->SetLayerTreeHost(layer_tree_host_.get()); |
104 | 104 |
105 // The following two members are reset during serialization, so | 105 // The following member is reset during serialization, so store the original |
106 // store the original values. | 106 // values. |
107 bool stacking_order_changed = src->stacking_order_changed_; | |
108 gfx::Rect update_rect = src->update_rect_; | 107 gfx::Rect update_rect = src->update_rect_; |
109 | 108 |
110 // Serialize |src| to protobuf and read the first entry in the | 109 // Serialize |src| to protobuf and read the first entry in the |
111 // LayerUpdate. There are no descendants, so the serialization | 110 // LayerUpdate. There are no descendants, so the serialization |
112 // of |src| is the only entry. | 111 // of |src| is the only entry. |
113 proto::LayerUpdate layer_update; | 112 proto::LayerUpdate layer_update; |
114 EXPECT_FALSE(src->ToLayerPropertiesProto(&layer_update)); | 113 EXPECT_FALSE(src->ToLayerPropertiesProto(&layer_update)); |
115 ASSERT_EQ(1, layer_update.layers_size()); | 114 ASSERT_EQ(1, layer_update.layers_size()); |
116 proto::LayerProperties props = layer_update.layers(0); | 115 proto::LayerProperties props = layer_update.layers(0); |
117 | 116 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 EXPECT_EQ(src->num_descendants_that_draw_content_, | 177 EXPECT_EQ(src->num_descendants_that_draw_content_, |
179 dest->num_descendants_that_draw_content_); | 178 dest->num_descendants_that_draw_content_); |
180 EXPECT_EQ(src->scroll_clip_layer_id_, dest->scroll_clip_layer_id_); | 179 EXPECT_EQ(src->scroll_clip_layer_id_, dest->scroll_clip_layer_id_); |
181 EXPECT_EQ(src->user_scrollable_horizontal_, | 180 EXPECT_EQ(src->user_scrollable_horizontal_, |
182 dest->user_scrollable_horizontal_); | 181 dest->user_scrollable_horizontal_); |
183 EXPECT_EQ(src->user_scrollable_vertical_, dest->user_scrollable_vertical_); | 182 EXPECT_EQ(src->user_scrollable_vertical_, dest->user_scrollable_vertical_); |
184 EXPECT_EQ(src->scroll_offset_, dest->scroll_offset_); | 183 EXPECT_EQ(src->scroll_offset_, dest->scroll_offset_); |
185 EXPECT_EQ(src->scroll_compensation_adjustment_, | 184 EXPECT_EQ(src->scroll_compensation_adjustment_, |
186 dest->scroll_compensation_adjustment_); | 185 dest->scroll_compensation_adjustment_); |
187 EXPECT_EQ(update_rect, dest->update_rect_); | 186 EXPECT_EQ(update_rect, dest->update_rect_); |
188 EXPECT_EQ(stacking_order_changed, dest->stacking_order_changed_); | |
189 | 187 |
190 if (src->scroll_parent_) { | 188 if (src->scroll_parent_) { |
191 ASSERT_TRUE(dest->scroll_parent_); | 189 ASSERT_TRUE(dest->scroll_parent_); |
192 EXPECT_EQ(src->scroll_parent_->id(), dest->scroll_parent_->id()); | 190 EXPECT_EQ(src->scroll_parent_->id(), dest->scroll_parent_->id()); |
193 } else { | 191 } else { |
194 EXPECT_FALSE(dest->scroll_parent_); | 192 EXPECT_FALSE(dest->scroll_parent_); |
195 } | 193 } |
196 if (src->scroll_children_) { | 194 if (src->scroll_children_) { |
197 ASSERT_TRUE(dest->scroll_children_); | 195 ASSERT_TRUE(dest->scroll_children_); |
198 EXPECT_EQ(*(src->scroll_children_), *(dest->scroll_children_)); | 196 EXPECT_EQ(*(src->scroll_children_), *(dest->scroll_children_)); |
199 } else { | 197 } else { |
200 EXPECT_FALSE(dest->scroll_children_); | 198 EXPECT_FALSE(dest->scroll_children_); |
201 } | 199 } |
202 | 200 |
203 if (src->clip_parent_) { | 201 if (src->clip_parent_) { |
204 ASSERT_TRUE(dest->clip_parent_); | 202 ASSERT_TRUE(dest->clip_parent_); |
205 EXPECT_EQ(src->clip_parent_->id(), dest->clip_parent_->id()); | 203 EXPECT_EQ(src->clip_parent_->id(), dest->clip_parent_->id()); |
206 } else { | 204 } else { |
207 ASSERT_FALSE(dest->clip_parent_); | 205 ASSERT_FALSE(dest->clip_parent_); |
208 } | 206 } |
209 if (src->clip_children_) { | 207 if (src->clip_children_) { |
210 ASSERT_TRUE(dest->clip_children_); | 208 ASSERT_TRUE(dest->clip_children_); |
211 EXPECT_EQ(*(src->clip_children_), *(dest->clip_children_)); | 209 EXPECT_EQ(*(src->clip_children_), *(dest->clip_children_)); |
212 } else { | 210 } else { |
213 EXPECT_FALSE(dest->clip_children_); | 211 EXPECT_FALSE(dest->clip_children_); |
214 } | 212 } |
215 | 213 |
216 // The following two members should have been reset during serialization. | 214 // The following member should have been reset during serialization. |
217 EXPECT_FALSE(src->stacking_order_changed_); | |
218 EXPECT_EQ(gfx::Rect(), src->update_rect_); | 215 EXPECT_EQ(gfx::Rect(), src->update_rect_); |
219 | 216 |
220 // Before deleting |dest|, the LayerTreeHost must be unset. | 217 // Before deleting |dest|, the LayerTreeHost must be unset. |
221 dest->SetLayerTreeHost(nullptr); | 218 dest->SetLayerTreeHost(nullptr); |
222 | 219 |
223 // Cleanup scroll tree. | 220 // Cleanup scroll tree. |
224 if (src->scroll_parent_) | 221 if (src->scroll_parent_) |
225 layer_tree_host_->UnregisterLayer(src->scroll_parent_); | 222 layer_tree_host_->UnregisterLayer(src->scroll_parent_); |
226 src->scroll_parent_ = nullptr; | 223 src->scroll_parent_ = nullptr; |
227 dest->scroll_parent_ = nullptr; | 224 dest->scroll_parent_ = nullptr; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 layer->transform_ = transform; | 283 layer->transform_ = transform; |
287 layer->transform_is_invertible_ = true; | 284 layer->transform_is_invertible_ = true; |
288 layer->sorting_context_id_ = 0; | 285 layer->sorting_context_id_ = 0; |
289 layer->num_descendants_that_draw_content_ = 5; | 286 layer->num_descendants_that_draw_content_ = 5; |
290 layer->scroll_clip_layer_id_ = Layer::INVALID_ID; | 287 layer->scroll_clip_layer_id_ = Layer::INVALID_ID; |
291 layer->user_scrollable_horizontal_ = false; | 288 layer->user_scrollable_horizontal_ = false; |
292 layer->user_scrollable_vertical_ = true; | 289 layer->user_scrollable_vertical_ = true; |
293 layer->scroll_offset_ = gfx::ScrollOffset(3, 14); | 290 layer->scroll_offset_ = gfx::ScrollOffset(3, 14); |
294 layer->scroll_compensation_adjustment_ = gfx::Vector2dF(6.28f, 3.14f); | 291 layer->scroll_compensation_adjustment_ = gfx::Vector2dF(6.28f, 3.14f); |
295 layer->update_rect_ = gfx::Rect(14, 15); | 292 layer->update_rect_ = gfx::Rect(14, 15); |
296 layer->stacking_order_changed_ = true; | |
297 | 293 |
298 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); | 294 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); |
299 } | 295 } |
300 | 296 |
301 void RunAllMembersChangedTest() { | 297 void RunAllMembersChangedTest() { |
302 scoped_refptr<Layer> layer = Layer::Create(LayerSettings()); | 298 scoped_refptr<Layer> layer = Layer::Create(LayerSettings()); |
303 layer->transform_origin_ = gfx::Point3F(3.0f, 1.0f, 4.0f); | 299 layer->transform_origin_ = gfx::Point3F(3.0f, 1.0f, 4.0f); |
304 layer->background_color_ = SK_ColorRED; | 300 layer->background_color_ = SK_ColorRED; |
305 layer->bounds_ = gfx::Size(3, 14); | 301 layer->bounds_ = gfx::Size(3, 14); |
306 layer->transform_tree_index_ = 39; | 302 layer->transform_tree_index_ = 39; |
(...skipping 30 matching lines...) Expand all Loading... |
337 layer->transform_ = transform; | 333 layer->transform_ = transform; |
338 layer->transform_is_invertible_ = !layer->transform_is_invertible_; | 334 layer->transform_is_invertible_ = !layer->transform_is_invertible_; |
339 layer->sorting_context_id_ = 42; | 335 layer->sorting_context_id_ = 42; |
340 layer->num_descendants_that_draw_content_ = 5; | 336 layer->num_descendants_that_draw_content_ = 5; |
341 layer->scroll_clip_layer_id_ = 17; | 337 layer->scroll_clip_layer_id_ = 17; |
342 layer->user_scrollable_horizontal_ = !layer->user_scrollable_horizontal_; | 338 layer->user_scrollable_horizontal_ = !layer->user_scrollable_horizontal_; |
343 layer->user_scrollable_vertical_ = !layer->user_scrollable_vertical_; | 339 layer->user_scrollable_vertical_ = !layer->user_scrollable_vertical_; |
344 layer->scroll_offset_ = gfx::ScrollOffset(3, 14); | 340 layer->scroll_offset_ = gfx::ScrollOffset(3, 14); |
345 layer->scroll_compensation_adjustment_ = gfx::Vector2dF(6.28f, 3.14f); | 341 layer->scroll_compensation_adjustment_ = gfx::Vector2dF(6.28f, 3.14f); |
346 layer->update_rect_ = gfx::Rect(14, 15); | 342 layer->update_rect_ = gfx::Rect(14, 15); |
347 layer->stacking_order_changed_ = !layer->stacking_order_changed_; | |
348 | 343 |
349 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); | 344 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); |
350 } | 345 } |
351 | 346 |
352 void RunScrollAndClipLayersTest() { | 347 void RunScrollAndClipLayersTest() { |
353 scoped_refptr<Layer> layer = Layer::Create(LayerSettings()); | 348 scoped_refptr<Layer> layer = Layer::Create(LayerSettings()); |
354 | 349 |
355 scoped_refptr<Layer> scroll_parent = Layer::Create(LayerSettings()); | 350 scoped_refptr<Layer> scroll_parent = Layer::Create(LayerSettings()); |
356 layer->scroll_parent_ = scroll_parent.get(); | 351 layer->scroll_parent_ = scroll_parent.get(); |
357 scoped_refptr<Layer> scroll_child = Layer::Create(LayerSettings()); | 352 scoped_refptr<Layer> scroll_child = Layer::Create(LayerSettings()); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 node = layer_tree_host_->property_trees()->transform_tree.Node( | 1034 node = layer_tree_host_->property_trees()->transform_tree.Node( |
1040 child->transform_tree_index()); | 1035 child->transform_tree_index()); |
1041 EXPECT_FALSE(node->data.transform_changed); | 1036 EXPECT_FALSE(node->data.transform_changed); |
1042 | 1037 |
1043 gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f); | 1038 gfx::Point3F arbitrary_point_3f = gfx::Point3F(0.125f, 0.25f, 0.f); |
1044 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 1039 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
1045 root->SetTransformOrigin(arbitrary_point_3f); | 1040 root->SetTransformOrigin(arbitrary_point_3f); |
1046 node = layer_tree_host_->property_trees()->transform_tree.Node( | 1041 node = layer_tree_host_->property_trees()->transform_tree.Node( |
1047 root->transform_tree_index()); | 1042 root->transform_tree_index()); |
1048 EXPECT_TRUE(node->data.transform_changed); | 1043 EXPECT_TRUE(node->data.transform_changed); |
| 1044 EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( |
| 1045 root->PushPropertiesTo(root_impl.get()); |
| 1046 child->PushPropertiesTo(child_impl.get()); |
| 1047 child2->PushPropertiesTo(child2_impl.get()); |
| 1048 grand_child->PushPropertiesTo(grand_child_impl.get()); |
| 1049 layer_tree_host_->property_trees()->transform_tree.ResetChangeTracking()); |
| 1050 |
| 1051 gfx::Transform arbitrary_transform; |
| 1052 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); |
| 1053 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
| 1054 root->SetTransform(arbitrary_transform); |
| 1055 node = layer_tree_host_->property_trees()->transform_tree.Node( |
| 1056 root->transform_tree_index()); |
| 1057 EXPECT_TRUE(node->data.transform_changed); |
1049 } | 1058 } |
1050 | 1059 |
1051 TEST_F(LayerTest, AddAndRemoveChild) { | 1060 TEST_F(LayerTest, AddAndRemoveChild) { |
1052 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); | 1061 scoped_refptr<Layer> parent = Layer::Create(layer_settings_); |
1053 scoped_refptr<Layer> child = Layer::Create(layer_settings_); | 1062 scoped_refptr<Layer> child = Layer::Create(layer_settings_); |
1054 | 1063 |
1055 // Upon creation, layers should not have children or parent. | 1064 // Upon creation, layers should not have children or parent. |
1056 ASSERT_EQ(0U, parent->children().size()); | 1065 ASSERT_EQ(0U, parent->children().size()); |
1057 EXPECT_FALSE(child->parent()); | 1066 EXPECT_FALSE(child->parent()); |
1058 | 1067 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); | 1600 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.5f)); |
1592 | 1601 |
1593 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | 1602 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); |
1594 | 1603 |
1595 test_layer->PushPropertiesTo(impl_layer.get()); | 1604 test_layer->PushPropertiesTo(impl_layer.get()); |
1596 | 1605 |
1597 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); | 1606 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); |
1598 } | 1607 } |
1599 | 1608 |
1600 TEST_F(LayerTest, | 1609 TEST_F(LayerTest, |
1601 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyTransformAnim) { | |
1602 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); | |
1603 scoped_ptr<LayerImpl> impl_layer = | |
1604 LayerImpl::Create(host_impl_.active_tree(), 1); | |
1605 | |
1606 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, | |
1607 layer_tree_host_->SetRootLayer(test_layer)); | |
1608 | |
1609 scoped_ptr<AnimationRegistrar> registrar; | |
1610 if (settings().use_compositor_animation_timelines) { | |
1611 AddAnimatedTransformToLayerWithPlayer(impl_layer->id(), timeline_impl(), | |
1612 1.0, 0, 100); | |
1613 } else { | |
1614 registrar = AnimationRegistrar::Create(); | |
1615 impl_layer->layer_animation_controller()->SetAnimationRegistrar( | |
1616 registrar.get()); | |
1617 | |
1618 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), | |
1619 1.0, 0, 100); | |
1620 } | |
1621 | |
1622 gfx::Transform transform; | |
1623 transform.Rotate(45.0); | |
1624 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform)); | |
1625 | |
1626 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1627 test_layer->PushPropertiesTo(impl_layer.get()); | |
1628 EXPECT_TRUE(impl_layer->LayerPropertyChanged()); | |
1629 | |
1630 impl_layer->ResetAllChangeTrackingForSubtree(); | |
1631 if (settings().use_compositor_animation_timelines) { | |
1632 int animation_id = AddAnimatedTransformToLayerWithPlayer( | |
1633 impl_layer->id(), timeline_impl(), 1.0, 0, 100); | |
1634 GetAnimationFromLayerWithExistingPlayer(impl_layer->id(), timeline_impl(), | |
1635 animation_id) | |
1636 ->set_is_impl_only(true); | |
1637 } else { | |
1638 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), | |
1639 1.0, 0, 100); | |
1640 impl_layer->layer_animation_controller() | |
1641 ->GetAnimation(Animation::TRANSFORM) | |
1642 ->set_is_impl_only(true); | |
1643 } | |
1644 transform.Rotate(45.0); | |
1645 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(transform)); | |
1646 | |
1647 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1648 test_layer->PushPropertiesTo(impl_layer.get()); | |
1649 EXPECT_FALSE(impl_layer->LayerPropertyChanged()); | |
1650 } | |
1651 | |
1652 TEST_F(LayerTest, | |
1653 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { | 1610 PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { |
1654 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); | 1611 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); |
1655 scoped_ptr<LayerImpl> impl_layer = | 1612 scoped_ptr<LayerImpl> impl_layer = |
1656 LayerImpl::Create(host_impl_.active_tree(), 1); | 1613 LayerImpl::Create(host_impl_.active_tree(), 1); |
1657 | 1614 |
1658 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, | 1615 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, |
1659 layer_tree_host_->SetRootLayer(test_layer)); | 1616 layer_tree_host_->SetRootLayer(test_layer)); |
1660 | 1617 |
1661 scoped_ptr<AnimationRegistrar> registrar; | 1618 scoped_ptr<AnimationRegistrar> registrar; |
1662 if (settings().use_compositor_animation_timelines) { | 1619 if (settings().use_compositor_animation_timelines) { |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 scoped_refptr<Layer> layer_src_b_replica = Layer::Create(LayerSettings()); | 2495 scoped_refptr<Layer> layer_src_b_replica = Layer::Create(LayerSettings()); |
2539 scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings()); | 2496 scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings()); |
2540 scoped_refptr<Layer> layer_src_d = Layer::Create(LayerSettings()); | 2497 scoped_refptr<Layer> layer_src_d = Layer::Create(LayerSettings()); |
2541 layer_src_root->AddChild(layer_src_a); | 2498 layer_src_root->AddChild(layer_src_a); |
2542 layer_src_root->AddChild(layer_src_b); | 2499 layer_src_root->AddChild(layer_src_b); |
2543 layer_src_a->AddChild(layer_src_c); | 2500 layer_src_a->AddChild(layer_src_c); |
2544 layer_src_b->AddChild(layer_src_d); | 2501 layer_src_b->AddChild(layer_src_d); |
2545 layer_src_b->SetMaskLayer(layer_src_b_mask.get()); | 2502 layer_src_b->SetMaskLayer(layer_src_b_mask.get()); |
2546 layer_src_b->SetReplicaLayer(layer_src_b_replica.get()); | 2503 layer_src_b->SetReplicaLayer(layer_src_b_replica.get()); |
2547 | 2504 |
| 2505 proto::LayerUpdate layer_update_root; |
| 2506 // Only layers with descendants that require pushing properties will |
| 2507 // return true from ToLayerPropertiesProto and AddChild will change the |
| 2508 // stacking order of child which will make it push properties. |
| 2509 EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root)); |
| 2510 proto::LayerUpdate layer_update_a; |
| 2511 EXPECT_TRUE(layer_src_a->ToLayerPropertiesProto(&layer_update_a)); |
| 2512 proto::LayerUpdate layer_update_b; |
| 2513 EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b)); |
| 2514 proto::LayerUpdate layer_update_c; |
| 2515 EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c)); |
| 2516 proto::LayerUpdate layer_update_d; |
| 2517 EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d)); |
| 2518 layer_update_root.Clear(); |
| 2519 layer_update_a.Clear(); |
| 2520 layer_update_b.Clear(); |
| 2521 layer_update_c.Clear(); |
| 2522 layer_update_d.Clear(); |
| 2523 |
2548 layer_src_a->SetNeedsPushProperties(); | 2524 layer_src_a->SetNeedsPushProperties(); |
2549 layer_src_b->SetNeedsPushProperties(); | 2525 layer_src_b->SetNeedsPushProperties(); |
2550 layer_src_b_mask->SetNeedsPushProperties(); | 2526 layer_src_b_mask->SetNeedsPushProperties(); |
2551 layer_src_d->SetNeedsPushProperties(); | 2527 layer_src_d->SetNeedsPushProperties(); |
2552 | 2528 |
2553 // Only layers with descendants that require pushing properties will | 2529 // Only layers with descendants that require pushing properties will |
2554 // return true from ToLayerPropertiesProto. | 2530 // return true from ToLayerPropertiesProto. |
2555 proto::LayerUpdate layer_update_root; | |
2556 EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root)); | 2531 EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root)); |
2557 proto::LayerUpdate layer_update_a; | |
2558 EXPECT_FALSE(layer_src_a->ToLayerPropertiesProto(&layer_update_a)); | 2532 EXPECT_FALSE(layer_src_a->ToLayerPropertiesProto(&layer_update_a)); |
2559 proto::LayerUpdate layer_update_b; | |
2560 EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b)); | 2533 EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b)); |
2561 proto::LayerUpdate layer_update_b_mask; | 2534 proto::LayerUpdate layer_update_b_mask; |
2562 EXPECT_FALSE(layer_src_b_mask->ToLayerPropertiesProto(&layer_update_b_mask)); | 2535 EXPECT_FALSE(layer_src_b_mask->ToLayerPropertiesProto(&layer_update_b_mask)); |
2563 proto::LayerUpdate layer_update_b_replica; | 2536 proto::LayerUpdate layer_update_b_replica; |
2564 EXPECT_FALSE( | 2537 EXPECT_FALSE( |
2565 layer_src_b_replica->ToLayerPropertiesProto(&layer_update_b_replica)); | 2538 layer_src_b_replica->ToLayerPropertiesProto(&layer_update_b_replica)); |
2566 proto::LayerUpdate layer_update_c; | |
2567 EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c)); | 2539 EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c)); |
2568 proto::LayerUpdate layer_update_d; | |
2569 EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d)); | 2540 EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d)); |
2570 | 2541 |
2571 // All flags for pushing properties should have been cleared. | 2542 // All flags for pushing properties should have been cleared. |
2572 EXPECT_FALSE(layer_src_root->needs_push_properties()); | 2543 EXPECT_FALSE(layer_src_root->needs_push_properties()); |
2573 EXPECT_FALSE(layer_src_root->descendant_needs_push_properties()); | 2544 EXPECT_FALSE(layer_src_root->descendant_needs_push_properties()); |
2574 EXPECT_FALSE(layer_src_a->needs_push_properties()); | 2545 EXPECT_FALSE(layer_src_a->needs_push_properties()); |
2575 EXPECT_FALSE(layer_src_a->descendant_needs_push_properties()); | 2546 EXPECT_FALSE(layer_src_a->descendant_needs_push_properties()); |
2576 EXPECT_FALSE(layer_src_b->needs_push_properties()); | 2547 EXPECT_FALSE(layer_src_b->needs_push_properties()); |
2577 EXPECT_FALSE(layer_src_b->descendant_needs_push_properties()); | 2548 EXPECT_FALSE(layer_src_b->descendant_needs_push_properties()); |
2578 EXPECT_FALSE(layer_src_b_mask->needs_push_properties()); | 2549 EXPECT_FALSE(layer_src_b_mask->needs_push_properties()); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2662 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
2692 | 2663 |
2693 test_layer->PushPropertiesTo(impl_layer.get()); | 2664 test_layer->PushPropertiesTo(impl_layer.get()); |
2694 | 2665 |
2695 EXPECT_EQ(2lu, impl_layer->element_id()); | 2666 EXPECT_EQ(2lu, impl_layer->element_id()); |
2696 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2667 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
2697 } | 2668 } |
2698 | 2669 |
2699 } // namespace | 2670 } // namespace |
2700 } // namespace cc | 2671 } // namespace cc |
OLD | NEW |