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