| 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 RootViewportScrollCallback_h | |
| 6 #define RootViewportScrollCallback_h | |
| 7 | |
| 8 #include "core/page/scrolling/ViewportScrollCallback.h" | |
| 9 #include "platform/heap/Handle.h" | |
| 10 #include "platform/scroll/ScrollTypes.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class FloatSize; | |
| 15 class ScrollableArea; | |
| 16 class ScrollState; | |
| 17 class TopControls; | |
| 18 class OverscrollController; | |
| 19 class RootFrameViewport; | |
| 20 | |
| 21 // The ViewportScrollCallback used by the one root frame on the page. This | |
| 22 // callback provides scrolling of the frame as well as associated actions like | |
| 23 // top controls movement and overscroll glow. | |
| 24 class RootViewportScrollCallback : public ViewportScrollCallback { | |
| 25 public: | |
| 26 // The TopControls and OverscrollController are given to the | |
| 27 // RootViewportScrollCallback but are not owned or kept alive by it. | |
| 28 static RootViewportScrollCallback* create( | |
| 29 TopControls* topControls, | |
| 30 OverscrollController* overscrollController, | |
| 31 RootFrameViewport& rootFrameViewport) | |
| 32 { | |
| 33 return new RootViewportScrollCallback( | |
| 34 topControls, overscrollController, rootFrameViewport); | |
| 35 } | |
| 36 | |
| 37 virtual ~RootViewportScrollCallback(); | |
| 38 | |
| 39 void handleEvent(ScrollState*) override; | |
| 40 void setScroller(ScrollableArea*) override; | |
| 41 | |
| 42 DECLARE_VIRTUAL_TRACE(); | |
| 43 | |
| 44 private: | |
| 45 // RootViewportScrollCallback does not assume ownership of TopControls or of | |
| 46 // OverscrollController. | |
| 47 RootViewportScrollCallback(TopControls*, OverscrollController*, RootFrameVie
wport&); | |
| 48 | |
| 49 bool shouldScrollTopControls(const FloatSize&, ScrollGranularity) const; | |
| 50 bool scrollTopControls(ScrollState&); | |
| 51 | |
| 52 WeakMember<TopControls> m_topControls; | |
| 53 WeakMember<OverscrollController> m_overscrollController; | |
| 54 WeakMember<RootFrameViewport> m_rootFrameViewport; | |
| 55 }; | |
| 56 | |
| 57 } // namespace blink | |
| 58 | |
| 59 #endif // RootViewportScrollCallback_h | |
| OLD | NEW |