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

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: Add a test for the transform goop 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
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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { 618 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() {
619 DCHECK(!scroll_elasticity_helper_); 619 DCHECK(!scroll_elasticity_helper_);
620 if (settings_.enable_elastic_overscroll) { 620 if (settings_.enable_elastic_overscroll) {
621 scroll_elasticity_helper_.reset( 621 scroll_elasticity_helper_.reset(
622 ScrollElasticityHelper::CreateForLayerTreeHostImpl(this)); 622 ScrollElasticityHelper::CreateForLayerTreeHostImpl(this));
623 } 623 }
624 return scroll_elasticity_helper_.get(); 624 return scroll_elasticity_helper_.get();
625 } 625 }
626 626
627 bool LayerTreeHostImpl::GetScrollOffsetForLayer(int layer_id,
628 gfx::ScrollOffset* offset) {
629 LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
630 if (!layer)
631 return false;
632
633 *offset = layer->CurrentScrollOffset();
634 return true;
635 }
636
637 bool LayerTreeHostImpl::ScrollLayerTo(int layer_id,
638 const gfx::ScrollOffset& offset) {
639 LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
640 if (!layer)
641 return false;
642
643 layer->ScrollBy(
644 ScrollOffsetToVector2dF(offset - layer->CurrentScrollOffset()));
645 return true;
646 }
647
627 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( 648 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate(
628 std::unique_ptr<SwapPromise> swap_promise) { 649 std::unique_ptr<SwapPromise> swap_promise) {
629 swap_promises_for_main_thread_scroll_update_.push_back( 650 swap_promises_for_main_thread_scroll_update_.push_back(
630 std::move(swap_promise)); 651 std::move(swap_promise));
631 } 652 }
632 653
633 void LayerTreeHostImpl::TrackDamageForAllSurfaces( 654 void LayerTreeHostImpl::TrackDamageForAllSurfaces(
634 const LayerImplList& render_surface_layer_list) { 655 const LayerImplList& render_surface_layer_list) {
635 // For now, we use damage tracking to compute a global scissor. To do this, we 656 // For now, we use damage tracking to compute a global scissor. To do this, we
636 // must compute all damage tracking before drawing anything, so that we know 657 // must compute all damage tracking before drawing anything, so that we know
(...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 return task_runner_provider_->HasImplThread(); 4063 return task_runner_provider_->HasImplThread();
4043 } 4064 }
4044 4065
4045 bool LayerTreeHostImpl::CommitToActiveTree() const { 4066 bool LayerTreeHostImpl::CommitToActiveTree() const {
4046 // In single threaded mode we skip the pending tree and commit directly to the 4067 // In single threaded mode we skip the pending tree and commit directly to the
4047 // active tree. 4068 // active tree.
4048 return !task_runner_provider_->HasImplThread(); 4069 return !task_runner_provider_->HasImplThread();
4049 } 4070 }
4050 4071
4051 } // namespace cc 4072 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698