Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: third_party/WebKit/Source/core/input/MouseEventManager.h

Issue 2255323004: Create MouseEventManager and EventHandlingUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e2e9bd975bda14c740daa7c65d27b30d30277c27
--- /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 pointer events and keeps track of
+// properties of active pointer events.
bokan 2016/09/01 13:50:13 Is "pointer events" here related to actual Pointer
Navid Zolghadr 2016/09/01 17:07:27 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:
+ virtual void dispatchOut(EventTarget*, EventTarget* relatedTarget);
+ virtual void dispatchOver(EventTarget*, EventTarget* relatedTarget);
+ virtual void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkForListener);
+ virtual void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkForListener);
+ virtual AtomicString getLeaveEvent();
+ virtual AtomicString getEnterEvent();
+
+ private:
+ void dispatch(EventTarget*, EventTarget* relatedTarget,
+ const AtomicString&, const PlatformMouseEvent&,
+ bool checkForListener);
+ MouseEventManager* m_mouseEventManager;
+ PlatformMouseEvent m_platformMouseEvent;
bokan 2016/09/01 13:50:13 Is there a reason we have to copy the PlatformMous
Navid Zolghadr 2016/09/01 14:30:41 I can keep a pointer to that. Do you think that is
bokan 2016/09/01 16:00:54 Yah, lets avoid copying unless we need it.
Navid Zolghadr 2016/09/01 17:07:27 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698