| 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/test/test_task_graph_runner.h" | 10 #include "cc/test/test_task_graph_runner.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) { | 61 TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) { |
| 62 scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds()); | 62 scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds()); |
| 63 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(150, 250)); | 63 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(150, 250)); |
| 64 // Change fixed_bounds. | 64 // Change fixed_bounds. |
| 65 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(75, 100)); | 65 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(75, 100)); |
| 66 // Change bounds. | 66 // Change bounds. |
| 67 CheckBoundsScaleSimple(layer.get(), WebSize(300, 100), gfx::Size(75, 100)); | 67 CheckBoundsScaleSimple(layer.get(), WebSize(300, 100), gfx::Size(75, 100)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) { | 70 void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) { |
| 71 gfx::RectF layer1_rect_in_target(layer1->bounds()); | 71 gfx::RectF layer1_rect_in_target(gfx::SizeF(layer1->bounds())); |
| 72 layer1->draw_transform().TransformRect(&layer1_rect_in_target); | 72 layer1->draw_transform().TransformRect(&layer1_rect_in_target); |
| 73 | 73 |
| 74 gfx::RectF layer2_rect_in_target(layer2->bounds()); | 74 gfx::RectF layer2_rect_in_target(gfx::SizeF(layer2->bounds())); |
| 75 layer2->draw_transform().TransformRect(&layer2_rect_in_target); | 75 layer2->draw_transform().TransformRect(&layer2_rect_in_target); |
| 76 | 76 |
| 77 EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target); | 77 EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point, | 80 void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point, |
| 81 const gfx::Transform& transform) { | 81 const gfx::Transform& transform) { |
| 82 const gfx::Size kDeviceViewportSize(800, 600); | 82 const gfx::Size kDeviceViewportSize(800, 600); |
| 83 const float kDeviceScaleFactor = 2.f; | 83 const float kDeviceScaleFactor = 2.f; |
| 84 const float kPageScaleFactor = 1.5f; | 84 const float kPageScaleFactor = 1.5f; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); | 171 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); |
| 172 | 172 |
| 173 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to | 173 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to |
| 174 // WebLayerImpl. | 174 // WebLayerImpl. |
| 175 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); | 175 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace | 178 } // namespace |
| 179 } // namespace cc_blink | 179 } // namespace cc_blink |
| OLD | NEW |