Allow repeated fling boosting for accelerated scrolling

Scrolling long documents on Android is a laborious, sad affair.  Native Android
view's address this with a "flywheel" fling mechanism, whereby successive flings
in similar directions accumulative velocity. Add such a feature to
InputHandlerProxy, allowing compositor-driven flings on all platforms to
quickly accelerate to infinity and beyond.

Flings will accumulate if the following conditions are met:
  - The active and new flings target the same layer, are in a similar direction,
    and are both of sufficient velocity.
  - All scroll update events received during the active fling and preceding the
    new fling are in a similar direction and of sufficient velocity.

Note: This approach is not suitable to WebView; it relies heavily on the fling
accumulator living "close" to the fling driver.  It also does not affect
main-thread driven flings.

BUG=164116

Review URL: https://codereview.chromium.org/239433010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268363 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 2488eda8..ae69b01 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -145,8 +145,11 @@
                                        float page_scale,
                                        base::TimeDelta duration) OVERRIDE;
   virtual void SetNeedsAnimate() OVERRIDE;
-  virtual bool HaveTouchEventHandlersAt(const gfx::Point& viewport_port)
-      OVERRIDE;
+  virtual bool IsCurrentlyScrollingLayerAt(
+      const gfx::Point& viewport_point,
+      InputHandler::ScrollInputType type) OVERRIDE;
+  virtual bool HaveTouchEventHandlersAt(
+      const gfx::Point& viewport_port) OVERRIDE;
   virtual scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
       ui::LatencyInfo* latency) OVERRIDE;
 
@@ -523,7 +526,7 @@
       InputHandler::ScrollInputType type,
       LayerImpl* layer_hit_by_point,
       bool* scroll_on_main_thread,
-      bool* has_ancestor_scroll_handler) const;
+      bool* optional_has_ancestor_scroll_handler) const;
   float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point,
                                    LayerImpl* layer_impl);
   void StartScrollbarFadeRecursive(LayerImpl* layer);