Index: third_party/WebKit/Source/core/input/MouseEventManager.h |
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.h b/third_party/WebKit/Source/core/input/MouseEventManager.h |
index 400ddd5f6d5ee4dc8fd88ee75124002b649cd4a3..3ab7bfb26071b32d26e408a10d4fa73d2fadbbdb 100644 |
--- a/third_party/WebKit/Source/core/input/MouseEventManager.h |
+++ b/third_party/WebKit/Source/core/input/MouseEventManager.h |
@@ -6,15 +6,26 @@ |
#define MouseEventManager_h |
#include "core/CoreExport.h" |
-#include "core/frame/LocalFrame.h" |
#include "core/input/BoundaryEventDispatcher.h" |
+#include "core/page/DragActions.h" |
+#include "core/page/EventWithHitTestResults.h" |
#include "platform/PlatformMouseEvent.h" |
+#include "platform/Timer.h" |
#include "public/platform/WebInputEventResult.h" |
#include "wtf/Allocator.h" |
namespace blink { |
+class DragState; |
+class DataTransfer; |
+class Element; |
+class FloatQuad; |
+class HitTestResult; |
+class InputDeviceCapabilities; |
class LocalFrame; |
+class ScrollManager; |
+ |
+enum class DragInitiator; |
// This class takes care of dispatching all mouse events and keeps track of |
// positions and states of mouse. |
@@ -22,13 +33,23 @@ class CORE_EXPORT MouseEventManager : public GarbageCollectedFinalized<MouseEven |
WTF_MAKE_NONCOPYABLE(MouseEventManager); |
public: |
- explicit MouseEventManager(LocalFrame*); |
+ explicit MouseEventManager(LocalFrame*, ScrollManager*); |
+ ~MouseEventManager(); |
DECLARE_TRACE(); |
WebInputEventResult dispatchMouseEvent( |
EventTarget*, const AtomicString&, const PlatformMouseEvent&, |
- EventTarget* relatedTarget, int detail = 0, |
- bool checkForListener = false); |
+ EventTarget* relatedTarget, bool checkForListener = false); |
+ |
+ WebInputEventResult dispatchMouseEvent( |
+ Node* targetNode, const AtomicString& eventType, |
+ const PlatformMouseEvent&); |
+ |
+ WebInputEventResult dispatchMouseClickIfNeeded( |
+ const MouseEventWithHitTestResults&); |
+ |
+ WebInputEventResult dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&); |
+ WebInputEventResult dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, DataTransfer*); |
// Resets the internal state of this object. |
void clear(); |
@@ -38,6 +59,68 @@ public: |
EventTarget* enteredTarget, |
const PlatformMouseEvent& mousePlatformEvent); |
+ void setNodeUnderMouse(Node*, const PlatformMouseEvent&); |
+ |
+ WebInputEventResult handleMouseFocus(const HitTestResult&, InputDeviceCapabilities* sourceCapabilities); |
+ |
+ void fakeMouseMoveEventTimerFired(TimerBase*); |
+ |
+ void cancelFakeMouseMoveEvent(); |
+ void dispatchFakeMouseMoveEventSoon(); |
+ void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); |
+ |
+ void setLastKnownMousePosition(const PlatformMouseEvent&); |
+ |
+ bool handleDragDropIfPossible(const GestureEventWithHitTestResults&); |
+ |
+ WebInputEventResult handleMouseDraggedEvent(const MouseEventWithHitTestResults&); |
+ WebInputEventResult handleMousePressEvent(const MouseEventWithHitTestResults&); |
+ WebInputEventResult handleMouseReleaseEvent(const MouseEventWithHitTestResults&); |
+ |
+ void nodeWillBeRemoved(Node& nodeToBeRemoved); |
+ |
+ static DragState& dragState(); |
dtapuska
2016/09/21 17:07:44
Is the intended DragState supposed to be one per t
Navid Zolghadr
2016/09/21 17:17:30
Since the variable is defined in this way as stati
|
+ |
+ void focusDocumentView(); |
+ |
+ // Resets the state that indicates the next events could cause a drag. It is called when |
+ // we realize the next events should not cause drag based on the drag heuristics. |
+ void clearDragHeuristicState(); |
+ |
+ void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); |
+ |
+ void updateSelectionForMouseDrag(); |
+ |
+ void handleMousePressEventUpdateStates(const PlatformMouseEvent&); |
+ |
+ // Returns whether pan is handled. |
mustaq
2016/09/21 17:28:14
also say: resets the state on release.
Navid Zolghadr
2016/09/23 11:11:16
Done.
|
+ bool handleSvgPanIfNeeded(bool isReleaseEvent); |
+ |
+ void invalidateClick(); |
+ |
+ |
+ // TODO: These functions ideally should be private but the code needs more |
+ // refactoring to be able to remove the dependency from EventHandler. |
+ Node* getNodeUnderMouse(); |
+ bool isMousePositionUnknown(); |
+ IntPoint lastKnownMousePosition(); |
+ |
+ bool mousePressed(); |
+ void setMousePressed(bool); |
+ |
+ bool capturesDragging() const; |
+ void setCapturesDragging(bool); |
+ |
+ void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; } |
+ |
+ Node* mousePressNode(); |
+ void setMousePressNode(Node*); |
+ |
+ void setClickNode(Node*); |
+ void setClickCount(int); |
+ |
+ bool mouseDownMayStartDrag(); |
+ |
private: |
class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher { |
WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher); |
@@ -63,14 +146,56 @@ private: |
Member<EventTarget> m_exitedTarget; |
}; |
+ // If the given element is a shadow host and its root has delegatesFocus=false flag, |
+ // slide focus to its inner element. Returns true if the resulting focus is different from |
+ // the given element. |
+ bool slideFocusOnShadowHostIfNecessary(const Element&); |
+ |
+ bool dragHysteresisExceeded(const IntPoint&) const; |
+ bool handleDrag(const MouseEventWithHitTestResults&, DragInitiator); |
+ bool tryStartDrag(const MouseEventWithHitTestResults&); |
+ void clearDragDataTransfer(); |
+ DataTransfer* createDraggingDataTransfer() const; |
+ |
// NOTE: If adding a new field to this class please ensure that it is |
// cleared in |MouseEventManager::clear()|. |
const Member<LocalFrame> m_frame; |
+ Member<ScrollManager> m_scrollManager; |
// The effective position of the mouse pointer. |
// See https://w3c.github.io/pointerevents/#dfn-tracking-the-effective-position-of-the-legacy-mouse-pointer. |
Member<Node> m_nodeUnderMouse; |
+ |
+ bool m_isMousePositionUnknown; |
dtapuska
2016/09/21 17:07:44
We should probably use unsigned m_ : 1 for all the
Navid Zolghadr
2016/09/21 17:17:30
Sure. I'll do that.
|
+ // The last mouse movement position this frame has seen in root frame coordinates. |
+ IntPoint m_lastKnownMousePosition; |
+ IntPoint m_lastKnownMouseGlobalPosition; |
+ |
+ // Current button-press state for mouse/mouse-like-stylus. |
+ // TODO(crbug.com/563676): Buggy for chorded buttons. |
+ bool m_mousePressed; |
+ |
+ bool m_mouseDownMayStartAutoscroll; |
+ |
+ bool m_capturesDragging; |
+ Member<Node> m_mousePressNode; |
+ |
+ bool m_mouseDownMayStartDrag; |
+ |
+ int m_clickCount; |
+ Member<Node> m_clickNode; |
+ |
+ IntPoint m_mouseDownPos; // In our view's coords. |
+ double m_mouseDownTimestamp; |
+ PlatformMouseEvent m_mouseDown; |
+ |
+ bool m_svgPan; |
+ |
+ LayoutPoint m_dragStartPos; |
+ |
+ Timer<MouseEventManager> m_fakeMouseMoveEventTimer; |
+ |
}; |
} // namespace blink |