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