| 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 5347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5358 rotate_transform.Rotate(child_layer_angle); | 5358 rotate_transform.Rotate(child_layer_angle); |
| 5359 rotate_transform.Translate(50.0, 50.0); | 5359 rotate_transform.Translate(50.0, 50.0); |
| 5360 clip_layer->SetTransform(rotate_transform); | 5360 clip_layer->SetTransform(rotate_transform); |
| 5361 | 5361 |
| 5362 // Only allow vertical scrolling. | 5362 // Only allow vertical scrolling. |
| 5363 clip_layer->SetBounds( | 5363 clip_layer->SetBounds( |
| 5364 gfx::Size(child->bounds().width(), child->bounds().height() / 2)); | 5364 gfx::Size(child->bounds().width(), child->bounds().height() / 2)); |
| 5365 // The rotation depends on the layer's transform origin, and the child layer | 5365 // The rotation depends on the layer's transform origin, and the child layer |
| 5366 // is a different size than the clip, so make sure the clip layer's origin | 5366 // is a different size than the clip, so make sure the clip layer's origin |
| 5367 // lines up over the child. | 5367 // lines up over the child. |
| 5368 clip_layer->SetTransformOrigin(gfx::Point3F( | 5368 clip_layer->test_properties()->transform_origin = gfx::Point3F( |
| 5369 clip_layer->bounds().width() * 0.5f, clip_layer->bounds().height(), 0.f)); | 5369 clip_layer->bounds().width() * 0.5f, clip_layer->bounds().height(), 0.f); |
| 5370 LayerImpl* child_ptr = child.get(); | 5370 LayerImpl* child_ptr = child.get(); |
| 5371 clip_layer->AddChild(std::move(child)); | 5371 clip_layer->AddChild(std::move(child)); |
| 5372 scroll_layer->AddChild(std::move(clip_layer)); | 5372 scroll_layer->AddChild(std::move(clip_layer)); |
| 5373 | 5373 |
| 5374 gfx::Size surface_size(50, 50); | 5374 gfx::Size surface_size(50, 50); |
| 5375 host_impl_->SetViewportSize(surface_size); | 5375 host_impl_->SetViewportSize(surface_size); |
| 5376 SetNeedsRebuildPropertyTrees(); | 5376 SetNeedsRebuildPropertyTrees(); |
| 5377 DrawFrame(); | 5377 DrawFrame(); |
| 5378 { | 5378 { |
| 5379 // Scroll down in screen coordinates with a gesture. | 5379 // Scroll down in screen coordinates with a gesture. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5444 perspective_transform.ApplyPerspectiveDepth(20); | 5444 perspective_transform.ApplyPerspectiveDepth(20); |
| 5445 perspective_transform.RotateAboutXAxis(45); | 5445 perspective_transform.RotateAboutXAxis(45); |
| 5446 perspective_transform.Translate(50.0, 50.0); | 5446 perspective_transform.Translate(50.0, 50.0); |
| 5447 clip_layer->SetTransform(perspective_transform); | 5447 clip_layer->SetTransform(perspective_transform); |
| 5448 | 5448 |
| 5449 clip_layer->SetBounds(gfx::Size(child_ptr->bounds().width() / 2, | 5449 clip_layer->SetBounds(gfx::Size(child_ptr->bounds().width() / 2, |
| 5450 child_ptr->bounds().height() / 2)); | 5450 child_ptr->bounds().height() / 2)); |
| 5451 // The transform depends on the layer's transform origin, and the child layer | 5451 // The transform depends on the layer's transform origin, and the child layer |
| 5452 // is a different size than the clip, so make sure the clip layer's origin | 5452 // is a different size than the clip, so make sure the clip layer's origin |
| 5453 // lines up over the child. | 5453 // lines up over the child. |
| 5454 clip_layer->SetTransformOrigin(gfx::Point3F( | 5454 clip_layer->test_properties()->transform_origin = gfx::Point3F( |
| 5455 clip_layer->bounds().width(), clip_layer->bounds().height(), 0.f)); | 5455 clip_layer->bounds().width(), clip_layer->bounds().height(), 0.f); |
| 5456 clip_layer->AddChild(std::move(child)); | 5456 clip_layer->AddChild(std::move(child)); |
| 5457 scroll_layer->AddChild(std::move(clip_layer)); | 5457 scroll_layer->AddChild(std::move(clip_layer)); |
| 5458 | 5458 |
| 5459 gfx::Size surface_size(50, 50); | 5459 gfx::Size surface_size(50, 50); |
| 5460 host_impl_->SetViewportSize(surface_size); | 5460 host_impl_->SetViewportSize(surface_size); |
| 5461 | 5461 |
| 5462 std::unique_ptr<ScrollAndScaleSet> scroll_info; | 5462 std::unique_ptr<ScrollAndScaleSet> scroll_info; |
| 5463 | 5463 |
| 5464 gfx::Vector2d gesture_scroll_deltas[4]; | 5464 gfx::Vector2d gesture_scroll_deltas[4]; |
| 5465 gesture_scroll_deltas[0] = gfx::Vector2d(4, 10); | 5465 gesture_scroll_deltas[0] = gfx::Vector2d(4, 10); |
| (...skipping 5203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10669 // There should not be any jitter measured till we hit the fixed point hits | 10669 // There should not be any jitter measured till we hit the fixed point hits |
| 10670 // threshold. | 10670 // threshold. |
| 10671 float expected_jitter = | 10671 float expected_jitter = |
| 10672 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10672 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10673 EXPECT_EQ(jitter, expected_jitter); | 10673 EXPECT_EQ(jitter, expected_jitter); |
| 10674 } | 10674 } |
| 10675 } | 10675 } |
| 10676 | 10676 |
| 10677 } // namespace | 10677 } // namespace |
| 10678 } // namespace cc | 10678 } // namespace cc |
| OLD | NEW |