| 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..873c637bc69a6f75f0ef1aad05f93fb5228d5de7 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,23 @@ 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();
|
| +
|
| + // Sends touch pointer events and sets consumed bits in TouchInfo array
|
| + // based on the return value of pointer event handlers.
|
| + void dispatchTouchPointerEvents(
|
| + 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 +146,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 +164,15 @@ 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;
|
| + TouchEventManager m_touchEventManager;
|
| +
|
| };
|
|
|
| } // namespace blink
|
|
|