mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 698261 - Remove the aElementType argument of NS_NewElement; r=bz
This commit is contained in:
parent
a4e37b2f13
commit
0ac11f32f0
@ -58,7 +58,7 @@ class nsNodeInfoManager;
|
||||
class nsGenericHTMLElement;
|
||||
|
||||
nsresult
|
||||
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
|
||||
NS_NewElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser);
|
||||
|
||||
|
@ -4421,9 +4421,7 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 ns = nodeInfo->NamespaceID();
|
||||
return NS_NewElement(aReturn, ns,
|
||||
nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
return NS_NewElement(aReturn, nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -6754,8 +6752,7 @@ nsDocument::CreateElem(const nsAString& aName, nsIAtom *aPrefix, PRInt32 aNamesp
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NS_NewElement(aResult, aNamespaceID, nodeInfo.forget(),
|
||||
NOT_FROM_PARSER);
|
||||
return NS_NewElement(aResult, nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -224,28 +224,29 @@ NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
|
||||
NS_NewElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser)
|
||||
{
|
||||
if (aElementType == kNameSpaceID_XHTML) {
|
||||
PRInt32 ns = aNodeInfo.get()->NamespaceID();
|
||||
if (ns == kNameSpaceID_XHTML) {
|
||||
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);
|
||||
}
|
||||
#ifdef MOZ_XUL
|
||||
if (aElementType == kNameSpaceID_XUL) {
|
||||
if (ns == kNameSpaceID_XUL) {
|
||||
return NS_NewXULElement(aResult, aNodeInfo);
|
||||
}
|
||||
#endif
|
||||
if (aElementType == kNameSpaceID_MathML) {
|
||||
if (ns == kNameSpaceID_MathML) {
|
||||
return NS_NewMathMLElement(aResult, aNodeInfo);
|
||||
}
|
||||
if (aElementType == kNameSpaceID_SVG) {
|
||||
if (ns == kNameSpaceID_SVG) {
|
||||
return NS_NewSVGElement(aResult, aNodeInfo, aFromParser);
|
||||
}
|
||||
if (aElementType == kNameSpaceID_XMLEvents) {
|
||||
if (ns == kNameSpaceID_XMLEvents) {
|
||||
return NS_NewXMLEventsElement(aResult, aNodeInfo);
|
||||
}
|
||||
#ifdef MOZ_XTF
|
||||
if (aElementType > kNameSpaceID_LastBuiltin) {
|
||||
if (ns > kNameSpaceID_LastBuiltin) {
|
||||
nsIXTFService* xtfService = nsContentUtils::GetXTFService();
|
||||
NS_ASSERTION(xtfService, "could not get xtf service");
|
||||
if (xtfService &&
|
||||
|
@ -78,12 +78,11 @@
|
||||
#include "nsXBLResourceLoader.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULElement.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// Helper Classes =====================================================================
|
||||
@ -1904,9 +1903,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
nsCOMPtr<nsINodeInfo> ni = nodeInfo;
|
||||
NS_NewElement(getter_AddRefs(content), nodeInfo->NamespaceID(),
|
||||
ni.forget(), mozilla::dom::NOT_FROM_PARSER);
|
||||
NS_NewElement(getter_AddRefs(content), nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
|
||||
for (PRUint32 i = 0; i < attrCount; i++) {
|
||||
rv = ReadNamespace(aStream, namespaceID);
|
||||
|
@ -497,8 +497,7 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
rv = NS_NewElement(getter_AddRefs(content), aNodeInfo->NamespaceID(),
|
||||
ni.forget(), aFromParser);
|
||||
rv = NS_NewElement(getter_AddRefs(content), ni.forget(), aFromParser);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML)
|
||||
|
@ -555,12 +555,12 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
|
||||
mOpenedElementIsHTML = false;
|
||||
|
||||
// Create the element
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
nsCOMPtr<nsINodeInfo> ni =
|
||||
mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), aNsID, ni.forget(),
|
||||
NS_NewElement(getter_AddRefs(mOpenedElement), ni.forget(),
|
||||
mCreatingNewDocument ?
|
||||
FROM_PARSER_XSLT : FROM_PARSER_FRAGMENT);
|
||||
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "nsIDOMHTMLMenuItemElement.h"
|
||||
#include "nsXULContextMenuBuilder.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsXULContextMenuBuilder::nsXULContextMenuBuilder()
|
||||
: mCurrentGeneratedItemId(0)
|
||||
@ -247,8 +249,7 @@ nsXULContextMenuBuilder::CreateElement(nsIAtom* aTag,
|
||||
aTag, nsnull, kNameSpaceID_XUL, nsIDOMNode::ELEMENT_NODE);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = NS_NewElement(aResult, kNameSpaceID_XUL, nodeInfo.forget(),
|
||||
mozilla::dom::NOT_FROM_PARSER);
|
||||
nsresult rv = NS_NewElement(aResult, nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -3703,9 +3703,8 @@ nsXULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
if (!newNodeInfo) return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
PRInt32 ns = newNodeInfo->NamespaceID();
|
||||
nsCOMPtr<nsINodeInfo> xtfNi = newNodeInfo;
|
||||
rv = NS_NewElement(getter_AddRefs(content), ns, newNodeInfo.forget(),
|
||||
rv = NS_NewElement(getter_AddRefs(content), newNodeInfo.forget(),
|
||||
NOT_FROM_PARSER);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1399,20 +1399,17 @@ nsXULContentBuilder::CreateElement(PRInt32 aNameSpaceID,
|
||||
if (! doc)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIContent> result;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo =
|
||||
doc->NodeInfoManager()->GetNodeInfo(aTag, nsnull, aNameSpaceID,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(aTag, nsnull, aNameSpaceID,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
rv = NS_NewElement(getter_AddRefs(result), aNameSpaceID, nodeInfo.forget(),
|
||||
NOT_FROM_PARSER);
|
||||
nsresult rv = NS_NewElement(getter_AddRefs(result), nodeInfo.forget(),
|
||||
NOT_FROM_PARSER);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*aResult = result;
|
||||
NS_ADDREF(*aResult);
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
GetNodeInfo(name, nsnull, ns, nsIDOMNode::ELEMENT_NODE);
|
||||
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
|
||||
NS_NewElement(getter_AddRefs(newContent),
|
||||
ns, nodeInfo.forget(),
|
||||
nodeInfo.forget(),
|
||||
(mOpCode == eTreeOpCreateElementNetwork ?
|
||||
dom::FROM_PARSER_NETWORK
|
||||
: (aBuilder->IsFragmentMode() ?
|
||||
@ -431,7 +431,6 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
nsCOMPtr<nsIContent> optionElt;
|
||||
nsCOMPtr<nsINodeInfo> ni = optionNodeInfo;
|
||||
NS_NewElement(getter_AddRefs(optionElt),
|
||||
optionNodeInfo->NamespaceID(),
|
||||
ni.forget(),
|
||||
(mOpCode == eTreeOpCreateElementNetwork ?
|
||||
dom::FROM_PARSER_NETWORK
|
||||
|
Loading…
Reference in New Issue
Block a user