| 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 MouseEventManager_h |
| 6 #define MouseEventManager_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/input/BoundaryEventDispatcher.h" |
| 11 #include "platform/PlatformMouseEvent.h" |
| 12 #include "public/platform/WebInputEventResult.h" |
| 13 #include "wtf/Allocator.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class LocalFrame; |
| 18 |
| 19 // This class takes care of dispatching all mouse events and keeps track of |
| 20 // positions and states of mouse. |
| 21 class CORE_EXPORT MouseEventManager : public GarbageCollectedFinalized<MouseEven
tManager> { |
| 22 WTF_MAKE_NONCOPYABLE(MouseEventManager); |
| 23 |
| 24 public: |
| 25 explicit MouseEventManager(LocalFrame*); |
| 26 DECLARE_TRACE(); |
| 27 |
| 28 WebInputEventResult dispatchMouseEvent( |
| 29 EventTarget*, const AtomicString&, const PlatformMouseEvent&, |
| 30 EventTarget* relatedTarget, int detail = 0, |
| 31 bool checkForListener = false); |
| 32 |
| 33 // Resets the internal state of this object. |
| 34 void clear(); |
| 35 |
| 36 void sendBoundaryEvents( |
| 37 EventTarget* exitedTarget, |
| 38 EventTarget* enteredTarget, |
| 39 const PlatformMouseEvent& mousePlatformEvent); |
| 40 |
| 41 private: |
| 42 class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher { |
| 43 WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher); |
| 44 |
| 45 public: |
| 46 MouseEventBoundaryEventDispatcher(MouseEventManager*, |
| 47 const PlatformMouseEvent*, EventTarget* exitedTarget); |
| 48 |
| 49 protected: |
| 50 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override; |
| 51 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override; |
| 52 void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkF
orListener) override; |
| 53 void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkF
orListener) override; |
| 54 AtomicString getLeaveEvent() override; |
| 55 AtomicString getEnterEvent() override; |
| 56 |
| 57 private: |
| 58 void dispatch(EventTarget*, EventTarget* relatedTarget, |
| 59 const AtomicString&, const PlatformMouseEvent&, |
| 60 bool checkForListener); |
| 61 Member<MouseEventManager> m_mouseEventManager; |
| 62 const PlatformMouseEvent* m_platformMouseEvent; |
| 63 Member<EventTarget> m_exitedTarget; |
| 64 }; |
| 65 |
| 66 // NOTE: If adding a new field to this class please ensure that it is |
| 67 // cleared in |MouseEventManager::clear()|. |
| 68 |
| 69 const Member<LocalFrame> m_frame; |
| 70 |
| 71 // The effective position of the mouse pointer. |
| 72 // See https://w3c.github.io/pointerevents/#dfn-tracking-the-effective-posit
ion-of-the-legacy-mouse-pointer. |
| 73 Member<Node> m_nodeUnderMouse; |
| 74 }; |
| 75 |
| 76 } // namespace blink |
| 77 |
| 78 #endif // MouseEventManager_h |
| OLD | NEW |