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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 856 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
857 // This test requires the page_scale and inner viewport layers to be | 857 // This test requires the page_scale and inner viewport layers to be |
858 // identified. | 858 // identified. |
859 layer_tree_host()->RegisterViewportLayers( | 859 layer_tree_host()->RegisterViewportLayers( |
860 root_layer, scroll_layer_.get(), NULL); | 860 root_layer, scroll_layer_.get(), NULL); |
861 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 861 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
862 } | 862 } |
863 | 863 |
864 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 864 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
865 | 865 |
866 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, | 866 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, |
867 float scale) OVERRIDE { | 867 float scale, |
| 868 float) OVERRIDE { |
868 gfx::Vector2d offset = scroll_layer_->scroll_offset(); | 869 gfx::Vector2d offset = scroll_layer_->scroll_offset(); |
869 scroll_layer_->SetScrollOffset(offset + scroll_delta); | 870 scroll_layer_->SetScrollOffset(offset + scroll_delta); |
870 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 871 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
871 } | 872 } |
872 | 873 |
873 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 874 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
874 // We get one commit before the first draw, and the animation doesn't happen | 875 // We get one commit before the first draw, and the animation doesn't happen |
875 // until the second draw. | 876 // until the second draw. |
876 switch (impl->active_tree()->source_frame_number()) { | 877 switch (impl->active_tree()->source_frame_number()) { |
877 case 0: | 878 case 0: |
(...skipping 4155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5033 const gfx::Size bounds_; | 5034 const gfx::Size bounds_; |
5034 FakeContentLayerClient client_; | 5035 FakeContentLayerClient client_; |
5035 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5036 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5036 scoped_refptr<FakePictureLayer> picture_layer_; | 5037 scoped_refptr<FakePictureLayer> picture_layer_; |
5037 Layer* child_layer_; | 5038 Layer* child_layer_; |
5038 }; | 5039 }; |
5039 | 5040 |
5040 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5041 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5041 | 5042 |
5042 } // namespace cc | 5043 } // namespace cc |
OLD | NEW |