Thu, 15 Jan 2015 21:03:48 +0100
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.)
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_DOMQUAD_H_
7 #define MOZILLA_DOMQUAD_H_
9 #include "nsWrapperCache.h"
10 #include "nsISupports.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "mozilla/Attributes.h"
13 #include "nsCOMPtr.h"
14 #include "nsAutoPtr.h"
15 #include "mozilla/dom/BindingDeclarations.h"
16 #include "mozilla/ErrorResult.h"
17 #include "Units.h"
19 namespace mozilla {
20 namespace dom {
22 class DOMRectReadOnly;
23 class DOMPoint;
24 struct DOMPointInit;
26 class DOMQuad MOZ_FINAL : public nsWrapperCache
27 {
28 public:
29 DOMQuad(nsISupports* aParent, CSSPoint aPoints[4]);
30 DOMQuad(nsISupports* aParent);
31 ~DOMQuad();
33 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMQuad)
34 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMQuad)
36 nsISupports* GetParentObject() const { return mParent; }
37 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
39 static already_AddRefed<DOMQuad>
40 Constructor(const GlobalObject& aGlobal,
41 const DOMPointInit& aP1,
42 const DOMPointInit& aP2,
43 const DOMPointInit& aP3,
44 const DOMPointInit& aP4,
45 ErrorResult& aRV);
46 static already_AddRefed<DOMQuad>
47 Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
48 ErrorResult& aRV);
50 DOMRectReadOnly* Bounds() const;
51 DOMPoint* P1() const { return mPoints[0]; }
52 DOMPoint* P2() const { return mPoints[1]; }
53 DOMPoint* P3() const { return mPoints[2]; }
54 DOMPoint* P4() const { return mPoints[3]; }
56 DOMPoint* Point(uint32_t aIndex) { return mPoints[aIndex]; }
58 protected:
59 class QuadBounds;
61 nsCOMPtr<nsISupports> mParent;
62 nsRefPtr<DOMPoint> mPoints[4];
63 mutable nsRefPtr<QuadBounds> mBounds; // allocated lazily
64 };
66 }
67 }
69 #endif /*MOZILLA_DOMRECT_H_*/