/work/obj-fuzz/dist/include/mozilla/dom/CanvasPattern.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
4 | | |
5 | | #ifndef mozilla_dom_CanvasPattern_h |
6 | | #define mozilla_dom_CanvasPattern_h |
7 | | |
8 | | #include "mozilla/Attributes.h" |
9 | | #include "mozilla/dom/CanvasRenderingContext2DBinding.h" |
10 | | #include "mozilla/dom/CanvasRenderingContext2D.h" |
11 | | #include "mozilla/RefPtr.h" |
12 | | #include "nsISupports.h" |
13 | | #include "nsWrapperCache.h" |
14 | | |
15 | | class nsIPrincipal; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace gfx { |
19 | | class SourceSurface; |
20 | | } // namespace gfx |
21 | | |
22 | | namespace dom { |
23 | | class SVGMatrix; |
24 | | |
25 | | class CanvasPattern final : public nsWrapperCache |
26 | | { |
27 | 0 | ~CanvasPattern() {} |
28 | | public: |
29 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern) |
30 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern) |
31 | | |
32 | | enum class RepeatMode : uint8_t { |
33 | | REPEAT, |
34 | | REPEATX, |
35 | | REPEATY, |
36 | | NOREPEAT |
37 | | }; |
38 | | |
39 | | CanvasPattern(CanvasRenderingContext2D* aContext, |
40 | | gfx::SourceSurface* aSurface, |
41 | | RepeatMode aRepeat, |
42 | | nsIPrincipal* principalForSecurityCheck, |
43 | | bool forceWriteOnly, |
44 | | bool CORSUsed) |
45 | | : mContext(aContext) |
46 | | , mSurface(aSurface) |
47 | | , mPrincipal(principalForSecurityCheck) |
48 | | , mTransform() |
49 | | , mForceWriteOnly(forceWriteOnly) |
50 | | , mCORSUsed(CORSUsed) |
51 | | , mRepeat(aRepeat) |
52 | 0 | { |
53 | 0 | } |
54 | | |
55 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override |
56 | 0 | { |
57 | 0 | return CanvasPattern_Binding::Wrap(aCx, this, aGivenProto); |
58 | 0 | } |
59 | | |
60 | | CanvasRenderingContext2D* GetParentObject() |
61 | 0 | { |
62 | 0 | return mContext; |
63 | 0 | } |
64 | | |
65 | | // WebIDL |
66 | | void SetTransform(SVGMatrix& matrix); |
67 | | |
68 | | RefPtr<CanvasRenderingContext2D> mContext; |
69 | | RefPtr<gfx::SourceSurface> mSurface; |
70 | | nsCOMPtr<nsIPrincipal> mPrincipal; |
71 | | mozilla::gfx::Matrix mTransform; |
72 | | const bool mForceWriteOnly; |
73 | | const bool mCORSUsed; |
74 | | const RepeatMode mRepeat; |
75 | | }; |
76 | | |
77 | | } // namespace dom |
78 | | } // namespace mozilla |
79 | | |
80 | | #endif // mozilla_dom_CanvasPattern_h |