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

Unified Diff: cc/trees/tree_scroll_elasticity_client.cc

Issue 704463003: Move overscroll bounce to impl thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/trees/tree_scroll_elasticity_client.h ('k') | content/content_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/tree_scroll_elasticity_client.cc
diff --git a/cc/trees/tree_scroll_elasticity_client.cc b/cc/trees/tree_scroll_elasticity_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..650a21e6072205383edb7bd1ba0349bbcdd6695b
--- /dev/null
+++ b/cc/trees/tree_scroll_elasticity_client.cc
@@ -0,0 +1,88 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/trees/tree_scroll_elasticity_client.h"
+
+#include "cc/layers/layer_impl.h"
+#include "cc/trees/layer_tree_host_impl.h"
+
+namespace cc {
+
+TreeScrollElasticityClient::TreeScrollElasticityClient(LayerTreeHostImpl* tree)
+ : tree_(tree), timer_active_(false), controller_(NULL) {}
+
+TreeScrollElasticityClient::~TreeScrollElasticityClient() {}
+
+void TreeScrollElasticityClient::BindToController(
+ ScrollElasticityController* controller) {
+ controller_ = controller;
+}
+
+bool TreeScrollElasticityClient::allowsHorizontalStretching() const {
+ return true;
+}
+
+bool TreeScrollElasticityClient::allowsVerticalStretching() const {
+ return true;
+}
+
+// The amount that the view is stretched past the normal allowable bounds.
+// The "overhang" amount.
+gfx::Vector2dF TreeScrollElasticityClient::stretchAmount() const {
+ return stretch_offset_;
+}
+
+bool TreeScrollElasticityClient::pinnedInDirection(const gfx::Vector2dF& delta) const {
+ LayerImpl* layer = tree_->InnerViewportScrollLayer();
+ bool result = false;
+ if (delta.x() < 0)
+ result |= layer->TotalScrollOffset().x() <= 0;
+ if (delta.x() > 0)
+ result |= layer->TotalScrollOffset().x() >= layer->MaxScrollOffset().x();
+ if (delta.y() < 0)
+ result |= layer->TotalScrollOffset().y() <= 0;
+ if (delta.y() > 0)
+ result |= layer->TotalScrollOffset().y() >= layer->MaxScrollOffset().y();
+ printf("pinned delta=%s offset=%s max=%s : %d\n",
+ delta.ToString().c_str(),
+ layer->TotalScrollOffset().ToString().c_str(),
+ layer->MaxScrollOffset().ToString().c_str(),
+ result);
+ return result;
+}
+
+bool TreeScrollElasticityClient::canScrollHorizontally() const {
+ return true;
+}
+
+bool TreeScrollElasticityClient::canScrollVertically() const {
+ return true;
+}
+
+// Return the absolute scroll position, not relative to the scroll origin.
+gfx::Vector2dF TreeScrollElasticityClient::absoluteScrollPosition() const {
+ return stretchAmount();
+}
+
+void TreeScrollElasticityClient::immediateScrollBy(const gfx::Vector2dF& delta) {
+}
+
+void TreeScrollElasticityClient::immediateScrollByWithoutContentEdgeConstraints(const gfx::Vector2dF& delta) {
+ stretch_offset_ += delta;
+ // tree_->UpdateRubberband(-stretch_offset_);
+}
+
+void TreeScrollElasticityClient::startSnapRubberbandTimer() {
+ timer_active_ = true;
+ tree_->SetNeedsAnimate();
+}
+
+void TreeScrollElasticityClient::stopSnapRubberbandTimer() {
+ timer_active_ = false;
+}
+
+void TreeScrollElasticityClient::adjustScrollPositionToBoundsIfNecessary() {
+}
+
+} // namespace cc
« no previous file with comments | « cc/trees/tree_scroll_elasticity_client.h ('k') | content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698