content/canvas/src/CanvasPattern.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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/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"
    15 class nsIPrincipal;
    17 namespace mozilla {
    18 namespace gfx {
    19 class SourceSurface;
    20 }
    22 namespace dom {
    24 class CanvasPattern MOZ_FINAL : public nsWrapperCache
    25 {
    26 public:
    27   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
    28   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
    30   MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t)
    31     REPEAT,
    32     REPEATX,
    33     REPEATY,
    34     NOREPEAT
    35   MOZ_END_NESTED_ENUM_CLASS(RepeatMode)
    37   CanvasPattern(CanvasRenderingContext2D* aContext,
    38                 gfx::SourceSurface* aSurface,
    39                 RepeatMode aRepeat,
    40                 nsIPrincipal* principalForSecurityCheck,
    41                 bool forceWriteOnly,
    42                 bool CORSUsed)
    43     : mContext(aContext)
    44     , mSurface(aSurface)
    45     , mPrincipal(principalForSecurityCheck)
    46     , mForceWriteOnly(forceWriteOnly)
    47     , mCORSUsed(CORSUsed)
    48     , mRepeat(aRepeat)
    49   {
    50     SetIsDOMBinding();
    51   }
    53   JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    54   {
    55     return CanvasPatternBinding::Wrap(aCx, this);
    56   }
    58   CanvasRenderingContext2D* GetParentObject()
    59   {
    60     return mContext;
    61   }
    63   nsRefPtr<CanvasRenderingContext2D> mContext;
    64   RefPtr<gfx::SourceSurface> mSurface;
    65   nsCOMPtr<nsIPrincipal> mPrincipal;
    66   const bool mForceWriteOnly;
    67   const bool mCORSUsed;
    68   const RepeatMode mRepeat;
    69 };
    71 MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode)
    73 }
    74 }
    76 #endif // mozilla_dom_CanvasPattern_h

mercurial