Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c7e320de1c20e1e92b9c4eac347b690842f550d6 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/input/MouseEventManager.h |
| @@ -0,0 +1,86 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MouseEventManager_h |
| +#define MouseEventManager_h |
| + |
| +#include "core/CoreExport.h" |
| +#include "core/frame/LocalFrame.h" |
| +#include "core/input/BoundaryEventDispatcher.h" |
| +#include "platform/PlatformMouseEvent.h" |
| +#include "public/platform/WebInputEventResult.h" |
| +#include "wtf/Allocator.h" |
| + |
| +namespace blink { |
| + |
| +class LocalFrame; |
| + |
| +// This class takes care of dispatching all mouse events and keeps track of |
| +// 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.
|
| +class CORE_EXPORT MouseEventManager { |
| + WTF_MAKE_NONCOPYABLE(MouseEventManager); |
| + DISALLOW_NEW(); |
| + |
| +public: |
| + explicit MouseEventManager(LocalFrame*); |
| + ~MouseEventManager(); |
| + DECLARE_TRACE(); |
| + |
| + WebInputEventResult dispatchMouseEvent( |
| + EventTarget*, const AtomicString&, const PlatformMouseEvent&, |
| + EventTarget* relatedTarget, int detail = 0, |
| + bool checkForListener = false); |
| + |
| + // Resets the internal state of this object. |
| + void clear(); |
| + |
| + void sendBoundaryEvents( |
| + EventTarget* exitedTarget, |
| + EventTarget* enteredTarget, |
| + const PlatformMouseEvent& mousePlatformEvent); |
| + |
| +private: |
| + class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher { |
| + WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher); |
| + DISALLOW_NEW(); |
| + |
| + public: |
| + DEFINE_INLINE_TRACE() |
| + { |
| + visitor->trace(m_exitedTarget); |
| + BoundaryEventDispatcher::trace(visitor); |
| + } |
| + MouseEventBoundaryEventDispatcher(MouseEventManager*, |
| + const PlatformMouseEvent*, EventTarget* exitedTarget); |
| + |
| + protected: |
| + void dispatchOut(EventTarget*, EventTarget* relatedTarget) override; |
| + void dispatchOver(EventTarget*, EventTarget* relatedTarget) override; |
| + void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkForListener) override; |
| + void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkForListener) override; |
| + AtomicString getLeaveEvent() override; |
| + AtomicString getEnterEvent() override; |
| + |
| + private: |
| + void dispatch(EventTarget*, EventTarget* relatedTarget, |
| + const AtomicString&, const PlatformMouseEvent&, |
| + bool checkForListener); |
| + 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
|
| + const PlatformMouseEvent* m_platformMouseEvent; |
| + Member<EventTarget> m_exitedTarget; |
| + }; |
| + |
| + // NOTE: If adding a new field to this class please ensure that it is |
| + // cleared in |MouseEventManager::clear()|. |
| + |
| + const Member<LocalFrame> m_frame; |
| + |
| + // 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; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // MouseEventManager_h |