tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CanvasPattern.h (1769B)


      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/RefPtr.h"
      9 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
     10 #include "nsISupports.h"
     11 #include "nsWrapperCache.h"
     12 
     13 class nsIPrincipal;
     14 
     15 namespace mozilla {
     16 namespace gfx {
     17 class SourceSurface;
     18 }  // namespace gfx
     19 
     20 namespace dom {
     21 class CanvasRenderingContext2D;
     22 struct DOMMatrix2DInit;
     23 
     24 class CanvasPattern final : public nsWrapperCache {
     25  ~CanvasPattern();
     26 
     27 public:
     28  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
     29  NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(CanvasPattern)
     30 
     31  enum class RepeatMode : uint8_t { REPEAT, REPEATX, REPEATY, NOREPEAT };
     32 
     33  CanvasPattern(CanvasRenderingContext2D* aContext,
     34                gfx::SourceSurface* aSurface, RepeatMode aRepeat,
     35                nsIPrincipal* principalForSecurityCheck, bool forceWriteOnly,
     36                bool CORSUsed);
     37 
     38  JSObject* WrapObject(JSContext* aCx,
     39                       JS::Handle<JSObject*> aGivenProto) override {
     40    return CanvasPattern_Binding::Wrap(aCx, this, aGivenProto);
     41  }
     42 
     43  CanvasRenderingContext2D* GetParentObject() { return mContext; }
     44 
     45  // WebIDL
     46  void SetTransform(const DOMMatrix2DInit& aInit, ErrorResult& aError);
     47 
     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;
     55 };
     56 
     57 }  // namespace dom
     58 }  // namespace mozilla
     59 
     60 #endif  // mozilla_dom_CanvasPattern_h