content/base/src/DOMPoint.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial