Bug 614724. Quickstub createElementNS. r=peterv a=jst

This commit is contained in:
Boris Zbarsky 2010-11-30 11:56:12 +01:00
parent fb26e96957
commit f52401fdc4
3 changed files with 22 additions and 6 deletions

View File

@ -4351,7 +4351,18 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
nsIDOMElement** aReturn)
{
*aReturn = nsnull;
nsCOMPtr<nsIContent> content;
nsresult rv = CreateElementNS(aNamespaceURI, aQualifiedName,
getter_AddRefs(content));
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(content, aReturn);
}
nsresult
nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIContent** aReturn)
{
nsCOMPtr<nsINodeInfo> nodeInfo;
nsresult rv = nsContentUtils::GetNodeInfoFromQName(aNamespaceURI,
aQualifiedName,
@ -4359,13 +4370,9 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
PRInt32 ns = nodeInfo->NamespaceID();
rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(),
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(content, aReturn);
return NS_NewElement(aReturn, nodeInfo->NamespaceID(),
nodeInfo.forget(), NOT_FROM_PARSER);
}
NS_IMETHODIMP

View File

@ -859,6 +859,9 @@ public:
nsresult CreateElement(const nsAString& aTagName,
nsIContent** aReturn);
nsresult CreateElementNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIContent** aReturn);
nsresult CreateTextNode(const nsAString& aData, nsIContent** aReturn);

View File

@ -103,6 +103,7 @@ members = [
'nsIDOMDocument.getElementById',
'nsIDOMDocument.createDocumentFragment',
'nsIDOMDocument.createElement',
'nsIDOMDocument.createElementNS',
'nsIDOMDocument.importNode',
'nsIDOMDocument.createTextNode',
'nsIDOMElement.removeAttributeNS',
@ -909,6 +910,11 @@ customMethodCalls = {
'code': ' nsCOMPtr<nsIContent> result;\n'
' rv = self->CreateElement(arg0, getter_AddRefs(result));'
},
'nsIDOMDocument_CreateElementNS': {
'thisType': 'nsDocument',
'code': ' nsCOMPtr<nsIContent> result;\n'
' rv = self->CreateElementNS(arg0, arg1, getter_AddRefs(result));'
},
'nsIDOMDocument_CreateTextNode': {
'thisType': 'nsDocument',
'code': ' nsCOMPtr<nsIContent> result;\n'