Index: Source/platform/scroll/ScrollableArea.h |
diff --git a/Source/platform/scroll/ScrollableArea.h b/Source/platform/scroll/ScrollableArea.h |
index 15b27b7cc4fd541aac0935766f7f9d4bf5c1dff8..d3b774d60409276b6053eba7d9c104e2b92c6b45 100644 |
--- a/Source/platform/scroll/ScrollableArea.h |
+++ b/Source/platform/scroll/ScrollableArea.h |
@@ -39,6 +39,7 @@ class GraphicsContext; |
class GraphicsLayer; |
class PlatformGestureEvent; |
class PlatformWheelEvent; |
+class ProgrammaticScrollAnimator; |
class ScrollAnimator; |
enum ScrollBehavior { |
@@ -63,6 +64,8 @@ public: |
void scrollToOffsetWithoutAnimation(const FloatPoint&); |
void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); |
+ void programmaticallyScrollSmoothlyToOffset(const FloatPoint&); |
+ |
// Should be called when the scroll position changes externally, for example if the scroll layer position |
// is updated on the scrolling thread and we need to notify the main thread. |
void notifyScrollPositionChanged(const IntPoint&); |
@@ -111,6 +114,12 @@ public: |
// This getter will return null if the ScrollAnimator hasn't been created yet. |
ScrollAnimator* existingScrollAnimator() const { return m_scrollAnimator.get(); } |
+ ProgrammaticScrollAnimator* programmaticScrollAnimator() const; |
+ ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const |
+ { |
+ return m_programmaticScrollAnimator.get(); |
+ } |
+ |
const IntPoint& scrollOrigin() const { return m_scrollOrigin; } |
bool scrollOriginChanged() const { return m_scrollOriginChanged; } |
@@ -178,8 +187,10 @@ public: |
// Let subclasses provide a way of asking for and servicing scroll |
// animations. |
+ virtual void registerForAnimation() { } |
+ virtual void deregisterForAnimation() { } |
virtual bool scheduleAnimation() { return false; } |
- void serviceScrollAnimations(); |
+ virtual void serviceScrollAnimations(double monotonicTime); |
virtual bool usesCompositedScrolling() const { return false; } |
@@ -189,6 +200,14 @@ public: |
virtual bool userInputScrollable(ScrollbarOrientation) const = 0; |
virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; |
+ // Notifications for compositor-driven animations. |
+ void notifyAnimationStarted(double monotonicTime); |
+ void notifyAnimationFinished(double monotonicTime); |
+ |
+ void layerForScrollingDidChange(); |
+ void requiresMainThreadScrollingDidChange(); |
+ bool canUseCompositedScrollAnimations() const; |
+ |
// Convenience functions |
int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } |
int minimumScrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPosition().y(); } |
@@ -224,6 +243,8 @@ public: |
bool hasLayerForVerticalScrollbar() const; |
bool hasLayerForScrollCorner() const; |
+ void cancelProgrammaticScrollAnimation(); |
+ |
protected: |
ScrollableArea(); |
virtual ~ScrollableArea(); |
@@ -258,6 +279,7 @@ private: |
virtual float pixelStep(ScrollbarOrientation) const; |
mutable OwnPtr<ScrollAnimator> m_scrollAnimator; |
+ mutable OwnPtr<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; |
unsigned m_constrainsScrollingToContentEdge : 1; |
unsigned m_inLiveResize : 1; |