Bug 614724. Quickstub createElementNS. r=peterv

This commit is contained in:
Boris Zbarsky 2010-11-30 13:18:14 -05:00
Родитель b8f17a71ec
Коммит 35c15aa23a
3 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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