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 // position and related states mouse and its buttons. | |
|
mustaq
2016/09/01 19:21:27
Missed the class doc before: "...positions and sta
Navid Zolghadr
2016/09/01 19:31:54
Done.
| |
| 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 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override; | |
| 59 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override; | |
| 60 void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override; | |
| 61 void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override; | |
| 62 AtomicString getLeaveEvent() override; | |
| 63 AtomicString getEnterEvent() override; | |
| 64 | |
| 65 private: | |
| 66 void dispatch(EventTarget*, EventTarget* relatedTarget, | |
| 67 const AtomicString&, const PlatformMouseEvent&, | |
| 68 bool checkForListener); | |
| 69 MouseEventManager* m_mouseEventManager; | |
|
haraken
2016/09/01 17:21:58
I don't see any reason we want to make MouseEventM
Navid Zolghadr
2016/09/01 19:31:54
Alright. I made all the *Manager classes GarbageCo
| |
| 70 const 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 |