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

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

Issue 1892653003: Extract touch handling logic from EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/PointerEventManager.h
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.h b/third_party/WebKit/Source/core/input/PointerEventManager.h
index b158c868da347f803efd8f03cb7c820f9f395ec7..ac1b966e75dd72354a8f153aff728d3b060c39c8 100644
--- a/third_party/WebKit/Source/core/input/PointerEventManager.h
+++ b/third_party/WebKit/Source/core/input/PointerEventManager.h
@@ -8,6 +8,7 @@
#include "core/CoreExport.h"
#include "core/events/PointerEvent.h"
#include "core/events/PointerEventFactory.h"
+#include "core/input/TouchEventManager.h"
#include "public/platform/WebInputEventResult.h"
#include "public/platform/WebPointerProperties.h"
#include "wtf/Allocator.h"
@@ -15,13 +16,14 @@
namespace blink {
+class LocalFrame;
// This class takes care of dispatching all pointer events and keeps track of
// properties of active pointer events.
class CORE_EXPORT PointerEventManager {
DISALLOW_NEW();
public:
- PointerEventManager();
+ explicit PointerEventManager(LocalFrame*);
~PointerEventManager();
DECLARE_TRACE();
@@ -32,20 +34,8 @@ public:
AbstractView*,
Node* lastNodeUnderMouse);
- // Returns whether the event is consumed or not
- WebInputEventResult sendTouchPointerEvent(
- EventTarget*,
- const PlatformTouchPoint&, PlatformEvent::Modifiers,
- const double width, const double height,
- const double clientX, const double clientY);
-
- // Inhibits firing of touch-type PointerEvents until unblocked by unblockTouchPointers(). Also
- // sends pointercancels for existing touch-type PointerEvents.
- // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors
- void blockTouchPointers();
-
- // Enables firing of touch-type PointerEvents after they were inhibited by blockTouchPointers().
- void unblockTouchPointers();
+ WebInputEventResult handleTouchEvents(
+ const PlatformTouchEvent&);
// Sends node transition events mouseout/leave/over/enter to the
// corresponding targets. This function sends pointerout/leave/over/enter
@@ -64,17 +54,21 @@ public:
const PlatformMouseEvent&,
AbstractView*, bool isFrameBoundaryTransition);
- // Clear all the existing ids.
+ // Resets the internal state of this object.
void clear();
void elementRemoved(EventTarget*);
void setPointerCapture(int, EventTarget*);
void releasePointerCapture(int, EventTarget*);
- bool isActive(const int);
- WebPointerProperties::PointerType getPointerEventType(const int);
+ bool isActive(const int) const;
+ WebPointerProperties::PointerType getPointerEventType(const int) const;
+
+ // Returns whether there is any touch on the screen.
+ bool isAnyTouchActive() const;
private:
- typedef HeapHashMap<int, Member<EventTarget>> PointerCapturingMap;
+ typedef HeapHashMap<int, Member<EventTarget>, WTF::IntHash<int>,
+ WTF::UnsignedWithZeroKeyHashTraits<int>> PointerCapturingMap;
class EventTargetAttributes {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
public:
@@ -93,6 +87,21 @@ private:
, hasRecievedOverEvent(hasRecievedOverEvent) {}
};
+ // Inhibits firing of touch-type PointerEvents until unblocked by unblockTouchPointers(). Also
+ // sends pointercancels for existing touch-type PointerEvents.
+ // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors
+ void blockTouchPointers();
+
+ // Enables firing of touch-type PointerEvents after they were inhibited by blockTouchPointers().
+ void unblockTouchPointers();
+
+ void dispatchTouchPointerEvents(
dtapuska 2016/04/27 17:07:04 Is it possible for HeapVector to be const? I'm no
Navid Zolghadr 2016/04/28 15:13:11 It is kind of an output parameter in the sense tha
dtapuska 2016/04/29 14:56:54 Can we add a comment to the file describing what i
+ const PlatformTouchEvent&, HeapVector<TouchEventManager::TouchInfo>&);
+
+ // Returns whether the event is consumed or not.
+ WebInputEventResult sendTouchPointerEvent(
+ EventTarget*, PointerEvent*);
+
void sendNodeTransitionEvents(
EventTarget* exitedTarget,
EventTarget* enteredTarget,
@@ -135,6 +144,11 @@ private:
bool checkForListener = false);
void releasePointerCapture(int);
+ // NOTE: If adding a new field to this class please ensure that it is
+ // cleared in |PointerEventManager::clear()|.
+
+ const Member<LocalFrame> m_frame;
+
// Prevents firing mousedown, mousemove & mouseup in-between a canceled pointerdown and next pointerup/pointercancel.
// See "PREVENT MOUSE EVENT flag" in the spec:
// https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-events
@@ -148,11 +162,16 @@ private:
// which might be different than m_nodeUnderMouse in EventHandler. That one
// keeps track of any compatibility mouse event positions but this map for
// the pointer with id=1 is only taking care of true mouse related events.
- HeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer;
+ using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes,
+ WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>;
+ NodeUnderPointerMap m_nodeUnderPointer;
PointerCapturingMap m_pointerCaptureTarget;
PointerCapturingMap m_pendingPointerCaptureTarget;
PointerEventFactory m_pointerEventFactory;
+
dtapuska 2016/04/27 17:07:04 If there isn't a comment I don't think it needs a
Navid Zolghadr 2016/04/28 15:13:11 Done.
+ TouchEventManager m_touchEventManager;
+
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698