Chromium Code Reviews| Index: Source/core/page/scrolling/ScrollState.h |
| diff --git a/Source/core/page/scrolling/ScrollState.h b/Source/core/page/scrolling/ScrollState.h |
| index d88e86d404b0e489084cdaa8f3e919806c51851e..68d4116b80db16043508b4d1edcca5db91704ee8 100644 |
| --- a/Source/core/page/scrolling/ScrollState.h |
| +++ b/Source/core/page/scrolling/ScrollState.h |
| @@ -18,13 +18,18 @@ class ScrollState final : public RefCountedWillBeGarbageCollected<ScrollState>, |
| public: |
| static PassRefPtrWillBeRawPtr<ScrollState> create( |
| double deltaX, double deltaY, double deltaGranularity, double velocityX, |
| - double velocityY, bool inInertialPhase, bool isEnding, bool fromUserInput = false, |
| - bool shouldPropagate = true, bool deltaConsumedForScrollSequence = false); |
| + double velocityY, bool inInertialPhase, |
| + bool isBeginning = false, bool isEnding = false, |
| + bool fromUserInput = false, bool shouldPropagate = true, |
| + bool deltaConsumedForScrollSequence = false); |
| // Web exposed methods. |
| // Reduce deltas by x, y. |
| void consumeDelta(double x, double y, ExceptionState&); |
| + // Pops the first element off of |m_scrollChain| and calls |
| + // |distributeScroll| on it. |
| + void distributeToScrollChainDescendant(); |
| // Positive when scrolling left. |
| double deltaX() const { return m_deltaX; } |
| // Positive when scrolling up. |
| @@ -37,6 +42,8 @@ public: |
| double velocityY() const { return m_velocityY; } |
| // True for events dispatched after the users's gesture has finished. |
| bool inInertialPhase() const { return m_inInertialPhase; } |
| + // True if this is the first event for this scroll. |
| + bool isBeginning() const { return m_isBeginning; } |
| // True if this is the last event for this scroll. |
| bool isEnding() const { return m_isEnding; } |
| // True if this scroll is the direct result of user input. |
| @@ -47,6 +54,11 @@ public: |
| // Non web exposed methods. |
| void consumeDeltaNative(double x, double y); |
| + void setScrollChain(WillBeHeapDeque<RefPtrWillBeMember<Element>> scrollChain) |
| + { |
| + m_scrollChain = scrollChain; |
| + } |
| + |
| void setCurrentNativeScrollingElement(Element* element) |
| { |
| m_currentNativeScrollingElement = element; |
| @@ -57,11 +69,6 @@ public: |
| return m_currentNativeScrollingElement.get(); |
| } |
| - void setDeltaConsumedForScrollSequence(bool deltaConsumedForScrollSequence) |
| - { |
| - m_deltaConsumedForScrollSequence = deltaConsumedForScrollSequence; |
| - } |
| - |
| bool deltaConsumedForScrollSequence() const |
| { |
| return m_deltaConsumedForScrollSequence; |
| @@ -69,19 +76,21 @@ public: |
| bool fullyConsumed() const |
| { |
| - return !m_deltaX && !m_deltaY && !m_isEnding; |
| + return !m_deltaX && !m_deltaY && !m_isEnding && !m_isBeginning; |
|
Rick Byers
2015/03/11 02:22:19
worth a comment perhaps - something like 'scroll b
tdresser
2015/03/20 18:00:37
Done.
|
| } |
| DEFINE_INLINE_TRACE() |
| { |
| visitor->trace(m_currentNativeScrollingElement); |
| + visitor->trace(m_scrollChain); |
| }; |
| private: |
| ScrollState(); |
| ScrollState(double deltaX, double deltaY, double deltaGranularity, |
| - double velocityX, double velocityY, bool inInertialPhase, bool isEnding, |
| - bool fromUserInput, bool shouldPropagate, bool deltaConsumedForScrollSequence); |
| + double velocityX, double velocityY, bool inInertialPhase, bool isBeginning, |
| + bool isEnding, bool fromUserInput, bool shouldPropagate, |
| + bool deltaConsumedForScrollSequence); |
| double m_deltaX; |
| double m_deltaY; |
| @@ -89,6 +98,7 @@ private: |
| double m_velocityX; |
| double m_velocityY; |
| bool m_inInertialPhase; |
| + bool m_isBeginning; |
| bool m_isEnding; |
| bool m_fromUserInput; |
| @@ -97,6 +107,8 @@ private: |
| RefPtrWillBeMember<Element> m_currentNativeScrollingElement; |
| // Whether the scroll sequence has had any delta consumed. |
| bool m_deltaConsumedForScrollSequence; |
| + |
| + WillBeHeapDeque<RefPtrWillBeMember<Element>> m_scrollChain; |
| }; |
| } // namespace blink |