mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 852135 - Part d: Move nsDOMAttributeMap to WebIDL bindings, remove CI and QS; r=bz
This commit is contained in:
parent
5832f550d5
commit
cc2268408a
@ -11,6 +11,7 @@
|
||||
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/MozNamedAttrMapBinding.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsError.h"
|
||||
@ -31,6 +32,7 @@ nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
|
||||
// We don't add a reference to our content. If it goes away,
|
||||
// we'll be told to drop our reference
|
||||
mAttributeCache.Init();
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,6 +61,7 @@ nsDOMAttributeMap::DropReference()
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttributeMap)
|
||||
tmp->DropReference();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
@ -76,18 +79,17 @@ TraverseMapEntry(nsAttrHashKey::KeyType aKey, nsRefPtr<Attr>& aData,
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttributeMap)
|
||||
tmp->mAttributeCache.Enumerate(TraverseMapEntry, &cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
DOMCI_DATA(MozNamedAttrMap, nsDOMAttributeMap)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsDOMAttributeMap)
|
||||
|
||||
// QueryInterface implementation for nsDOMAttributeMap
|
||||
NS_INTERFACE_TABLE_HEAD(nsDOMAttributeMap)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsDOMAttributeMap)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDOMAttributeMap, nsIDOMMozNamedAttrMap)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_TABLE1(nsDOMAttributeMap, nsIDOMMozNamedAttrMap)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttributeMap)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozNamedAttrMap)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMAttributeMap)
|
||||
@ -518,3 +520,9 @@ nsDOMAttributeMap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
// NB: mContent is non-owning and thus not counted.
|
||||
return n;
|
||||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
nsDOMAttributeMap::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return MozNamedAttrMapBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIDOMMozNamedAttrMap.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsINodeInfo;
|
||||
@ -87,6 +88,7 @@ private:
|
||||
|
||||
// Helper class that implements the nsIDOMMozNamedAttrMap interface.
|
||||
class nsDOMAttributeMap : public nsIDOMMozNamedAttrMap
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
typedef mozilla::dom::Attr Attr;
|
||||
@ -97,6 +99,7 @@ public:
|
||||
virtual ~nsDOMAttributeMap();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMAttributeMap)
|
||||
|
||||
// nsIDOMMozNamedAttrMap interface
|
||||
NS_DECL_NSIDOMMOZNAMEDATTRMAP
|
||||
@ -139,29 +142,12 @@ public:
|
||||
*/
|
||||
uint32_t Enumerate(AttrCache::EnumReadFunction aFunc, void *aUserArg) const;
|
||||
|
||||
Attr* GetItemAt(uint32_t aIndex)
|
||||
Element* GetParentObject() const
|
||||
{
|
||||
return Item(aIndex);
|
||||
return mContent;
|
||||
}
|
||||
|
||||
static nsDOMAttributeMap* FromSupports(nsISupports* aSupports)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIDOMMozNamedAttrMap> map_qi = do_QueryInterface(aSupports);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIDOMMozNamedAttrMap pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(map_qi == static_cast<nsIDOMMozNamedAttrMap*>(aSupports),
|
||||
"Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return static_cast<nsDOMAttributeMap*>(aSupports);
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMAttributeMap)
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
Attr* GetNamedItem(const nsAString& aAttrName);
|
||||
|
@ -102,7 +102,6 @@
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMDOMException.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMMozNamedAttrMap.h"
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
|
||||
// HTMLFormElement helper includes
|
||||
@ -560,8 +559,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(Attr, nsAttributeSH,
|
||||
NODE_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozNamedAttrMap, nsNamedNodeMapSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS)
|
||||
|
||||
// Misc Core related classes
|
||||
|
||||
@ -1725,10 +1722,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozNamedAttrMap, nsIDOMMozNamedAttrMap)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNamedAttrMap)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Event, nsIDOMEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -6068,31 +6061,6 @@ nsNamedArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
|
||||
|
||||
// NamedNodeMap helper
|
||||
|
||||
nsISupports*
|
||||
nsNamedNodeMapSH::GetItemAt(nsISupports *aNative, uint32_t aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
*aResult = NS_OK;
|
||||
nsDOMAttributeMap* map = nsDOMAttributeMap::FromSupports(aNative);
|
||||
|
||||
nsINode *attr;
|
||||
*aCache = attr = map->GetItemAt(aIndex);
|
||||
return attr;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsNamedNodeMapSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsDOMAttributeMap* map = nsDOMAttributeMap::FromSupports(aNative);
|
||||
|
||||
nsINode *attr;
|
||||
*aCache = attr = map->GetNamedItem(aName);
|
||||
return attr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
|
@ -590,35 +590,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// NamedNodeMap helper
|
||||
|
||||
class nsNamedNodeMapSH : public nsNamedArraySH
|
||||
{
|
||||
protected:
|
||||
nsNamedNodeMapSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsNamedNodeMapSH()
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsWrapperCache **cache,
|
||||
nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsNamedNodeMapSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
// Document helper, for document.location and document.on*
|
||||
|
||||
class nsDocumentSH : public nsNodeSH
|
||||
|
@ -19,7 +19,6 @@ DOMCI_CLASS(DOMConstructor)
|
||||
DOMCI_CLASS(DOMException)
|
||||
DOMCI_CLASS(Element)
|
||||
DOMCI_CLASS(Attr)
|
||||
DOMCI_CLASS(MozNamedAttrMap)
|
||||
|
||||
// Event classes
|
||||
DOMCI_CLASS(Event)
|
||||
|
@ -637,6 +637,10 @@ DOMInterfaces = {
|
||||
'previousSibling', 'nextSibling' ]
|
||||
},
|
||||
|
||||
'MozNamedAttrMap': {
|
||||
'nativeType': 'nsDOMAttributeMap',
|
||||
},
|
||||
|
||||
'Node': {
|
||||
'nativeType': 'nsINode',
|
||||
'concrete': False,
|
||||
@ -1535,7 +1539,6 @@ addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject',
|
||||
addExternalIface('MozTreeColumn', nativeType='nsITreeColumn',
|
||||
headerFile='nsITreeColumns.h')
|
||||
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
|
||||
addExternalIface('MozNamedAttrMap')
|
||||
addExternalIface('nsIControllers', nativeType='nsIControllers')
|
||||
addExternalIface('nsIInputStreamCallback', nativeType='nsIInputStreamCallback',
|
||||
headerFile='nsIAsyncInputStream.h')
|
||||
|
@ -13,8 +13,6 @@
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface MozNamedAttrMap;
|
||||
|
||||
interface Element : Node {
|
||||
/*
|
||||
We haven't moved these from Node to Element like the spec wants.
|
||||
|
27
dom/webidl/MozNamedAttrMap.webidl
Normal file
27
dom/webidl/MozNamedAttrMap.webidl
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
interface Attr;
|
||||
|
||||
/**
|
||||
* This is a temporary, non-standard interface, to ease the transition to a
|
||||
* world where Attr no longer inherits from Node.
|
||||
*/
|
||||
interface MozNamedAttrMap {
|
||||
getter Attr? getNamedItem(DOMString name);
|
||||
[Throws]
|
||||
Attr? setNamedItem(Attr arg);
|
||||
[Throws]
|
||||
Attr removeNamedItem(DOMString name);
|
||||
|
||||
getter Attr? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
Attr? getNamedItemNS(DOMString? namespaceURI, DOMString localName);
|
||||
[Throws]
|
||||
Attr? setNamedItemNS(Attr arg);
|
||||
[Throws]
|
||||
Attr removeNamedItemNS(DOMString? namespaceURI, DOMString localName);
|
||||
};
|
@ -163,6 +163,7 @@ webidl_files = \
|
||||
MouseEvent.webidl \
|
||||
MouseScrollEvent.webidl \
|
||||
MozActivity.webidl \
|
||||
MozNamedAttrMap.webidl \
|
||||
MutationEvent.webidl \
|
||||
MutationObserver.webidl \
|
||||
NetDashboard.webidl \
|
||||
|
@ -57,8 +57,6 @@ members = [
|
||||
'nsIDOMCanvasPattern.*',
|
||||
|
||||
# dom/interfaces/core
|
||||
'nsIDOMMozNamedAttrMap.item',
|
||||
'nsIDOMMozNamedAttrMap.length',
|
||||
'nsIDOMDOMStringList.*',
|
||||
|
||||
'nsIDOMKeyEvent.*',
|
||||
|
Loading…
Reference in New Issue
Block a user