Bug 802243 - WrapperCache DOMStringMap, quickstub, r=smaug

--HG--
extra : rebase_source : 3c1bb6ab18692d647461af42e732e5f150ae8500
This commit is contained in:
bzbarsky@mit.edu 2012-10-17 04:14:32 +03:00
parent a25fbe40e2
commit 696273ce6e
4 changed files with 20 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class nsDOMTokenList;
class nsIControllers;
class nsICSSDeclaration;
class nsIDocument;
class nsIDOMDOMStringMap;
class nsDOMStringMap;
class nsIDOMNamedNodeMap;
class nsINodeInfo;
class nsIURI;
@ -348,7 +348,7 @@ public:
* The .dataset attribute.
* @see nsGenericHTMLElement::GetDataset
*/
nsIDOMDOMStringMap* mDataset; // [Weak]
nsDOMStringMap* mDataset; // [Weak]
/**
* SMIL Overridde style rules (for SMIL animation of CSS properties)

View File

@ -344,18 +344,25 @@ nsGenericHTMLElement::SetAttribute(const nsAString& aName,
aValue, true);
}
nsresult
nsGenericHTMLElement::GetDataset(nsIDOMDOMStringMap** aDataset)
already_AddRefed<nsDOMStringMap>
nsGenericHTMLElement::Dataset()
{
nsDOMSlots *slots = DOMSlots();
if (!slots->mDataset) {
// mDataset is a weak reference so assignment will not AddRef.
// AddRef is called before assigning to out parameter.
// AddRef is called before returning the pointer.
slots->mDataset = new nsDOMStringMap(this);
}
NS_ADDREF(*aDataset = slots->mDataset);
NS_ADDREF(slots->mDataset);
return slots->mDataset;
}
nsresult
nsGenericHTMLElement::GetDataset(nsIDOMDOMStringMap** aDataset)
{
*aDataset = Dataset().get();
return NS_OK;
}

View File

@ -219,6 +219,7 @@ public:
nsresult GetIsContentEditable(bool* aContentEditable);
nsresult SetContentEditable(const nsAString &aContentEditable);
nsresult GetDataset(nsIDOMDOMStringMap** aDataset);
already_AddRefed<nsDOMStringMap> Dataset();
// Callback for destructor of of dataset to ensure to null out weak pointer.
nsresult ClearDataset();
nsresult GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu);

View File

@ -485,6 +485,7 @@ customIncludes = [
'nsSVGStylableElement.h',
'nsHTMLDocument.h',
'nsDOMQS.h',
'nsDOMStringMap.h',
'mozilla/dom/ImageData.h'
]
@ -849,6 +850,11 @@ customMethodCalls = {
' self->SetInnerHTML(arg0, error);\n'
' rv = error.ErrorCode();'
},
'nsIDOMHTMLElement_GetDataset': {
'thisType' : 'nsGenericHTMLElement',
'code': ' nsRefPtr<nsDOMStringMap> result = self->Dataset();',
'canFail': False
},
'nsIDOMElementCSSInlineStyle_GetStyle': {
'thisType': 'nsStyledElement',
'code': ' /* XXXbz MathML elements inherit from nsStyledElement but\n'