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

Unified Diff: cc/input/scroll_elasticity_helper.h

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/debug/frame_viewer_instrumentation.cc ('k') | cc/input/scroll_elasticity_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/scroll_elasticity_helper.h
diff --git a/cc/input/scroll_elasticity_helper.h b/cc/input/scroll_elasticity_helper.h
index 645b20c97d175110d07fc2acf49d26ca1036032b..96c917a4911b874c49124dc6c5d4ff41b0a0fdc1 100644
--- a/cc/input/scroll_elasticity_helper.h
+++ b/cc/input/scroll_elasticity_helper.h
@@ -46,37 +46,27 @@ class LayerTreeHostImpl;
// of logic and state held directly inside LayerTreeHostImpl.
class CC_EXPORT ScrollElasticityHelper {
public:
- explicit ScrollElasticityHelper(LayerTreeHostImpl* layer_tree);
- ~ScrollElasticityHelper();
+ static ScrollElasticityHelper* CreateForLayerTreeHostImpl(
+ LayerTreeHostImpl* layer_tree_host_impl);
- bool AllowsHorizontalStretching();
- bool AllowsVerticalStretching();
- // The amount that the view is stretched past the normal allowable bounds.
- // The "overhang" amount.
- gfx::Vector2dF StretchAmount();
- bool PinnedInDirection(const gfx::Vector2dF& direction);
- bool CanScrollHorizontally();
- bool CanScrollVertically();
-
- // Return the absolute scroll position, not relative to the scroll origin.
- gfx::Vector2dF AbsoluteScrollPosition();
-
- void ImmediateScrollBy(const gfx::Vector2dF& scroll);
- void ImmediateScrollByWithoutContentEdgeConstraints(
- const gfx::Vector2dF& scroll);
- void StartSnapRubberbandTimer();
- void StopSnapRubberbandTimer();
- void SnapRubberbandTimerFired();
+ virtual ~ScrollElasticityHelper() {}
- // If the current scroll position is within the overhang area, this function
- // will cause
- // the page to scroll to the nearest boundary point.
- void AdjustScrollPositionToBoundsIfNecessary();
-
- private:
- LayerTreeHostImpl* layer_tree_host_impl_;
- gfx::Vector2dF stretch_offset_;
- bool timer_active_;
+ // The amount that the view is stretched past the normal allowable bounds.
+ virtual gfx::Vector2dF StretchAmount() = 0;
+ virtual void SetStretchAmount(const gfx::Vector2dF& stretch_amount) = 0;
+ // Returns true if either component of |direction| is pointing in a direction
+ // in which it is not possible to scroll any farther. It is only in this
+ // circumstance that an overscroll in that direction may begin.
+ // TODO(ccameron): Note that it is possible for a scroll to occur against a
+ // previous over-scroll. Such a scroll needs to first cancel out the
+ // over-scroll, and only then may it start scrolling away from the edge.
+ virtual bool PinnedInDirection(const gfx::Vector2dF& direction) = 0;
+ // Whether or not the content of the page is scrollable in each direction.
+ virtual bool CanScrollHorizontally() = 0;
+ virtual bool CanScrollVertically() = 0;
+ // Request that the controller have its Animate method called for the next
+ // frame.
+ virtual void RequestAnimate() = 0;
};
} // namespace cc
« no previous file with comments | « cc/debug/frame_viewer_instrumentation.cc ('k') | cc/input/scroll_elasticity_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698