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 file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_CanvasPattern_h michael@0: #define mozilla_dom_CanvasPattern_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/dom/CanvasRenderingContext2DBinding.h" michael@0: #include "mozilla/dom/CanvasRenderingContext2D.h" michael@0: #include "mozilla/RefPtr.h" michael@0: #include "nsISupports.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: class nsIPrincipal; michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: class SourceSurface; michael@0: } michael@0: michael@0: namespace dom { michael@0: michael@0: class CanvasPattern MOZ_FINAL : public nsWrapperCache michael@0: { michael@0: public: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern) michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern) michael@0: michael@0: MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t) michael@0: REPEAT, michael@0: REPEATX, michael@0: REPEATY, michael@0: NOREPEAT michael@0: MOZ_END_NESTED_ENUM_CLASS(RepeatMode) michael@0: michael@0: CanvasPattern(CanvasRenderingContext2D* aContext, michael@0: gfx::SourceSurface* aSurface, michael@0: RepeatMode aRepeat, michael@0: nsIPrincipal* principalForSecurityCheck, michael@0: bool forceWriteOnly, michael@0: bool CORSUsed) michael@0: : mContext(aContext) michael@0: , mSurface(aSurface) michael@0: , mPrincipal(principalForSecurityCheck) michael@0: , mForceWriteOnly(forceWriteOnly) michael@0: , mCORSUsed(CORSUsed) michael@0: , mRepeat(aRepeat) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE michael@0: { michael@0: return CanvasPatternBinding::Wrap(aCx, this); michael@0: } michael@0: michael@0: CanvasRenderingContext2D* GetParentObject() michael@0: { michael@0: return mContext; michael@0: } michael@0: michael@0: nsRefPtr mContext; michael@0: RefPtr mSurface; michael@0: nsCOMPtr mPrincipal; michael@0: const bool mForceWriteOnly; michael@0: const bool mCORSUsed; michael@0: const RepeatMode mRepeat; michael@0: }; michael@0: michael@0: MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode) michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif // mozilla_dom_CanvasPattern_h