OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ScrollManager_h | 5 #ifndef ScrollManager_h |
6 #define ScrollManager_h | 6 #define ScrollManager_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/page/EventWithHitTestResults.h" | 9 #include "core/page/EventWithHitTestResults.h" |
10 #include "platform/PlatformEvent.h" | 10 #include "platform/PlatformEvent.h" |
11 #include "platform/geometry/LayoutSize.h" | 11 #include "platform/geometry/LayoutSize.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "platform/heap/Visitor.h" | 13 #include "platform/heap/Visitor.h" |
14 #include "platform/scroll/ScrollTypes.h" | 14 #include "platform/scroll/ScrollTypes.h" |
15 #include "public/platform/WebInputEventResult.h" | 15 #include "public/platform/WebInputEventResult.h" |
16 #include "wtf/Allocator.h" | 16 #include "wtf/Allocator.h" |
17 #include <deque> | 17 #include <deque> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class AutoscrollController; | 21 class AutoscrollController; |
22 class FrameHost; | 22 class FrameHost; |
23 class LayoutBox; | 23 class LayoutBox; |
24 class LayoutObject; | 24 class LayoutObject; |
25 class LocalFrame; | 25 class LocalFrame; |
26 class PaintLayer; | 26 class PaintLayer; |
27 class PaintLayerScrollableArea; | 27 class PaintLayerScrollableArea; |
28 class PlatformGestureEvent; | |
29 class Scrollbar; | 28 class Scrollbar; |
30 class ScrollState; | 29 class ScrollState; |
31 | 30 |
32 // This class takes care of scrolling and resizing and the related states. The | 31 // This class takes care of scrolling and resizing and the related states. The |
33 // user action that causes scrolling or resizing is determined in other *Manager | 32 // user action that causes scrolling or resizing is determined in other *Manager |
34 // classes and they call into this class for doing the work. | 33 // classes and they call into this class for doing the work. |
35 class CORE_EXPORT ScrollManager | 34 class CORE_EXPORT ScrollManager |
36 : public GarbageCollectedFinalized<ScrollManager> { | 35 : public GarbageCollectedFinalized<ScrollManager> { |
37 WTF_MAKE_NONCOPYABLE(ScrollManager); | 36 WTF_MAKE_NONCOPYABLE(ScrollManager); |
38 | 37 |
(...skipping 29 matching lines...) Expand all Loading... |
68 Node* startingNode, | 67 Node* startingNode, |
69 Node* mousePressNode); | 68 Node* mousePressNode); |
70 | 69 |
71 void setFrameWasScrolledByUser(); | 70 void setFrameWasScrolledByUser(); |
72 | 71 |
73 // TODO(crbug.com/616491): Consider moving all gesture related functions to | 72 // TODO(crbug.com/616491): Consider moving all gesture related functions to |
74 // another class. | 73 // another class. |
75 | 74 |
76 // Handle the provided scroll gesture event, propagating down to child frames | 75 // Handle the provided scroll gesture event, propagating down to child frames |
77 // as necessary. | 76 // as necessary. |
78 WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&); | 77 WebInputEventResult handleGestureScrollEvent(const WebGestureEvent&); |
79 | 78 |
80 WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&); | 79 WebInputEventResult handleGestureScrollEnd(const WebGestureEvent&); |
81 | 80 |
82 bool isScrollbarHandlingGestures() const; | 81 bool isScrollbarHandlingGestures() const; |
83 | 82 |
84 // Returns true if the gesture event should be handled in ScrollManager. | 83 // Returns true if the gesture event should be handled in ScrollManager. |
85 bool canHandleGestureEvent(const GestureEventWithHitTestResults&); | 84 bool canHandleGestureEvent(const GestureEventWithHitTestResults&); |
86 | 85 |
87 // These functions are related to |m_resizeScrollableArea|. | 86 // These functions are related to |m_resizeScrollableArea|. |
88 bool inResizeMode() const; | 87 bool inResizeMode() const; |
89 void resize(const PlatformEvent&); | 88 void resize(const PlatformEvent&); |
90 // Clears |m_resizeScrollableArea|. if |shouldNotBeNull| is true this | 89 // Clears |m_resizeScrollableArea|. if |shouldNotBeNull| is true this |
91 // function DCHECKs to make sure that variable is indeed not null. | 90 // function DCHECKs to make sure that variable is indeed not null. |
92 void clearResizeScrollableArea(bool shouldNotBeNull); | 91 void clearResizeScrollableArea(bool shouldNotBeNull); |
93 void setResizeScrollableArea(PaintLayer*, IntPoint); | 92 void setResizeScrollableArea(PaintLayer*, IntPoint); |
94 | 93 |
95 private: | 94 private: |
96 WebInputEventResult handleGestureScrollUpdate(const PlatformGestureEvent&); | 95 WebInputEventResult handleGestureScrollUpdate(const WebGestureEvent&); |
97 WebInputEventResult handleGestureScrollBegin(const PlatformGestureEvent&); | 96 WebInputEventResult handleGestureScrollBegin(const WebGestureEvent&); |
98 | 97 |
99 WebInputEventResult passScrollGestureEventToWidget( | 98 WebInputEventResult passScrollGestureEventToWidget(const WebGestureEvent&, |
100 const PlatformGestureEvent&, | 99 LayoutObject*); |
101 LayoutObject*); | |
102 | 100 |
103 void clearGestureScrollState(); | 101 void clearGestureScrollState(); |
104 | 102 |
105 void customizedScroll(const Node& startNode, ScrollState&); | 103 void customizedScroll(const Node& startNode, ScrollState&); |
106 | 104 |
107 FrameHost* frameHost() const; | 105 FrameHost* frameHost() const; |
108 | 106 |
109 bool isEffectiveRootScroller(const Node&) const; | 107 bool isEffectiveRootScroller(const Node&) const; |
110 | 108 |
111 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); | 109 bool handleScrollGestureOnResizer(Node*, const WebGestureEvent&); |
112 | 110 |
113 void recomputeScrollChain(const Node& startNode, | 111 void recomputeScrollChain(const Node& startNode, |
114 std::deque<int>& scrollChain); | 112 std::deque<int>& scrollChain); |
115 | 113 |
116 // NOTE: If adding a new field to this class please ensure that it is | 114 // NOTE: If adding a new field to this class please ensure that it is |
117 // cleared in |ScrollManager::clear()|. | 115 // cleared in |ScrollManager::clear()|. |
118 | 116 |
119 const Member<LocalFrame> m_frame; | 117 const Member<LocalFrame> m_frame; |
120 | 118 |
121 // Only used with the ScrollCustomization runtime enabled feature. | 119 // Only used with the ScrollCustomization runtime enabled feature. |
(...skipping 20 matching lines...) Expand all Loading... |
142 | 140 |
143 Member<PaintLayerScrollableArea> m_resizeScrollableArea; | 141 Member<PaintLayerScrollableArea> m_resizeScrollableArea; |
144 | 142 |
145 LayoutSize | 143 LayoutSize |
146 m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea. | 144 m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea. |
147 }; | 145 }; |
148 | 146 |
149 } // namespace blink | 147 } // namespace blink |
150 | 148 |
151 #endif // ScrollManager_h | 149 #endif // ScrollManager_h |
OLD | NEW |