| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 explicit ScrollManager(LocalFrame*); | 40 explicit ScrollManager(LocalFrame*); |
| 41 ~ScrollManager(); | 41 ~ScrollManager(); |
| 42 DECLARE_TRACE(); | 42 DECLARE_TRACE(); |
| 43 | 43 |
| 44 void clear(); | 44 void clear(); |
| 45 | 45 |
| 46 bool panScrollInProgress() const; | 46 bool panScrollInProgress() const; |
| 47 AutoscrollController* autoscrollController() const; | 47 AutoscrollController* autoscrollController() const; |
| 48 void stopAutoscroll(); | 48 void stopAutoscroll(); |
| 49 | 49 |
| 50 // Performs a chaining scroll, within a *single* frame, starting from a | |
| 51 // given node and optionally stopping on a given node. | |
| 52 // granularity - The units that the scroll delta parameter is in. | |
| 53 // delta - The delta to scroll by, in the units of the granularity param | |
| 54 // (e.g. pixels, lines, pages, etc.). These are in a physical | |
| 55 // direction. i.e. Positive is down and right. | |
| 56 // position - Where the scroll originated from (e.g. touch location). | |
| 57 // velocity - The velocity of the scroll in the case of fling gestures. | |
| 58 // startNode - The node to start the scroll chaining from. | |
| 59 // stopNode - On input, if non-null, the node at which we should stop | |
| 60 // chaining. On output, if provided and a node was scrolled, | |
| 61 // stopNode will point to that node. | |
| 62 // consumed - [OUT] Whether the scroll was consumed. This is different than | |
| 63 // ScrollResult.didScroll since we might not have scrolled but | |
| 64 // have reached the stopNode and thus don't want to continue | |
| 65 // chaining the scroll. | |
| 66 ScrollResult physicalScroll( | |
| 67 ScrollGranularity, | |
| 68 const FloatSize& delta, | |
| 69 const FloatPoint& position, | |
| 70 const FloatSize& velocity, | |
| 71 Node* startNode, | |
| 72 Node** stopNode, | |
| 73 bool* consumed); | |
| 74 | |
| 75 // Performs a chaining logical scroll, within a *single* frame, starting | 50 // Performs a chaining logical scroll, within a *single* frame, starting |
| 76 // from either a provided starting node or a default based on the focused or | 51 // from either a provided starting node or a default based on the focused or |
| 77 // most recently clicked node, falling back to the frame. | 52 // most recently clicked node, falling back to the frame. |
| 78 // Returns true if the scroll was consumed. | 53 // Returns true if the scroll was consumed. |
| 79 // direction - The logical direction to scroll in. This will be converted to | 54 // direction - The logical direction to scroll in. This will be converted to |
| 80 // a physical direction for each LayoutBox we try to scroll | 55 // a physical direction for each LayoutBox we try to scroll |
| 81 // based on that box's writing mode. | 56 // based on that box's writing mode. |
| 82 // granularity - The units that the scroll delta parameter is in. | 57 // granularity - The units that the scroll delta parameter is in. |
| 83 // startNode - Optional. If provided, start chaining from the given node. | 58 // startNode - Optional. If provided, start chaining from the given node. |
| 84 // If not, use the current focus or last clicked node. | 59 // If not, use the current focus or last clicked node. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 91 |
| 117 WebInputEventResult handleGestureScrollUpdate(const PlatformGestureEvent&); | 92 WebInputEventResult handleGestureScrollUpdate(const PlatformGestureEvent&); |
| 118 WebInputEventResult handleGestureScrollBegin(const PlatformGestureEvent&); | 93 WebInputEventResult handleGestureScrollBegin(const PlatformGestureEvent&); |
| 119 | 94 |
| 120 WebInputEventResult passScrollGestureEventToWidget(const PlatformGestureEven
t&, LayoutObject*); | 95 WebInputEventResult passScrollGestureEventToWidget(const PlatformGestureEven
t&, LayoutObject*); |
| 121 | 96 |
| 122 void clearGestureScrollState(); | 97 void clearGestureScrollState(); |
| 123 | 98 |
| 124 void customizedScroll(const Node& startNode, ScrollState&); | 99 void customizedScroll(const Node& startNode, ScrollState&); |
| 125 | 100 |
| 126 ScrollResult scrollBox( | |
| 127 LayoutBox*, | |
| 128 ScrollGranularity, | |
| 129 const FloatSize& delta, | |
| 130 const FloatPoint& position, | |
| 131 const FloatSize& velocity, | |
| 132 bool* wasRootScroller); | |
| 133 | |
| 134 FrameHost* frameHost() const; | 101 FrameHost* frameHost() const; |
| 135 | 102 |
| 136 bool isRootScroller(const Node&) const; | 103 bool isEffectiveRootScroller(const Node&) const; |
| 137 | 104 |
| 138 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); | 105 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); |
| 139 | 106 |
| 107 void recomputeScrollChain(const Node& startNode, |
| 108 std::deque<int>& scrollChain); |
| 109 |
| 140 | 110 |
| 141 // NOTE: If adding a new field to this class please ensure that it is | 111 // NOTE: If adding a new field to this class please ensure that it is |
| 142 // cleared in |ScrollManager::clear()|. | 112 // cleared in |ScrollManager::clear()|. |
| 143 | 113 |
| 144 const Member<LocalFrame> m_frame; | 114 const Member<LocalFrame> m_frame; |
| 145 | 115 |
| 146 // Only used with the ScrollCustomization runtime enabled feature. | 116 // Only used with the ScrollCustomization runtime enabled feature. |
| 147 std::deque<int> m_currentScrollChain; | 117 std::deque<int> m_currentScrollChain; |
| 148 | 118 |
| 149 Member<Node> m_scrollGestureHandlingNode; | 119 Member<Node> m_scrollGestureHandlingNode; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 167 | 137 |
| 168 Member<PaintLayerScrollableArea> m_resizeScrollableArea; | 138 Member<PaintLayerScrollableArea> m_resizeScrollableArea; |
| 169 | 139 |
| 170 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeScrollableA
rea. | 140 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeScrollableA
rea. |
| 171 | 141 |
| 172 }; | 142 }; |
| 173 | 143 |
| 174 } // namespace blink | 144 } // namespace blink |
| 175 | 145 |
| 176 #endif // ScrollManager_h | 146 #endif // ScrollManager_h |
| OLD | NEW |