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

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

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: bugref, scale_delta DCHECK + comment Created 4 years, 4 months 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_impl.h ('k') | cc/trees/single_thread_proxy.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 620
621 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { 621 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() {
622 DCHECK(!scroll_elasticity_helper_); 622 DCHECK(!scroll_elasticity_helper_);
623 if (settings_.enable_elastic_overscroll) { 623 if (settings_.enable_elastic_overscroll) {
624 scroll_elasticity_helper_.reset( 624 scroll_elasticity_helper_.reset(
625 ScrollElasticityHelper::CreateForLayerTreeHostImpl(this)); 625 ScrollElasticityHelper::CreateForLayerTreeHostImpl(this));
626 } 626 }
627 return scroll_elasticity_helper_.get(); 627 return scroll_elasticity_helper_.get();
628 } 628 }
629 629
630 bool LayerTreeHostImpl::GetScrollOffsetForLayer(int layer_id,
631 gfx::ScrollOffset* offset) {
632 LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
633 if (!layer)
634 return false;
635
636 *offset = layer->CurrentScrollOffset();
637 return true;
638 }
639
640 bool LayerTreeHostImpl::ScrollLayerTo(int layer_id,
641 const gfx::ScrollOffset& offset) {
642 LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
643 if (!layer)
644 return false;
645
646 layer->ScrollBy(
647 ScrollOffsetToVector2dF(offset - layer->CurrentScrollOffset()));
648 return true;
649 }
650
630 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( 651 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate(
631 std::unique_ptr<SwapPromise> swap_promise) { 652 std::unique_ptr<SwapPromise> swap_promise) {
632 swap_promises_for_main_thread_scroll_update_.push_back( 653 swap_promises_for_main_thread_scroll_update_.push_back(
633 std::move(swap_promise)); 654 std::move(swap_promise));
634 } 655 }
635 656
636 void LayerTreeHostImpl::TrackDamageForAllSurfaces( 657 void LayerTreeHostImpl::TrackDamageForAllSurfaces(
637 const LayerImplList& render_surface_layer_list) { 658 const LayerImplList& render_surface_layer_list) {
638 // For now, we use damage tracking to compute a global scissor. To do this, we 659 // For now, we use damage tracking to compute a global scissor. To do this, we
639 // must compute all damage tracking before drawing anything, so that we know 660 // must compute all damage tracking before drawing anything, so that we know
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 return task_runner_provider_->HasImplThread(); 4029 return task_runner_provider_->HasImplThread();
4009 } 4030 }
4010 4031
4011 bool LayerTreeHostImpl::CommitToActiveTree() const { 4032 bool LayerTreeHostImpl::CommitToActiveTree() const {
4012 // In single threaded mode we skip the pending tree and commit directly to the 4033 // In single threaded mode we skip the pending tree and commit directly to the
4013 // active tree. 4034 // active tree.
4014 return !task_runner_provider_->HasImplThread(); 4035 return !task_runner_provider_->HasImplThread();
4015 } 4036 }
4016 4037
4017 } // namespace cc 4038 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698