2013-04-19 08:49:22 +00: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 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-04-19 08:49:22 +00:00
|
|
|
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
2013-04-26 14:55:56 +00:00
|
|
|
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
2013-04-19 08:49:22 +00:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "nsISupports.h"
|
2013-04-26 14:55:37 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2013-04-19 08:49:22 +00:00
|
|
|
|
2013-04-19 08:49:22 +00:00
|
|
|
class nsIPrincipal;
|
2013-04-19 08:49:22 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-04-19 08:49:22 +00:00
|
|
|
namespace gfx {
|
|
|
|
class SourceSurface;
|
|
|
|
}
|
|
|
|
|
2013-04-19 08:49:22 +00:00
|
|
|
namespace dom {
|
2014-06-12 14:54:43 +00:00
|
|
|
class SVGMatrix;
|
2013-04-19 08:49:22 +00:00
|
|
|
|
2013-07-26 18:25:56 +00:00
|
|
|
class CanvasPattern MOZ_FINAL : public nsWrapperCache
|
2013-04-19 08:49:22 +00:00
|
|
|
{
|
2014-06-26 13:30:49 +00:00
|
|
|
~CanvasPattern() {}
|
2013-04-19 08:49:22 +00:00
|
|
|
public:
|
2013-07-26 18:25:56 +00:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
|
2013-04-19 08:49:22 +00:00
|
|
|
|
2014-04-26 02:34:07 +00:00
|
|
|
MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t)
|
2013-04-19 08:49:22 +00:00
|
|
|
REPEAT,
|
|
|
|
REPEATX,
|
|
|
|
REPEATY,
|
|
|
|
NOREPEAT
|
2014-04-26 02:34:07 +00:00
|
|
|
MOZ_END_NESTED_ENUM_CLASS(RepeatMode)
|
2013-04-19 08:49:22 +00:00
|
|
|
|
2013-04-26 14:55:37 +00:00
|
|
|
CanvasPattern(CanvasRenderingContext2D* aContext,
|
|
|
|
gfx::SourceSurface* aSurface,
|
2013-04-19 08:49:22 +00:00
|
|
|
RepeatMode aRepeat,
|
|
|
|
nsIPrincipal* principalForSecurityCheck,
|
|
|
|
bool forceWriteOnly,
|
|
|
|
bool CORSUsed)
|
2013-04-26 14:55:37 +00:00
|
|
|
: mContext(aContext)
|
|
|
|
, mSurface(aSurface)
|
2013-04-19 08:49:22 +00:00
|
|
|
, mPrincipal(principalForSecurityCheck)
|
2014-06-12 14:54:43 +00:00
|
|
|
, mTransform()
|
2013-04-19 08:49:22 +00:00
|
|
|
, mForceWriteOnly(forceWriteOnly)
|
|
|
|
, mCORSUsed(CORSUsed)
|
2014-04-26 02:34:07 +00:00
|
|
|
, mRepeat(aRepeat)
|
2013-04-19 08:49:22 +00:00
|
|
|
{
|
2013-04-26 14:55:37 +00:00
|
|
|
SetIsDOMBinding();
|
2013-04-19 08:49:22 +00:00
|
|
|
}
|
|
|
|
|
2014-04-08 22:27:18 +00:00
|
|
|
JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
|
2013-04-19 08:49:22 +00: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 22:27:17 +00:00
|
|
|
return CanvasPatternBinding::Wrap(aCx, this);
|
2013-04-19 08:49:22 +00:00
|
|
|
}
|
2013-04-19 08:49:22 +00:00
|
|
|
|
2013-04-26 14:55:37 +00:00
|
|
|
CanvasRenderingContext2D* GetParentObject()
|
|
|
|
{
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
2014-06-12 14:54:43 +00:00
|
|
|
// WebIDL
|
|
|
|
void SetTransform(SVGMatrix& matrix);
|
|
|
|
|
2013-04-26 14:55:37 +00:00
|
|
|
nsRefPtr<CanvasRenderingContext2D> mContext;
|
|
|
|
RefPtr<gfx::SourceSurface> mSurface;
|
2013-04-19 08:49:22 +00:00
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2014-06-12 14:54:43 +00:00
|
|
|
mozilla::gfx::Matrix mTransform;
|
2013-04-19 08:49:22 +00:00
|
|
|
const bool mForceWriteOnly;
|
|
|
|
const bool mCORSUsed;
|
2014-04-26 02:34:07 +00:00
|
|
|
const RepeatMode mRepeat;
|
2013-04-19 08:49:22 +00:00
|
|
|
};
|
|
|
|
|
2014-04-26 02:34:07 +00:00
|
|
|
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode)
|
|
|
|
|
2013-04-19 08:49:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // mozilla_dom_CanvasPattern_h
|