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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index b32ed4e00bcbb3aa36ed3c7f8611da47db624879..adb0d95bb8f591a400f13a71caf9a4e1341152c9 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -624,6 +624,27 @@ ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() {
return scroll_elasticity_helper_.get();
}
+bool LayerTreeHostImpl::GetScrollOffsetForLayer(int layer_id,
+ gfx::ScrollOffset* offset) {
+ LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
+ if (!layer)
+ return false;
+
+ *offset = layer->CurrentScrollOffset();
+ return true;
+}
+
+bool LayerTreeHostImpl::ScrollLayerTo(int layer_id,
+ const gfx::ScrollOffset& offset) {
+ LayerImpl* layer = active_tree()->FindActiveTreeLayerById(layer_id);
+ if (!layer)
+ return false;
+
+ layer->ScrollBy(
+ ScrollOffsetToVector2dF(offset - layer->CurrentScrollOffset()));
+ return true;
+}
+
void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate(
std::unique_ptr<SwapPromise> swap_promise) {
swap_promises_for_main_thread_scroll_update_.push_back(

Powered by Google App Engine
This is Rietveld 408576698