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