| 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 pointer events and keeps track of |
| 20 // properties of active pointer events. |
| 21 class CORE_EXPORT MouseEventManager { |
| 22 WTF_MAKE_NONCOPYABLE(MouseEventManager); |
| 23 DISALLOW_NEW(); |
| 24 |
| 25 public: |
| 26 explicit MouseEventManager(LocalFrame*); |
| 27 ~MouseEventManager(); |
| 28 DECLARE_TRACE(); |
| 29 |
| 30 WebInputEventResult dispatchMouseEvent( |
| 31 EventTarget*, const AtomicString&, const PlatformMouseEvent&, |
| 32 EventTarget* relatedTarget, int detail = 0, |
| 33 bool checkForListener = false); |
| 34 |
| 35 // Resets the internal state of this object. |
| 36 void clear(); |
| 37 |
| 38 void sendBoundaryEvents( |
| 39 EventTarget* exitedTarget, |
| 40 EventTarget* enteredTarget, |
| 41 const PlatformMouseEvent& mousePlatformEvent); |
| 42 |
| 43 private: |
| 44 class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher { |
| 45 WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher); |
| 46 DISALLOW_NEW(); |
| 47 |
| 48 public: |
| 49 DEFINE_INLINE_TRACE() |
| 50 { |
| 51 visitor->trace(m_exitedTarget); |
| 52 BoundaryEventDispatcher::trace(visitor); |
| 53 } |
| 54 MouseEventBoundaryEventDispatcher(MouseEventManager*, |
| 55 const PlatformMouseEvent&, EventTarget* exitedTarget); |
| 56 |
| 57 protected: |
| 58 virtual void dispatchOut(EventTarget*, EventTarget* relatedTarget); |
| 59 virtual void dispatchOver(EventTarget*, EventTarget* relatedTarget); |
| 60 virtual void dispatchLeave(EventTarget*, EventTarget* relatedTarget, boo
l checkForListener); |
| 61 virtual void dispatchEnter(EventTarget*, EventTarget* relatedTarget, boo
l checkForListener); |
| 62 virtual AtomicString getLeaveEvent(); |
| 63 virtual AtomicString getEnterEvent(); |
| 64 |
| 65 private: |
| 66 void dispatch(EventTarget*, EventTarget* relatedTarget, |
| 67 const AtomicString&, const PlatformMouseEvent&, |
| 68 bool checkForListener); |
| 69 MouseEventManager* m_mouseEventManager; |
| 70 PlatformMouseEvent m_platformMouseEvent; |
| 71 Member<EventTarget> m_exitedTarget; |
| 72 }; |
| 73 |
| 74 // NOTE: If adding a new field to this class please ensure that it is |
| 75 // cleared in |MouseEventManager::clear()|. |
| 76 |
| 77 const Member<LocalFrame> m_frame; |
| 78 |
| 79 // The effective position of the mouse pointer. |
| 80 // See https://w3c.github.io/pointerevents/#dfn-tracking-the-effective-posit
ion-of-the-legacy-mouse-pointer. |
| 81 Member<Node> m_nodeUnderMouse; |
| 82 }; |
| 83 |
| 84 } // namespace blink |
| 85 |
| 86 #endif // MouseEventManager_h |
| OLD | NEW |