Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes
CBodyElement Class Reference

#include <COtherElements.h>

Inheritance diagram for CBodyElement:
Inheritance graph
[legend]
Collaboration diagram for CBodyElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBodyElement (eHTMLTags aTag=eHTMLTag_body)
virtual PRBool CanContain (CElement *anElement, nsDTDContext *aContext)
virtual nsresult OpenContainer (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult OpenContainerInContext (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult HandleStartToken (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult HandleEndToken (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult HandleEndTokenForChild (CElement *aChild, nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
CElementGetDelegate (void)
CElementGetDefaultContainerFor (CElement *anElement)
virtual PRInt32 FindAutoCloseIndexForStartTag (CElement *anElement, PRInt32 aParentIndex, nsDTDContext *aContext)
virtual PRBool CanBeClosedByEndTag (CElement *anElement, nsDTDContext *aContext)
virtual PRBool IsBlockCloser (void)
virtual PRBool IsBlockElement (eHTMLTags aParentID)
virtual PRBool IsInlineElement (eHTMLTags aParentID)
virtual PRBool IsContainer (void)
virtual PRBool IsSinkContainer (void)
virtual eHTMLTags GetSkipTarget (void)
virtual nsresult WillHandleStartToken (CElement *anElement, nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult HandleMisplacedStartToken (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual PRInt32 FindAutoCloseTargetForEndTag (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink, PRInt32 &anIndex)
virtual nsresult HandleMisplacedEndToken (nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
nsresult AutoGenerateStructure (eHTMLTags *aTagList, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult NotifyOpen (nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult NotifyClose (nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult OpenContainer (nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult OpenContext (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult CloseContainer (nsIParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult CloseContext (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
virtual nsresult CloseContainerInContext (nsCParserNode *aNode, eHTMLTags aTag, nsDTDContext *aContext, nsIHTMLContentSink *aSink)
CElementGetElement (eHTMLTags aTag)

Static Public Member Functions

static CGroupMembersGetGroup (void)
static CGroupMembersGetEmptyGroup (void)
static void Initialize (CElement &anElement, eHTMLTags aTag)
static void Initialize (CElement &anElement, eHTMLTags aTag, CGroupMembers &aGroup, CGroupMembers &aContainsGroups)
static void InitializeLeaf (CElement &anElement, eHTMLTags aTag, CGroupMembers &aGroup, CGroupMembers &aContainsGroups)

Public Attributes

union CElement.__unnamed__ 
eHTMLTags mTag
eHTMLTags mDelegate
CGroupMembers mGroup
CGroupMembers mContainsGroups
const eHTMLTagsmIncludeKids
const eHTMLTagsmExcludeKids
const eHTMLTagsmAutoClose

Detailed Description

Definition at line 1877 of file COtherElements.h.


Constructor & Destructor Documentation

CBodyElement::CBodyElement ( eHTMLTags  aTag = eHTMLTag_body) [inline]

Definition at line 1887 of file COtherElements.h.

Here is the call graph for this function:


Member Function Documentation

nsresult CElement::AutoGenerateStructure ( eHTMLTags aTagList,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, inherited]

Definition at line 264 of file COtherElements.h.

                                                                                                        {
    nsresult  result=NS_OK;

    CStartToken theToken(*aTagList);
    nsCParserNode theNode(&theToken, 0 /*stack token*/);
    result=OpenContainer(&theNode,*aTagList,aContext,aSink);
    if(eHTMLTag_unknown!=*(aTagList+1)) {
      AutoGenerateStructure(++aTagList,aContext,aSink);
    }
    
    CEndToken theEndToken(*aTagList--);
    nsCParserNode theEndNode(&theEndToken, 0 /*stack token*/);
    result=CloseContainer(&theEndNode,*aTagList,aContext,aSink);

    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool CElement::CanBeClosedByEndTag ( CElement anElement,
nsDTDContext aContext 
) [virtual, inherited]

Definition at line 2581 of file COtherElements.h.

                                                                               {
  PRBool result=PR_FALSE;

    //first, let's see if we can contain the given tag based on group info...
  if(anElement) {
    if(ListContainsTag(mAutoClose,anElement->mTag)) {
      return PR_TRUE;
    }
    else if((this==anElement) && (!mContainsGroups.mBits.mSelf)){
      return PR_TRUE;
    }
    else {
      eHTMLTags theTag=aContext->Last();
      CElement* theElement=gElementTable->mElements[theTag];
      if(HasOptionalEndTag(theTag)) {
        if(anElement->CanContain(theElement,aContext)){
          result=PR_TRUE;
        }
      }
    }
  }
  return result;
}

Here is the call graph for this function:

virtual PRBool CBodyElement::CanContain ( CElement anElement,
nsDTDContext aContext 
) [inline, virtual]

Reimplemented from CElement.

Definition at line 1894 of file COtherElements.h.

                                                                        {
    PRBool result=CElement::CanContain(anElement,aContext);
    if((!result) && (aContext->mFlags.mTransitional)) {
      //let's try so additions that are specific to the body tag,
      //and only work in transitional mode...
        
      CGroupMembers& theFlowGroup=CFlowElement::GetContainedGroups();
      result=ContainsGroup(theFlowGroup,anElement->mGroup);            
    }
    return result;
  }

Here is the call graph for this function:

virtual nsresult CElement::CloseContainer ( nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 324 of file COtherElements.h.

                                                                                                                         {
    return aSink->CloseContainer(aTag);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult CElement::CloseContainerInContext ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 346 of file COtherElements.h.

                                                                                                                                 {    
    nsresult result=NS_OK;
    if(mTag!=aTag) {
      CElement *theElement=GetElement(aTag);
      return theElement->CloseContainerInContext(aNode,aTag,aContext,aSink);
    }
    result=CloseContainer(aNode,aTag,aContext,aSink);
    CloseContext(aNode,aTag,aContext,aSink);
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult CElement::CloseContext ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 331 of file COtherElements.h.

                                                                                                                       {
    nsresult result=NS_OK;
    nsEntryStack  *theStack=0;
    nsCParserNode *theNode=aContext->Pop(theStack);

    CElement *theElement=(aTag==mTag) ? this : GetElement(aTag);
    result=theElement->NotifyClose(theNode,aTag,aContext,aSink);

    IF_FREE(aNode, aContext->mNodeAllocator);
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 CElement::FindAutoCloseIndexForStartTag ( CElement anElement,
PRInt32  aParentIndex,
nsDTDContext aContext 
) [virtual, inherited]

Definition at line 2545 of file COtherElements.h.

                                                                                                               {
  PRInt32 result=kNotFound;

  if(anElement) {
    eHTMLTags theParentTag=aContext->TagAt(aParentIndex);
    if(eHTMLTag_unknown!=theParentTag) {

      CElement* theParent=gElementTable->mElements[theParentTag];

      if(!theParent->CanContain(anElement,aContext)) {
        if(HasOptionalEndTag(theParentTag)) {

          if(ListContainsTag(theParent->mAutoClose,anElement->mTag)) {
            result=theParent->FindAutoCloseIndexForStartTag(anElement,aParentIndex-1,aContext);
          }
          else if((theParent->mTag==anElement->mTag) && (!theParent->mContainsGroups.mBits.mSelf)){
            result=aParentIndex;
          }
          else if(eHTMLTag_body!=theParent->mTag) {
            result=theParent->FindAutoCloseIndexForStartTag(anElement,aParentIndex-1,aContext);
          }
          else result=aParentIndex+1;
        }
        else result=kNotFound;
      } 
      else result=aParentIndex+1;
    }
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PRInt32 CElement::FindAutoCloseTargetForEndTag ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink,
PRInt32 anIndex 
) [inline, virtual, inherited]

Definition at line 242 of file COtherElements.h.

                                                                                                                                                       {
    PRInt32 result=-1;

    if(mTag!=aTag) {
      if(HasOptionalEndTag(mTag) && (0<anIndex)) {
        eHTMLTags theGrandParentTag=aContext->TagAt(--anIndex);
        CElement *theGrandParent=GetElement(theGrandParentTag);
        if(theGrandParent) {
          result=theGrandParent->FindAutoCloseTargetForEndTag(aNode,aTag,aContext,aSink,anIndex); //give the parent a chance...
        }
      }
    }
    else result=anIndex;

    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

CElement * CElement::GetDefaultContainerFor ( CElement anElement) [inline, inherited]

Definition at line 2822 of file COtherElements.h.

                                                                     {
  CElement* result=0;

  if(anElement) {
    if(anElement->mGroup.mBits.mBlock) {
      result=gElementTable->mElements[eHTMLTag_body];
    }
    else if(anElement->mGroup.mBits.mHeadContent) {
      result=gElementTable->mElements[eHTMLTag_head];
    }
    else if(anElement->mGroup.mBits.mHeadMisc) {
      result=gElementTable->mElements[eHTMLTag_head];
    }
  }
  return result;
}

Here is the caller graph for this function:

CElement * CElement::GetDelegate ( void  ) [inline, inherited]

Definition at line 2815 of file COtherElements.h.

                                           {
  if(eHTMLTag_unknown!=mDelegate) {
    return gElementTable->mElements[mDelegate];
  }
  return 0;
}

Here is the caller graph for this function:

CElement * CElement::GetElement ( eHTMLTags  aTag) [inline, inherited]

Definition at line 2103 of file COtherElements.h.

                                                    {
  return gElementTable->mElements[aTag];
}

Here is the caller graph for this function:

static CGroupMembers& CElement::GetEmptyGroup ( void  ) [inline, static, inherited]

Definition at line 151 of file COtherElements.h.

                                            {
    static CGroupMembers theGroup={0};
    return theGroup;
  }

Here is the caller graph for this function:

static CGroupMembers& CBodyElement::GetGroup ( void  ) [inline, static]

Definition at line 1881 of file COtherElements.h.

                                       {
    static CGroupMembers theGroup={0};
    theGroup.mBits.mTopLevel=1;
    return theGroup;
  }

Here is the caller graph for this function:

virtual eHTMLTags CElement::GetSkipTarget ( void  ) [inline, virtual, inherited]

Definition at line 221 of file COtherElements.h.

{return eHTMLTag_unknown;}
virtual nsresult CBodyElement::HandleEndToken ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual]

Reimplemented from CElement.

Definition at line 1978 of file COtherElements.h.

                                                                                                                        {
    nsresult result=NS_OK;
    switch(aTag) {
      case eHTMLTag_script:
        result=CloseContext(aNode,aTag,aContext,aSink);
        break;
      default:
        result=CElement::HandleEndToken(aNode,aTag,aContext,aSink);
    }
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult CBodyElement::HandleEndTokenForChild ( CElement aChild,
nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual]

Definition at line 1993 of file COtherElements.h.

                                                                                                                                                  {
    nsresult result=NS_OK;
    return result;
  }
virtual nsresult CElement::HandleMisplacedEndToken ( nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 259 of file COtherElements.h.

                                                                                                                                  {
    nsresult result=NS_OK;
    return result;
  }
virtual nsresult CElement::HandleMisplacedStartToken ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 237 of file COtherElements.h.

                                                                                                                                    {
    nsresult result=NS_OK;
    return result;
  }

Here is the caller graph for this function:

virtual nsresult CBodyElement::HandleStartToken ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual]

Reimplemented from CElement.

Definition at line 1950 of file COtherElements.h.

                                                                 {
    //for now, let's drop other elements onto the floor.

    nsresult result=CElement::HandleStartToken(aNode,aTag,aContext,aSink);

    if(NS_SUCCEEDED(result)) {
      if(aNode) {
        nsCParserNode*  theNode=(nsCParserNode*)aNode;
        eHTMLTokenTypes theType=eHTMLTokenTypes(theNode->GetTokenType());
        if(theType==eToken_start) {
          CStartToken *theToken=(CStartToken*)theNode->mToken;
          if(theToken && theToken->IsEmpty() && (aTag==aContext->Last())){
            result=CElement::HandleEndToken(aNode,aTag,aContext,aSink);
          }
        }
      }
    }

    return result;
  }

Here is the call graph for this function:

static void CElement::Initialize ( CElement anElement,
eHTMLTags  aTag 
) [inline, static, inherited]
static void CElement::Initialize ( CElement anElement,
eHTMLTags  aTag,
CGroupMembers aGroup,
CGroupMembers aContainsGroups 
) [inline, static, inherited]

Definition at line 172 of file COtherElements.h.

                                                                                                                  {
    anElement.mProperties.mIsContainer=PR_TRUE;
    anElement.mProperties.mIsSinkContainer=PR_TRUE;
    anElement.mTag=aTag;
    anElement.mGroup.mAllBits=aGroup.mAllBits;
    anElement.mContainsGroups.mAllBits=aContainsGroups.mAllBits;
  }
static void CElement::InitializeLeaf ( CElement anElement,
eHTMLTags  aTag,
CGroupMembers aGroup,
CGroupMembers aContainsGroups 
) [inline, static, inherited]

Definition at line 164 of file COtherElements.h.

                                                                                                                      {
    anElement.mProperties.mIsContainer=PR_FALSE;
    anElement.mProperties.mIsSinkContainer=PR_FALSE;
    anElement.mTag=aTag;
    anElement.mGroup.mAllBits=aGroup.mAllBits;
    anElement.mContainsGroups.mAllBits=aContainsGroups.mAllBits;
  }

Here is the caller graph for this function:

virtual PRBool CElement::IsBlockCloser ( void  ) [inline, virtual, inherited]

Definition at line 189 of file COtherElements.h.

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool CElement::IsBlockElement ( eHTMLTags  aParentID) [virtual, inherited]

Definition at line 2842 of file COtherElements.h.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PRBool CElement::IsContainer ( void  ) [inline, virtual, inherited]

Definition at line 216 of file COtherElements.h.

{return mProperties.mIsContainer;  }

Here is the caller graph for this function:

PRBool CElement::IsInlineElement ( eHTMLTags  aParentID) [virtual, inherited]

Definition at line 2850 of file COtherElements.h.

                                                    {
  CGroupMembers& theInlineGroup=CInlineElement::GetContainedGroups();
  PRBool result=ContainsGroup(theInlineGroup,mGroup);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PRBool CElement::IsSinkContainer ( void  ) [inline, virtual, inherited]

Definition at line 219 of file COtherElements.h.

{ return mProperties.mIsSinkContainer; }

Here is the caller graph for this function:

virtual nsresult CElement::NotifyClose ( nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Reimplemented in CTextContainer, and CTableElement.

Definition at line 292 of file COtherElements.h.

                                                                                                                      {
    return NS_OK;
  }

Here is the caller graph for this function:

virtual nsresult CElement::NotifyOpen ( nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Reimplemented in CTableElement.

Definition at line 285 of file COtherElements.h.

                                                                                                                     {
    return NS_OK;
  }

Here is the caller graph for this function:

virtual nsresult CElement::OpenContainer ( nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Reimplemented in CFormElement.

Definition at line 299 of file COtherElements.h.

                                                                                                                        {
    return aSink->OpenContainer(*aNode);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult CBodyElement::OpenContainer ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual]

Definition at line 1907 of file COtherElements.h.

                                                                                                                        {

    // XXXldb This method is completely unused because the |aNode|
    // parameter is declared as |nsCParserNode| rather than
    // |nsIParserNode| so it doesn't override the member function of
    // CElement.
    NS_NOTREACHED("This isn't used.  Should it be?");

    nsresult result=NS_OK;
    if(mTag==aTag) {
      // Close the head before opening a body.
      CElement* theHead=GetElement(eHTMLTag_head);
      result=theHead->CloseContext(aNode,aTag,aContext,aSink);
      if(NS_SUCCEEDED(result)) {
        result=aSink->OpenBody(*aNode);
      }
    }
    else result=CElement::OpenContainer(aNode,aTag,aContext,aSink);
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult CBodyElement::OpenContainerInContext ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual]

Reimplemented from CElement.

Definition at line 1931 of file COtherElements.h.

                                                                                                                                {
    NS_ASSERTION(aContext!=nsnull,"need a valid context");
    nsresult result=NS_OK;
    // Since BODY is optional, we might come across more than one BODY!.
    // That is, one that's auto opened and one that came from the document itself.
    // If that's the case then make sure that we don't open up multiple contexts, however,
    // don't forget to inform the sink because it needs to account for the BODY attributes.
    if(aContext) {
      if(!aContext->mFlags.mHadBody) {
        result=OpenContext(aNode,aTag,aContext,aSink);
        aContext->mFlags.mHadBody=PR_TRUE;
      }
    }
    return (NS_SUCCEEDED(result))? OpenContainer(aNode,aTag,aContext,aSink):result;
  }

Here is the call graph for this function:

virtual nsresult CElement::OpenContext ( nsCParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [inline, virtual, inherited]

Definition at line 306 of file COtherElements.h.

                                                                                                                      {
    aContext->Push(aNode, 0, PR_FALSE);
    CElement *theElement = (aTag == mTag) ? this : GetElement(aTag);
    theElement->NotifyOpen(aNode, aTag, aContext,aSink);
    return NS_OK;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult CElement::WillHandleStartToken ( CElement anElement,
nsIParserNode aNode,
eHTMLTags  aTag,
nsDTDContext aContext,
nsIHTMLContentSink aSink 
) [virtual, inherited]

Definition at line 2663 of file COtherElements.h.

                                                                     {
  nsresult result=NS_OK;
  return result;
}

Here is the caller graph for this function:


Member Data Documentation

union { ... } [inherited]

Definition at line 366 of file COtherElements.h.

Definition at line 363 of file COtherElements.h.

Definition at line 361 of file COtherElements.h.

Definition at line 365 of file COtherElements.h.

Definition at line 362 of file COtherElements.h.

Definition at line 364 of file COtherElements.h.

Definition at line 360 of file COtherElements.h.


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