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/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 src->SetLayerTreeHost(layer_tree_host_.get()); | 127 src->SetLayerTreeHost(layer_tree_host_.get()); |
128 | 128 |
129 // The following member is reset during serialization, so store the original | 129 // The following member is reset during serialization, so store the original |
130 // values. | 130 // values. |
131 gfx::Rect update_rect = src->inputs_.update_rect; | 131 gfx::Rect update_rect = src->inputs_.update_rect; |
132 | 132 |
133 // Serialize |src| to protobuf and read the first entry in the | 133 // Serialize |src| to protobuf and read the first entry in the |
134 // LayerUpdate. There are no descendants, so the serialization | 134 // LayerUpdate. There are no descendants, so the serialization |
135 // of |src| is the only entry. | 135 // of |src| is the only entry. |
136 proto::LayerUpdate layer_update; | 136 proto::LayerUpdate layer_update; |
137 src->ToLayerPropertiesProto(&layer_update); | 137 src->ToLayerPropertiesProto(&layer_update, false); |
138 ASSERT_EQ(1, layer_update.layers_size()); | 138 ASSERT_EQ(1, layer_update.layers_size()); |
139 proto::LayerProperties props = layer_update.layers(0); | 139 proto::LayerProperties props = layer_update.layers(0); |
140 | 140 |
141 // The |dest| layer needs to be able to lookup the scroll and clip parents. | 141 // The |dest| layer needs to be able to lookup the scroll and clip parents. |
142 LayerTree* layer_tree = layer_tree_host_->GetLayerTree(); | 142 LayerTree* layer_tree = layer_tree_host_->GetLayerTree(); |
143 if (src->inputs_.scroll_parent) | 143 if (src->inputs_.scroll_parent) |
144 layer_tree->RegisterLayer(src->inputs_.scroll_parent); | 144 layer_tree->RegisterLayer(src->inputs_.scroll_parent); |
145 if (src->scroll_children_) { | 145 if (src->scroll_children_) { |
146 for (auto* child : *(src->scroll_children_)) | 146 for (auto* child : *(src->scroll_children_)) |
147 layer_tree->RegisterLayer(child); | 147 layer_tree->RegisterLayer(child); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 !layer->inputs_.user_scrollable_vertical; | 371 !layer->inputs_.user_scrollable_vertical; |
372 layer->inputs_.scroll_offset = gfx::ScrollOffset(3, 14); | 372 layer->inputs_.scroll_offset = gfx::ScrollOffset(3, 14); |
373 layer->inputs_.update_rect = gfx::Rect(14, 15); | 373 layer->inputs_.update_rect = gfx::Rect(14, 15); |
374 | 374 |
375 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); | 375 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); |
376 } | 376 } |
377 | 377 |
378 void VerifySolidColorScrollbarLayerAfterSerializationAndDeserialization( | 378 void VerifySolidColorScrollbarLayerAfterSerializationAndDeserialization( |
379 scoped_refptr<SolidColorScrollbarLayer> source_scrollbar) { | 379 scoped_refptr<SolidColorScrollbarLayer> source_scrollbar) { |
380 proto::LayerProperties serialized_scrollbar; | 380 proto::LayerProperties serialized_scrollbar; |
381 source_scrollbar->LayerSpecificPropertiesToProto(&serialized_scrollbar); | 381 source_scrollbar->LayerSpecificPropertiesToProto(&serialized_scrollbar, |
| 382 false); |
382 | 383 |
383 scoped_refptr<SolidColorScrollbarLayer> deserialized_scrollbar = | 384 scoped_refptr<SolidColorScrollbarLayer> deserialized_scrollbar = |
384 SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, -1, | 385 SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, -1, |
385 -1, false, Layer::INVALID_ID); | 386 -1, false, Layer::INVALID_ID); |
386 deserialized_scrollbar->inputs_.layer_id = | 387 deserialized_scrollbar->inputs_.layer_id = |
387 source_scrollbar->inputs_.layer_id; | 388 source_scrollbar->inputs_.layer_id; |
388 | 389 |
389 // FromLayerSpecificPropertiesProto expects a non-null LayerTreeHost to be | 390 // FromLayerSpecificPropertiesProto expects a non-null LayerTreeHost to be |
390 // set. | 391 // set. |
391 deserialized_scrollbar->SetLayerTreeHost(layer_tree_host_.get()); | 392 deserialized_scrollbar->SetLayerTreeHost(layer_tree_host_.get()); |
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2558 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
2558 | 2559 |
2559 test_layer->PushPropertiesTo(impl_layer.get()); | 2560 test_layer->PushPropertiesTo(impl_layer.get()); |
2560 | 2561 |
2561 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); | 2562 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); |
2562 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2563 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
2563 } | 2564 } |
2564 | 2565 |
2565 } // namespace | 2566 } // namespace |
2566 } // namespace cc | 2567 } // namespace cc |
OLD | NEW |