Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsContentCreatorFunctions.h File Reference
#include "nscore.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nsresult NS_NewElement (nsIContent **aResult, PRInt32 aElementType, nsINodeInfo *aNodeInfo)
nsresult NS_NewXMLElement (nsIContent **aResult, nsINodeInfo *aNodeInfo)
nsresult NS_NewXMLProcessingInstruction (nsIContent **aInstancePtrResult, nsNodeInfoManager *aNodeInfoManager, const nsAString &aTarget, const nsAString &aData)
 aNodeInfoManager must not be null.
nsresult NS_NewXMLStylesheetProcessingInstruction (nsIContent **aInstancePtrResult, nsNodeInfoManager *aNodeInfoManager, const nsAString &aData)
 aNodeInfoManager must not be null.
nsresult NS_NewXMLCDATASection (nsIContent **aInstancePtrResult, nsNodeInfoManager *aNodeInfoManager)
 aNodeInfoManager must not be null.
nsresult NS_NewHTMLElement (nsIContent **aResult, nsINodeInfo *aNodeInfo)
nsresult NS_NewGenConImageContent (nsIContent **aResult, nsINodeInfo *aNodeInfo, imgIRequest *aImageRequest)
nsresult NS_NewXMLEventsElement (nsIContent **aResult, nsINodeInfo *aNodeInfo)

Function Documentation

nsresult NS_NewElement ( nsIContent **  aResult,
PRInt32  aElementType,
nsINodeInfo aNodeInfo 
)

Definition at line 244 of file nsNameSpaceManager.cpp.

{
  if (aElementType == kNameSpaceID_XHTML) {
    return NS_NewHTMLElement(aResult, aNodeInfo);
  }
#ifdef MOZ_XUL
  if (aElementType == kNameSpaceID_XUL) {
    return NS_NewXULElement(aResult, aNodeInfo);
  }
#endif
#ifdef MOZ_MATHML
  if (aElementType == kNameSpaceID_MathML) {
    return NS_NewMathMLElement(aResult, aNodeInfo);
  }
#endif
#ifdef MOZ_SVG
  if (aElementType == kNameSpaceID_SVG &&
      nsSVGUtils::SVGEnabled()) {
    return NS_NewSVGElement(aResult, aNodeInfo);
  }
#endif
  if (aElementType == kNameSpaceID_XMLEvents) {
    return NS_NewXMLEventsElement(aResult, aNodeInfo);
  }
#ifdef MOZ_XTF
  if (aElementType > kNameSpaceID_LastBuiltin) {
    nsIXTFService* xtfService = nsContentUtils::GetXTFServiceWeakRef();
    NS_ASSERTION(xtfService, "could not get xtf service");
    if (xtfService &&
        NS_SUCCEEDED(xtfService->CreateElement(aResult, aNodeInfo)))
      return NS_OK;
  }
#endif
  return NS_NewXMLElement(aResult, aNodeInfo);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewGenConImageContent ( nsIContent **  aResult,
nsINodeInfo aNodeInfo,
imgIRequest aImageRequest 
)

Here is the caller graph for this function:

nsresult NS_NewHTMLElement ( nsIContent **  aResult,
nsINodeInfo aNodeInfo 
)

Definition at line 909 of file nsHTMLContentSink.cpp.

{
  *aResult = nsnull;

  nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
  if (!parserService)
    return NS_ERROR_OUT_OF_MEMORY;

  nsIAtom *name = aNodeInfo->NameAtom();

  nsHTMLTag id;
  nsRefPtr<nsGenericHTMLElement> result;
  if (aNodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) {
    // Find tag in tag table
    id = nsHTMLTag(parserService->HTMLCaseSensitiveAtomTagToId(name));

    result = MakeContentObject(id, aNodeInfo, nsnull, PR_FALSE, PR_FALSE);
  }
  else {
    // Find tag in tag table
    id = nsHTMLTag(parserService->HTMLAtomTagToId(name));

    // Reverse map id to name to get the correct character case in
    // the tag name.

    nsCOMPtr<nsINodeInfo> kungFuDeathGrip;
    nsINodeInfo *nodeInfo = aNodeInfo;

    if (id != eHTMLTag_userdefined) {
      nsIAtom *tag = parserService->HTMLIdToAtomTag(id);
      NS_ASSERTION(tag, "What? Reverse mapping of id to string broken!!!");

      if (name != tag) {
        nsresult rv =
          nsContentUtils::NameChanged(aNodeInfo, tag,
                                      getter_AddRefs(kungFuDeathGrip));
        NS_ENSURE_SUCCESS(rv, rv);

        nodeInfo = kungFuDeathGrip;
      }
    }

    result = MakeContentObject(id, nodeInfo, nsnull, PR_FALSE, PR_FALSE);
  }

  return result ? CallQueryInterface(result.get(), aResult)
    : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewXMLCDATASection ( nsIContent **  aInstancePtrResult,
nsNodeInfoManager aNodeInfoManager 
)

aNodeInfoManager must not be null.

Definition at line 82 of file nsXMLCDATASection.cpp.

{
  NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");

  *aInstancePtrResult = nsnull;

  nsXMLCDATASection *instance = new nsXMLCDATASection(aNodeInfoManager);
  if (!instance) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = instance);

  return NS_OK;
}

Here is the call graph for this function:

nsresult NS_NewXMLElement ( nsIContent **  aResult,
nsINodeInfo aNodeInfo 
)

Definition at line 70 of file nsXMLElement.cpp.

{
  nsXMLElement* it = new nsXMLElement(aNodeInfo);
  if (!it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = it);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewXMLEventsElement ( nsIContent **  aResult,
nsINodeInfo aNodeInfo 
)

Definition at line 86 of file nsXMLEventsElement.cpp.

{
  nsXMLEventsElement* it = new nsXMLEventsElement(aNodeInfo);
  if (!it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  NS_ADDREF(*aInstancePtrResult = it);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewXMLProcessingInstruction ( nsIContent **  aInstancePtrResult,
nsNodeInfoManager aNodeInfoManager,
const nsAString &  aTarget,
const nsAString &  aData 
)

aNodeInfoManager must not be null.

Definition at line 46 of file nsXMLProcessingInstruction.cpp.

{
  NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");

  if (aTarget.EqualsLiteral("xml-stylesheet")) {
    return NS_NewXMLStylesheetProcessingInstruction(aInstancePtrResult,
                                                    aNodeInfoManager, aData);
  }

  *aInstancePtrResult = nsnull;

  nsXMLProcessingInstruction *instance =
    new nsXMLProcessingInstruction(aNodeInfoManager, aTarget, aData);
  if (!instance) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = instance);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewXMLStylesheetProcessingInstruction ( nsIContent **  aInstancePtrResult,
nsNodeInfoManager aNodeInfoManager,
const nsAString &  aData 
)

aNodeInfoManager must not be null.

Definition at line 248 of file nsXMLStylesheetPI.cpp.

{
  NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");

  *aInstancePtrResult = nsnull;
  
  nsXMLStylesheetPI *instance = new nsXMLStylesheetPI(aNodeInfoManager, aData);
  if (!instance) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aInstancePtrResult = instance);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: