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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 | 1130 |
1131 if (layer_tree_host()->settings().impl_side_painting) { | 1131 if (layer_tree_host()->settings().impl_side_painting) { |
1132 scoped_refptr<FakePictureLayer> layer = | 1132 scoped_refptr<FakePictureLayer> layer = |
1133 FakePictureLayer::Create(&client_); | 1133 FakePictureLayer::Create(&client_); |
1134 layer->set_always_update_resources(true); | 1134 layer->set_always_update_resources(true); |
1135 scroll_layer_ = layer; | 1135 scroll_layer_ = layer; |
1136 } else { | 1136 } else { |
1137 scroll_layer_ = FakeContentLayer::Create(&client_); | 1137 scroll_layer_ = FakeContentLayer::Create(&client_); |
1138 } | 1138 } |
1139 | 1139 |
1140 scroll_layer_->SetScrollable(true); | 1140 Layer* root_layer = layer_tree_host()->root_layer(); |
| 1141 scroll_layer_->SetScrollClipLayerId(root_layer->id()); |
| 1142 scroll_layer_->SetIsContainerForFixedPositionLayers(true); |
| 1143 scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(), |
| 1144 2 * root_layer->bounds().height())); |
1141 scroll_layer_->SetScrollOffset(gfx::Vector2d()); | 1145 scroll_layer_->SetScrollOffset(gfx::Vector2d()); |
1142 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 1146 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 1147 // This test requires the page_scale and inner viewport layers to be |
| 1148 // identified. |
| 1149 layer_tree_host()->RegisterViewportLayers( |
| 1150 root_layer, scroll_layer_.get(), NULL); |
1143 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 1151 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
1144 } | 1152 } |
1145 | 1153 |
1146 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 1154 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
1147 | 1155 |
1148 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 1156 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
1149 float scale) OVERRIDE { | 1157 float scale) OVERRIDE { |
1150 gfx::Vector2d offset = scroll_layer_->scroll_offset(); | 1158 gfx::Vector2d offset = scroll_layer_->scroll_offset(); |
1151 scroll_layer_->SetScrollOffset(offset + scroll_delta); | 1159 scroll_layer_->SetScrollOffset(offset + scroll_delta); |
1152 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 1160 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
(...skipping 3796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4949 | 4957 |
4950 EndTest(); | 4958 EndTest(); |
4951 } | 4959 } |
4952 | 4960 |
4953 virtual void AfterTest() OVERRIDE {} | 4961 virtual void AfterTest() OVERRIDE {} |
4954 }; | 4962 }; |
4955 | 4963 |
4956 MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 4964 MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
4957 | 4965 |
4958 } // namespace cc | 4966 } // namespace cc |
OLD | NEW |