| 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 3222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 // scales that we want when we're not inside a pinch. | 3233 // scales that we want when we're not inside a pinch. |
| 3234 active_tree_->set_needs_update_draw_properties(); | 3234 active_tree_->set_needs_update_draw_properties(); |
| 3235 SetNeedsRedraw(); | 3235 SetNeedsRedraw(); |
| 3236 } | 3236 } |
| 3237 | 3237 |
| 3238 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 3238 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
| 3239 LayerImpl* layer_impl) { | 3239 LayerImpl* layer_impl) { |
| 3240 if (!layer_impl) | 3240 if (!layer_impl) |
| 3241 return; | 3241 return; |
| 3242 | 3242 |
| 3243 gfx::ScrollOffset scroll_delta = layer_impl->PullDeltaForMainThread(); | 3243 return layer_impl->layer_tree_impl() |
| 3244 | 3244 ->property_trees() |
| 3245 if (!scroll_delta.IsZero()) { | 3245 ->scroll_tree.CollectScrollDeltas(scroll_info); |
| 3246 LayerTreeHostCommon::ScrollUpdateInfo scroll; | |
| 3247 scroll.layer_id = layer_impl->id(); | |
| 3248 scroll.scroll_delta = gfx::Vector2d(scroll_delta.x(), scroll_delta.y()); | |
| 3249 scroll_info->scrolls.push_back(scroll); | |
| 3250 } | |
| 3251 | |
| 3252 for (size_t i = 0; i < layer_impl->children().size(); ++i) | |
| 3253 CollectScrollDeltas(scroll_info, layer_impl->children()[i].get()); | |
| 3254 } | 3246 } |
| 3255 | 3247 |
| 3256 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3248 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3257 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3249 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3258 | 3250 |
| 3259 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); | 3251 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); |
| 3260 scroll_info->page_scale_delta = | 3252 scroll_info->page_scale_delta = |
| 3261 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3253 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
| 3262 scroll_info->top_controls_delta = | 3254 scroll_info->top_controls_delta = |
| 3263 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3255 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3962 return task_runner_provider_->HasImplThread(); | 3954 return task_runner_provider_->HasImplThread(); |
| 3963 } | 3955 } |
| 3964 | 3956 |
| 3965 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3957 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3966 // In single threaded mode we skip the pending tree and commit directly to the | 3958 // In single threaded mode we skip the pending tree and commit directly to the |
| 3967 // active tree. | 3959 // active tree. |
| 3968 return !task_runner_provider_->HasImplThread(); | 3960 return !task_runner_provider_->HasImplThread(); |
| 3969 } | 3961 } |
| 3970 | 3962 |
| 3971 } // namespace cc | 3963 } // namespace cc |
| OLD | NEW |