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