Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 749393005: Translate the overscroll elasticity layer by the overscroll amount (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aelias
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 requires_high_res_to_draw_(false), 230 requires_high_res_to_draw_(false),
231 required_for_draw_tile_is_top_of_raster_queue_(false) { 231 required_for_draw_tile_is_top_of_raster_queue_(false) {
232 DCHECK(proxy_->IsImplThread()); 232 DCHECK(proxy_->IsImplThread());
233 DidVisibilityChange(this, visible_); 233 DidVisibilityChange(this, visible_);
234 animation_registrar_->set_supports_scroll_animations( 234 animation_registrar_->set_supports_scroll_animations(
235 proxy_->SupportsImplScrolling()); 235 proxy_->SupportsImplScrolling());
236 236
237 SetDebugState(settings.initial_debug_state); 237 SetDebugState(settings.initial_debug_state);
238 238
239 // LTHI always has an active tree. 239 // LTHI always has an active tree.
240 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>()); 240 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(),
241 new SyncedElasticOverscroll);
241 242
242 TRACE_EVENT_OBJECT_CREATED_WITH_ID( 243 TRACE_EVENT_OBJECT_CREATED_WITH_ID(
243 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); 244 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_);
244 245
245 if (settings.calculate_top_controls_position) { 246 if (settings.calculate_top_controls_position) {
246 top_controls_manager_ = 247 top_controls_manager_ =
247 TopControlsManager::Create(this, 248 TopControlsManager::Create(this,
248 settings.top_controls_show_threshold, 249 settings.top_controls_show_threshold,
249 settings.top_controls_hide_threshold); 250 settings.top_controls_hide_threshold);
250 } 251 }
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); 1095 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0));
1095 } 1096 }
1096 1097
1097 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { 1098 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) {
1098 NOTREACHED(); 1099 NOTREACHED();
1099 } 1100 }
1100 1101
1101 void LayerTreeHostImpl::ResetTreesForTesting() { 1102 void LayerTreeHostImpl::ResetTreesForTesting() {
1102 if (active_tree_) 1103 if (active_tree_)
1103 active_tree_->DetachLayerTree(); 1104 active_tree_->DetachLayerTree();
1104 active_tree_ = 1105 active_tree_ = LayerTreeImpl::create(this, active_tree()->page_scale_factor(),
1105 LayerTreeImpl::create(this, active_tree()->page_scale_factor()); 1106 active_tree()->elastic_overscroll());
1106 if (pending_tree_) 1107 if (pending_tree_)
1107 pending_tree_->DetachLayerTree(); 1108 pending_tree_->DetachLayerTree();
1108 pending_tree_ = nullptr; 1109 pending_tree_ = nullptr;
1109 if (recycle_tree_) 1110 if (recycle_tree_)
1110 recycle_tree_->DetachLayerTree(); 1111 recycle_tree_->DetachLayerTree();
1111 recycle_tree_ = nullptr; 1112 recycle_tree_ = nullptr;
1112 } 1113 }
1113 1114
1114 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( 1115 void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
1115 const ManagedMemoryPolicy& policy) { 1116 const ManagedMemoryPolicy& policy) {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 1742
1742 return NULL; 1743 return NULL;
1743 } 1744 }
1744 1745
1745 void LayerTreeHostImpl::CreatePendingTree() { 1746 void LayerTreeHostImpl::CreatePendingTree() {
1746 CHECK(!pending_tree_); 1747 CHECK(!pending_tree_);
1747 if (recycle_tree_) 1748 if (recycle_tree_)
1748 recycle_tree_.swap(pending_tree_); 1749 recycle_tree_.swap(pending_tree_);
1749 else 1750 else
1750 pending_tree_ = 1751 pending_tree_ =
1751 LayerTreeImpl::create(this, active_tree()->page_scale_factor()); 1752 LayerTreeImpl::create(this, active_tree()->page_scale_factor(),
1753 active_tree()->elastic_overscroll());
1752 1754
1753 // Update the delta from the active tree, which may have 1755 // Update the delta from the active tree, which may have
1754 // adjusted its delta prior to the pending tree being created. 1756 // adjusted its delta prior to the pending tree being created.
1755 DCHECK_EQ(0.f, pending_tree_->sent_top_controls_delta()); 1757 DCHECK_EQ(0.f, pending_tree_->sent_top_controls_delta());
1756 pending_tree_->set_top_controls_delta( 1758 pending_tree_->set_top_controls_delta(
1757 active_tree_->top_controls_delta() - 1759 active_tree_->top_controls_delta() -
1758 active_tree_->sent_top_controls_delta()); 1760 active_tree_->sent_top_controls_delta());
1759 pending_tree_->set_top_controls_height(active_tree_->top_controls_height()); 1761 pending_tree_->set_top_controls_height(active_tree_->top_controls_height());
1760 1762
1761 client_->OnCanDrawStateChanged(CanDraw()); 1763 client_->OnCanDrawStateChanged(CanDraw());
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 for (size_t i = 0; i < layer_impl->children().size(); ++i) 3017 for (size_t i = 0; i < layer_impl->children().size(); ++i)
3016 CollectScrollDeltas(scroll_info, layer_impl->children()[i]); 3018 CollectScrollDeltas(scroll_info, layer_impl->children()[i]);
3017 } 3019 }
3018 3020
3019 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { 3021 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
3020 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); 3022 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet());
3021 3023
3022 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); 3024 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer());
3023 scroll_info->page_scale_delta = 3025 scroll_info->page_scale_delta =
3024 active_tree_->page_scale_factor()->PullDeltaForMainThread(); 3026 active_tree_->page_scale_factor()->PullDeltaForMainThread();
3027 scroll_info->elastic_overscroll_delta =
3028 active_tree_->elastic_overscroll()->PullDeltaForMainThread();
3025 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); 3029 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_);
3026 scroll_info->top_controls_delta = active_tree()->top_controls_delta(); 3030 scroll_info->top_controls_delta = active_tree()->top_controls_delta();
3027 active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta); 3031 active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta);
3028 3032
3029 return scroll_info.Pass(); 3033 return scroll_info.Pass();
3030 } 3034 }
3031 3035
3032 void LayerTreeHostImpl::SetFullRootLayerDamage() { 3036 void LayerTreeHostImpl::SetFullRootLayerDamage() {
3033 SetViewportDamage(gfx::Rect(DrawViewportSize())); 3037 SetViewportDamage(gfx::Rect(DrawViewportSize()));
3034 } 3038 }
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3477 } 3481 }
3478 3482
3479 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3483 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3480 std::vector<PictureLayerImpl*>::iterator it = 3484 std::vector<PictureLayerImpl*>::iterator it =
3481 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3485 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3482 DCHECK(it != picture_layers_.end()); 3486 DCHECK(it != picture_layers_.end());
3483 picture_layers_.erase(it); 3487 picture_layers_.erase(it);
3484 } 3488 }
3485 3489
3486 } // namespace cc 3490 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698