OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
6 #include "cc/blink/web_layer_impl_fixed_bounds.h" | 6 #include "cc/blink/web_layer_impl_fixed_bounds.h" |
7 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
8 #include "cc/test/fake_layer_tree_host.h" | 8 #include "cc/test/fake_layer_tree_host.h" |
9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
10 #include "cc/trees/layer_tree_host_common.h" | 10 #include "cc/trees/layer_tree_host_common.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const gfx::Size kDeviceViewportSize(800, 600); | 81 const gfx::Size kDeviceViewportSize(800, 600); |
82 const float kDeviceScaleFactor = 2.f; | 82 const float kDeviceScaleFactor = 2.f; |
83 const float kPageScaleFactor = 1.5f; | 83 const float kPageScaleFactor = 1.5f; |
84 | 84 |
85 WebSize bounds(150, 200); | 85 WebSize bounds(150, 200); |
86 WebFloatPoint position(20, 30); | 86 WebFloatPoint position(20, 30); |
87 gfx::Size fixed_bounds(160, 70); | 87 gfx::Size fixed_bounds(160, 70); |
88 | 88 |
89 scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); | 89 scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); |
90 | 90 |
91 WebLayerImplFixedBounds* fixed_bounds_layer = | 91 WebLayerImplFixedBounds* fixed_bounds_layer = new WebLayerImplFixedBounds( |
92 new WebLayerImplFixedBounds(cc::PictureImageLayer::Create()); | 92 cc::PictureImageLayer::Create(WebLayerImpl::LayerSettings())); |
93 fixed_bounds_layer->setBounds(bounds); | 93 fixed_bounds_layer->setBounds(bounds); |
94 fixed_bounds_layer->SetFixedBounds(fixed_bounds); | 94 fixed_bounds_layer->SetFixedBounds(fixed_bounds); |
95 fixed_bounds_layer->setTransform(transform.matrix()); | 95 fixed_bounds_layer->setTransform(transform.matrix()); |
96 fixed_bounds_layer->setPosition(position); | 96 fixed_bounds_layer->setPosition(position); |
97 root_layer->addChild(fixed_bounds_layer); | 97 root_layer->addChild(fixed_bounds_layer); |
98 | 98 |
99 WebLayerImpl* normal_layer(new WebLayerImpl(cc::PictureImageLayer::Create())); | 99 WebLayerImpl* normal_layer( |
| 100 new WebLayerImpl(cc::PictureImageLayer::Create(cc::LayerSettings()))); |
100 | 101 |
101 normal_layer->setBounds(bounds); | 102 normal_layer->setBounds(bounds); |
102 normal_layer->setTransform(transform.matrix()); | 103 normal_layer->setTransform(transform.matrix()); |
103 normal_layer->setPosition(position); | 104 normal_layer->setPosition(position); |
104 root_layer->addChild(normal_layer); | 105 root_layer->addChild(normal_layer); |
105 | 106 |
106 cc::FakeLayerTreeHostClient client(cc::FakeLayerTreeHostClient::DIRECT_3D); | 107 cc::FakeLayerTreeHostClient client(cc::FakeLayerTreeHostClient::DIRECT_3D); |
107 scoped_ptr<cc::FakeLayerTreeHost> host = | 108 scoped_ptr<cc::FakeLayerTreeHost> host = |
108 cc::FakeLayerTreeHost::Create(&client); | 109 cc::FakeLayerTreeHost::Create(&client); |
109 host->SetRootLayer(root_layer->layer()); | 110 host->SetRootLayer(root_layer->layer()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 170 |
170 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); | 171 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); |
171 | 172 |
172 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to | 173 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to |
173 // WebLayerImpl. | 174 // WebLayerImpl. |
174 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); | 175 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); |
175 } | 176 } |
176 | 177 |
177 } // namespace | 178 } // namespace |
178 } // namespace cc_blink | 179 } // namespace cc_blink |
OLD | NEW |