2015-05-03 19:32:37 +00: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-04-05 08:49:00 +00: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/. */
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#ifndef mozilla_dom_Touch_h_
|
|
|
|
#define mozilla_dom_Touch_h_
|
2013-04-05 08:49:00 +00:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-24 10:04:14 +00:00
|
|
|
#include "mozilla/EventForwards.h"
|
2014-02-26 21:37:01 +00:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2015-12-29 13:46:18 +00:00
|
|
|
#include "mozilla/dom/TouchBinding.h"
|
2013-05-18 21:18:12 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2013-07-10 09:55:05 +00:00
|
|
|
#include "Units.h"
|
2013-04-05 08:49:00 +00:00
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
class nsPresContext;
|
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-08-19 10:15:55 +00:00
|
|
|
class EventTarget;
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class Touch final : public nsISupports
|
2015-03-27 18:52:19 +00:00
|
|
|
, public nsWrapperCache
|
|
|
|
, public WidgetPointerHelper
|
2013-04-05 08:49:00 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-02-06 18:28:14 +00:00
|
|
|
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
|
2013-04-21 06:42:19 +00:00
|
|
|
|
2015-12-29 13:46:18 +00:00
|
|
|
static already_AddRefed<Touch> Constructor(const GlobalObject& aGlobal,
|
|
|
|
const TouchInit& aParam,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
Touch(EventTarget* aTarget,
|
2013-04-05 08:49:00 +00:00
|
|
|
int32_t aIdentifier,
|
|
|
|
int32_t aPageX,
|
|
|
|
int32_t aPageY,
|
|
|
|
int32_t aScreenX,
|
|
|
|
int32_t aScreenY,
|
|
|
|
int32_t aClientX,
|
|
|
|
int32_t aClientY,
|
|
|
|
int32_t aRadiusX,
|
|
|
|
int32_t aRadiusY,
|
|
|
|
float aRotationAngle,
|
2013-08-19 10:15:55 +00:00
|
|
|
float aForce);
|
2013-04-05 08:49:00 +00:00
|
|
|
Touch(int32_t aIdentifier,
|
2015-02-01 22:27:31 +00:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2015-11-10 05:37:31 +00:00
|
|
|
LayoutDeviceIntPoint aRadius,
|
2013-04-05 08:49:00 +00:00
|
|
|
float aRotationAngle,
|
2013-08-19 10:15:55 +00:00
|
|
|
float aForce);
|
2015-04-29 20:29:34 +00:00
|
|
|
Touch(const Touch& aOther);
|
2013-08-19 10:15:55 +00:00
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-04-21 06:42:19 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
|
2013-05-17 20:17:53 +00:00
|
|
|
|
2013-10-02 03:46:04 +00:00
|
|
|
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
|
2013-05-17 20:17:53 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
void SetTarget(EventTarget* aTarget);
|
2013-08-19 10:15:55 +00:00
|
|
|
|
2013-08-02 07:06:35 +00:00
|
|
|
bool Equals(Touch* aTouch);
|
2013-04-05 08:49:00 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-03-19 16:35:45 +00:00
|
|
|
|
2015-05-12 19:56:39 +00:00
|
|
|
nsIGlobalObject* GetParentObject();
|
2013-04-21 06:42:19 +00:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
int32_t Identifier() const { return mIdentifier; }
|
2014-05-05 10:48:50 +00:00
|
|
|
EventTarget* GetTarget() const;
|
2013-04-21 06:42:19 +00:00
|
|
|
int32_t ScreenX() const { return mScreenPoint.x; }
|
|
|
|
int32_t ScreenY() const { return mScreenPoint.y; }
|
|
|
|
int32_t ClientX() const { return mClientPoint.x; }
|
|
|
|
int32_t ClientY() const { return mClientPoint.y; }
|
|
|
|
int32_t PageX() const { return mPagePoint.x; }
|
|
|
|
int32_t PageY() const { return mPagePoint.y; }
|
|
|
|
int32_t RadiusX() const { return mRadius.x; }
|
|
|
|
int32_t RadiusY() const { return mRadius.y; }
|
|
|
|
float RotationAngle() const { return mRotationAngle; }
|
|
|
|
float Force() const { return mForce; }
|
|
|
|
|
2013-08-02 07:06:35 +00:00
|
|
|
nsCOMPtr<EventTarget> mTarget;
|
2015-02-01 22:27:31 +00:00
|
|
|
LayoutDeviceIntPoint mRefPoint;
|
2013-08-02 07:06:35 +00:00
|
|
|
bool mChanged;
|
|
|
|
uint32_t mMessage;
|
2013-04-05 08:49:00 +00:00
|
|
|
int32_t mIdentifier;
|
2013-07-10 09:55:05 +00:00
|
|
|
CSSIntPoint mPagePoint;
|
|
|
|
CSSIntPoint mClientPoint;
|
2015-11-10 16:32:40 +00:00
|
|
|
CSSIntPoint mScreenPoint;
|
2015-11-10 05:37:31 +00:00
|
|
|
LayoutDeviceIntPoint mRadius;
|
2013-04-05 08:49:00 +00:00
|
|
|
float mRotationAngle;
|
|
|
|
float mForce;
|
|
|
|
protected:
|
2014-06-23 19:56:07 +00:00
|
|
|
~Touch();
|
|
|
|
|
2013-04-05 08:49:00 +00:00
|
|
|
bool mPointsInitialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
#endif // mozilla_dom_Touch_h_
|