mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 717013 (Add new DOM binding for DOMTokenList). r=jst.
--HG-- extra : rebase_source : 6ae0abe3bbe33a140c62c193685e23529d44e6d4
This commit is contained in:
parent
004486d3c8
commit
c1cb66d9c8
@ -39,6 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsDOMSettableTokenList.h"
|
#include "nsDOMSettableTokenList.h"
|
||||||
|
#include "dombindings.h"
|
||||||
|
|
||||||
|
|
||||||
nsDOMSettableTokenList::nsDOMSettableTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
nsDOMSettableTokenList::nsDOMSettableTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
||||||
@ -78,3 +79,10 @@ nsDOMSettableTokenList::SetValue(const nsAString& aValue)
|
|||||||
return mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true);
|
return mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
nsDOMSettableTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||||
|
bool *triedToWrap)
|
||||||
|
{
|
||||||
|
return mozilla::dom::binding::DOMSettableTokenList::create(cx, scope, this,
|
||||||
|
triedToWrap);
|
||||||
|
}
|
||||||
|
@ -59,6 +59,9 @@ public:
|
|||||||
|
|
||||||
nsDOMSettableTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
nsDOMSettableTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
||||||
|
|
||||||
|
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||||
|
bool *triedToWrap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsDOMSettableTokenList();
|
virtual ~nsDOMSettableTokenList();
|
||||||
};
|
};
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
|
#include "dombindings.h"
|
||||||
|
|
||||||
|
|
||||||
nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
||||||
@ -52,21 +53,34 @@ nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
|||||||
{
|
{
|
||||||
// We don't add a reference to our element. If it goes away,
|
// We don't add a reference to our element. If it goes away,
|
||||||
// we'll be told to drop our reference
|
// we'll be told to drop our reference
|
||||||
|
SetIsProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMTokenList::~nsDOMTokenList() { }
|
nsDOMTokenList::~nsDOMTokenList() { }
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTokenList)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMTokenList)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMTokenList)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMTokenList)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
DOMCI_DATA(DOMTokenList, nsDOMTokenList)
|
DOMCI_DATA(DOMTokenList, nsDOMTokenList)
|
||||||
|
|
||||||
NS_INTERFACE_TABLE_HEAD(nsDOMTokenList)
|
NS_INTERFACE_TABLE_HEAD(nsDOMTokenList)
|
||||||
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_TABLE1(nsDOMTokenList,
|
NS_INTERFACE_TABLE1(nsDOMTokenList,
|
||||||
nsIDOMDOMTokenList)
|
nsIDOMDOMTokenList)
|
||||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDOMTokenList)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMTokenList)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMTokenList)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDOMTokenList)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTokenList)
|
||||||
NS_IMPL_RELEASE(nsDOMTokenList)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTokenList)
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDOMTokenList::DropReference()
|
nsDOMTokenList::DropReference()
|
||||||
@ -293,3 +307,12 @@ nsDOMTokenList::ToString(nsAString& aResult)
|
|||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
nsDOMTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||||
|
bool *triedToWrap)
|
||||||
|
{
|
||||||
|
return mozilla::dom::binding::DOMTokenList::create(cx, scope, this,
|
||||||
|
triedToWrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -46,16 +46,26 @@
|
|||||||
|
|
||||||
class nsAttrValue;
|
class nsAttrValue;
|
||||||
|
|
||||||
class nsDOMTokenList : public nsIDOMDOMTokenList
|
class nsDOMTokenList : public nsIDOMDOMTokenList,
|
||||||
|
public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTokenList)
|
||||||
NS_DECL_NSIDOMDOMTOKENLIST
|
NS_DECL_NSIDOMDOMTOKENLIST
|
||||||
|
|
||||||
nsDOMTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
nsDOMTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
||||||
|
|
||||||
void DropReference();
|
void DropReference();
|
||||||
|
|
||||||
|
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||||
|
bool *triedToWrap);
|
||||||
|
|
||||||
|
nsINode *GetParentObject()
|
||||||
|
{
|
||||||
|
return mElement;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~nsDOMTokenList();
|
~nsDOMTokenList();
|
||||||
|
|
||||||
|
@ -1980,7 +1980,7 @@ nsGenericElement::GetChildrenList()
|
|||||||
return slots->mChildrenList;
|
return slots->mChildrenList;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMDOMTokenList*
|
nsDOMTokenList*
|
||||||
nsGenericElement::GetClassList(nsresult *aResult)
|
nsGenericElement::GetClassList(nsresult *aResult)
|
||||||
{
|
{
|
||||||
*aResult = NS_ERROR_OUT_OF_MEMORY;
|
*aResult = NS_ERROR_OUT_OF_MEMORY;
|
||||||
@ -2468,6 +2468,9 @@ nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, b
|
|||||||
|
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
|
||||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
|
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
|
||||||
|
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
|
||||||
|
cb.NoteXPCOMChild(mClassList.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2482,6 +2485,10 @@ nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
|
|||||||
if (aIsXUL)
|
if (aIsXUL)
|
||||||
NS_IF_RELEASE(mControllers);
|
NS_IF_RELEASE(mControllers);
|
||||||
mChildrenList = nsnull;
|
mChildrenList = nsnull;
|
||||||
|
if (mClassList) {
|
||||||
|
mClassList->DropReference();
|
||||||
|
mClassList = nsnull;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||||
|
@ -597,7 +597,7 @@ public:
|
|||||||
nsIContent* GetLastElementChild();
|
nsIContent* GetLastElementChild();
|
||||||
nsIContent* GetPreviousElementSibling();
|
nsIContent* GetPreviousElementSibling();
|
||||||
nsIContent* GetNextElementSibling();
|
nsIContent* GetNextElementSibling();
|
||||||
nsIDOMDOMTokenList* GetClassList(nsresult *aResult);
|
nsDOMTokenList* GetClassList(nsresult *aResult);
|
||||||
bool MozMatchesSelector(const nsAString& aSelector, nsresult* aResult);
|
bool MozMatchesSelector(const nsAString& aSelector, nsresult* aResult);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,8 +100,8 @@ public:
|
|||||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLOutputElement,
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLOutputElement,
|
||||||
nsGenericHTMLFormElement)
|
nsGenericHTMLFormElement)
|
||||||
|
|
||||||
virtual nsXPCClassInfo* GetClassInfo();
|
virtual nsXPCClassInfo* GetClassInfo();
|
||||||
protected:
|
protected:
|
||||||
@ -136,13 +136,26 @@ nsHTMLOutputElement::~nsHTMLOutputElement()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLOutputElement)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLOutputElement,
|
||||||
|
nsGenericHTMLFormElement)
|
||||||
|
if (tmp->mTokenList) {
|
||||||
|
tmp->mTokenList->DropReference();
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTokenList)
|
||||||
|
}
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLOutputElement,
|
||||||
|
nsGenericHTMLFormElement)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTokenList,
|
||||||
|
nsDOMTokenList)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
||||||
|
|
||||||
DOMCI_NODE_DATA(HTMLOutputElement, nsHTMLOutputElement)
|
DOMCI_NODE_DATA(HTMLOutputElement, nsHTMLOutputElement)
|
||||||
|
|
||||||
NS_INTERFACE_TABLE_HEAD(nsHTMLOutputElement)
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLOutputElement)
|
||||||
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLOutputElement,
|
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLOutputElement,
|
||||||
nsIDOMHTMLOutputElement,
|
nsIDOMHTMLOutputElement,
|
||||||
nsIMutationObserver,
|
nsIMutationObserver,
|
||||||
|
@ -49,11 +49,11 @@ interface nsIDOMDOMTokenList : nsISupports
|
|||||||
{
|
{
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
|
|
||||||
DOMString item(in unsigned long index);
|
[getter] DOMString item(in unsigned long index);
|
||||||
boolean contains([Null(Stringify)] in DOMString token);
|
boolean contains([Null(Stringify)] in DOMString token);
|
||||||
void add([Null(Stringify)] in DOMString token);
|
void add([Null(Stringify)] in DOMString token);
|
||||||
void remove([Null(Stringify)] in DOMString token);
|
void remove([Null(Stringify)] in DOMString token);
|
||||||
boolean toggle([Null(Stringify)] in DOMString token);
|
boolean toggle([Null(Stringify)] in DOMString token);
|
||||||
|
|
||||||
DOMString toString();
|
[stringifier] DOMString toString();
|
||||||
};
|
};
|
||||||
|
@ -518,6 +518,7 @@ customIncludes = [
|
|||||||
'nsINodeList.h',
|
'nsINodeList.h',
|
||||||
'nsCSSPropertiesQS.h',
|
'nsCSSPropertiesQS.h',
|
||||||
'nsDocument.h',
|
'nsDocument.h',
|
||||||
|
'nsDOMTokenList.h',
|
||||||
'nsGenericDOMDataNode.h',
|
'nsGenericDOMDataNode.h',
|
||||||
'nsGenericElement.h',
|
'nsGenericElement.h',
|
||||||
'nsGenericHTMLElement.h',
|
'nsGenericHTMLElement.h',
|
||||||
@ -785,7 +786,7 @@ customMethodCalls = {
|
|||||||
},
|
},
|
||||||
'nsIDOMElement_GetClassList': {
|
'nsIDOMElement_GetClassList': {
|
||||||
'thisType': 'nsGenericElement',
|
'thisType': 'nsGenericElement',
|
||||||
'code': ' nsIDOMDOMTokenList *result = self->GetClassList(&rv);'
|
'code': ' nsDOMTokenList *result = self->GetClassList(&rv);'
|
||||||
},
|
},
|
||||||
'nsIDOMElement_SetCapture': {
|
'nsIDOMElement_SetCapture': {
|
||||||
'thisType': 'nsGenericElement',
|
'thisType': 'nsGenericElement',
|
||||||
|
@ -2,6 +2,8 @@ classes = {
|
|||||||
'NodeList': 'nsINodeList',
|
'NodeList': 'nsINodeList',
|
||||||
'HTMLCollection': 'nsIHTMLCollection',
|
'HTMLCollection': 'nsIHTMLCollection',
|
||||||
'HTMLOptionsCollection': 'nsHTMLOptionCollection',
|
'HTMLOptionsCollection': 'nsHTMLOptionCollection',
|
||||||
|
'DOMTokenList': 'nsDOMTokenList',
|
||||||
|
'DOMSettableTokenList': 'nsDOMSettableTokenList',
|
||||||
}
|
}
|
||||||
|
|
||||||
irregularFilenames = {
|
irregularFilenames = {
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsproxy.h"
|
#include "jsproxy.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
Loading…
Reference in New Issue
Block a user