2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-11-21 09:44:22 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* Portions Copyright 2013 Microsoft Open Technologies, Inc. */
|
|
|
|
|
2014-02-27 14:51:15 +04:00
|
|
|
#ifndef mozilla_dom_PointerEvent_h_
|
|
|
|
#define mozilla_dom_PointerEvent_h_
|
2013-11-21 09:44:22 +04:00
|
|
|
|
2014-02-27 14:51:15 +04:00
|
|
|
#include "mozilla/dom/MouseEvent.h"
|
2013-11-21 09:44:22 +04:00
|
|
|
#include "mozilla/dom/PointerEventBinding.h"
|
2021-09-03 18:04:56 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
2013-11-21 09:44:22 +04:00
|
|
|
|
|
|
|
class nsPresContext;
|
|
|
|
|
2022-05-09 23:41:07 +03:00
|
|
|
namespace mozilla::dom {
|
2013-11-21 09:44:22 +04:00
|
|
|
|
2017-09-20 08:00:57 +03:00
|
|
|
struct PointerEventInit;
|
|
|
|
|
2014-02-27 14:51:15 +04:00
|
|
|
class PointerEvent : public MouseEvent {
|
2013-11-21 09:44:22 +04:00
|
|
|
public:
|
|
|
|
PointerEvent(EventTarget* aOwner, nsPresContext* aPresContext,
|
|
|
|
WidgetPointerEvent* aEvent);
|
|
|
|
|
2017-09-20 08:00:57 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PointerEvent, MouseEvent)
|
|
|
|
|
|
|
|
virtual JSObject* WrapObjectInternal(
|
|
|
|
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-11-21 09:44:22 +04:00
|
|
|
|
|
|
|
static already_AddRefed<PointerEvent> Constructor(
|
|
|
|
const GlobalObject& aGlobal, const nsAString& aType,
|
2019-09-11 17:35:28 +03:00
|
|
|
const PointerEventInit& aParam);
|
2013-11-21 09:44:22 +04:00
|
|
|
|
2014-04-04 21:09:10 +04:00
|
|
|
static already_AddRefed<PointerEvent> Constructor(
|
|
|
|
EventTarget* aOwner, const nsAString& aType,
|
|
|
|
const PointerEventInit& aParam);
|
|
|
|
|
2023-02-08 02:53:19 +03:00
|
|
|
int32_t PointerId();
|
|
|
|
int32_t Width();
|
|
|
|
int32_t Height();
|
|
|
|
float Pressure();
|
|
|
|
float TangentialPressure();
|
|
|
|
int32_t TiltX();
|
|
|
|
int32_t TiltY();
|
|
|
|
int32_t Twist();
|
2013-11-21 09:44:22 +04:00
|
|
|
bool IsPrimary();
|
2023-02-08 02:53:19 +03:00
|
|
|
void GetPointerType(nsAString& aPointerType);
|
2017-09-20 08:00:57 +03:00
|
|
|
void GetCoalescedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
2021-04-01 18:19:05 +03:00
|
|
|
void GetPredictedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
2017-09-20 08:00:57 +03:00
|
|
|
|
|
|
|
protected:
|
2020-02-20 18:56:28 +03:00
|
|
|
~PointerEvent() = default;
|
2017-09-20 08:00:57 +03:00
|
|
|
|
|
|
|
private:
|
2018-10-09 14:55:43 +03:00
|
|
|
// This method returns the boolean to indicate whether spoofing pointer
|
|
|
|
// event for fingerprinting resistance.
|
2023-02-08 02:53:19 +03:00
|
|
|
bool ShouldResistFingerprinting();
|
2018-10-09 14:55:43 +03:00
|
|
|
|
2017-09-20 08:00:57 +03:00
|
|
|
nsTArray<RefPtr<PointerEvent>> mCoalescedEvents;
|
2021-04-01 18:19:05 +03:00
|
|
|
nsTArray<RefPtr<PointerEvent>> mPredictedEvents;
|
2021-09-03 18:04:56 +03:00
|
|
|
|
|
|
|
// This is used to store the pointerType assigned from constructor.
|
|
|
|
Maybe<nsString> mPointerType;
|
2013-11-21 09:44:22 +04:00
|
|
|
};
|
|
|
|
|
2014-11-11 10:29:00 +03:00
|
|
|
void ConvertPointerTypeToString(uint16_t aPointerTypeSrc,
|
|
|
|
nsAString& aPointerTypeDest);
|
|
|
|
|
2022-05-09 23:41:07 +03:00
|
|
|
} // namespace mozilla::dom
|
2013-11-21 09:44:22 +04:00
|
|
|
|
2015-08-12 14:39:31 +03:00
|
|
|
already_AddRefed<mozilla::dom::PointerEvent> NS_NewDOMPointerEvent(
|
|
|
|
mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
|
|
|
|
mozilla::WidgetPointerEvent* aEvent);
|
|
|
|
|
2014-02-27 14:51:15 +04:00
|
|
|
#endif // mozilla_dom_PointerEvent_h_
|