Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / dom / canvas / CanvasPattern.h
blob7ec392b0c31aa4ce47268c591f547965056879f1
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_CanvasPattern_h
6 #define mozilla_dom_CanvasPattern_h
8 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
9 #include "mozilla/RefPtr.h"
10 #include "nsISupports.h"
11 #include "nsWrapperCache.h"
13 class nsIPrincipal;
15 namespace mozilla {
16 namespace gfx {
17 class SourceSurface;
18 } // namespace gfx
20 namespace dom {
21 class CanvasRenderingContext2D;
22 struct DOMMatrix2DInit;
24 class CanvasPattern final : public nsWrapperCache {
25 ~CanvasPattern();
27 public:
28 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
29 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(CanvasPattern)
31 enum class RepeatMode : uint8_t { REPEAT, REPEATX, REPEATY, NOREPEAT };
33 CanvasPattern(CanvasRenderingContext2D* aContext,
34 gfx::SourceSurface* aSurface, RepeatMode aRepeat,
35 nsIPrincipal* principalForSecurityCheck, bool forceWriteOnly,
36 bool CORSUsed);
38 JSObject* WrapObject(JSContext* aCx,
39 JS::Handle<JSObject*> aGivenProto) override {
40 return CanvasPattern_Binding::Wrap(aCx, this, aGivenProto);
43 CanvasRenderingContext2D* GetParentObject() { return mContext; }
45 // WebIDL
46 void SetTransform(const DOMMatrix2DInit& aInit, ErrorResult& aError);
48 RefPtr<CanvasRenderingContext2D> mContext;
49 RefPtr<gfx::SourceSurface> mSurface;
50 nsCOMPtr<nsIPrincipal> mPrincipal;
51 mozilla::gfx::Matrix mTransform;
52 const bool mForceWriteOnly;
53 const bool mCORSUsed;
54 const RepeatMode mRepeat;
57 } // namespace dom
58 } // namespace mozilla
60 #endif // mozilla_dom_CanvasPattern_h