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