mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 762651 (Add wrappercache to CanvasRenderingContext2D). r=bz.
This commit is contained in:
parent
470c53a48e
commit
eeca8d5fd4
@ -50,6 +50,10 @@ public:
|
|||||||
{
|
{
|
||||||
mCanvasElement = aParentCanvas;
|
mCanvasElement = aParentCanvas;
|
||||||
}
|
}
|
||||||
|
nsHTMLCanvasElement* GetParentObject() const
|
||||||
|
{
|
||||||
|
return mCanvasElement;
|
||||||
|
}
|
||||||
|
|
||||||
// Sets the dimensions of the canvas, in pixels. Called
|
// Sets the dimensions of the canvas, in pixels. Called
|
||||||
// whenever the size of the element changes.
|
// whenever the size of the element changes.
|
||||||
|
@ -1240,7 +1240,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
|
|||||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||||
// If the exact way we cast to nsISupports here ever changes, fix our
|
// If the exact way we cast to nsISupports here ever changes, fix our
|
||||||
// PreCreate hook!
|
// PreCreate hook!
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
|
||||||
|
nsICanvasRenderingContextInternal)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
@ -482,10 +482,6 @@ public:
|
|||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext,
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext,
|
||||||
nsIDOMWebGLRenderingContext)
|
nsIDOMWebGLRenderingContext)
|
||||||
|
|
||||||
nsINode* GetParentObject() {
|
|
||||||
return mCanvasElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
|
||||||
bool *triedToWrap);
|
bool *triedToWrap);
|
||||||
|
|
||||||
|
@ -595,9 +595,8 @@ protected:
|
|||||||
* Gets the pres shell from either the canvas element or the doc shell
|
* Gets the pres shell from either the canvas element or the doc shell
|
||||||
*/
|
*/
|
||||||
nsIPresShell *GetPresShell() {
|
nsIPresShell *GetPresShell() {
|
||||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
if (mCanvasElement) {
|
||||||
if (content) {
|
return mCanvasElement->OwnerDoc()->GetShell();
|
||||||
return content->OwnerDoc()->GetShell();
|
|
||||||
}
|
}
|
||||||
if (mDocShell) {
|
if (mDocShell) {
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
@ -772,7 +771,8 @@ DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2D)
|
|||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2D)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2D)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
|
||||||
|
nsICanvasRenderingContextInternal)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
@ -1177,10 +1177,9 @@ nsCanvasRenderingContext2D::EnsureSurface()
|
|||||||
gfxASurface::gfxImageFormat format = GetImageFormat();
|
gfxASurface::gfxImageFormat format = GetImageFormat();
|
||||||
|
|
||||||
if (!PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) {
|
if (!PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) {
|
||||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
|
||||||
nsIDocument* ownerDoc = nsnull;
|
nsIDocument* ownerDoc = nsnull;
|
||||||
if (content)
|
if (mCanvasElement)
|
||||||
ownerDoc = content->OwnerDoc();
|
ownerDoc = mCanvasElement->OwnerDoc();
|
||||||
nsRefPtr<LayerManager> layerManager = nsnull;
|
nsRefPtr<LayerManager> layerManager = nsnull;
|
||||||
|
|
||||||
if (ownerDoc)
|
if (ownerDoc)
|
||||||
|
@ -89,6 +89,8 @@
|
|||||||
#include "mozilla/ipc/PDocumentRendererParent.h"
|
#include "mozilla/ipc/PDocumentRendererParent.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
|
#include "nsCCUncollectableMarker.h"
|
||||||
|
#include "nsWrapperCacheInlines.h"
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include "gfxWindowsPlatform.h"
|
#include "gfxWindowsPlatform.h"
|
||||||
@ -364,7 +366,8 @@ static const Float SIGMA_MAX = 100;
|
|||||||
**/
|
**/
|
||||||
class nsCanvasRenderingContext2DAzure :
|
class nsCanvasRenderingContext2DAzure :
|
||||||
public nsIDOMCanvasRenderingContext2D,
|
public nsIDOMCanvasRenderingContext2D,
|
||||||
public nsICanvasRenderingContextInternal
|
public nsICanvasRenderingContextInternal,
|
||||||
|
public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsCanvasRenderingContext2DAzure();
|
nsCanvasRenderingContext2DAzure();
|
||||||
@ -405,7 +408,8 @@ public:
|
|||||||
// nsISupports interface + CC
|
// nsISupports interface + CC
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCanvasRenderingContext2DAzure, nsIDOMCanvasRenderingContext2D)
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(
|
||||||
|
nsCanvasRenderingContext2DAzure, nsIDOMCanvasRenderingContext2D)
|
||||||
|
|
||||||
// nsIDOMCanvasRenderingContext2D interface
|
// nsIDOMCanvasRenderingContext2D interface
|
||||||
NS_DECL_NSIDOMCANVASRENDERINGCONTEXT2D
|
NS_DECL_NSIDOMCANVASRENDERINGCONTEXT2D
|
||||||
@ -586,9 +590,8 @@ protected:
|
|||||||
* Gets the pres shell from either the canvas element or the doc shell
|
* Gets the pres shell from either the canvas element or the doc shell
|
||||||
*/
|
*/
|
||||||
nsIPresShell *GetPresShell() {
|
nsIPresShell *GetPresShell() {
|
||||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
if (mCanvasElement) {
|
||||||
if (content) {
|
return mCanvasElement->OwnerDoc()->GetShell();
|
||||||
return content->OwnerDoc()->GetShell();
|
|
||||||
}
|
}
|
||||||
if (mDocShell) {
|
if (mDocShell) {
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
@ -938,18 +941,46 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCanvasRenderingContext2DAzure)
|
|||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsCanvasRenderingContext2DAzure)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsCanvasRenderingContext2DAzure)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCanvasRenderingContext2DAzure)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCanvasRenderingContext2DAzure)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mCanvasElement, nsINode)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mCanvasElement, nsINode)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
|
if (nsCCUncollectableMarker::sGeneration && tmp->IsBlack()) {
|
||||||
|
nsGenericElement* canvasElement = tmp->mCanvasElement;
|
||||||
|
if (canvasElement) {
|
||||||
|
if (canvasElement->IsPurple()) {
|
||||||
|
canvasElement->RemovePurple();
|
||||||
|
}
|
||||||
|
nsGenericElement::MarkNodeChildren(canvasElement);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
|
return nsCCUncollectableMarker::sGeneration && tmp->IsBlack();
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsCanvasRenderingContext2DAzure)
|
||||||
|
return nsCCUncollectableMarker::sGeneration && tmp->IsBlack();
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2DAzure)
|
// DOMCI_DATA(CanvasRenderingContext2D, nsCanvasRenderingContext2DAzure)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2DAzure)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCanvasRenderingContext2DAzure)
|
||||||
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCanvasRenderingContext2D)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCanvasRenderingContext2D)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
|
||||||
|
nsICanvasRenderingContextInternal)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContext2D)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
@ -1241,10 +1272,9 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height)
|
|||||||
if (size.width <= 0xFFFF && size.height <= 0xFFFF &&
|
if (size.width <= 0xFFFF && size.height <= 0xFFFF &&
|
||||||
size.width >= 0 && size.height >= 0) {
|
size.width >= 0 && size.height >= 0) {
|
||||||
SurfaceFormat format = GetSurfaceFormat();
|
SurfaceFormat format = GetSurfaceFormat();
|
||||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
|
||||||
nsIDocument* ownerDoc = nsnull;
|
nsIDocument* ownerDoc = nsnull;
|
||||||
if (content) {
|
if (mCanvasElement) {
|
||||||
ownerDoc = content->OwnerDoc();
|
ownerDoc = mCanvasElement->OwnerDoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<LayerManager> layerManager = nsnull;
|
nsRefPtr<LayerManager> layerManager = nsnull;
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
#include "XPCWrapper.h"
|
#include "XPCWrapper.h"
|
||||||
|
#include "XPCQuickStubs.h"
|
||||||
|
#include "nsDOMQS.h"
|
||||||
|
|
||||||
#include "mozilla/dom/RegisterBindings.h"
|
#include "mozilla/dom/RegisterBindings.h"
|
||||||
|
|
||||||
@ -415,8 +417,7 @@
|
|||||||
#include "nsIDOMSVGZoomAndPan.h"
|
#include "nsIDOMSVGZoomAndPan.h"
|
||||||
#include "nsIDOMSVGZoomEvent.h"
|
#include "nsIDOMSVGZoomEvent.h"
|
||||||
|
|
||||||
#include "nsIDOMCanvasRenderingContext2D.h"
|
#include "nsICanvasRenderingContextInternal.h"
|
||||||
#include "nsIDOMWebGLRenderingContext.h"
|
|
||||||
|
|
||||||
#include "nsIImageDocument.h"
|
#include "nsIImageDocument.h"
|
||||||
|
|
||||||
@ -621,13 +622,21 @@ static const char kDOMStringBundleURL[] =
|
|||||||
// nothing
|
// nothing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DOMCI_DATA(Crypto, void)
|
/**
|
||||||
DOMCI_DATA(CRMFObject, void)
|
* To generate the bitmap for a class that we're sure doesn't implement any of
|
||||||
DOMCI_DATA(SmartCardEvent, void)
|
* the interfaces in DOMCI_CASTABLE_INTERFACES.
|
||||||
DOMCI_DATA(ContentFrameMessageManager, void)
|
*/
|
||||||
|
#define DOMCI_DATA_NO_CLASS(_dom_class) \
|
||||||
|
const PRUint32 kDOMClassInfo_##_dom_class##_interfaces = \
|
||||||
|
0;
|
||||||
|
|
||||||
DOMCI_DATA(DOMPrototype, void)
|
DOMCI_DATA_NO_CLASS(Crypto)
|
||||||
DOMCI_DATA(DOMConstructor, void)
|
DOMCI_DATA_NO_CLASS(CRMFObject)
|
||||||
|
DOMCI_DATA_NO_CLASS(SmartCardEvent)
|
||||||
|
DOMCI_DATA_NO_CLASS(ContentFrameMessageManager)
|
||||||
|
|
||||||
|
DOMCI_DATA_NO_CLASS(DOMPrototype)
|
||||||
|
DOMCI_DATA_NO_CLASS(DOMConstructor)
|
||||||
|
|
||||||
#define NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _name, _helper, \
|
#define NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _name, _helper, \
|
||||||
_flags) \
|
_flags) \
|
||||||
@ -691,6 +700,10 @@ public:
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
typedef nsNewDOMBindingSH<nsICanvasRenderingContextInternal>
|
||||||
|
nsCanvasRenderingContextSH;
|
||||||
|
|
||||||
|
|
||||||
// This list of NS_DEFINE_CLASSINFO_DATA macros is what gives the DOM
|
// This list of NS_DEFINE_CLASSINFO_DATA macros is what gives the DOM
|
||||||
// classes their correct behavior when used through XPConnect. The
|
// classes their correct behavior when used through XPConnect. The
|
||||||
// arguments that are passed to NS_DEFINE_CLASSINFO_DATA are
|
// arguments that are passed to NS_DEFINE_CLASSINFO_DATA are
|
||||||
@ -1317,7 +1330,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||||||
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(HTMLCanvasElement, nsElementSH,
|
NS_DEFINE_CLASSINFO_DATA(HTMLCanvasElement, nsElementSH,
|
||||||
ELEMENT_SCRIPTABLE_FLAGS)
|
ELEMENT_SCRIPTABLE_FLAGS)
|
||||||
NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContext2D, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContext2D,
|
||||||
|
nsCanvasRenderingContextSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
NS_DEFINE_CLASSINFO_DATA(CanvasGradient, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(CanvasGradient, nsDOMGenericSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
@ -2002,8 +2016,7 @@ WrapNative(JSContext *cx, JSObject *scope, nsISupports *native,
|
|||||||
// nsWrapperCache.
|
// nsWrapperCache.
|
||||||
static inline nsresult
|
static inline nsresult
|
||||||
WrapNativeParent(JSContext *cx, JSObject *scope, nsISupports *native,
|
WrapNativeParent(JSContext *cx, JSObject *scope, nsISupports *native,
|
||||||
nsWrapperCache *nativeWrapperCache,
|
nsWrapperCache *nativeWrapperCache, JSObject **parentObj)
|
||||||
JSObject **parentObj)
|
|
||||||
{
|
{
|
||||||
// In the common case, |native| is a wrapper cache with an existing wrapper
|
// In the common case, |native| is a wrapper cache with an existing wrapper
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -2033,6 +2046,14 @@ WrapNativeParent(JSContext *cx, JSObject *scope, nsISupports *native,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class P>
|
||||||
|
static inline nsresult
|
||||||
|
WrapNativeParent(JSContext *cx, JSObject *scope, P *parent,
|
||||||
|
JSObject **parentObj)
|
||||||
|
{
|
||||||
|
return WrapNativeParent(cx, scope, ToSupports(parent), parent, parentObj);
|
||||||
|
}
|
||||||
|
|
||||||
// Helper to handle torn-down inner windows.
|
// Helper to handle torn-down inner windows.
|
||||||
static inline nsresult
|
static inline nsresult
|
||||||
SetParentToWindow(nsGlobalWindow *win, JSObject **parent)
|
SetParentToWindow(nsGlobalWindow *win, JSObject **parent)
|
||||||
@ -7976,8 +7997,7 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
|||||||
// to wrap here? But that's not always reachable, let's use
|
// to wrap here? But that's not always reachable, let's use
|
||||||
// globalObj for now...
|
// globalObj for now...
|
||||||
|
|
||||||
nsresult rv = WrapNativeParent(cx, globalObj, native_parent, native_parent,
|
nsresult rv = WrapNativeParent(cx, globalObj, native_parent, parentObj);
|
||||||
parentObj);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return node->IsInNativeAnonymousSubtree() ?
|
return node->IsInNativeAnonymousSubtree() ?
|
||||||
@ -10312,7 +10332,7 @@ nsCSSStyleDeclSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
WrapNativeParent(cx, globalObj, native_parent, native_parent, parentObj);
|
WrapNativeParent(cx, globalObj, native_parent, parentObj);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
return NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
||||||
@ -10927,7 +10947,7 @@ WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|||||||
WebGLContext *webgl = ext->Context();
|
WebGLContext *webgl = ext->Context();
|
||||||
nsINode *node = webgl->GetParentObject();
|
nsINode *node = webgl->GetParentObject();
|
||||||
|
|
||||||
return WrapNativeParent(cx, globalObj, node, node, parentObj);
|
return WrapNativeParent(cx, globalObj, node, parentObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -10940,15 +10960,18 @@ nsNewDOMBindingNoWrapperCacheSH::PreCreate(nsISupports *nativeObj,
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class BaseType>
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebGLViewportHandlerSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
nsNewDOMBindingSH<T, BaseType>::PreCreate(nsISupports *nativeObj,
|
||||||
JSObject *globalObj, JSObject **parentObj)
|
JSContext *cx,
|
||||||
|
JSObject *globalObj,
|
||||||
|
JSObject **parentObj)
|
||||||
{
|
{
|
||||||
*parentObj = globalObj;
|
*parentObj = globalObj;
|
||||||
|
|
||||||
WebGLContext *webgl = static_cast<WebGLContext*>(
|
T *native = static_cast<T*>(static_cast<BaseType*>(nativeObj));
|
||||||
static_cast<nsIDOMWebGLRenderingContext*>(nativeObj));
|
if (!native->GetParentObject()) {
|
||||||
nsINode *node = webgl->GetParentObject();
|
return NS_OK;
|
||||||
|
}
|
||||||
return WrapNativeParent(cx, globalObj, node, node, parentObj);
|
return WrapNativeParent(cx, globalObj, native->GetParentObject(), parentObj);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ class DOMSVGStringList;
|
|||||||
class DOMSVGTransformList;
|
class DOMSVGTransformList;
|
||||||
}
|
}
|
||||||
class nsGlobalWindow;
|
class nsGlobalWindow;
|
||||||
|
class nsICanvasRenderingContextInternal;
|
||||||
class nsIDOMDocument;
|
class nsIDOMDocument;
|
||||||
class nsIDOMHTMLOptionsCollection;
|
class nsIDOMHTMLOptionsCollection;
|
||||||
class nsIDOMSVGLength;
|
class nsIDOMSVGLength;
|
||||||
@ -1531,40 +1532,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsWebGLViewportHandlerSH : public nsDOMGenericSH
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~nsWebGLViewportHandlerSH()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) {
|
|
||||||
nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2),
|
|
||||||
nsnull, nsnull, JSPROP_ENUMERATE))
|
|
||||||
{
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|
||||||
JSObject *globalObj, JSObject **parentObj);
|
|
||||||
|
|
||||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
|
||||||
{
|
|
||||||
return new nsWebGLViewportHandlerSH(aData);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Template for SVGXXXList helpers
|
// Template for SVGXXXList helpers
|
||||||
|
|
||||||
template<class ListInterfaceType, class ListType>
|
template<class ListInterfaceType, class ListType>
|
||||||
@ -1614,4 +1581,58 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T, class BaseType = T>
|
||||||
|
class nsNewDOMBindingSH : public nsDOMGenericSH
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
nsNewDOMBindingSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~nsNewDOMBindingSH()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||||
|
JSObject *globalObj, JSObject **parentObj);
|
||||||
|
|
||||||
|
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||||
|
{
|
||||||
|
return new nsNewDOMBindingSH<T, BaseType>(aData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class nsWebGLViewportHandlerSH
|
||||||
|
: public nsNewDOMBindingSH<nsICanvasRenderingContextInternal>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData)
|
||||||
|
: nsNewDOMBindingSH<nsICanvasRenderingContextInternal>(aData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~nsWebGLViewportHandlerSH()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) {
|
||||||
|
nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2),
|
||||||
|
nsnull, nsnull, JSPROP_ENUMERATE))
|
||||||
|
{
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||||
|
{
|
||||||
|
return new nsWebGLViewportHandlerSH(aData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* nsDOMClassInfo_h___ */
|
#endif /* nsDOMClassInfo_h___ */
|
||||||
|
@ -502,13 +502,13 @@ template<class T>
|
|||||||
inline nsISupports*
|
inline nsISupports*
|
||||||
GetParentPointer(T* aObject)
|
GetParentPointer(T* aObject)
|
||||||
{
|
{
|
||||||
return aObject;
|
return ToSupports(aObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline nsISupports*
|
inline nsISupports*
|
||||||
GetParentPointer(const ParentObject& aObject)
|
GetParentPointer(const ParentObject& aObject)
|
||||||
{
|
{
|
||||||
return aObject.mObject;
|
return ToSupports(aObject.mObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set allowNativeWrapper to false if you really know you need it, if in
|
// Only set allowNativeWrapper to false if you really know you need it, if in
|
||||||
|
@ -179,6 +179,23 @@ DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement)
|
|||||||
DEFINE_UNWRAP_CAST_HTML(img, nsHTMLImageElement)
|
DEFINE_UNWRAP_CAST_HTML(img, nsHTMLImageElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement)
|
DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement)
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline nsresult
|
||||||
|
xpc_qsUnwrapArg<mozilla::dom::ImageData>(JSContext *cx, jsval v,
|
||||||
|
mozilla::dom::ImageData **ppArg,
|
||||||
|
mozilla::dom::ImageData **ppArgRef,
|
||||||
|
jsval *vp)
|
||||||
|
{
|
||||||
|
nsIDOMImageData* arg;
|
||||||
|
nsIDOMImageData* argRef;
|
||||||
|
nsresult rv = xpc_qsUnwrapArg<nsIDOMImageData>(cx, v, &arg, &argRef, vp);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
*ppArg = static_cast<mozilla::dom::ImageData*>(arg);
|
||||||
|
*ppArgRef = static_cast<mozilla::dom::ImageData*>(argRef);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
inline nsISupports*
|
inline nsISupports*
|
||||||
ToSupports(nsContentList *p)
|
ToSupports(nsContentList *p)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user