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/layer_settings.h" | |
8 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
9 #include "cc/test/fake_layer_tree_host.h" | 8 #include "cc/test/fake_layer_tree_host.h" |
10 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
11 #include "cc/test/test_task_graph_runner.h" | 10 #include "cc/test/test_task_graph_runner.h" |
12 #include "cc/trees/layer_tree_host_common.h" | 11 #include "cc/trees/layer_tree_host_common.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 13 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
15 #include "third_party/WebKit/public/platform/WebSize.h" | 14 #include "third_party/WebKit/public/platform/WebSize.h" |
16 #include "third_party/skia/include/utils/SkMatrix44.h" | 15 #include "third_party/skia/include/utils/SkMatrix44.h" |
17 #include "ui/gfx/geometry/point3_f.h" | 16 #include "ui/gfx/geometry/point3_f.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 const gfx::Size kDeviceViewportSize(800, 600); | 82 const gfx::Size kDeviceViewportSize(800, 600); |
84 const float kDeviceScaleFactor = 2.f; | 83 const float kDeviceScaleFactor = 2.f; |
85 const float kPageScaleFactor = 1.5f; | 84 const float kPageScaleFactor = 1.5f; |
86 | 85 |
87 WebSize bounds(150, 200); | 86 WebSize bounds(150, 200); |
88 WebFloatPoint position(20, 30); | 87 WebFloatPoint position(20, 30); |
89 gfx::Size fixed_bounds(160, 70); | 88 gfx::Size fixed_bounds(160, 70); |
90 | 89 |
91 scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); | 90 scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); |
92 | 91 |
93 WebLayerImplFixedBounds* fixed_bounds_layer = new WebLayerImplFixedBounds( | 92 WebLayerImplFixedBounds* fixed_bounds_layer = |
94 cc::PictureImageLayer::Create(cc::LayerSettings())); | 93 new WebLayerImplFixedBounds(cc::PictureImageLayer::Create()); |
95 fixed_bounds_layer->setBounds(bounds); | 94 fixed_bounds_layer->setBounds(bounds); |
96 fixed_bounds_layer->SetFixedBounds(fixed_bounds); | 95 fixed_bounds_layer->SetFixedBounds(fixed_bounds); |
97 fixed_bounds_layer->setTransform(transform.matrix()); | 96 fixed_bounds_layer->setTransform(transform.matrix()); |
98 fixed_bounds_layer->setPosition(position); | 97 fixed_bounds_layer->setPosition(position); |
99 root_layer->addChild(fixed_bounds_layer); | 98 root_layer->addChild(fixed_bounds_layer); |
100 | 99 |
101 WebLayerImpl* normal_layer( | 100 WebLayerImpl* normal_layer(new WebLayerImpl(cc::PictureImageLayer::Create())); |
102 new WebLayerImpl(cc::PictureImageLayer::Create(cc::LayerSettings()))); | |
103 | 101 |
104 normal_layer->setBounds(bounds); | 102 normal_layer->setBounds(bounds); |
105 normal_layer->setTransform(transform.matrix()); | 103 normal_layer->setTransform(transform.matrix()); |
106 normal_layer->setPosition(position); | 104 normal_layer->setPosition(position); |
107 root_layer->addChild(normal_layer); | 105 root_layer->addChild(normal_layer); |
108 | 106 |
109 cc::FakeLayerTreeHostClient client(cc::FakeLayerTreeHostClient::DIRECT_3D); | 107 cc::FakeLayerTreeHostClient client(cc::FakeLayerTreeHostClient::DIRECT_3D); |
110 cc::TestTaskGraphRunner task_graph_runner; | 108 cc::TestTaskGraphRunner task_graph_runner; |
111 scoped_ptr<cc::FakeLayerTreeHost> host = | 109 scoped_ptr<cc::FakeLayerTreeHost> host = |
112 cc::FakeLayerTreeHost::Create(&client, &task_graph_runner); | 110 cc::FakeLayerTreeHost::Create(&client, &task_graph_runner); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 169 |
172 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); | 170 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); |
173 | 171 |
174 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to | 172 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to |
175 // WebLayerImpl. | 173 // WebLayerImpl. |
176 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); | 174 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); |
177 } | 175 } |
178 | 176 |
179 } // namespace | 177 } // namespace |
180 } // namespace cc_blink | 178 } // namespace cc_blink |
OLD | NEW |