summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/events/pointer_event_factory.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/events/pointer_event_factory.h')
-rw-r--r--chromium/third_party/blink/renderer/core/events/pointer_event_factory.h51
1 files changed, 28 insertions, 23 deletions
diff --git a/chromium/third_party/blink/renderer/core/events/pointer_event_factory.h b/chromium/third_party/blink/renderer/core/events/pointer_event_factory.h
index 67413673980..6592a2b4ffb 100644
--- a/chromium/third_party/blink/renderer/core/events/pointer_event_factory.h
+++ b/chromium/third_party/blink/renderer/core/events/pointer_event_factory.h
@@ -35,9 +35,8 @@ class CORE_EXPORT PointerEventFactory {
const Vector<WebPointerEvent>& predicted_events,
LocalDOMWindow* view);
- PointerEvent* CreatePointerCancelEvent(
- const int pointer_id,
- TimeTicks platfrom_time_stamp);
+ PointerEvent* CreatePointerCancelEvent(const PointerId pointer_id,
+ TimeTicks platfrom_time_stamp);
// For creating raw move events in chorded button case.
PointerEvent* CreatePointerRawMoveEvent(PointerEvent*);
@@ -56,16 +55,16 @@ class CORE_EXPORT PointerEventFactory {
// When a particular pointerId is removed, the id is considered free even
// though there might have been other PointerEvents that were generated with
// the same id before.
- bool Remove(const int);
+ bool Remove(const PointerId);
// Returns all ids of pointers that are not hovering.
- Vector<int> GetPointerIdsOfNonHoveringPointers() const;
+ Vector<PointerId> GetPointerIdsOfNonHoveringPointers() const;
// Returns whether a pointer id exists and active.
- bool IsActive(const int) const;
+ bool IsActive(const PointerId) const;
// Returns whether a pointer id exists and has at least one pressed button.
- bool IsActiveButtonsState(const int) const;
+ bool IsActiveButtonsState(const PointerId) const;
// Returns the id of the pointer event corresponding to the given pointer
// properties if exists otherwise s_invalidId.
@@ -73,24 +72,23 @@ class CORE_EXPORT PointerEventFactory {
// Returns pointerType of for the given pointerId if such id is active.
// Otherwise it returns WebPointerProperties::PointerType::Unknown.
- WebPointerProperties::PointerType GetPointerType(int pointer_id) const;
+ WebPointerProperties::PointerType GetPointerType(PointerId pointer_id) const;
// Returns whether a WebPoinerProperties is primary pointer.
bool IsPrimary(const WebPointerProperties&) const;
- static const int kMouseId;
+ static const PointerId kMouseId;
// Removes pointer_id from the map.
- void RemoveLastPosition(const int pointer_id);
+ void RemoveLastPosition(const PointerId pointer_id);
// Returns last_position of for the given pointerId if such id is active.
// Otherwise it returns the PositionInScreen of the given events, so we will
// get movement = 0 when there is no last position.
- FloatPoint GetLastPointerPosition(int pointer_id,
+ FloatPoint GetLastPointerPosition(PointerId pointer_id,
const WebPointerProperties& event) const;
private:
- typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash;
typedef struct IncomingId : public std::pair<int, int> {
IncomingId() = default;
IncomingId(WebPointerProperties::PointerType pointer_type, int raw_id)
@@ -115,10 +113,10 @@ class CORE_EXPORT PointerEventFactory {
hovering(hovering) {}
} PointerAttributes;
- int AddIdAndActiveButtons(const IncomingId,
- bool is_active_buttons,
- bool hovering);
- bool IsPrimary(const int) const;
+ PointerId AddIdAndActiveButtons(const IncomingId,
+ bool is_active_buttons,
+ bool hovering);
+ bool IsPrimary(const PointerId) const;
PointerEventInit* ConvertIdTypeButtonsEvent(const WebPointerEvent&);
void SetEventSpecificFields(PointerEventInit*, const AtomicString& type);
@@ -134,17 +132,21 @@ class CORE_EXPORT PointerEventFactory {
const Vector<WebPointerEvent>& event_list,
LocalDOMWindow* view);
- void SetLastPosition(int pointer_id, const WebPointerProperties& event);
+ void SetLastPosition(PointerId pointer_id, const WebPointerProperties& event);
- static const int kInvalidId;
+ static const PointerId kInvalidId;
- int current_id_;
+ PointerId current_id_;
HashMap<IncomingId,
- int,
+ PointerId,
WTF::PairHash<int, int>,
- WTF::PairHashTraits<UnsignedHash, UnsignedHash>>
+ WTF::PairHashTraits<WTF::UnsignedWithZeroKeyHashTraits<int>,
+ WTF::UnsignedWithZeroKeyHashTraits<int>>>
pointer_incoming_id_mapping_;
- HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash>
+ HashMap<PointerId,
+ PointerAttributes,
+ WTF::IntHash<PointerId>,
+ WTF::UnsignedWithZeroKeyHashTraits<PointerId>>
pointer_id_mapping_;
int primary_id_[static_cast<int>(
WebPointerProperties::PointerType::kLastEntry) +
@@ -153,7 +155,10 @@ class CORE_EXPORT PointerEventFactory {
WebPointerProperties::PointerType::kLastEntry) +
1];
- HashMap<int, FloatPoint, WTF::IntHash<int>, UnsignedHash>
+ HashMap<PointerId,
+ FloatPoint,
+ WTF::IntHash<PointerId>,
+ WTF::UnsignedWithZeroKeyHashTraits<PointerId>>
pointer_id_last_position_mapping_;
};