| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 layer->inputs_.user_scrollable_vertical = | 353 layer->inputs_.user_scrollable_vertical = |
| 354 !layer->inputs_.user_scrollable_vertical; | 354 !layer->inputs_.user_scrollable_vertical; |
| 355 layer->inputs_.scroll_offset = gfx::ScrollOffset(3, 14); | 355 layer->inputs_.scroll_offset = gfx::ScrollOffset(3, 14); |
| 356 layer->inputs_.update_rect = gfx::Rect(14, 15); | 356 layer->inputs_.update_rect = gfx::Rect(14, 15); |
| 357 | 357 |
| 358 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); | 358 VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void VerifySolidColorScrollbarLayerAfterSerializationAndDeserialization( | 361 void VerifySolidColorScrollbarLayerAfterSerializationAndDeserialization( |
| 362 scoped_refptr<SolidColorScrollbarLayer> source_scrollbar) { | 362 scoped_refptr<SolidColorScrollbarLayer> source_scrollbar) { |
| 363 proto::LayerProperties serialized_scrollbar; | 363 proto::LayerNode serialized_scrollbar_node; |
| 364 source_scrollbar->LayerSpecificPropertiesToProto(&serialized_scrollbar, | 364 source_scrollbar->ToLayerNodeProto(&serialized_scrollbar_node); |
| 365 false); | |
| 366 | 365 |
| 367 scoped_refptr<SolidColorScrollbarLayer> deserialized_scrollbar = | 366 scoped_refptr<SolidColorScrollbarLayer> deserialized_scrollbar = |
| 368 SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, -1, | 367 SolidColorScrollbarLayer::Create(ScrollbarOrientation::HORIZONTAL, -1, |
| 369 -1, false, Layer::INVALID_ID); | 368 -1, false, Layer::INVALID_ID); |
| 370 deserialized_scrollbar->inputs_.layer_id = | 369 deserialized_scrollbar->inputs_.layer_id = |
| 371 source_scrollbar->inputs_.layer_id; | 370 source_scrollbar->inputs_.layer_id; |
| 372 | 371 |
| 373 // FromLayerSpecificPropertiesProto expects a non-null LayerTreeHost to be | 372 // FromLayerSpecificPropertiesProto expects a non-null LayerTreeHost to be |
| 374 // set. | 373 // set. |
| 375 deserialized_scrollbar->SetLayerTreeHost(layer_tree_host_.get()); | 374 Layer::LayerIdMap layer_map; |
| 376 deserialized_scrollbar->FromLayerSpecificPropertiesProto( | 375 deserialized_scrollbar->FromLayerNodeProto( |
| 377 serialized_scrollbar); | 376 serialized_scrollbar_node, layer_map, layer_tree_host_.get()); |
| 378 | 377 |
| 379 EXPECT_EQ(source_scrollbar->solid_color_scrollbar_layer_inputs_.track_start, | 378 EXPECT_EQ(source_scrollbar->solid_color_scrollbar_layer_inputs_.track_start, |
| 380 deserialized_scrollbar->solid_color_scrollbar_layer_inputs_ | 379 deserialized_scrollbar->solid_color_scrollbar_layer_inputs_ |
| 381 .track_start); | 380 .track_start); |
| 382 EXPECT_EQ( | 381 EXPECT_EQ( |
| 383 source_scrollbar->solid_color_scrollbar_layer_inputs_.thumb_thickness, | 382 source_scrollbar->solid_color_scrollbar_layer_inputs_.thumb_thickness, |
| 384 deserialized_scrollbar->solid_color_scrollbar_layer_inputs_ | 383 deserialized_scrollbar->solid_color_scrollbar_layer_inputs_ |
| 385 .thumb_thickness); | 384 .thumb_thickness); |
| 386 EXPECT_EQ( | 385 EXPECT_EQ( |
| 387 source_scrollbar->solid_color_scrollbar_layer_inputs_.scroll_layer_id, | 386 source_scrollbar->solid_color_scrollbar_layer_inputs_.scroll_layer_id, |
| (...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); | 2474 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); |
| 2476 | 2475 |
| 2477 test_layer->PushPropertiesTo(impl_layer.get()); | 2476 test_layer->PushPropertiesTo(impl_layer.get()); |
| 2478 | 2477 |
| 2479 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); | 2478 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); |
| 2480 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); | 2479 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); |
| 2481 } | 2480 } |
| 2482 | 2481 |
| 2483 } // namespace | 2482 } // namespace |
| 2484 } // namespace cc | 2483 } // namespace cc |
| OLD | NEW |