2013-04-19 01:49:22 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_CanvasPattern_h
|
|
|
|
#define mozilla_dom_CanvasPattern_h
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-04-19 01:49:22 -07:00
|
|
|
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
2013-04-26 07:55:56 -07:00
|
|
|
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
2013-04-19 01:49:22 -07:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "nsISupports.h"
|
2013-04-26 07:55:37 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2013-04-19 01:49:22 -07:00
|
|
|
|
2013-04-19 01:49:22 -07:00
|
|
|
class nsIPrincipal;
|
2013-04-19 01:49:22 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-04-19 01:49:22 -07:00
|
|
|
namespace gfx {
|
|
|
|
class SourceSurface;
|
|
|
|
}
|
|
|
|
|
2013-04-19 01:49:22 -07:00
|
|
|
namespace dom {
|
2014-06-12 07:54:43 -07:00
|
|
|
class SVGMatrix;
|
2013-04-19 01:49:22 -07:00
|
|
|
|
2013-07-26 11:25:56 -07:00
|
|
|
class CanvasPattern MOZ_FINAL : public nsWrapperCache
|
2013-04-19 01:49:22 -07:00
|
|
|
{
|
2014-06-26 06:30:49 -07:00
|
|
|
~CanvasPattern() {}
|
2013-04-19 01:49:22 -07:00
|
|
|
public:
|
2013-07-26 11:25:56 -07:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
|
2013-04-19 01:49:22 -07:00
|
|
|
|
2015-01-25 14:22:08 -08:00
|
|
|
enum class RepeatMode : uint8_t {
|
2013-04-19 01:49:22 -07:00
|
|
|
REPEAT,
|
|
|
|
REPEATX,
|
|
|
|
REPEATY,
|
|
|
|
NOREPEAT
|
2015-01-25 14:22:08 -08:00
|
|
|
};
|
2013-04-19 01:49:22 -07:00
|
|
|
|
2013-04-26 07:55:37 -07:00
|
|
|
CanvasPattern(CanvasRenderingContext2D* aContext,
|
|
|
|
gfx::SourceSurface* aSurface,
|
2013-04-19 01:49:22 -07:00
|
|
|
RepeatMode aRepeat,
|
|
|
|
nsIPrincipal* principalForSecurityCheck,
|
|
|
|
bool forceWriteOnly,
|
|
|
|
bool CORSUsed)
|
2013-04-26 07:55:37 -07:00
|
|
|
: mContext(aContext)
|
|
|
|
, mSurface(aSurface)
|
2013-04-19 01:49:22 -07:00
|
|
|
, mPrincipal(principalForSecurityCheck)
|
2014-06-12 07:54:43 -07:00
|
|
|
, mTransform()
|
2013-04-19 01:49:22 -07:00
|
|
|
, mForceWriteOnly(forceWriteOnly)
|
|
|
|
, mCORSUsed(CORSUsed)
|
2014-04-25 19:34:07 -07:00
|
|
|
, mRepeat(aRepeat)
|
2013-04-19 01:49:22 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
|
2013-04-19 01:49:22 -07:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 15:27:17 -07:00
|
|
|
return CanvasPatternBinding::Wrap(aCx, this);
|
2013-04-19 01:49:22 -07:00
|
|
|
}
|
2013-04-19 01:49:22 -07:00
|
|
|
|
2013-04-26 07:55:37 -07:00
|
|
|
CanvasRenderingContext2D* GetParentObject()
|
|
|
|
{
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
2014-06-12 07:54:43 -07:00
|
|
|
// WebIDL
|
|
|
|
void SetTransform(SVGMatrix& matrix);
|
|
|
|
|
2013-04-26 07:55:37 -07:00
|
|
|
nsRefPtr<CanvasRenderingContext2D> mContext;
|
|
|
|
RefPtr<gfx::SourceSurface> mSurface;
|
2013-04-19 01:49:22 -07:00
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2014-06-12 07:54:43 -07:00
|
|
|
mozilla::gfx::Matrix mTransform;
|
2013-04-19 01:49:22 -07:00
|
|
|
const bool mForceWriteOnly;
|
|
|
|
const bool mCORSUsed;
|
2014-04-25 19:34:07 -07:00
|
|
|
const RepeatMode mRepeat;
|
2013-04-19 01:49:22 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // mozilla_dom_CanvasPattern_h
|