| 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 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 // scales that we want when we're not inside a pinch. | 3242 // scales that we want when we're not inside a pinch. |
| 3243 active_tree_->set_needs_update_draw_properties(); | 3243 active_tree_->set_needs_update_draw_properties(); |
| 3244 SetNeedsRedraw(); | 3244 SetNeedsRedraw(); |
| 3245 } | 3245 } |
| 3246 | 3246 |
| 3247 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 3247 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
| 3248 LayerImpl* root_layer) { | 3248 LayerImpl* root_layer) { |
| 3249 if (!root_layer) | 3249 if (!root_layer) |
| 3250 return; | 3250 return; |
| 3251 | 3251 |
| 3252 for (auto* layer : *root_layer->layer_tree_impl()) { | 3252 return root_layer->layer_tree_impl() |
| 3253 gfx::ScrollOffset scroll_delta = layer->PullDeltaForMainThread(); | 3253 ->property_trees() |
| 3254 | 3254 ->scroll_tree.CollectScrollDeltas(scroll_info); |
| 3255 if (!scroll_delta.IsZero()) { | |
| 3256 LayerTreeHostCommon::ScrollUpdateInfo scroll; | |
| 3257 scroll.layer_id = layer->id(); | |
| 3258 scroll.scroll_delta = gfx::Vector2d(scroll_delta.x(), scroll_delta.y()); | |
| 3259 scroll_info->scrolls.push_back(scroll); | |
| 3260 } | |
| 3261 } | |
| 3262 } | 3255 } |
| 3263 | 3256 |
| 3264 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3257 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3265 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3258 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3266 | 3259 |
| 3267 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); | 3260 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); |
| 3268 scroll_info->page_scale_delta = | 3261 scroll_info->page_scale_delta = |
| 3269 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3262 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
| 3270 scroll_info->top_controls_delta = | 3263 scroll_info->top_controls_delta = |
| 3271 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3264 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3970 return task_runner_provider_->HasImplThread(); | 3963 return task_runner_provider_->HasImplThread(); |
| 3971 } | 3964 } |
| 3972 | 3965 |
| 3973 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3966 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3974 // In single threaded mode we skip the pending tree and commit directly to the | 3967 // In single threaded mode we skip the pending tree and commit directly to the |
| 3975 // active tree. | 3968 // active tree. |
| 3976 return !task_runner_provider_->HasImplThread(); | 3969 return !task_runner_provider_->HasImplThread(); |
| 3977 } | 3970 } |
| 3978 | 3971 |
| 3979 } // namespace cc | 3972 } // namespace cc |
| OLD | NEW |