Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef OverscrollController_h | |
| 6 #define OverscrollController_h | |
| 7 | |
| 8 #include "platform/geometry/FloatSize.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class ChromeClient; | |
| 14 class FloatPoint; | |
| 15 struct ScrollResult; | |
| 16 class VisualViewport; | |
| 17 | |
| 18 // Handles overscroll logic that occurs when the user scolls past the end of the | |
| 19 // document's scroll extents. Currently, this applies only to document scrolling | |
| 20 // and only on the root frame. We "accumulate" overscroll deltas from separate | |
| 21 // scroll events if the user continuously scrolls past the extent but reset it | |
| 22 // as soon as a gesture ends. | |
| 23 class OverscrollController : public GarbageCollected<OverscrollController> { | |
| 24 public: | |
| 25 static OverscrollController* create( | |
| 26 VisualViewport& visualViewport, | |
| 27 ChromeClient& chromeClient) { | |
| 28 return new OverscrollController(visualViewport, chromeClient); | |
| 29 } | |
| 30 | |
| 31 void resetAccumulated(bool resetX, bool resetY); | |
| 32 | |
| 33 // Reports unused scroll as overscroll to the content layer. The position | |
| 34 // argument is the most recent location of the gesture, the finger position | |
| 35 // for touch scrolling and the cursor position for wheel. Velocity is used | |
| 36 // in the case of a fling gesture where we want the overscroll to feel like | |
| 37 // it has momentum. | |
| 38 void handleOverscroll( | |
| 39 const ScrollResult&, | |
| 40 const FloatPoint& positionInRootFrame, | |
| 41 const FloatSize& velocityInRootFrame); | |
| 42 | |
| 43 DECLARE_TRACE(); | |
| 44 | |
| 45 private: | |
| 46 OverscrollController(VisualViewport&, ChromeClient&); | |
| 47 | |
| 48 WeakMember<VisualViewport> m_visualViewport; | |
|
bokan
2016/04/25 13:44:21
This should really be `const VisualViewport` but W
bokan
2016/04/26 01:08:41
Oilpan team fixed so I made this const again.
| |
| 49 ChromeClient& m_chromeClient; | |
| 50 | |
| 51 FloatSize m_accumulatedRootOverscroll; | |
| 52 }; | |
| 53 | |
| 54 } // namespace blink | |
| 55 | |
| 56 #endif // OverscrollController_h | |
| OLD | NEW |