Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
nsHTMLParanoidFragmentSink Class Reference
Inheritance diagram for nsHTMLParanoidFragmentSink:
Inheritance graph
[legend]
Collaboration diagram for nsHTMLParanoidFragmentSink:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsHTMLParanoidFragmentSink ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
OpenContainer (const nsIParserNode &aNode)
 This method is used to open a generic container in the sink.
NS_IMETHOD CloseContainer (const nsHTMLTag aTag)
 This method gets called by the parser when a close container tag has been consumed and needs to be closed.
NS_IMETHOD AddLeaf (const nsIParserNode &aNode)
 This gets called by the parser when you want to add a leaf node to the current container in the content model.
NS_IMETHOD AddComment (const nsIParserNode &aNode)
 This gets called by the parser when you want to add a leaf node to the current container in the content model.
NS_IMETHOD AddProcessingInstruction (const nsIParserNode &aNode)
 This gets called by the parser when you want to add a leaf node to the current container in the content model.
nsresult AddAttributes (const nsIParserNode &aNode, nsIContent *aContent)
NS_DECL_ISUPPORTS NS_IMETHOD WillBuildModel (void)
 This method gets called when the parser begins the process of building the content model via the content sink.
NS_IMETHOD DidBuildModel (void)
 This method gets called when the parser concludes the process of building the content model via the content sink.
NS_IMETHOD WillInterrupt (void)
 This method gets called when the parser gets i/o blocked, and wants to notify the sink that it may be a while before more data is available.
NS_IMETHOD WillResume (void)
 This method gets called when the parser i/o gets unblocked, and we're about to start dumping content again to the sink.
NS_IMETHOD SetParser (nsIParser *aParser)
 This method gets called by the parser so that the content sink can retain a reference to the parser.
virtual void FlushPendingNotifications (mozFlushType aType)
 Flush content so that the content model is in sync with the state of the sink.
NS_IMETHOD SetDocumentCharset (nsACString &aCharset)
 Set the document character set.
virtual nsISupports * GetTarget ()
 Returns the target object (often a document object) into which the content built by this content sink is being added, if any (IOW, may return null).
NS_IMETHOD BeginContext (PRInt32 aID)
 This gets called when handling illegal contents, especially in dealing with tables.
NS_IMETHOD EndContext (PRInt32 aID)
 This method terminates any new context that got created by BeginContext and switches back to the main context.
NS_IMETHOD SetTitle (const nsString &aValue)
 This method gets called by the parser when it encounters a title tag and wants to set the document title in the sink.
NS_IMETHOD OpenHTML (const nsIParserNode &aNode)
 This method is used to open the outer HTML container.
NS_IMETHOD CloseHTML ()
 This method is used to close the outer HTML container.
NS_IMETHOD OpenHead (const nsIParserNode &aNode)
 This method is used to open the only HEAD container.
NS_IMETHOD CloseHead ()
 This method is used to close the only HEAD container.
NS_IMETHOD OpenBody (const nsIParserNode &aNode)
 This method is used to open the main BODY container.
NS_IMETHOD CloseBody ()
 This method is used to close the main BODY container.
NS_IMETHOD OpenForm (const nsIParserNode &aNode)
 This method is used to open a new FORM container.
NS_IMETHOD CloseForm ()
 This method is used to close the outer FORM container.
NS_IMETHOD OpenFrameset (const nsIParserNode &aNode)
 This method is used to open the FRAMESET container.
NS_IMETHOD CloseFrameset ()
 This method is used to close the FRAMESET container.
NS_IMETHOD IsEnabled (PRInt32 aTag, PRBool *aReturn)
 01/09/2003 harishd
 NS_IMETHOD_ (PRBool) IsFormOnStack()
 Call this method to determnine if a FORM is on the sink's stack.
NS_IMETHOD OpenMap (const nsIParserNode &aNode)
 This method is used to open a new MAP container.
NS_IMETHOD CloseMap ()
 This method is used to close the MAP container.
NS_IMETHOD WillProcessTokens (void)
 This method is called when parser is about to begin synchronously processing a chunk of tokens.
NS_IMETHOD DidProcessTokens (void)
 This method is called when parser has completed processing a chunk of tokens.
NS_IMETHOD WillProcessAToken (void)
 This method is called when parser is about to process a single token.
NS_IMETHOD DidProcessAToken (void)
 This method is called when parser has completed the processing for a single token.
NS_IMETHOD NotifyTagObservers (nsIParserNode *aNode)
 This gets called by the parser to notify observers of the tag.
NS_IMETHOD AddHeadContent (const nsIParserNode &aNode)
 This gets called by the parser to contents to the head container.
NS_IMETHOD AddDocTypeDecl (const nsIParserNode &aNode)
 This gets called by the parser when it encounters a DOCTYPE declaration in the HTML document.
NS_IMETHOD GetFragment (nsIDOMDocumentFragment **aFragment)
 This method is used to obtain the fragment created by a fragment content sink.
NS_IMETHOD SetTargetDocument (nsIDocument *aDocument)
 This method is used to set the target document for this fragment sink.
NS_IMETHOD WillBuildContent ()
 This method is used to indicate to the sink that we're done building the context and should start paying attention to the incoming content.
NS_IMETHOD DidBuildContent ()
 This method is used to indicate to the sink that we're done building The real content.
NS_IMETHOD IgnoreFirstContainer ()
 This method is a total hack to help with parsing fragments.
nsIContentGetCurrentContent ()
PRInt32 PushContent (nsIContent *aContent)
nsIContentPopContent ()
nsresult AddText (const nsAString &aString)
nsresult AddTextToContent (nsIContent *aContent, const nsAString &aText)
nsresult FlushText ()
void ProcessBaseTag (nsIContent *aContent)
void AddBaseTagInfo (nsIContent *aContent)
nsresult SetDocumentTitle (const nsAString &aString, const nsIParserNode *aNode)

Static Public Member Functions

static nsresult Init ()
static void Cleanup ()

Public Attributes

PRPackedBool mAllContent
PRPackedBool mProcessing
PRPackedBool mSeenBody
PRPackedBool mIgnoreContainer
nsCOMPtr< nsIContentmRoot
nsCOMPtr< nsIParsermParser
nsVoidArraymContentStack
PRUnicharmText
PRInt32 mTextLength
PRInt32 mTextSize
nsString mBaseHREF
nsString mBaseTarget
nsCOMPtr< nsIDocumentmTargetDocument
nsRefPtr< nsNodeInfoManagermNodeInfoManager

Protected Member Functions

nsresult NameFromType (const nsHTMLTag aTag, nsIAtom **aResult)
nsresult NameFromNode (const nsIParserNode &aNode, nsIAtom **aResult)

Protected Attributes

PRBool mSkip

Static Protected Attributes

static nsTHashtable
< nsISupportsHashKey > * 
sAllowedTags
static nsTHashtable
< nsISupportsHashKey > * 
sAllowedAttributes

Detailed Description

Definition at line 937 of file nsHTMLFragmentContentSink.cpp.


Constructor & Destructor Documentation


Member Function Documentation

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1093 of file nsHTMLFragmentContentSink.cpp.

{
  PRInt32 ac = aNode.GetAttributeCount();

  if (ac == 0) {
    return NS_OK;
  }

  nsCAutoString k;
  nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());

  nsresult rv;
  // use this to check for safe URIs in the few attributes that allow them
  nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
  nsCOMPtr<nsIURI> baseURI;

  for (PRInt32 i = ac - 1; i >= 0; i--) {
    rv = NS_OK;
    const nsAString& key = aNode.GetKeyAt(i);
    CopyUTF16toUTF8(key, k);
    ToLowerCase(k);

    nsCOMPtr<nsIAtom> keyAtom = do_GetAtom(k);

    // not an allowed attribute
    if (!sAllowedAttributes || !sAllowedAttributes->GetEntry(keyAtom)) {
      continue;
    }

    // Get value and remove mandatory quotes
    static const char* kWhitespace = "\n\r\t\b";
    const nsAString& v =
      nsContentUtils::TrimCharsInSet(kWhitespace, aNode.GetValueAt(i));

    // check the attributes we allow that contain URIs
    if (IsAttrURI(keyAtom)) {
      if (!baseURI) {
        baseURI = aContent->GetBaseURI();
      }
      nsCOMPtr<nsIURI> attrURI;
      rv = NS_NewURI(getter_AddRefs(attrURI), v, nsnull, baseURI);
      if (NS_SUCCEEDED(rv)) {
        rv = secMan->CheckLoadURIWithPrincipal(mTargetDocument->GetPrincipal(),
                                               attrURI,
                                               nsIScriptSecurityManager::DISALLOW_SCRIPT_OR_DATA);
      }
    }
    
    // skip to the next attribute if we encountered issues with the
    // current value
    if (NS_FAILED(rv)) {
      continue;
    }

    if (nodeType == eHTMLTag_a && keyAtom == nsHTMLAtoms::name) {
      NS_ConvertUTF16toUTF8 cname(v);
      NS_ConvertUTF8toUTF16 uv(nsUnescape(cname.BeginWriting()));
      // Add attribute to content
      aContent->SetAttr(kNameSpaceID_None, keyAtom, uv, PR_FALSE);
    } else {
      // Add attribute to content
      aContent->SetAttr(kNameSpaceID_None, keyAtom, v, PR_FALSE);
    }

    if (nodeType == eHTMLTag_a || 
        nodeType == eHTMLTag_form ||
        nodeType == eHTMLTag_img ||
        nodeType == eHTMLTag_map ||
        nodeType == eHTMLTag_q ||
        nodeType == eHTMLTag_blockquote ||
        nodeType == eHTMLTag_input) {
      AddBaseTagInfo(aContent);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 405 of file nsHTMLFragmentContentSink.cpp.

{
  if (aContent) {
    if (!mBaseHREF.IsEmpty()) {
      aContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::_baseHref, mBaseHREF, PR_FALSE);
    }
    if (!mBaseTarget.IsEmpty()) {
      aContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::_baseTarget, mBaseTarget, PR_FALSE);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

This gets called by the parser when you want to add a leaf node to the current container in the content model.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1278 of file nsHTMLFragmentContentSink.cpp.

{
  // no comments
  return NS_OK;
}

This gets called by the parser when it encounters a DOCTYPE declaration in the HTML document.

Implements nsIHTMLContentSink.

Definition at line 689 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}

This gets called by the parser to contents to the head container.

Implements nsIHTMLContentSink.

Definition at line 528 of file nsHTMLFragmentContentSink.cpp.

{
  return AddLeaf(aNode);
}

Here is the call graph for this function:

This gets called by the parser when you want to add a leaf node to the current container in the content model.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1219 of file nsHTMLFragmentContentSink.cpp.

{
  NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);
  
  nsresult rv = NS_OK;

#ifndef MOZILLA_1_8_BRANCH
  if (mSkip) {
    return rv;
  }
#endif

  if (aNode.GetTokenType() == eToken_start) {
    nsCOMPtr<nsIAtom> name;
    rv = NameFromNode(aNode, getter_AddRefs(name));
    NS_ENSURE_SUCCESS(rv, rv);

#ifdef MOZILLA_1_8_BRANCH
    // we have to do this on the branch for some late 90s reason
    if (name == nsHTMLAtoms::script || name == nsHTMLAtoms::style) {
      nsCOMPtr<nsIDTD> dtd;
      mParser->GetDTD(getter_AddRefs(dtd));
      NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);

      nsAutoString skippedContent;
      PRInt32 lineNo = 0;                
      dtd->CollectSkippedContent(aNode.GetTokenType(),
                                 skippedContent, lineNo);
    }
#endif

    // We will process base tags, but we won't include them
    // in the output
    if (name == nsHTMLAtoms::base) {
      nsCOMPtr<nsIContent> content;
      nsCOMPtr<nsINodeInfo> nodeInfo;
      nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
      if (!parserService)
        return NS_ERROR_OUT_OF_MEMORY;
      rv = mNodeInfoManager->GetNodeInfo(name, nsnull,
                                         kNameSpaceID_None,
                                         getter_AddRefs(nodeInfo));
      NS_ENSURE_SUCCESS(rv, rv);
      rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo);
      NS_ENSURE_SUCCESS(rv, rv);
      AddAttributes(aNode, content);
      ProcessBaseTag(content);
      return NS_OK;
    }

    if (!sAllowedTags || !sAllowedTags->GetEntry(name)) {
      return NS_OK;
    }
  }

  return nsHTMLFragmentContentSink::AddLeaf(aNode);
}

Here is the call graph for this function:

This gets called by the parser when you want to add a leaf node to the current container in the content model.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1285 of file nsHTMLFragmentContentSink.cpp.

{
  // no PIs
  return NS_OK;
}
nsresult nsHTMLFragmentContentSink::AddText ( const nsAString &  aString) [inherited]

Definition at line 783 of file nsHTMLFragmentContentSink.cpp.

{
  PRInt32 addLen = aString.Length();
  if (0 == addLen) {
    return NS_OK;
  }

  // Create buffer when we first need it
  if (0 == mTextSize) {
    mText = (PRUnichar *) PR_MALLOC(sizeof(PRUnichar) * NS_ACCUMULATION_BUFFER_SIZE);
    if (nsnull == mText) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
    mTextSize = NS_ACCUMULATION_BUFFER_SIZE;
  }

  // Copy data from string into our buffer; flush buffer when it fills up
  PRInt32 offset = 0;
  PRBool  isLastCharCR = PR_FALSE;
  while (0 != addLen) {
    PRInt32 amount = mTextSize - mTextLength;
    if (amount > addLen) {
      amount = addLen;
    }
    if (0 == amount) {
      nsresult rv = FlushText();
      if (NS_OK != rv) {
        return rv;
      }
    }
    mTextLength +=
      nsContentUtils::CopyNewlineNormalizedUnicodeTo(aString,
                                                     offset,
                                                     &mText[mTextLength],
                                                     amount,
                                                     isLastCharCR);
    offset += amount;
    addLen -= amount;
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsHTMLFragmentContentSink::AddTextToContent ( nsIContent aContent,
const nsAString &  aText 
) [inherited]

Definition at line 827 of file nsHTMLFragmentContentSink.cpp.

                                                                                        {
  NS_ASSERTION(aContent !=nsnull, "can't add text w/o a content");

  nsresult result=NS_OK;

  if(aContent) {
    if (!aText.IsEmpty()) {
      nsCOMPtr<nsITextContent> text;
      result = NS_NewTextNode(getter_AddRefs(text), mNodeInfoManager);
      if (NS_SUCCEEDED(result)) {
        text->SetText(aText, PR_TRUE);

        result = aContent->AppendChildTo(text, PR_FALSE);
      }
    }
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsHTMLFragmentContentSink::BeginContext ( PRInt32  aPosition) [virtual, inherited]

This gets called when handling illegal contents, especially in dealing with tables.

This method creates a new context.

04/04/99 harishd

Parameters:
aPosition- The position from where the new context begins.

Implements nsIHTMLContentSink.

Definition at line 295 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}

Definition at line 1019 of file nsHTMLFragmentContentSink.cpp.

Here is the caller graph for this function:

This method is used to close the main BODY container.

Implements nsIHTMLContentSink.

Definition at line 351 of file nsHTMLFragmentContentSink.cpp.

{
  return CloseContainer(eHTMLTag_body);
}

Here is the call graph for this function:

This method gets called by the parser when a close container tag has been consumed and needs to be closed.

Parameters:
aTag- The tag to be closed.

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1197 of file nsHTMLFragmentContentSink.cpp.

{
  nsresult rv = NS_OK;

  if (mSkip) {
    mSkip = PR_FALSE;
    return rv;
  }

  nsCOMPtr<nsIAtom> name;
  rv = NameFromType(aTag, getter_AddRefs(name));
  NS_ENSURE_SUCCESS(rv, rv);
  
  // not on whitelist
  if (!sAllowedTags || !sAllowedTags->GetEntry(name)) {
    return NS_OK;
  }

  return nsHTMLFragmentContentSink::CloseContainer(aTag);
}

Here is the call graph for this function:

This method is used to close the outer FORM container.

Implements nsIHTMLContentSink.

Definition at line 363 of file nsHTMLFragmentContentSink.cpp.

{
  return CloseContainer(eHTMLTag_form);
}

Here is the call graph for this function:

This method is used to close the FRAMESET container.

Implements nsIHTMLContentSink.

Definition at line 375 of file nsHTMLFragmentContentSink.cpp.

{
  return CloseContainer(eHTMLTag_frameset);
}

Here is the call graph for this function:

This method is used to close the only HEAD container.

Implements nsIHTMLContentSink.

Definition at line 331 of file nsHTMLFragmentContentSink.cpp.

{
  return CloseContainer(eHTMLTag_head);
}

Here is the call graph for this function:

This method is used to close the outer HTML container.

Implements nsIHTMLContentSink.

Definition at line 319 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}

This method is used to close the MAP container.

Implements nsIHTMLContentSink.

Definition at line 387 of file nsHTMLFragmentContentSink.cpp.

{
  return CloseContainer(eHTMLTag_map);
}

Here is the call graph for this function:

This method is used to indicate to the sink that we're done building The real content.

This is useful if you want to parse additional context (such as an end context).

Implements nsIFragmentContentSink.

Definition at line 726 of file nsHTMLFragmentContentSink.cpp.

{
  if (!mAllContent) {
    FlushText();
    DidBuildModel(); // Release our ref to the parser now.
    mProcessing = PR_FALSE;
  }

  return NS_OK;
}

Here is the call graph for this function:

This method gets called when the parser concludes the process of building the content model via the content sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 263 of file nsHTMLFragmentContentSink.cpp.

{
  FlushText();

  // Drop our reference to the parser to get rid of a circular
  // reference.
  mParser = nsnull;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsHTMLFragmentContentSink::DidProcessAToken ( void  ) [inline, virtual, inherited]

This method is called when parser has completed the processing for a single token.

Returns:
NS_OK if processing should not be interrupted NS_ERROR_HTMLPARSER_INTERRUPTED if the parsing should be interrupted

Implements nsIHTMLContentSink.

Definition at line 118 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }
NS_IMETHOD nsHTMLFragmentContentSink::DidProcessTokens ( void  ) [inline, virtual, inherited]

This method is called when parser has completed processing a chunk of tokens.

The processing of the tokens may be interrupted by returning NS_ERROR_HTMLPARSER_INTERRUPTED from DidProcessAToken.

Implements nsIHTMLContentSink.

Definition at line 116 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }
NS_IMETHODIMP nsHTMLFragmentContentSink::EndContext ( PRInt32  aPosition) [virtual, inherited]

This method terminates any new context that got created by BeginContext and switches back to the main context.

04/04/99 harishd

Parameters:
aPosition- Validates the end of a context.

Implements nsIHTMLContentSink.

Definition at line 301 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}
virtual void nsHTMLFragmentContentSink::FlushPendingNotifications ( mozFlushType  aType) [inline, virtual, inherited]

Flush content so that the content model is in sync with the state of the sink.

Parameters:
aTypethe type of flush to perform

Implements nsIContentSink.

Definition at line 90 of file nsHTMLFragmentContentSink.cpp.

{ }

Definition at line 847 of file nsHTMLFragmentContentSink.cpp.

{
  if (0 == mTextLength) {
    return NS_OK;
  }

  nsCOMPtr<nsITextContent> content;
  nsresult rv = NS_NewTextNode(getter_AddRefs(content), mNodeInfoManager);
  NS_ENSURE_SUCCESS(rv, rv);

  // Set the text in the text node
  content->SetText(mText, mTextLength, PR_FALSE);

  // Add text to its parent
  nsIContent *parent = GetCurrentContent();

  if (!parent) {
    parent = mRoot;
  }

  rv = parent->AppendChildTo(content, PR_FALSE);

  mTextLength = 0;

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 745 of file nsHTMLFragmentContentSink.cpp.

{
  if (nsnull != mContentStack) {
    PRInt32 indx = mContentStack->Count() - 1;
    if (indx >= 0)
      return (nsIContent *)mContentStack->ElementAt(indx);
  }
  return nsnull;
}

Here is the caller graph for this function:

This method is used to obtain the fragment created by a fragment content sink.

The value returned will be null if the content sink hasn't yet received parser notifications.

Implements nsIFragmentContentSink.

Definition at line 695 of file nsHTMLFragmentContentSink.cpp.

{
  if (mRoot) {
    return CallQueryInterface(mRoot, aFragment);
  }

  *aFragment = nsnull;

  return NS_OK;
}

Here is the call graph for this function:

virtual nsISupports* nsHTMLFragmentContentSink::GetTarget ( ) [inline, virtual, inherited]

Returns the target object (often a document object) into which the content built by this content sink is being added, if any (IOW, may return null).

Implements nsIContentSink.

Definition at line 92 of file nsHTMLFragmentContentSink.cpp.

{ return mTargetDocument; }

This method is a total hack to help with parsing fragments.

It is called to tell the fragment sink that a container from the context will be delivered after the call to WillBuildContent(). This is only relevent for HTML fragments that use nsHTMLTokenizer/CNavDTD.

Implements nsIFragmentContentSink.

Definition at line 738 of file nsHTMLFragmentContentSink.cpp.

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 979 of file nsHTMLFragmentContentSink.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsHTMLFragmentContentSink::IsEnabled ( PRInt32  aTag,
PRBool aReturn 
) [inline, virtual, inherited]

01/09/2003 harishd

Parameters:
aTag- Check if this tag is enabled or not.

Implements nsIHTMLContentSink.

Definition at line 108 of file nsHTMLFragmentContentSink.cpp.

                                                      {
    *aReturn = PR_TRUE;
    return NS_OK;
  }

Definition at line 1069 of file nsHTMLFragmentContentSink.cpp.

{
  nsresult rv;
  eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
  
  *aResult = nsnull;
  if (type == eHTMLTag_userdefined) {
    nsCOMPtr<nsINodeInfo> nodeInfo;
    rv =
      mNodeInfoManager->GetNodeInfo(aNode.GetText(), nsnull,
                                    kNameSpaceID_None,
                                    getter_AddRefs(nodeInfo));
    NS_ENSURE_SUCCESS(rv, rv);
    NS_IF_ADDREF(*aResult = nodeInfo->NameAtom());
  } else {
    rv = NameFromType(type, aResult);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsHTMLFragmentContentSink::NotifyTagObservers ( nsIParserNode aNode) [inline, virtual, inherited]

This gets called by the parser to notify observers of the tag.

Parameters:
aErrorResultthe error code

Implements nsIHTMLContentSink.

Definition at line 119 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }
nsHTMLFragmentContentSink::NS_IMETHOD_ ( PRBool  ) [inline, virtual, inherited]

Call this method to determnine if a FORM is on the sink's stack.

Returns:
PR_TRUE if found else PR_FALSE

Implements nsIHTMLContentSink.

Definition at line 112 of file nsHTMLFragmentContentSink.cpp.

{ return PR_FALSE; }

This method is used to open the main BODY container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 337 of file nsHTMLFragmentContentSink.cpp.

{
  // Ignore repeated BODY elements. The DTD is just sending them
  // to us for compatibility reasons that don't apply here.
  if (!mSeenBody) {
    mSeenBody = PR_TRUE;
    return OpenContainer(aNode);
  }
  else {
    return NS_OK;
  }
}

Here is the call graph for this function:

This method is used to open a generic container in the sink.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Reimplemented from nsHTMLFragmentContentSink.

Definition at line 1173 of file nsHTMLFragmentContentSink.cpp.

{
  nsresult rv = NS_OK;
  
  // bail if it's a script or style, or we're already inside one of those
  eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
  if (type == eHTMLTag_script || type == eHTMLTag_style) {
    mSkip = PR_TRUE;
    return rv;
  }

  nsCOMPtr<nsIAtom> name;
  rv = NameFromNode(aNode, getter_AddRefs(name));
  NS_ENSURE_SUCCESS(rv, rv);

  // not on whitelist
  if (!sAllowedTags || !sAllowedTags->GetEntry(name)) {
    return NS_OK;
  }

  return nsHTMLFragmentContentSink::OpenContainer(aNode);
}

Here is the call graph for this function:

This method is used to open a new FORM container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 357 of file nsHTMLFragmentContentSink.cpp.

{
  return OpenContainer(aNode);
}

Here is the call graph for this function:

This method is used to open the FRAMESET container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 369 of file nsHTMLFragmentContentSink.cpp.

{
  return OpenContainer(aNode);
}

Here is the call graph for this function:

This method is used to open the only HEAD container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 325 of file nsHTMLFragmentContentSink.cpp.

{
  return OpenContainer(aNode);
}

Here is the call graph for this function:

This method is used to open the outer HTML container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 313 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}

This method is used to open a new MAP container.

4/1/98 gess

Parameters:
nsIParserNodereference to parser node interface

Implements nsIHTMLContentSink.

Definition at line 381 of file nsHTMLFragmentContentSink.cpp.

{
  return OpenContainer(aNode);
}

Here is the call graph for this function:

Definition at line 767 of file nsHTMLFragmentContentSink.cpp.

{
  nsIContent* content = nsnull;
  if (nsnull != mContentStack) {
    PRInt32 indx = mContentStack->Count() - 1;
    if (indx >= 0) {
      content = (nsIContent *)mContentStack->ElementAt(indx);
      mContentStack->RemoveElementAt(indx);
    }
  }
  return content;
}

Here is the caller graph for this function:

Definition at line 393 of file nsHTMLFragmentContentSink.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 756 of file nsHTMLFragmentContentSink.cpp.

{
  if (nsnull == mContentStack) {
    mContentStack = new nsVoidArray();
  }

  mContentStack->AppendElement((void *)aContent);
  return mContentStack->Count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsHTMLFragmentContentSink::SetDocumentCharset ( nsACString &  aCharset) [inline, virtual, inherited]

Set the document character set.

This should be passed on to the document itself.

Implements nsIContentSink.

Definition at line 91 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }
nsresult nsHTMLFragmentContentSink::SetDocumentTitle ( const nsAString &  aString,
const nsIParserNode aNode 
) [inherited]

Definition at line 418 of file nsHTMLFragmentContentSink.cpp.

{
  NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);

  nsCOMPtr<nsINodeInfo> nodeInfo;
  nsresult rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull,
                                              kNameSpaceID_None,
                                              getter_AddRefs(nodeInfo));
  NS_ENSURE_SUCCESS(rv, rv);

  nsRefPtr<nsGenericHTMLElement> content = NS_NewHTMLTitleElement(nodeInfo);
  NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);

  nsIContent *parent = GetCurrentContent();

  if (!parent) {
    parent = mRoot;
  }

  if (aNode) {
    AddAttributes(*aNode, content);
  }

  rv = parent->AppendChildTo(content, PR_FALSE);
  NS_ENSURE_SUCCESS(rv, rv);

  return AddTextToContent(content, aString);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsHTMLFragmentContentSink::SetParser ( nsIParser aParser) [virtual, inherited]

This method gets called by the parser so that the content sink can retain a reference to the parser.

The expectation is that the content sink will drop the reference when it gets the DidBuildModel notification i.e. when parsing is done.

Implements nsIContentSink.

Definition at line 287 of file nsHTMLFragmentContentSink.cpp.

{
  mParser = aParser;

  return NS_OK;
}

This method is used to set the target document for this fragment sink.

This document's nodeinfo manager will be used to create the content objects. This MUST be called before the sink is used.

Parameters:
aDocumentthe document the new nodes will belong to (should not be null)

Implements nsIFragmentContentSink.

Definition at line 707 of file nsHTMLFragmentContentSink.cpp.

{
  NS_ENSURE_ARG_POINTER(aTargetDocument);

  mTargetDocument = aTargetDocument;
  mNodeInfoManager = aTargetDocument->NodeInfoManager();

  return NS_OK;
}

Here is the call graph for this function:

This method gets called by the parser when it encounters a title tag and wants to set the document title in the sink.

4/1/98 gess

Parameters:
nsStringreference to new title value

Implements nsIHTMLContentSink.

Definition at line 307 of file nsHTMLFragmentContentSink.cpp.

{
  return SetDocumentTitle(aValue, nsnull);
}

Here is the call graph for this function:

This method is used to indicate to the sink that we're done building the context and should start paying attention to the incoming content.

Implements nsIFragmentContentSink.

Definition at line 718 of file nsHTMLFragmentContentSink.cpp.

{
  mProcessing = PR_TRUE;

  return NS_OK;
}

This method gets called when the parser begins the process of building the content model via the content sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 245 of file nsHTMLFragmentContentSink.cpp.

Here is the call graph for this function:

This method gets called when the parser gets i/o blocked, and wants to notify the sink that it may be a while before more data is available.

5/7/98 gess

Implements nsIContentSink.

Definition at line 275 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}
NS_IMETHOD nsHTMLFragmentContentSink::WillProcessAToken ( void  ) [inline, virtual, inherited]

This method is called when parser is about to process a single token.

Implements nsIHTMLContentSink.

Definition at line 117 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }
NS_IMETHOD nsHTMLFragmentContentSink::WillProcessTokens ( void  ) [inline, virtual, inherited]

This method is called when parser is about to begin synchronously processing a chunk of tokens.

Implements nsIHTMLContentSink.

Definition at line 115 of file nsHTMLFragmentContentSink.cpp.

{ return NS_OK; }

This method gets called when the parser i/o gets unblocked, and we're about to start dumping content again to the sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 281 of file nsHTMLFragmentContentSink.cpp.

{
  return NS_OK;
}

Member Data Documentation

Definition at line 152 of file nsHTMLFragmentContentSink.cpp.

Definition at line 166 of file nsHTMLFragmentContentSink.cpp.

Definition at line 167 of file nsHTMLFragmentContentSink.cpp.

Definition at line 160 of file nsHTMLFragmentContentSink.cpp.

Definition at line 155 of file nsHTMLFragmentContentSink.cpp.

Definition at line 170 of file nsHTMLFragmentContentSink.cpp.

Definition at line 158 of file nsHTMLFragmentContentSink.cpp.

Definition at line 153 of file nsHTMLFragmentContentSink.cpp.

Definition at line 157 of file nsHTMLFragmentContentSink.cpp.

Definition at line 154 of file nsHTMLFragmentContentSink.cpp.

Definition at line 963 of file nsHTMLFragmentContentSink.cpp.

Definition at line 169 of file nsHTMLFragmentContentSink.cpp.

Definition at line 162 of file nsHTMLFragmentContentSink.cpp.

Definition at line 163 of file nsHTMLFragmentContentSink.cpp.

Definition at line 164 of file nsHTMLFragmentContentSink.cpp.

Definition at line 967 of file nsHTMLFragmentContentSink.cpp.

Definition at line 966 of file nsHTMLFragmentContentSink.cpp.


The documentation for this class was generated from the following file: