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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 8161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8172 external_viewport, | 8172 external_viewport, |
8173 external_transform, | 8173 external_transform, |
8174 resourceless_software_draw); | 8174 resourceless_software_draw); |
8175 DrawFrame(); | 8175 DrawFrame(); |
8176 EXPECT_TRANSFORMATION_MATRIX_EQ( | 8176 EXPECT_TRANSFORMATION_MATRIX_EQ( |
8177 external_transform, layer->draw_properties().target_space_transform); | 8177 external_transform, layer->draw_properties().target_space_transform); |
8178 } | 8178 } |
8179 | 8179 |
8180 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { | 8180 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
8181 SetupScrollAndContentsLayers(gfx::Size(100, 200)); | 8181 SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
| 8182 |
| 8183 // Shrink the outer viewport clip layer so that the outer viewport can scroll. |
| 8184 host_impl_->OuterViewportScrollLayer()->parent()->SetBounds( |
| 8185 gfx::Size(50, 100)); |
| 8186 |
8182 DrawFrame(); | 8187 DrawFrame(); |
8183 | 8188 |
8184 base::TimeTicks start_time = | 8189 base::TimeTicks start_time = |
8185 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); | 8190 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); |
8186 | 8191 |
8187 BeginFrameArgs begin_frame_args = | 8192 BeginFrameArgs begin_frame_args = |
8188 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 8193 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
8189 | 8194 |
8190 EXPECT_EQ(InputHandler::SCROLL_STARTED, | 8195 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
8191 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); | 8196 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); |
8192 | 8197 |
8193 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); | 8198 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
| 8199 EXPECT_EQ(host_impl_->OuterViewportScrollLayer(), scrolling_layer); |
8194 | 8200 |
8195 begin_frame_args.frame_time = start_time; | 8201 begin_frame_args.frame_time = start_time; |
8196 host_impl_->WillBeginImplFrame(begin_frame_args); | 8202 host_impl_->WillBeginImplFrame(begin_frame_args); |
8197 host_impl_->Animate(); | 8203 host_impl_->Animate(); |
8198 host_impl_->UpdateAnimationState(true); | 8204 host_impl_->UpdateAnimationState(true); |
8199 | 8205 |
8200 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); | 8206 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); |
8201 host_impl_->DidFinishImplFrame(); | 8207 host_impl_->DidFinishImplFrame(); |
8202 | 8208 |
8203 begin_frame_args.frame_time = | 8209 begin_frame_args.frame_time = |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8768 host_impl_->ActivateSyncTree(); | 8774 host_impl_->ActivateSyncTree(); |
8769 host_impl_->active_tree()->UpdateDrawProperties(false); | 8775 host_impl_->active_tree()->UpdateDrawProperties(false); |
8770 active_tree_node = | 8776 active_tree_node = |
8771 host_impl_->active_tree()->property_trees()->transform_tree.Node( | 8777 host_impl_->active_tree()->property_trees()->transform_tree.Node( |
8772 page_scale_layer->transform_tree_index()); | 8778 page_scale_layer->transform_tree_index()); |
8773 EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 2.f); | 8779 EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 2.f); |
8774 } | 8780 } |
8775 | 8781 |
8776 } // namespace | 8782 } // namespace |
8777 } // namespace cc | 8783 } // namespace cc |
OLD | NEW |