| 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 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3260 // scales that we want when we're not inside a pinch. | 3260 // scales that we want when we're not inside a pinch. |
| 3261 active_tree_->set_needs_update_draw_properties(); | 3261 active_tree_->set_needs_update_draw_properties(); |
| 3262 SetNeedsRedraw(); | 3262 SetNeedsRedraw(); |
| 3263 } | 3263 } |
| 3264 | 3264 |
| 3265 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 3265 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
| 3266 LayerImpl* layer_impl) { | 3266 LayerImpl* layer_impl) { |
| 3267 if (!layer_impl) | 3267 if (!layer_impl) |
| 3268 return; | 3268 return; |
| 3269 | 3269 |
| 3270 gfx::ScrollOffset scroll_delta = layer_impl->PullDeltaForMainThread(); | 3270 return layer_impl->layer_tree_impl() |
| 3271 | 3271 ->property_trees() |
| 3272 if (!scroll_delta.IsZero()) { | 3272 ->scroll_tree.CollectScrollDeltas(scroll_info); |
| 3273 LayerTreeHostCommon::ScrollUpdateInfo scroll; | |
| 3274 scroll.layer_id = layer_impl->id(); | |
| 3275 scroll.scroll_delta = gfx::Vector2d(scroll_delta.x(), scroll_delta.y()); | |
| 3276 scroll_info->scrolls.push_back(scroll); | |
| 3277 } | |
| 3278 | |
| 3279 for (size_t i = 0; i < layer_impl->children().size(); ++i) | |
| 3280 CollectScrollDeltas(scroll_info, layer_impl->children()[i].get()); | |
| 3281 } | 3273 } |
| 3282 | 3274 |
| 3283 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3275 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3284 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3276 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3285 | 3277 |
| 3286 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); | 3278 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); |
| 3287 scroll_info->page_scale_delta = | 3279 scroll_info->page_scale_delta = |
| 3288 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3280 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
| 3289 scroll_info->top_controls_delta = | 3281 scroll_info->top_controls_delta = |
| 3290 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3282 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 return task_runner_provider_->HasImplThread(); | 3983 return task_runner_provider_->HasImplThread(); |
| 3992 } | 3984 } |
| 3993 | 3985 |
| 3994 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3986 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3995 // In single threaded mode we skip the pending tree and commit directly to the | 3987 // In single threaded mode we skip the pending tree and commit directly to the |
| 3996 // active tree. | 3988 // active tree. |
| 3997 return !task_runner_provider_->HasImplThread(); | 3989 return !task_runner_provider_->HasImplThread(); |
| 3998 } | 3990 } |
| 3999 | 3991 |
| 4000 } // namespace cc | 3992 } // namespace cc |
| OLD | NEW |