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
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class CanvasPattern 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
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
2013-04-19 01:49:22 -07:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return CanvasPatternBinding::Wrap(aCx, this, aGivenProto);
|
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
|