Chromium Code Reviews| Index: Source/platform/mac/ScrollElasticityController.h |
| diff --git a/Source/platform/mac/ScrollElasticityController.h b/Source/platform/mac/ScrollElasticityController.h |
| index 180e79c9335c9e0cd8c93f143b85de2e5f774eb4..911bff2f50724a3fb22ef88442ce489ec882db2c 100644 |
| --- a/Source/platform/mac/ScrollElasticityController.h |
| +++ b/Source/platform/mac/ScrollElasticityController.h |
| @@ -44,10 +44,13 @@ protected: |
| public: |
| virtual bool allowsHorizontalStretching() = 0; |
| virtual bool allowsVerticalStretching() = 0; |
| + // The amount that the view is stretched past the normal allowable bounds. |
| + // The "overhang" amount. |
| virtual IntSize stretchAmount() = 0; |
| virtual bool pinnedInDirection(const FloatSize&) = 0; |
| virtual bool canScrollHorizontally() = 0; |
| virtual bool canScrollVertically() = 0; |
| + // TODO(erikchen): This method is no longer used. Remove all references. |
|
erikchen
2014/03/24 22:12:05
I left this as a TODO to try to keep this CL small
Alexei Svitkine (slow)
2014/03/25 15:25:40
SGTM.
|
| virtual bool shouldRubberBandInDirection(ScrollDirection) = 0; |
| // Return the absolute scroll position, not relative to the scroll origin. |
| @@ -65,6 +68,18 @@ class ScrollElasticityController { |
| public: |
| explicit ScrollElasticityController(ScrollElasticityControllerClient*); |
| + // This method is responsible for both scrolling and rubber-banding. |
| + // |
| + // Events are passed by IPC from the embedder. Events on mac are grouped |
|
Alexei Svitkine (slow)
2014/03/25 15:25:40
Nit: Mac
erikchen
2014/03/26 18:24:30
Done.
|
| + // into "gestures". If this method returns 'true', then this object has |
| + // handled the event. It expects the embedder to continue to forward events |
| + // from the gesture. |
| + // |
| + // This method makes the assumption that there is only 1 input device being |
| + // used at a time. If the user simultaneously uses multiple input devices, |
| + // Cocoa does not correctly pass all the gestureBegin/End events. The state |
| + // of this class is guaranteed to become eventually consistent, once the |
| + // user stops using multiple input devices. |
| bool handleWheelEvent(const PlatformWheelEvent&); |
| void snapRubberBandTimerFired(); |
| @@ -74,11 +89,30 @@ private: |
| void stopSnapRubberbandTimer(); |
| void snapRubberBand(); |
| - bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&); |
| + // This method determines whether a given event should be handled. The |
| + // logic for control events of gestures (PhaseBegan, PhaseEnded) is handled |
| + // elsewhere. |
| + // |
| + // This class handles almost all wheel events. All of the following |
| + // conditions must be met for this class to ignore an event: |
| + // + No previous events in this gesture have caused any scrolling or rubber |
| + // banding. |
| + // + The event contains a horizontal component. |
| + // + The client's view is pinned in the horizontal direction of the event. |
| + // + The wheel event disallows rubber banding in the horizontal direction |
| + // of the event. |
| + bool shouldHandleEvent(const PlatformWheelEvent&); |
| ScrollElasticityControllerClient* m_client; |
| + // There is an active scroll gesture event. This parameter only gets set to |
| + // false after the rubber band has been snapped, and before a new gesture |
| + // has begun. A careful audit of the code may deprecate the need for this parameter. |
|
Alexei Svitkine (slow)
2014/03/25 15:25:40
Nit: Wrap the end of this comment since everything
erikchen
2014/03/26 18:24:30
Done.
|
| bool m_inScrollGesture; |
| + // At least one event in the current gesture has been consumed and has |
| + // caused the view to scroll or rubber band. All future events in this |
| + // gesture will be consumed and overscrolls will cause rubberbanding. |
| + bool m_hasScrolled; |
| bool m_momentumScrollInProgress; |
| bool m_ignoreMomentumScrolls; |