Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
nsHTMLContentSink.cpp File Reference
#include "nsContentSink.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsIHTMLContentSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIParser.h"
#include "nsParserUtils.h"
#include "nsIScriptLoader.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsINodeInfo.h"
#include "nsHTMLTokens.h"
#include "nsCRT.h"
#include "prtime.h"
#include "prlog.h"
#include "nsInt64.h"
#include "nsGenericHTMLElement.h"
#include "nsITextContent.h"
#include "nsIDOMText.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIScriptElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsHTMLAtoms.h"
#include "nsContentUtils.h"
#include "nsIFrame.h"
#include "nsIChannel.h"
#include "nsIHttpChannel.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsStubDocumentObserver.h"
#include "nsIHTMLDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsICookieService.h"
#include "nsVoidArray.h"
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsTextFragment.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIParserService.h"
#include "nsISelectElement.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsTimer.h"
#include "nsITimer.h"
#include "nsDOMError.h"
#include "nsContentPolicyUtils.h"
#include "nsIScriptContext.h"
#include "nsStyleLinkElement.h"
#include "nsWeakReference.h"
#include "nsIPrompt.h"
#include "nsLayoutCID.h"
#include "nsIDocShellTreeItem.h"
#include "plevent.h"
#include "nsEscape.h"
#include "nsIElementObserver.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsHTMLTagList.h"

Go to the source code of this file.

Classes

class  HTMLContentSink
class  DummyParserRequest
class  SinkContext
struct  SinkContext::Node

Defines

#define SINK_TRACE(_bit, _args)
#define SINK_TRACE_NODE(_bit, _msg, _tag, _sp, _obj)
#define NS_SINK_FLAG_SCRIPT_ENABLED   0x00000008
#define NS_SINK_FLAG_FRAMES_ENABLED   0x00000010
#define NS_SINK_FLAG_CAN_INTERRUPT_PARSER   0x00000020
#define NS_SINK_FLAG_DYNAMIC_LOWER_VALUE   0x00000040
#define NS_SINK_FLAG_FORM_ON_STACK   0x00000080
#define NS_SINK_FLAG_PARSING   0x00000100
#define NS_SINK_FLAG_DROPPED_TIMER   0x00000200
#define NS_DELAY_FOR_WINDOW_CREATION   500000
#define NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE   200
#define HTML_TAG(_tag, _classname)   NS_NewHTML##_classname##Element,
#define HTML_OTHER(_tag)   NS_NewHTMLNOTUSEDElement,

Typedefs

typedef nsGenericHTMLElement *(* contentCreatorCallback )(nsINodeInfo *, PRBool aFromParser)

Functions

nsGenericHTMLElementNS_NewHTMLNOTUSEDElement (nsINodeInfo *aNodeInfo, PRBool aFromParser)
static void SetForm (nsGenericHTMLElement *aContent, nsGenericHTMLElement *aForm)
static already_AddRefed
< nsGenericHTMLElement
MakeContentObject (nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo, nsGenericHTMLElement *aForm, PRBool aInsideNoXXXTag, PRBool aFromParser)
nsresult NS_NewHTMLElement (nsIContent **aResult, nsINodeInfo *aNodeInfo)
nsresult NS_NewHTMLContentSink (nsIHTMLContentSink **aResult, nsIDocument *aDoc, nsIURI *aURI, nsISupports *aContainer, nsIChannel *aChannel)
 NS_IMPL_ISUPPORTS_INHERITED4 (HTMLContentSink, nsContentSink, nsIContentSink, nsIHTMLContentSink, nsITimerCallback, nsIDocumentObserver) static PRBool IsScriptEnabled(nsIDocument *aDoc

Variables

static const contentCreatorCallback sContentCreatorCallbacks []

Class Documentation

struct SinkContext::Node

Definition at line 737 of file nsHTMLContentSink.cpp.

Collaboration diagram for SinkContext::Node:
Class Members
nsGenericHTMLElement * mContent
PRInt32 mInsertionPoint
PRUint32 mNumFlushed
nsHTMLTag mType

Define Documentation

Definition at line 191 of file nsHTMLContentSink.cpp.

#define HTML_TAG (   _tag,
  _classname 
)    NS_NewHTML##_classname##Element,

Definition at line 190 of file nsHTMLContentSink.cpp.

Definition at line 175 of file nsHTMLContentSink.cpp.

Definition at line 179 of file nsHTMLContentSink.cpp.

Definition at line 162 of file nsHTMLContentSink.cpp.

Definition at line 172 of file nsHTMLContentSink.cpp.

Definition at line 166 of file nsHTMLContentSink.cpp.

Definition at line 168 of file nsHTMLContentSink.cpp.

Definition at line 159 of file nsHTMLContentSink.cpp.

#define NS_SINK_FLAG_PARSING   0x00000100

Definition at line 170 of file nsHTMLContentSink.cpp.

Definition at line 157 of file nsHTMLContentSink.cpp.

#define SINK_TRACE (   _bit,
  _args 
)

Definition at line 149 of file nsHTMLContentSink.cpp.

#define SINK_TRACE_NODE (   _bit,
  _msg,
  _tag,
  _sp,
  _obj 
)

Definition at line 150 of file nsHTMLContentSink.cpp.


Typedef Documentation

Definition at line 181 of file nsHTMLContentSink.cpp.


Function Documentation

already_AddRefed< nsGenericHTMLElement > MakeContentObject ( nsHTMLTag  aNodeType,
nsINodeInfo aNodeInfo,
nsGenericHTMLElement aForm,
PRBool  aInsideNoXXXTag,
PRBool  aFromParser 
) [static]

Definition at line 959 of file nsHTMLContentSink.cpp.

{

  if (aNodeType == eHTMLTag_form) {
    if (aForm) {
      // the form was already created
      NS_ADDREF(aForm);
      return aForm;
    }
    nsGenericHTMLElement* result = NS_NewHTMLFormElement(aNodeInfo);
    NS_IF_ADDREF(result);
    return result;
  }

  contentCreatorCallback cb = sContentCreatorCallbacks[aNodeType];

  NS_ASSERTION(cb != NS_NewHTMLNOTUSEDElement,
               "Don't know how to construct tag element!");

  nsGenericHTMLElement* result = cb(aNodeInfo, aFromParser);
  if (!result) {
    return nsnull;
  }

  NS_ADDREF(result);

  if (aForm && !aInsideNoXXXTag) {
    switch (aNodeType) {
    case eHTMLTag_button:
    case eHTMLTag_fieldset:
    case eHTMLTag_label:
    case eHTMLTag_legend:
    case eHTMLTag_object:
    case eHTMLTag_input:
    case eHTMLTag_select:
    case eHTMLTag_textarea:
      SetForm(result, aForm);
      break;
    default:
      break;
    }
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewHTMLContentSink ( nsIHTMLContentSink **  aResult,
nsIDocument aDoc,
nsIURI aURI,
nsISupports *  aContainer,
nsIChannel aChannel 
)

Definition at line 1807 of file nsHTMLContentSink.cpp.

{
  NS_ENSURE_ARG_POINTER(aResult);

  nsRefPtr<HTMLContentSink> it = new HTMLContentSink();

  if (!it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel);

  NS_ENSURE_SUCCESS(rv, rv);

  *aResult = it;
  NS_ADDREF(*aResult);

  return NS_OK;
}

Here is the call graph for this function:

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:

nsGenericHTMLElement* NS_NewHTMLNOTUSEDElement ( nsINodeInfo aNodeInfo,
PRBool  aFromParser 
)

Definition at line 184 of file nsHTMLContentSink.cpp.

{
  NS_NOTREACHED("The element ctor should never be called");
  return nsnull;
}

Here is the caller graph for this function:

static void SetForm ( nsGenericHTMLElement aContent,
nsGenericHTMLElement aForm 
) [static]

Definition at line 846 of file nsHTMLContentSink.cpp.

{
  nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aContent));
  NS_ASSERTION(formControl, "nsGenericHTMLElement didn't implement nsIFormControl");
  nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(aForm));
  NS_ASSERTION(!aForm || formElement, "nsGenericHTMLElement didn't implement nsIDOMHTMLFormElement");

  formControl->SetForm(formElement);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:
 {
  NS_NewHTMLUnknownElement,



  NS_NewHTMLUnknownElement
}

Definition at line 192 of file nsHTMLContentSink.cpp.