Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes
nsHTMLElement Struct Reference

gess 01/04/99 More...

#include <nsElementTable.h>

Collaboration diagram for nsHTMLElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

PRBool IsBlock (void) const
PRBool IsBlockEntity (void) const
PRBool IsSpecialEntity (void) const
PRBool IsPhraseEntity (void) const
PRBool IsFontStyleEntity (void) const
PRBool IsTableElement (void) const
const TagListGetSynonymousTags (void) const
const TagListGetRootTags (void) const
const TagListGetEndRootTags (void) const
const TagListGetAutoCloseStartTags (void) const
const TagListGetAutoCloseEndTags (void) const
eHTMLTags GetCloseTargetForEndTag (nsDTDContext &aContext, PRInt32 anIndex, nsDTDMode aMode) const
 gess 10.17.2000
const TagListGetSpecialChildren (void) const
const TagListGetSpecialParents (void) const
PRBool IsMemberOf (PRInt32 aType) const
 This tests whether all the bits in the parentbits are included in the given set.
PRBool ContainsSet (PRInt32 aType) const
 This tests whether all the bits in the parentbits are included in the given set.
PRBool CanContainType (PRInt32 aType) const
 gess12/13/98
eHTMLTags GetTag (void) const
PRBool CanContain (eHTMLTags aChild, nsDTDMode aMode) const
 See whether this tag can DIRECTLY contain the given child.
PRBool CanExclude (eHTMLTags aChild) const
 gess 01/04/99
PRBool CanOmitStartTag (eHTMLTags aChild) const
 gess 01/04/99
PRBool CanOmitEndTag (void) const
 gess 01/04/99
PRBool CanContainSelf (void) const
 gess12/13/98
PRBool CanAutoCloseTag (nsDTDContext &aContext, PRInt32 aIndex, eHTMLTags aTag) const
 This method is called to determine (once and for all) whether a start tag can close another tag on the stack.
PRBool HasSpecialProperty (PRInt32 aProperty) const
 gess1/21/99
PRBool IsSpecialParent (eHTMLTags aTag) const
 harishd 11/19/99
PRBool IsExcludableParent (eHTMLTags aParent) const
 harishd 03/01/00
PRBool SectionContains (eHTMLTags aTag, PRBool allowDepthSearch) const
 gess12/13/98
PRBool ShouldVerifyHierarchy () const
 This method should be called to determine if the a tags hierarchy needs to be validated.
PRBool CanBeContained (eHTMLTags aParentTag, nsDTDContext &aContext) const
 This is the default implementation, that was moved out of CNavDTD, so that it can be made to behave in a more flexible manner.

Static Public Member Functions

static PRBool IsInlineEntity (eHTMLTags aTag)
 gess 01/04/99
static PRBool IsFlowEntity (eHTMLTags aTag)
 gess 01/04/99
static PRBool IsBlockCloser (eHTMLTags aTag)
 This method determines whether the given tag closes other blocks.
static PRInt32 GetIndexOfChildOrSynonym (nsDTDContext &aContext, eHTMLTags aChildTag)
 Call this to find the index of a given child, or (if not found) the index of its nearest synonym.
static PRBool CanContain (eHTMLTags aParent, eHTMLTags aChild, nsDTDMode aMode)
 gess 01/04/99
static PRBool IsContainer (eHTMLTags aTag)
 gess12/13/98
static PRBool IsResidualStyleTag (eHTMLTags aTag)
 gess12/13/98
static PRBool IsTextTag (eHTMLTags aTag)
 gess12/13/98
static PRBool IsWhitespaceTag (eHTMLTags aTag)
 gess12/13/98
static PRBool IsBlockParent (eHTMLTags aTag)
 gess 01/04/99
static PRBool IsInlineParent (eHTMLTags aTag)
 gess 01/04/99
static PRBool IsFlowParent (eHTMLTags aTag)
 gess 01/04/99
static PRBool IsSectionTag (eHTMLTags aTag)
 Tells us whether the given tag opens a section gess 01/04/99.
static PRBool IsChildOfHead (eHTMLTags aTag, PRBool &aExclusively)
 Returns whether a given tag can be a direct child of the <head> node of an HTML document.

Public Attributes

eHTMLTags mTagID
eHTMLTags mRequiredAncestor
eHTMLTags mExcludingAncestor
const TagListmRootNodes
const TagListmEndRootNodes
const TagListmAutocloseStart
const TagListmAutocloseEnd
const TagListmSynonymousTags
const TagListmExcludableParents
int mParentBits
int mInclusionBits
int mExclusionBits
int mSpecialProperties
PRUint32 mPropagateRange
const TagListmSpecialParents
const TagListmSpecialKids
eHTMLTags mSkipTarget
ContainFunc mCanBeContained

Detailed Description

gess 01/04/99

Parameters:
@return

Definition at line 124 of file nsElementTable.h.


Member Function Documentation

PRBool nsHTMLElement::CanAutoCloseTag ( nsDTDContext aContext,
PRInt32  aIndex,
eHTMLTags  aChildTag 
) const

This method is called to determine (once and for all) whether a start tag can close another tag on the stack.

This method will return false if something prevents aParentTag from closing.

gess 12/20/99

Parameters:
aContextis the tag stack we're testing against
aIndexis the index of the tag we want to close
aChildTagis the child we're trying to close
Returns:
TRUE if we can autoclose the start tag; FALSE otherwise

Definition at line 2050 of file nsElementTable.cpp.

                                                                {

  PRInt32 thePos;
  PRBool  result = PR_TRUE;
  eHTMLTags thePrevTag;

  for(thePos = aContext.GetCount() - 1; thePos >= aIndex; thePos--) {
    thePrevTag = aContext.TagAt(thePos);

    if (thePrevTag == eHTMLTag_applet ||
        thePrevTag == eHTMLTag_td) {
          result = PR_FALSE;
          break;
    }
  }
  
  return result;
}

Here is the call graph for this function:

PRBool nsHTMLElement::CanBeContained ( eHTMLTags  aChildTag,
nsDTDContext aContext 
) const

This is the default implementation, that was moved out of CNavDTD, so that it can be made to behave in a more flexible manner.

At this point, the code itself has not changed. NOTE: This is not called YET. It's just a placeholder for future changes.

gess 10/13/00

Parameters:
@return

Definition at line 1463 of file nsElementTable.cpp.

                                                                                     {
  PRBool result=PR_TRUE;
  if(!mCanBeContained) {

    /* #    Interesting test cases:       Result:
     * 1.   <UL><LI>..<B>..<LI>           inner <LI> closes outer <LI>
     * 2.   <CENTER><DL><DT><A><CENTER>   allow nested <CENTER>
     * 3.   <TABLE><TR><TD><TABLE>...     allow nested <TABLE>
     * 4.   <FRAMESET> ... <FRAMESET>
     */

    //Note: This method is going away. First we need to get the elementtable to do closures right, and
    //      therefore we must get residual style handling to work.

    //the changes to this method were added to fix bug 54651...

    PRInt32 theCount=aContext.GetCount();
    result=PR_TRUE;

    if(0<theCount){
      const TagList* theRootTags=gHTMLElements[aChildTag].GetRootTags();
      const TagList* theSpecialParents=gHTMLElements[aChildTag].GetSpecialParents();
      if(theRootTags) {
        PRInt32 theRootIndex=LastOf(aContext,*theRootTags);
        PRInt32 theSPIndex=(theSpecialParents) ? LastOf(aContext,*theSpecialParents) : kNotFound;  
        PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aContext,aChildTag);
        PRInt32 theTargetIndex=(theRootIndex>theSPIndex) ? theRootIndex : theSPIndex;

        if((theTargetIndex==theCount-1) ||
          ((theTargetIndex==theChildIndex) && gHTMLElements[aChildTag].CanContainSelf())) {
          result=PR_TRUE;
        }
        else {
        
          result=PR_FALSE;

          static eHTMLTags gTableElements[]={eHTMLTag_td,eHTMLTag_th};

          PRInt32 theIndex=theCount-1;
          while(theChildIndex<theIndex) {
            eHTMLTags theParentTag=aContext.TagAt(theIndex--);
            if (gHTMLElements[theParentTag].IsMemberOf(kBlockEntity)  || 
                gHTMLElements[theParentTag].IsMemberOf(kHeading)      || 
                gHTMLElements[theParentTag].IsMemberOf(kPreformatted) || 
                gHTMLElements[theParentTag].IsMemberOf(kFormControl) || //added this to fix bug 44479
                gHTMLElements[theParentTag].IsMemberOf(kList)) {
              if(!HasOptionalEndTag(theParentTag)) {
                result=PR_TRUE;
                break;
              }
            }
            else if(FindTagInSet(theParentTag,gTableElements,sizeof(gTableElements)/sizeof(eHTMLTag_unknown))){
              result=PR_TRUE;  //added this to catch a case we missed; bug 57173.
              break;
            }
          }
        }
      }
    }

  }
  else result=(*mCanBeContained)(aChildTag,aContext);
  return result;
}

Here is the call graph for this function:

PRBool nsHTMLElement::CanContain ( eHTMLTags  aChild,
nsDTDMode  aMode 
) const

See whether this tag can DIRECTLY contain the given child.

gess12/13/98

Parameters:
@return

Definition at line 2247 of file nsElementTable.cpp.

                                                                      {


  if(IsContainer(mTagID)){

    if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {
      // Some tags could be opened anywhere, in the document, as they please.
      return PR_TRUE;
    }

    if(mTagID==aChild) {
      return CanContainSelf();  //not many tags can contain themselves...
    }

    const TagList* theCloseTags=gHTMLElements[aChild].GetAutoCloseStartTags();
    if(theCloseTags){
      if(FindTagInSet(mTagID,theCloseTags->mTags,theCloseTags->mCount))
        return PR_FALSE;
    }

    if(gHTMLElements[aChild].mExcludableParents) {
      const TagList* theParents=gHTMLElements[aChild].mExcludableParents;
      if(FindTagInSet(mTagID,theParents->mTags,theParents->mCount))
        return PR_FALSE;
    }
    
    if(gHTMLElements[aChild].IsExcludableParent(mTagID))
      return PR_FALSE;

    if(gHTMLElements[aChild].IsBlockCloser(aChild)){
      if(nsHTMLElement::IsBlockParent(mTagID)){
        return PR_TRUE;
      }
    }

    if(nsHTMLElement::IsInlineEntity(aChild)){
      if(nsHTMLElement::IsInlineParent(mTagID)){
        return PR_TRUE;
      }
    }

    if(nsHTMLElement::IsFlowEntity(aChild)) {
      if(nsHTMLElement::IsFlowParent(mTagID)){
        return PR_TRUE;
      }
    }

    if(nsHTMLElement::IsTextTag(aChild)) {
      // Allow <xmp> to contain text.
      if(nsHTMLElement::IsInlineParent(mTagID) || CanContainType(kCDATA)){
        return PR_TRUE;
      }
    }

    if(CanContainType(gHTMLElements[aChild].mParentBits)) {
      return PR_TRUE;
    }
 
    if(mSpecialKids) {
      if(FindTagInSet(aChild,mSpecialKids->mTags,mSpecialKids->mCount)) {
        return PR_TRUE;
      }
    }

    // Allow <p> to contain <table> only in Quirks mode, bug 43678 and bug 91927
    if (aChild == eHTMLTag_table && mTagID == eHTMLTag_p && aMode == eDTDMode_quirks) {
      return PR_TRUE;
    }
  }
  
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsHTMLElement::CanContain ( eHTMLTags  aParent,
eHTMLTags  aChild,
nsDTDMode  aMode 
) [static]

gess 01/04/99

Parameters:
@return

Definition at line 1752 of file nsElementTable.cpp.

                                                                                  {
  PRBool result=PR_FALSE;
  if((aParent>=eHTMLTag_unknown) && (aParent<=eHTMLTag_userdefined)){
    result=gHTMLElements[aParent].CanContain(aChild,aMode);
  } 
  return result;
}

Here is the call graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 2034 of file nsElementTable.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 1980 of file nsElementTable.cpp.

                                                       {
  PRInt32 answer=mInclusionBits & aType;
  PRBool  result=PRBool(0!=answer);
  return result;
}

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1766 of file nsElementTable.cpp.

                                                      {
  PRBool result=PR_FALSE;

  if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {
    // Some tags could be opened anywhere, in the document, as they please.
    return PR_FALSE;
  }

  //Note that special kids takes precedence over exclusions...
  if(mSpecialKids) {
    if(FindTagInSet(aChild,mSpecialKids->mTags,mSpecialKids->mCount)) {
      return PR_FALSE;
    }
  }

  if(mExclusionBits){
    if(gHTMLElements[aChild].IsMemberOf(mExclusionBits)) {
      result=PR_TRUE;
    }
  }
  return result;
}

Here is the call graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1834 of file nsElementTable.cpp.

Here is the call graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1847 of file nsElementTable.cpp.

                                                           {
  PRBool result=PR_FALSE;
  return result;
}

This tests whether all the bits in the parentbits are included in the given set.

It may be too broad a question for most cases.

gess12/13/98

Parameters:
@return

Definition at line 1596 of file nsElementTable.cpp.

                                                   {
  return TestBits(mParentBits,aSet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 200 of file nsElementTable.h.

{return mAutocloseEnd;}

Here is the caller graph for this function:

Definition at line 199 of file nsElementTable.h.

{return mAutocloseStart;}

Here is the caller graph for this function:

eHTMLTags nsHTMLElement::GetCloseTargetForEndTag ( nsDTDContext aContext,
PRInt32  anIndex,
nsDTDMode  aMode 
) const

gess 10.17.2000

Parameters:
@return

Definition at line 2076 of file nsElementTable.cpp.

                                                                                                            {
  eHTMLTags result=eHTMLTag_unknown;

  int theCount=aContext.GetCount();
  int theIndex=theCount;

  if(IsMemberOf(kPhrase)){

    while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
      eHTMLTags theTag = aContext.TagAt(theIndex);
      if(theTag != mTagID) {
        // Allow phrasals to close userdefined tags. bug 256731
        if(eHTMLTag_userdefined == theTag) {
          continue; // We can close this.
        }

        // Fixes a derivative of bug 22842...
        if(CanContainType(kBlock)) { // INS/DEL can contain blocks.
          if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || 
             gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
            if(HasOptionalEndTag(theTag)) {
              continue; // Then I can close it.
            }
          }
        }

        // Phrasal elements can close other phrasals, along with fontstyle,
        // extensions, and special tags...
        if(!gHTMLElements[theTag].IsMemberOf(kSpecial | 
                                             kFontStyle |
                                             kPhrase |
                                             kExtensions)) {  //fix bug 56665
          break; // It's not something I can close
        }
      }
      else {
        result=theTag; // Stop because you just found yourself on the stack
        break;
      }
    }
  }
  
  else if(IsMemberOf(kSpecial)){

    while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
      eHTMLTags theTag=aContext.TagAt(theIndex);
      if(theTag!=mTagID) {
        // Special elements can close other specials, along with fontstyle 
        // extensions, and phrasal tags...

        // Added Phrasal to fix bug 26347
        if((eHTMLTag_userdefined==theTag) ||
            gHTMLElements[theTag].IsSpecialEntity()  || 
            gHTMLElements[theTag].IsFontStyleEntity()||
            gHTMLElements[theTag].IsPhraseEntity()   ||
            gHTMLElements[theTag].IsMemberOf(kExtensions)) {
          continue;
        }
        else {

          // Fixes bug 22842...
          if(CanContainType(kBlock)) {
            if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || 
               gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
              if(HasOptionalEndTag(theTag)) {
                continue; // Then I can close it.
              }
            }
          }
          break; // It's not something I can close
        }
      }
      else {
        result=theTag; // Stop because you just found yourself on the stack
        break;
      }
    }
  }

  else if(ContainsSet(kPreformatted) ||  
          IsMemberOf(kFormControl|kExtensions|kPreformatted)){  //bug54834...

    while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
      eHTMLTags theTag=aContext.TagAt(theIndex);
      if(theTag!=mTagID) {
        if(!CanContain(theTag,aMode)) {
          break; //it's not something I can close
        }
      }
      else {
        result=theTag; //stop because you just found yourself on the stack
        break; 
      }
    }
  }

  else if(IsMemberOf(kList)){

    while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
      eHTMLTags theTag=aContext.TagAt(theIndex);
      if(theTag!=mTagID) {
        if(!CanContain(theTag,aMode)) {
          break; //it's not something I can close
        }
      }
      else {
        result=theTag; //stop because you just found yourself on the stack
        break; 
      }
    }
  }

  else if(IsResidualStyleTag(mTagID)){
    
    // Before finding a close target, for the current tag, make sure
    // that the tag above does not gate.
    // Note: we intentionally make 2 passes: 
    // The first pass tries to exactly match, the 2nd pass matches the group.

    const TagList* theRootTags=gHTMLElements[mTagID].GetEndRootTags();
    PRInt32 theIndexCopy=theIndex;
    while(--theIndex>=anIndex){
      eHTMLTags theTag=aContext.TagAt(theIndex);
      if(theTag == mTagID) {
        return theTag; // we found our target.
      }
      else if (!CanContain(theTag,aMode) || 
               (theRootTags && FindTagInSet(theTag,theRootTags->mTags,theRootTags->mCount))) {
        // If you cannot contain this tag then
        // you cannot close it either. It looks like
        // the tag trying to close is misplaced.
        // In the following Exs. notice the misplaced /font:
        // Ex. <font><table><tr><td></font></td></tr></table. -- Ref. bug 56245
        // Ex. <font><select><option></font></select> -- Ref. bug 37618
        // Ex. <font><select></font><option></select> -- Ref. bug 98187
        return eHTMLTag_unknown;
      }
    }

    theIndex=theIndexCopy;
    while(--theIndex>=anIndex){
      eHTMLTags theTag=aContext.TagAt(theIndex);
      if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
        return theTag;
      }
    }    
  }

  else if(gHTMLElements[mTagID].IsTableElement()) {
    
      //This fixes 57378...
      //example: <TABLE><THEAD><TR><TH></THEAD> which didn't close the <THEAD>

    PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table);
    PRInt32 theLastOfMe=aContext.LastOf(mTagID);
    if(theLastTable<theLastOfMe) {
      return mTagID;
    }
        
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file nsElementTable.h.

{return mEndRootNodes;}

Here is the caller graph for this function:

PRInt32 nsHTMLElement::GetIndexOfChildOrSynonym ( nsDTDContext aContext,
eHTMLTags  aChildTag 
) [static]

Call this to find the index of a given child, or (if not found) the index of its nearest synonym.

gess 3/25/98

Parameters:
aTagStack-- list of open tags
aTag-- tag to test for containership
Returns:
index of kNotFound

Definition at line 1537 of file nsElementTable.cpp.

                                                                                          {
  PRInt32 theChildIndex=aContext.LastOf(aChildTag);
  if(kNotFound==theChildIndex) {
    const TagList* theSynTags=gHTMLElements[aChildTag].GetSynonymousTags(); //get the list of tags that THIS tag can close
    if(theSynTags) {
      theChildIndex=LastOf(aContext,*theSynTags);
    } 
  }
  return theChildIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 197 of file nsElementTable.h.

{return mRootNodes;}

Here is the caller graph for this function:

Definition at line 203 of file nsElementTable.h.

{return mSpecialKids;}

Definition at line 204 of file nsElementTable.h.

{return mSpecialParents;}

Here is the caller graph for this function:

Definition at line 196 of file nsElementTable.h.

{return mSynonymousTags;}

Here is the caller graph for this function:

eHTMLTags nsHTMLElement::GetTag ( void  ) const [inline]

Definition at line 210 of file nsElementTable.h.

{return mTagID;}

gess1/21/99

Parameters:
@return

Definition at line 1554 of file nsElementTable.cpp.

                                                               {
  PRBool result=TestBits(mSpecialProperties,aProperty);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsHTMLElement::IsBlock ( void  ) const [inline]

Definition at line 136 of file nsElementTable.h.

                                      { 
                    if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
                      return TestBits(mParentBits,kBlock);
                    } 
                    return PR_FALSE;
                  }

Here is the call graph for this function:

Here is the caller graph for this function:

This method determines whether the given tag closes other blocks.

gess 12/20/99 -- added H1..H6 to this list.

Parameters:
@return

Definition at line 1607 of file nsElementTable.cpp.

                                                 {
  PRBool result=PR_FALSE;
    
  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){

    result=(gHTMLElements[aTag].IsBlock() || 
            gHTMLElements[aTag].IsBlockEntity() ||
            (kHeading==gHTMLElements[aTag].mParentBits));
    if(!result) {
      // NOBR is a block closure   - Ref. Bug# 24462
      // DIR is a block closure    - Ref. Bug# 25845
      // TD is a block closure     - Ref. Bug# 27490
      // TR is a block closure     - Ref. Bug# 26488
      // OBJECT is a block closure - Ref. Bug# 88992

      static eHTMLTags gClosers[]={ eHTMLTag_table,eHTMLTag_tbody,
                                    eHTMLTag_td,eHTMLTag_th,
                                    eHTMLTag_tr,eHTMLTag_caption,
                                    eHTMLTag_object,eHTMLTag_applet,
                                    eHTMLTag_ol, eHTMLTag_ul,
                                    eHTMLTag_optgroup,
                                    eHTMLTag_nobr,eHTMLTag_dir};

      result=FindTagInSet(aTag,gClosers,sizeof(gClosers)/sizeof(eHTMLTag_body));
    }
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 143 of file nsElementTable.h.

                                            { 
                    if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
                      return TestBits(mParentBits,kBlockEntity);
                    } 
                    return PR_FALSE;
                  }

Here is the call graph for this function:

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1672 of file nsElementTable.cpp.

                                                 {
  PRBool result=PR_FALSE;
  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
    result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity);
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsHTMLElement::IsChildOfHead ( eHTMLTags  aChild,
PRBool aExclusively 
) [static]

Returns whether a given tag can be a direct child of the <head> node of an HTML document.

Parameters:
aChildThe tag in question.
aExclusively[out]Whether or not this tag can only appear in the head (as opposed to things like <object> which can be either in the body or the head).
Returns:
Whether this tag can appear in the head.

Definition at line 1862 of file nsElementTable.cpp.

                                                                         {
  aExclusively = PR_TRUE;

  // Is this a head-only tag?
  if (gHTMLElements[aChild].mParentBits & kHeadContent) {
    return PR_TRUE;
  }


  // If not, check if it can appear in the head.
  if (gHTMLElements[aChild].mParentBits & kHeadMisc) {
    aExclusively = PR_FALSE;
    return PR_TRUE;
  }

  return PR_FALSE;
}

Here is the caller graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 1565 of file nsElementTable.cpp.

                                                  {
  PRBool result=(eHTMLTag_unknown==aChild);

  if(!result){
    result=!TestBits(gHTMLElements[aChild].mSpecialProperties,kNonContainer);
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

harishd 03/01/00

Parameters:
@return

Definition at line 1795 of file nsElementTable.cpp.

                                                               {
  PRBool result=PR_FALSE;

  if(!IsTextTag(mTagID)) {
    if(mExcludableParents) {
      const TagList* theParents=mExcludableParents;
      if(FindTagInSet(aParent,theParents->mTags,theParents->mCount))
        result=PR_TRUE;
    }
    if(!result) {
      // If you're a block parent make sure that you're not the
      // parent of a TABLE element. ex. <table><tr><td><div><td></tr></table>
      // IE & Nav. render this as table with two cells ( which I think is correct ).
      // NOTE: If need arise we could use the root node to solve this problem
      if(nsHTMLElement::IsBlockParent(aParent)){
        switch(mTagID) {
          case eHTMLTag_caption:
          case eHTMLTag_thead:
          case eHTMLTag_tbody:
          case eHTMLTag_tfoot:
          case eHTMLTag_td:
          case eHTMLTag_th:
          case eHTMLTag_tr:
            result=PR_TRUE;
          default:
            break;
        }
      }
    }
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1657 of file nsElementTable.cpp.

                                                {
  PRBool result=PR_FALSE;

  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
    result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity);
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1701 of file nsElementTable.cpp.

                                                {
  PRBool result=PR_FALSE;
  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
    result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity);
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file nsElementTable.h.

                                                { 
                    if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
                      return TestBits(mParentBits,kFontStyle);
                    } 
                    return PR_FALSE;
                  }

Here is the call graph for this function:

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1643 of file nsElementTable.cpp.

                                                  {
  PRBool result=PR_FALSE;
  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
    result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity);
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gess 01/04/99

Parameters:
@return

Definition at line 1686 of file nsElementTable.cpp.

                                                  {
  PRBool result=PR_FALSE;
  if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
    result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity);
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

This tests whether all the bits in the parentbits are included in the given set.

It may be too broad a question for most cases.

gess12/13/98

Parameters:
@return

Definition at line 1583 of file nsElementTable.cpp.

                                                  {
  return TestBits(aSet,mParentBits);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 157 of file nsElementTable.h.

                                             { 
                    if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
                      return TestBits(mParentBits,kPhrase);
                    } 
                    return PR_FALSE;
                  }

Here is the call graph for this function:

Here is the caller graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 1932 of file nsElementTable.cpp.

                                                         {
  PRBool result=PR_FALSE;
  switch(aChild) {
    case eHTMLTag_a:       
    case eHTMLTag_b:
    case eHTMLTag_bdo:     
    case eHTMLTag_big:       
    case eHTMLTag_blink:
    case eHTMLTag_del:
    case eHTMLTag_em:
    case eHTMLTag_font:    
    case eHTMLTag_i:         
    case eHTMLTag_ins:
    case eHTMLTag_q:
    case eHTMLTag_s:       
    case eHTMLTag_small:
    case eHTMLTag_strong:
    case eHTMLTag_strike:    
    case eHTMLTag_sub:     
    case eHTMLTag_sup:       
    case eHTMLTag_tt:
    case eHTMLTag_u:       
      result=PR_TRUE;
      break;

    case eHTMLTag_abbr:
    case eHTMLTag_acronym:   
    case eHTMLTag_center:  
    case eHTMLTag_cite:      
    case eHTMLTag_code:
    case eHTMLTag_dfn:       
    case eHTMLTag_kbd:     
    case eHTMLTag_samp:      
    case eHTMLTag_span:    
    case eHTMLTag_var:
      result=PR_FALSE;
    default:
      break;
  };
  return result;
}

Here is the caller graph for this function:

Tells us whether the given tag opens a section gess 01/04/99.

Parameters:
idof tag
Returns:
TRUE if opens section

Definition at line 1730 of file nsElementTable.cpp.

                                                {
  PRBool result=PR_FALSE;
  switch(aTag){
    case eHTMLTag_html:
    case eHTMLTag_frameset:
    case eHTMLTag_body:
    case eHTMLTag_head:
      result=PR_TRUE;
      break;
    default:
      result=PR_FALSE;
  }
  return result;
}

Here is the caller graph for this function:

Definition at line 150 of file nsElementTable.h.

                                              { 
                    if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
                      return TestBits(mParentBits,kSpecial);
                    } 
                    return PR_FALSE;
                  }

Here is the call graph for this function:

Here is the caller graph for this function:

harishd 11/19/99

Parameters:
@return

Definition at line 1715 of file nsElementTable.cpp.

Here is the call graph for this function:

Definition at line 171 of file nsElementTable.h.

                                             {  //return yes if it's a table or child of a table...
                    PRBool result=PR_FALSE;

                    switch(mTagID) {
                      case eHTMLTag_table:
                      case eHTMLTag_thead:
                      case eHTMLTag_tbody:
                      case eHTMLTag_tfoot:
                      case eHTMLTag_caption:
                      case eHTMLTag_tr:
                      case eHTMLTag_td:
                      case eHTMLTag_th:
                      case eHTMLTag_col:
                      case eHTMLTag_colgroup:
                        result=PR_TRUE;
                        break;
                      default:
                        result=PR_FALSE;
                    }
                    return result;
                  }

Here is the caller graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 2012 of file nsElementTable.cpp.

                                                {
  PRBool result=PR_FALSE;

  switch(aChild) {
    case eHTMLTag_text:
    case eHTMLTag_entity:
    case eHTMLTag_newline:
    case eHTMLTag_whitespace:
      result=PR_TRUE;
      break;
    default:
      break;
  }
  return result;
}

Here is the caller graph for this function:

gess12/13/98

Parameters:
@return

Definition at line 1992 of file nsElementTable.cpp.

                                                      {
  PRBool result=PR_FALSE;

  switch(aChild) {
    case eHTMLTag_newline:
    case eHTMLTag_whitespace:
      result=PR_TRUE;
      break;
    default:
      break;
  }
  return result;
}

Here is the caller graph for this function:

PRBool nsHTMLElement::SectionContains ( eHTMLTags  aChild,
PRBool  allowDepthSearch 
) const

gess12/13/98

Parameters:
@return

Definition at line 1888 of file nsElementTable.cpp.

                                                                                    {
  PRBool result=PR_FALSE;
  const TagList* theRootTags=gHTMLElements[aChild].GetRootTags();

  if(theRootTags){
    if(!FindTagInSet(mTagID,theRootTags->mTags,theRootTags->mCount)){
      eHTMLTags theRootBase=theRootTags->mTags[0];
      if((eHTMLTag_unknown!=theRootBase) && (allowDepthSearch))
        result=SectionContains(theRootBase,allowDepthSearch);
    }
    else result=PR_TRUE;
  }
  return result;
}

Here is the call graph for this function:

This method should be called to determine if the a tags hierarchy needs to be validated.

harishd 04/19/00

Parameters:
@return

Definition at line 1912 of file nsElementTable.cpp.

                                                  {
  PRBool result=PR_FALSE;
  
  // If the tag cannot contain itself then we need to make sure that
  // anywhere in the hierarchy we don't nest accidently.
  // Ex: <H1><LI><H1><LI>. Inner LI has the potential of getting nested
  // inside outer LI.If the tag can contain self, Ex: <A><B><A>,
  // ( B can contain self )then ask the child (<A>) if it requires a containment check.
  if(mTagID!=eHTMLTag_userdefined) {
    result=HasSpecialProperty(kVerifyHierarchy);
  }
  return result;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 243 of file nsElementTable.h.

Definition at line 242 of file nsElementTable.h.

Definition at line 254 of file nsElementTable.h.

Definition at line 241 of file nsElementTable.h.

Definition at line 245 of file nsElementTable.h.

Definition at line 239 of file nsElementTable.h.

Definition at line 248 of file nsElementTable.h.

Definition at line 247 of file nsElementTable.h.

Definition at line 246 of file nsElementTable.h.

Definition at line 250 of file nsElementTable.h.

Definition at line 238 of file nsElementTable.h.

Definition at line 240 of file nsElementTable.h.

Definition at line 253 of file nsElementTable.h.

Definition at line 252 of file nsElementTable.h.

Definition at line 251 of file nsElementTable.h.

Definition at line 249 of file nsElementTable.h.

Definition at line 244 of file nsElementTable.h.

Definition at line 237 of file nsElementTable.h.


The documentation for this struct was generated from the following files: