2015-05-03 12:32:37 -07: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 01:49:00 -07: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 06:58:42 -08:00
|
|
|
#ifndef mozilla_dom_Touch_h_
|
|
|
|
#define mozilla_dom_Touch_h_
|
2013-04-05 01:49:00 -07:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-24 03:04:14 -07:00
|
|
|
#include "mozilla/EventForwards.h"
|
2014-02-26 13:37:01 -08:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-05-18 14:18:12 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2013-09-06 13:15:04 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2013-07-10 02:55:05 -07:00
|
|
|
#include "Units.h"
|
2013-04-05 01:49:00 -07:00
|
|
|
|
2013-08-19 03:15:55 -07:00
|
|
|
class nsPresContext;
|
|
|
|
|
2013-04-05 01:49:00 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-08-19 03:15:55 -07:00
|
|
|
class EventTarget;
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class Touch final : public nsISupports
|
2015-03-27 11:52:19 -07:00
|
|
|
, public nsWrapperCache
|
|
|
|
, public WidgetPointerHelper
|
2013-04-05 01:49:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-02-06 10:28:14 -08:00
|
|
|
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
|
2013-04-20 23:42:19 -07:00
|
|
|
|
2014-02-28 06:58:42 -08:00
|
|
|
Touch(EventTarget* aTarget,
|
2013-04-05 01:49:00 -07: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 03:15:55 -07:00
|
|
|
float aForce);
|
2013-04-05 01:49:00 -07:00
|
|
|
Touch(int32_t aIdentifier,
|
2015-02-01 14:27:31 -08:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2013-04-05 01:49:00 -07:00
|
|
|
nsIntPoint aRadius,
|
|
|
|
float aRotationAngle,
|
2013-08-19 03:15:55 -07:00
|
|
|
float aForce);
|
|
|
|
|
2013-04-05 01:49:00 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-04-20 23:42:19 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
|
2013-05-17 13:17:53 -07:00
|
|
|
|
2013-10-01 20:46:04 -07:00
|
|
|
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
|
2013-05-17 13:17:53 -07:00
|
|
|
|
2014-02-28 06:58:42 -08:00
|
|
|
void SetTarget(EventTarget* aTarget);
|
2013-08-19 03:15:55 -07:00
|
|
|
|
2013-08-02 00:06:35 -07:00
|
|
|
bool Equals(Touch* aTouch);
|
2013-04-05 01:49:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-03-19 09:35:45 -07:00
|
|
|
|
|
|
|
EventTarget* GetParentObject();
|
2013-04-20 23:42:19 -07:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
int32_t Identifier() const { return mIdentifier; }
|
2014-05-05 03:48:50 -07:00
|
|
|
EventTarget* GetTarget() const;
|
2013-04-20 23:42:19 -07: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 00:06:35 -07:00
|
|
|
nsCOMPtr<EventTarget> mTarget;
|
2015-02-01 14:27:31 -08:00
|
|
|
LayoutDeviceIntPoint mRefPoint;
|
2013-08-02 00:06:35 -07:00
|
|
|
bool mChanged;
|
|
|
|
uint32_t mMessage;
|
2013-04-05 01:49:00 -07:00
|
|
|
int32_t mIdentifier;
|
2013-07-10 02:55:05 -07:00
|
|
|
CSSIntPoint mPagePoint;
|
|
|
|
CSSIntPoint mClientPoint;
|
2015-02-15 10:52:28 -08:00
|
|
|
LayoutDeviceIntPoint mScreenPoint;
|
2013-04-05 01:49:00 -07:00
|
|
|
nsIntPoint mRadius;
|
|
|
|
float mRotationAngle;
|
|
|
|
float mForce;
|
|
|
|
protected:
|
2014-06-23 12:56:07 -07:00
|
|
|
~Touch();
|
|
|
|
|
2013-04-05 01:49:00 -07:00
|
|
|
bool mPointsInitialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-28 06:58:42 -08:00
|
|
|
#endif // mozilla_dom_Touch_h_
|