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"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2013-04-19 12:49:22 +04:00
|
|
|
#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;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
2013-04-19 12:49:22 +04:00
|
|
|
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class CanvasPattern 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
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
2013-04-19 12:49:22 +04: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 17:13:33 +03:00
|
|
|
return CanvasPatternBinding::Wrap(aCx, this, aGivenProto);
|
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);
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<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
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-04-19 12:49:22 +04:00
|
|
|
|
|
|
|
#endif // mozilla_dom_CanvasPattern_h
|