Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / DOMPoint.h
blobf89d459865613e407e9610db0d4c3d15cc0b012e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_DOMPOINT_H_
7 #define MOZILLA_DOMPOINT_H_
9 #include "nsWrapperCache.h"
10 #include "nsISupports.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/ErrorResult.h"
14 #include "nsCOMPtr.h"
15 #include "mozilla/dom/BindingDeclarations.h"
17 namespace mozilla {
18 namespace dom {
20 class GlobalObject;
21 struct DOMPointInit;
23 class DOMPointReadOnly : public nsWrapperCache
25 public:
26 DOMPointReadOnly(nsISupports* aParent, double aX, double aY,
27 double aZ, double aW)
28 : mParent(aParent)
29 , mX(aX)
30 , mY(aY)
31 , mZ(aZ)
32 , mW(aW)
36 double X() const { return mX; }
37 double Y() const { return mY; }
38 double Z() const { return mZ; }
39 double W() const { return mW; }
41 protected:
42 nsCOMPtr<nsISupports> mParent;
43 double mX, mY, mZ, mW;
46 class DOMPoint MOZ_FINAL : public DOMPointReadOnly
48 ~DOMPoint() {}
50 public:
51 explicit DOMPoint(nsISupports* aParent, double aX = 0.0, double aY = 0.0,
52 double aZ = 0.0, double aW = 1.0)
53 : DOMPointReadOnly(aParent, aX, aY, aZ, aW)
56 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMPoint)
57 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPoint)
59 static already_AddRefed<DOMPoint>
60 Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams,
61 ErrorResult& aRV);
62 static already_AddRefed<DOMPoint>
63 Constructor(const GlobalObject& aGlobal, double aX, double aY,
64 double aZ, double aW, ErrorResult& aRV);
66 nsISupports* GetParentObject() const { return mParent; }
67 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
69 void SetX(double aX) { mX = aX; }
70 void SetY(double aY) { mY = aY; }
71 void SetZ(double aZ) { mZ = aZ; }
72 void SetW(double aW) { mW = aW; }
78 #endif /*MOZILLA_DOMPOINT_H_*/