| 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; |
| 30 class WebGestureEvent; |
| 31 | 31 |
| 32 // This class takes care of scrolling and resizing and the related states. The | 32 // 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 | 33 // user action that causes scrolling or resizing is determined in other *Manager |
| 34 // classes and they call into this class for doing the work. | 34 // classes and they call into this class for doing the work. |
| 35 class CORE_EXPORT ScrollManager | 35 class CORE_EXPORT ScrollManager |
| 36 : public GarbageCollectedFinalized<ScrollManager> { | 36 : public GarbageCollectedFinalized<ScrollManager> { |
| 37 WTF_MAKE_NONCOPYABLE(ScrollManager); | 37 WTF_MAKE_NONCOPYABLE(ScrollManager); |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 explicit ScrollManager(LocalFrame&); | 40 explicit ScrollManager(LocalFrame&); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 Node* startingNode, | 68 Node* startingNode, |
| 69 Node* mousePressNode); | 69 Node* mousePressNode); |
| 70 | 70 |
| 71 void setFrameWasScrolledByUser(); | 71 void setFrameWasScrolledByUser(); |
| 72 | 72 |
| 73 // TODO(crbug.com/616491): Consider moving all gesture related functions to | 73 // TODO(crbug.com/616491): Consider moving all gesture related functions to |
| 74 // another class. | 74 // another class. |
| 75 | 75 |
| 76 // Handle the provided scroll gesture event, propagating down to child frames | 76 // Handle the provided scroll gesture event, propagating down to child frames |
| 77 // as necessary. | 77 // as necessary. |
| 78 WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&); | 78 WebInputEventResult handleGestureScrollEvent(const WebGestureEvent&); |
| 79 | 79 |
| 80 WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&); | 80 WebInputEventResult handleGestureScrollEnd(const WebGestureEvent&); |
| 81 | 81 |
| 82 bool isScrollbarHandlingGestures() const; | 82 bool isScrollbarHandlingGestures() const; |
| 83 | 83 |
| 84 // Returns true if the gesture event should be handled in ScrollManager. | 84 // Returns true if the gesture event should be handled in ScrollManager. |
| 85 bool canHandleGestureEvent(const GestureEventWithHitTestResults&); | 85 bool canHandleGestureEvent(const GestureEventWithHitTestResults&); |
| 86 | 86 |
| 87 // These functions are related to |m_resizeScrollableArea|. | 87 // These functions are related to |m_resizeScrollableArea|. |
| 88 bool inResizeMode() const; | 88 bool inResizeMode() const; |
| 89 void resize(const PlatformEvent&); | 89 void resize(const PlatformMouseEvent&); |
| 90 // Clears |m_resizeScrollableArea|. if |shouldNotBeNull| is true this | 90 // Clears |m_resizeScrollableArea|. if |shouldNotBeNull| is true this |
| 91 // function DCHECKs to make sure that variable is indeed not null. | 91 // function DCHECKs to make sure that variable is indeed not null. |
| 92 void clearResizeScrollableArea(bool shouldNotBeNull); | 92 void clearResizeScrollableArea(bool shouldNotBeNull); |
| 93 void setResizeScrollableArea(PaintLayer*, IntPoint); | 93 void setResizeScrollableArea(PaintLayer*, IntPoint); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 WebInputEventResult handleGestureScrollUpdate(const PlatformGestureEvent&); | 96 WebInputEventResult handleGestureScrollUpdate(const WebGestureEvent&); |
| 97 WebInputEventResult handleGestureScrollBegin(const PlatformGestureEvent&); | 97 WebInputEventResult handleGestureScrollBegin(const WebGestureEvent&); |
| 98 | 98 |
| 99 WebInputEventResult passScrollGestureEventToWidget( | 99 WebInputEventResult passScrollGestureEventToWidget(const WebGestureEvent&, |
| 100 const PlatformGestureEvent&, | 100 LayoutObject*); |
| 101 LayoutObject*); | |
| 102 | 101 |
| 103 void clearGestureScrollState(); | 102 void clearGestureScrollState(); |
| 104 | 103 |
| 105 void customizedScroll(const Node& startNode, ScrollState&); | 104 void customizedScroll(const Node& startNode, ScrollState&); |
| 106 | 105 |
| 107 FrameHost* frameHost() const; | 106 FrameHost* frameHost() const; |
| 108 | 107 |
| 109 bool isViewportScrollingElement(const Element&) const; | 108 bool isViewportScrollingElement(const Element&) const; |
| 110 | 109 |
| 111 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); | 110 bool handleScrollGestureOnResizer(Node*, const WebGestureEvent&); |
| 112 | 111 |
| 113 void recomputeScrollChain(const Node& startNode, | 112 void recomputeScrollChain(const Node& startNode, |
| 114 std::deque<int>& scrollChain); | 113 std::deque<int>& scrollChain); |
| 115 | 114 |
| 116 // NOTE: If adding a new field to this class please ensure that it is | 115 // NOTE: If adding a new field to this class please ensure that it is |
| 117 // cleared in |ScrollManager::clear()|. | 116 // cleared in |ScrollManager::clear()|. |
| 118 | 117 |
| 119 const Member<LocalFrame> m_frame; | 118 const Member<LocalFrame> m_frame; |
| 120 | 119 |
| 121 // Only used with the ScrollCustomization runtime enabled feature. | 120 // Only used with the ScrollCustomization runtime enabled feature. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 142 | 141 |
| 143 Member<PaintLayerScrollableArea> m_resizeScrollableArea; | 142 Member<PaintLayerScrollableArea> m_resizeScrollableArea; |
| 144 | 143 |
| 145 LayoutSize | 144 LayoutSize |
| 146 m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea. | 145 m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea. |
| 147 }; | 146 }; |
| 148 | 147 |
| 149 } // namespace blink | 148 } // namespace blink |
| 150 | 149 |
| 151 #endif // ScrollManager_h | 150 #endif // ScrollManager_h |
| OLD | NEW |