1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/src/DOMQuad.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef MOZILLA_DOMQUAD_H_ 1.10 +#define MOZILLA_DOMQUAD_H_ 1.11 + 1.12 +#include "nsWrapperCache.h" 1.13 +#include "nsISupports.h" 1.14 +#include "nsCycleCollectionParticipant.h" 1.15 +#include "mozilla/Attributes.h" 1.16 +#include "nsCOMPtr.h" 1.17 +#include "nsAutoPtr.h" 1.18 +#include "mozilla/dom/BindingDeclarations.h" 1.19 +#include "mozilla/ErrorResult.h" 1.20 +#include "Units.h" 1.21 + 1.22 +namespace mozilla { 1.23 +namespace dom { 1.24 + 1.25 +class DOMRectReadOnly; 1.26 +class DOMPoint; 1.27 +struct DOMPointInit; 1.28 + 1.29 +class DOMQuad MOZ_FINAL : public nsWrapperCache 1.30 +{ 1.31 +public: 1.32 + DOMQuad(nsISupports* aParent, CSSPoint aPoints[4]); 1.33 + DOMQuad(nsISupports* aParent); 1.34 + ~DOMQuad(); 1.35 + 1.36 + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMQuad) 1.37 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMQuad) 1.38 + 1.39 + nsISupports* GetParentObject() const { return mParent; } 1.40 + virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.41 + 1.42 + static already_AddRefed<DOMQuad> 1.43 + Constructor(const GlobalObject& aGlobal, 1.44 + const DOMPointInit& aP1, 1.45 + const DOMPointInit& aP2, 1.46 + const DOMPointInit& aP3, 1.47 + const DOMPointInit& aP4, 1.48 + ErrorResult& aRV); 1.49 + static already_AddRefed<DOMQuad> 1.50 + Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect, 1.51 + ErrorResult& aRV); 1.52 + 1.53 + DOMRectReadOnly* Bounds() const; 1.54 + DOMPoint* P1() const { return mPoints[0]; } 1.55 + DOMPoint* P2() const { return mPoints[1]; } 1.56 + DOMPoint* P3() const { return mPoints[2]; } 1.57 + DOMPoint* P4() const { return mPoints[3]; } 1.58 + 1.59 + DOMPoint* Point(uint32_t aIndex) { return mPoints[aIndex]; } 1.60 + 1.61 +protected: 1.62 + class QuadBounds; 1.63 + 1.64 + nsCOMPtr<nsISupports> mParent; 1.65 + nsRefPtr<DOMPoint> mPoints[4]; 1.66 + mutable nsRefPtr<QuadBounds> mBounds; // allocated lazily 1.67 +}; 1.68 + 1.69 +} 1.70 +} 1.71 + 1.72 +#endif /*MOZILLA_DOMRECT_H_*/