michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MOZILLA_DOMQUAD_H_ michael@0: #define MOZILLA_DOMQUAD_H_ michael@0: michael@0: #include "nsWrapperCache.h" michael@0: #include "nsISupports.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "mozilla/dom/BindingDeclarations.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #include "Units.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class DOMRectReadOnly; michael@0: class DOMPoint; michael@0: struct DOMPointInit; michael@0: michael@0: class DOMQuad MOZ_FINAL : public nsWrapperCache michael@0: { michael@0: public: michael@0: DOMQuad(nsISupports* aParent, CSSPoint aPoints[4]); michael@0: DOMQuad(nsISupports* aParent); michael@0: ~DOMQuad(); michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMQuad) michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMQuad) michael@0: michael@0: nsISupports* GetParentObject() const { return mParent; } michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: static already_AddRefed michael@0: Constructor(const GlobalObject& aGlobal, michael@0: const DOMPointInit& aP1, michael@0: const DOMPointInit& aP2, michael@0: const DOMPointInit& aP3, michael@0: const DOMPointInit& aP4, michael@0: ErrorResult& aRV); michael@0: static already_AddRefed michael@0: Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect, michael@0: ErrorResult& aRV); michael@0: michael@0: DOMRectReadOnly* Bounds() const; michael@0: DOMPoint* P1() const { return mPoints[0]; } michael@0: DOMPoint* P2() const { return mPoints[1]; } michael@0: DOMPoint* P3() const { return mPoints[2]; } michael@0: DOMPoint* P4() const { return mPoints[3]; } michael@0: michael@0: DOMPoint* Point(uint32_t aIndex) { return mPoints[aIndex]; } michael@0: michael@0: protected: michael@0: class QuadBounds; michael@0: michael@0: nsCOMPtr mParent; michael@0: nsRefPtr mPoints[4]; michael@0: mutable nsRefPtr mBounds; // allocated lazily michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /*MOZILLA_DOMRECT_H_*/