Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_dom_CanvasPattern_h |
michael@0 | 6 | #define mozilla_dom_CanvasPattern_h |
michael@0 | 7 | |
michael@0 | 8 | #include "mozilla/Attributes.h" |
michael@0 | 9 | #include "mozilla/dom/CanvasRenderingContext2DBinding.h" |
michael@0 | 10 | #include "mozilla/dom/CanvasRenderingContext2D.h" |
michael@0 | 11 | #include "mozilla/RefPtr.h" |
michael@0 | 12 | #include "nsISupports.h" |
michael@0 | 13 | #include "nsWrapperCache.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsIPrincipal; |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace gfx { |
michael@0 | 19 | class SourceSurface; |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | namespace dom { |
michael@0 | 23 | |
michael@0 | 24 | class CanvasPattern MOZ_FINAL : public nsWrapperCache |
michael@0 | 25 | { |
michael@0 | 26 | public: |
michael@0 | 27 | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern) |
michael@0 | 28 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern) |
michael@0 | 29 | |
michael@0 | 30 | MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t) |
michael@0 | 31 | REPEAT, |
michael@0 | 32 | REPEATX, |
michael@0 | 33 | REPEATY, |
michael@0 | 34 | NOREPEAT |
michael@0 | 35 | MOZ_END_NESTED_ENUM_CLASS(RepeatMode) |
michael@0 | 36 | |
michael@0 | 37 | CanvasPattern(CanvasRenderingContext2D* aContext, |
michael@0 | 38 | gfx::SourceSurface* aSurface, |
michael@0 | 39 | RepeatMode aRepeat, |
michael@0 | 40 | nsIPrincipal* principalForSecurityCheck, |
michael@0 | 41 | bool forceWriteOnly, |
michael@0 | 42 | bool CORSUsed) |
michael@0 | 43 | : mContext(aContext) |
michael@0 | 44 | , mSurface(aSurface) |
michael@0 | 45 | , mPrincipal(principalForSecurityCheck) |
michael@0 | 46 | , mForceWriteOnly(forceWriteOnly) |
michael@0 | 47 | , mCORSUsed(CORSUsed) |
michael@0 | 48 | , mRepeat(aRepeat) |
michael@0 | 49 | { |
michael@0 | 50 | SetIsDOMBinding(); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE |
michael@0 | 54 | { |
michael@0 | 55 | return CanvasPatternBinding::Wrap(aCx, this); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | CanvasRenderingContext2D* GetParentObject() |
michael@0 | 59 | { |
michael@0 | 60 | return mContext; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | nsRefPtr<CanvasRenderingContext2D> mContext; |
michael@0 | 64 | RefPtr<gfx::SourceSurface> mSurface; |
michael@0 | 65 | nsCOMPtr<nsIPrincipal> mPrincipal; |
michael@0 | 66 | const bool mForceWriteOnly; |
michael@0 | 67 | const bool mCORSUsed; |
michael@0 | 68 | const RepeatMode mRepeat; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode) |
michael@0 | 72 | |
michael@0 | 73 | } |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | #endif // mozilla_dom_CanvasPattern_h |