Back to index

lightning-sunbird  0.9+nobinonly
nsElementTable.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Blake Kaplan <mrbkap@gmail.com>
00024  *   Mats Palmgren <mats.palmgren@bredband.net>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 
00041 #include "nsIAtom.h"
00042 #include "nsElementTable.h"
00043 
00044 /***************************************************************************** 
00045   Now it's time to list all the html elements all with their capabilities...
00046 ******************************************************************************/
00047 
00048 #define DECL_TAG_LIST(name_, list_)                                           \
00049   static const eHTMLTags name_##list[] = list_;                               \
00050   static const TagList name_ = { NS_ARRAY_LENGTH(name_##list), name_##list };
00051 
00052 #define COMMA ,
00053 
00054 //First, define the set of taglists for tags with special parents...
00055 DECL_TAG_LIST(gAParents,{eHTMLTag_map})
00056 DECL_TAG_LIST(gInAddress,{eHTMLTag_address})
00057 DECL_TAG_LIST(gInHead,{eHTMLTag_head})
00058 DECL_TAG_LIST(gInTable,{eHTMLTag_table})
00059 DECL_TAG_LIST(gInHTML,{eHTMLTag_html})
00060 DECL_TAG_LIST(gInBody,{eHTMLTag_body})
00061 DECL_TAG_LIST(gInForm,{eHTMLTag_form})
00062 DECL_TAG_LIST(gInFieldset,{eHTMLTag_fieldset})
00063 DECL_TAG_LIST(gInTR,{eHTMLTag_tr})
00064 DECL_TAG_LIST(gInDL,{eHTMLTag_dl COMMA eHTMLTag_body})
00065 DECL_TAG_LIST(gInFrameset,{eHTMLTag_frameset})
00066 DECL_TAG_LIST(gInNoframes,{eHTMLTag_noframes})
00067 //Removed ADDRESS to solve 24885
00068 // gInP: nsHTMLElement::CanContain() also allows table in Quirks mode for bug 43678, removed FORM bug 94269
00069 DECL_TAG_LIST(gInP,{eHTMLTag_span})
00070 DECL_TAG_LIST(gOptgroupParents,{eHTMLTag_select COMMA eHTMLTag_optgroup})
00071 DECL_TAG_LIST(gBodyParents,{eHTMLTag_html COMMA eHTMLTag_noframes})
00072 DECL_TAG_LIST(gColParents,{eHTMLTag_table COMMA eHTMLTag_colgroup})
00073 DECL_TAG_LIST(gFramesetParents,{eHTMLTag_html COMMA eHTMLTag_frameset})
00074 DECL_TAG_LIST(gLegendParents,{eHTMLTag_fieldset})
00075 DECL_TAG_LIST(gAreaParent,{eHTMLTag_map})
00076 DECL_TAG_LIST(gParamParents,{eHTMLTag_applet COMMA eHTMLTag_object})
00077 DECL_TAG_LIST(gTRParents,{eHTMLTag_tbody COMMA eHTMLTag_tfoot COMMA eHTMLTag_thead COMMA eHTMLTag_table})
00078 DECL_TAG_LIST(gTREndParents,{eHTMLTag_tbody COMMA eHTMLTag_tfoot COMMA eHTMLTag_thead COMMA eHTMLTag_table COMMA eHTMLTag_applet})
00079 
00080 //*********************************************************************************************
00081 //  Next, define the set of taglists for tags with special kids...
00082 //*********************************************************************************************
00083 
00084 DECL_TAG_LIST(gContainsText,{eHTMLTag_text COMMA eHTMLTag_newline COMMA eHTMLTag_whitespace COMMA eHTMLTag_entity})
00085 DECL_TAG_LIST(gUnknownKids,{eHTMLTag_html COMMA eHTMLTag_frameset})
00086 
00087 // The presence of <input>, <select>, and <textarea> in gContainsOpts is due to
00088 // the exclgroup that <select> sets...  If I don't include those here, they
00089 // just get dropped automatically, since they are not allowed to open inside
00090 // <select>.  Note that we are NOT allowing them to actually open without
00091 // closing the select -- see gInputAutoClose.  Further note that I'm not
00092 // including <button> in the list because in IE it doesn't autoclose <select>!
00093 DECL_TAG_LIST(gContainsOpts,{eHTMLTag_option COMMA eHTMLTag_optgroup COMMA eHTMLTag_script COMMA eHTMLTag_input COMMA eHTMLTag_select COMMA eHTMLTag_textarea })
00094 // Similar deal for <option> except it allows all of gContainsText _and_ the things that should autoclose selects.
00095 DECL_TAG_LIST(gContainedInOpt,{eHTMLTag_text COMMA eHTMLTag_newline COMMA eHTMLTag_whitespace COMMA eHTMLTag_entity COMMA eHTMLTag_input COMMA eHTMLTag_select COMMA eHTMLTag_textarea})
00096 DECL_TAG_LIST(gContainsParam,{eHTMLTag_param})
00097 DECL_TAG_LIST(gColgroupKids,{eHTMLTag_col}) 
00098 DECL_TAG_LIST(gAddressKids,{eHTMLTag_p})
00099 DECL_TAG_LIST(gBodyKids,{eHTMLTag_dd COMMA eHTMLTag_del COMMA eHTMLTag_dt COMMA eHTMLTag_ins COMMA  eHTMLTag_noscript COMMA eHTMLTag_script COMMA eHTMLTag_li COMMA eHTMLTag_param}) // Added PARAM for bug 54448
00100 DECL_TAG_LIST(gButtonKids,{eHTMLTag_caption COMMA eHTMLTag_legend})
00101 
00102 DECL_TAG_LIST(gDLRootTags,{eHTMLTag_body COMMA eHTMLTag_td COMMA eHTMLTag_table COMMA eHTMLTag_applet COMMA eHTMLTag_dd})
00103 DECL_TAG_LIST(gDLKids,{eHTMLTag_dd COMMA eHTMLTag_dt})
00104 DECL_TAG_LIST(gDTKids,{eHTMLTag_dt})
00105 DECL_TAG_LIST(gFieldsetKids,{eHTMLTag_legend COMMA eHTMLTag_text})
00106 DECL_TAG_LIST(gFontKids,{eHTMLTag_legend COMMA eHTMLTag_table COMMA eHTMLTag_text COMMA eHTMLTag_li}) // Added table to fix bug 93365, li to fix bug 96031
00107 DECL_TAG_LIST(gFormKids,{eHTMLTag_keygen})
00108 DECL_TAG_LIST(gFramesetKids,{eHTMLTag_frame COMMA eHTMLTag_frameset COMMA eHTMLTag_noframes})
00109 
00110 DECL_TAG_LIST(gHtmlKids,{eHTMLTag_body COMMA eHTMLTag_frameset COMMA eHTMLTag_head COMMA eHTMLTag_map COMMA eHTMLTag_noscript COMMA eHTMLTag_noframes COMMA eHTMLTag_script COMMA eHTMLTag_newline COMMA eHTMLTag_whitespace})
00111 
00112 DECL_TAG_LIST(gLabelKids,{eHTMLTag_span})
00113 DECL_TAG_LIST(gLIKids,{eHTMLTag_ol COMMA eHTMLTag_ul})
00114 DECL_TAG_LIST(gMapKids,{eHTMLTag_area})
00115 DECL_TAG_LIST(gPreKids,{eHTMLTag_hr COMMA eHTMLTag_center})  //note that CENTER is here for backward compatibility; it's not 4.0 spec.
00116 
00117 DECL_TAG_LIST(gTableKids,{eHTMLTag_caption COMMA eHTMLTag_col COMMA eHTMLTag_colgroup COMMA eHTMLTag_form COMMA  eHTMLTag_thead COMMA eHTMLTag_tbody COMMA eHTMLTag_tfoot COMMA eHTMLTag_script})// Removed INPUT - Ref. Bug 20087, 25382
00118   
00119 DECL_TAG_LIST(gTableElemKids,{eHTMLTag_form COMMA eHTMLTag_noscript COMMA eHTMLTag_script COMMA eHTMLTag_td COMMA eHTMLTag_th COMMA eHTMLTag_tr})
00120 DECL_TAG_LIST(gTRKids,{eHTMLTag_td COMMA eHTMLTag_th COMMA eHTMLTag_form COMMA eHTMLTag_script})// Removed INPUT - Ref. Bug 20087, 25382 |  Removed MAP to fix 58942
00121 DECL_TAG_LIST(gTBodyKids,{eHTMLTag_tr COMMA eHTMLTag_form}) // Removed INPUT - Ref. Bug 20087, 25382
00122 DECL_TAG_LIST(gULKids,{eHTMLTag_li COMMA eHTMLTag_p})
00123 
00124 
00125 //*********************************************************************************************
00126 // The following tag lists are used to define common set of root notes for the HTML elements...
00127 //*********************************************************************************************
00128 
00129 DECL_TAG_LIST(gRootTags,{eHTMLTag_body COMMA eHTMLTag_td COMMA eHTMLTag_table COMMA eHTMLTag_applet COMMA eHTMLTag_select}) // Added SELECT to fix bug 98645
00130 DECL_TAG_LIST(gTableRootTags,{eHTMLTag_applet COMMA eHTMLTag_body COMMA eHTMLTag_dl COMMA eHTMLTag_ol COMMA eHTMLTag_td COMMA eHTMLTag_th})
00131 DECL_TAG_LIST(gHTMLRootTags,{eHTMLTag_unknown})
00132  
00133 DECL_TAG_LIST(gLIRootTags,{eHTMLTag_ul COMMA eHTMLTag_ol COMMA eHTMLTag_dir COMMA eHTMLTag_menu COMMA eHTMLTag_p COMMA eHTMLTag_body COMMA eHTMLTag_td COMMA eHTMLTag_th})
00134 
00135 DECL_TAG_LIST(gOLRootTags,{eHTMLTag_body COMMA eHTMLTag_li COMMA eHTMLTag_td COMMA eHTMLTag_th COMMA eHTMLTag_select})
00136 DECL_TAG_LIST(gTDRootTags,{eHTMLTag_tr COMMA eHTMLTag_tbody COMMA eHTMLTag_thead COMMA eHTMLTag_tfoot COMMA eHTMLTag_table COMMA eHTMLTag_applet})
00137 DECL_TAG_LIST(gNoframeRoot,{eHTMLTag_body COMMA eHTMLTag_frameset})
00138 
00139 //*********************************************************************************************
00140 // The following tag lists are used to define the autoclose properties of the html elements...
00141 //*********************************************************************************************
00142 
00143 DECL_TAG_LIST(gBodyAutoClose,{eHTMLTag_head})
00144 DECL_TAG_LIST(gTBodyAutoClose,{eHTMLTag_thead COMMA eHTMLTag_tfoot COMMA eHTMLTag_tbody COMMA eHTMLTag_td COMMA eHTMLTag_th})  // TD|TH inclusion - Bug# 24112
00145 DECL_TAG_LIST(gCaptionAutoClose,{eHTMLTag_tbody})
00146 DECL_TAG_LIST(gLIAutoClose,{eHTMLTag_p COMMA eHTMLTag_li})
00147 DECL_TAG_LIST(gPAutoClose,{eHTMLTag_p COMMA eHTMLTag_li})
00148 DECL_TAG_LIST(gHRAutoClose,{eHTMLTag_p})
00149 DECL_TAG_LIST(gOLAutoClose,{eHTMLTag_p COMMA eHTMLTag_ol})
00150 DECL_TAG_LIST(gDivAutoClose,{eHTMLTag_p})
00151 // Form controls that autoclose <select> use this
00152 DECL_TAG_LIST(gInputAutoClose,{eHTMLTag_select COMMA eHTMLTag_optgroup COMMA eHTMLTag_option})
00153 
00154 DECL_TAG_LIST(gHeadingTags,{eHTMLTag_h1 COMMA eHTMLTag_h2 COMMA eHTMLTag_h3 COMMA eHTMLTag_h4 COMMA eHTMLTag_h5 COMMA eHTMLTag_h6})
00155 
00156 DECL_TAG_LIST(gTableCloseTags,{eHTMLTag_td COMMA eHTMLTag_tr COMMA eHTMLTag_th COMMA eHTMLTag_tbody COMMA eHTMLTag_thead COMMA eHTMLTag_tfoot})
00157 DECL_TAG_LIST(gTRCloseTags,{eHTMLTag_tr COMMA eHTMLTag_td COMMA eHTMLTag_th})
00158 DECL_TAG_LIST(gTDCloseTags,{eHTMLTag_td COMMA eHTMLTag_th})
00159 DECL_TAG_LIST(gDTCloseTags,{eHTMLTag_p COMMA eHTMLTag_dd COMMA eHTMLTag_dt})
00160 DECL_TAG_LIST(gULCloseTags,{eHTMLTag_li})
00161 DECL_TAG_LIST(gULAutoClose,{eHTMLTag_p COMMA eHTMLTag_ul}) //fix bug 50261..
00162 
00163 
00164 DECL_TAG_LIST(gExcludableParents,{eHTMLTag_pre}) // Ref Bug 22913
00165 DECL_TAG_LIST(gCaptionExcludableParents,{eHTMLTag_td}) //Ref Bug 26488
00166 
00167 //*********************************************************************************************
00168 //Lastly, bind tags with their rules, their special parents and special kids.
00169 //*********************************************************************************************
00170 
00171 
00172 const int kNoPropRange=0;
00173 const int kDefaultPropRange=1;
00174 const int kBodyPropRange=2;
00175 
00176 PRBool CanBeContainedLI(eHTMLTags aChildTag,nsDTDContext &aContext);
00177 
00178 //*********************************************************************************************
00179 //
00180 //        Now let's declare the element table...
00181 //
00182 //*********************************************************************************************
00183 
00184 
00185 const nsHTMLElement gHTMLElements[] = {
00186   {
00187     /*tag*/                             eHTMLTag_unknown,
00188     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00189     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,  
00190     /*autoclose starttags and endtags*/ 0,0,0,0,
00191     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00192     /*special props, prop-range*/       kNonContainer, 10,
00193     /*special parents,kids,skip*/       0,&gUnknownKids,eHTMLTag_unknown,
00194     /*contain-func*/                    0
00195   },
00196   {
00197     /*************************************************
00198       Note: I changed A to contain flow elements
00199             since it's such a popular (but illegal) 
00200             idiom.
00201      *************************************************/
00202 
00203     /*tag*/                             eHTMLTag_a,
00204     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00205     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00206     /*autoclose starttags and endtags*/ 0,0,0,0,
00207     /*parent,incl,exclgroups*/          kSpecial, kInlineEntity, kNone,  
00208     /*special props, prop-range*/       kVerifyHierarchy, kDefaultPropRange,
00209     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00210     /*contain-func*/                    0
00211   },
00212   {
00213     /*tag*/                             eHTMLTag_abbr,
00214     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00215     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00216     /*autoclose starttags and endtags*/ 0,0,0,0,
00217     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00218     /*special props, prop-range*/       0,kDefaultPropRange,
00219     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00220     /*contain-func*/                    0
00221   },
00222   {
00223     /*tag*/                             eHTMLTag_acronym,
00224     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00225     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00226     /*autoclose starttags and endtags*/ 0,0,0,0,
00227     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00228     /*special props, prop-range*/       0,kDefaultPropRange,
00229     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00230     /*contain-func*/                    0
00231   },
00232   {
00233     /*tag*/                             eHTMLTag_address,
00234     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00235     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00236     /*autoclose starttags and endtags*/ 0,0,0,0,
00237     /*parent,incl,exclgroups*/          kBlock, kInlineEntity, kNone,
00238     /*special props, prop-range*/       0,kDefaultPropRange,
00239     /*special parents,kids,skip*/       0,&gAddressKids,eHTMLTag_unknown,
00240     /*contain-func*/                    0
00241   },
00242   {
00243     /*tag*/                             eHTMLTag_applet,
00244     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00245     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00246     /*autoclose starttags and endtags*/ 0,0,0,0,
00247     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kInlineEntity|kFlowEntity), kNone,
00248     /*special props, prop-range*/       kRequiresBody,kDefaultPropRange,
00249     /*special parents,kids,skip*/       0,&gContainsParam,eHTMLTag_unknown,
00250     /*contain-func*/                    0
00251   },
00252   {
00253     /*tag*/                             eHTMLTag_area,
00254     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00255     /*rootnodes,endrootnodes*/          &gAreaParent,&gRootTags,
00256     /*autoclose starttags and endtags*/ 0,0,0,0,
00257     /*parent,incl,exclgroups*/          kNone, kInlineEntity, kSelf,
00258     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
00259     /*special parents,kids,skip*/       &gAreaParent,0,eHTMLTag_unknown,
00260     /*contain-func*/                    0
00261   },
00262   {
00263     /*tag*/                             eHTMLTag_b,
00264     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00265     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00266     /*autoclose starttags and endtags*/ 0,0,0,0,
00267     /*parent,incl,exclgroups*/          kFontStyle, (kInlineEntity|kSelf), kNone,
00268     /*special props, prop-range*/       0, kDefaultPropRange,
00269     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00270     /*contain-func*/                    0
00271   },
00272   {
00273     /*tag*/                             eHTMLTag_base,
00274     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00275     /*rootnodes,endrootnodes*/          &gInHead,&gRootTags,
00276     /*autoclose starttags and endtags*/ 0,0,0,0,
00277     /*parent,incl,exclgroups*/          kHeadContent, kNone, kNone,
00278     /*special props, prop-range*/       kNonContainer, kNoPropRange,
00279     /*special parents,kids,skip*/       &gInHead,0,eHTMLTag_unknown,
00280     /*contain-func*/                    0
00281   },
00282   {
00283     /*tag*/                             eHTMLTag_basefont,
00284     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00285     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00286     /*autoclose starttags and endtags*/ 0,0,0,0,
00287     /*parent,incl,exclgroups*/          kSpecial, kInlineEntity, kNone,
00288     /*special props, prop-range*/       kNonContainer, kNoPropRange,
00289     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00290     /*contain-func*/                    0
00291   },
00292   {
00293     /*tag*/                             eHTMLTag_bdo,
00294     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00295     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00296     /*autoclose starttags and endtags*/ 0,0,0,0,
00297     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kInlineEntity), kNone,
00298     /*special props, prop-range*/       0, kDefaultPropRange,
00299     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00300     /*contain-func*/                    0
00301   },
00302   {
00303     /*tag*/                             eHTMLTag_bgsound,
00304     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00305     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00306     /*autoclose starttags and endtags*/ 0,0,0,0,
00307     /*parent,incl,exclgroups*/          (kFlowEntity|kHeadMisc), kNone, kNone,
00308     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
00309     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00310     /*contain-func*/                    0
00311   },
00312   {
00313     /*tag*/                             eHTMLTag_big,
00314     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00315     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00316     /*autoclose starttags and endtags*/ 0,0,0,0,
00317     /*parent,incl,exclgroups*/          kFontStyle, (kInlineEntity|kSelf), kNone,
00318     /*special props, prop-range*/       0, kDefaultPropRange,
00319     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00320     /*contain-func*/                    0
00321   },
00322   {
00323     /*tag*/                             eHTMLTag_blink,
00324     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00325     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00326     /*autoclose starttags and endtags*/ 0,0,0,0,
00327     /*parent,incl,exclgroups*/          kFontStyle, (kFlowEntity|kSelf), kNone,
00328     /*special props, prop-range*/       0, kDefaultPropRange,
00329     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00330     /*contain-func*/                    0
00331   },
00332   {
00333     /*tag*/                             eHTMLTag_blockquote,
00334     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00335     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00336     /*autoclose starttags and endtags*/ 0,0,0,0,  //remove excludeable parents to fix bug 53473
00337     /*parent,incl,exclgroups*/          kBlock, (kSelf|kFlowEntity), kNone,
00338     /*special props, prop-range*/       0,kDefaultPropRange,
00339     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00340     /*contain-func*/                    0
00341   },
00342   {
00343     /*tag*/                             eHTMLTag_body,
00344     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_frameset,
00345     /*rootnodes,endrootnodes*/          &gInHTML,&gInHTML,
00346     /*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
00347     /*parent,incl,exclgroups*/          kHTMLContent,(kFlowEntity|kSelf), kNone,
00348     /*special props, prop-range*/       kOmitEndTag, kBodyPropRange,
00349     /*special parents,kids,skip*/       0,&gBodyKids,eHTMLTag_unknown,
00350     /*contain-func*/                    0
00351   },
00352   {
00353     /*tag*/                             eHTMLTag_br,
00354     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00355     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00356     /*autoclose starttags and endtags*/ 0,0,0,0,
00357     /*parent,incl,exclgroups*/          kSpecial, kNone, kNone,
00358     /*special props, prop-range*/       kRequiresBody|kNonContainer, kNoPropRange,
00359     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00360     /*contain-func*/                    0
00361   },
00362   {
00363     /*tag*/                             eHTMLTag_button,
00364     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00365     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00366     /*autoclose starttags and endtags*/ 0,0,0,0,
00367     /*parent,incl,exclgroups*/          kFormControl, kFlowEntity, kFormControl,
00368     /*special props, prop-range*/       kRequiresBody,kDefaultPropRange,
00369     /*special parents,kids,skip*/       0,&gButtonKids,eHTMLTag_unknown,
00370     /*contain-func*/                    0
00371   },
00372   {
00373     /*tag*/                             eHTMLTag_canvas,
00374     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00375     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00376     /*autoclose starttags and endtags*/ 0,0,0,0,
00377     /*parent,incl,exclgroups*/          kSpecial, (kFlowEntity|kSelf), kNone,
00378     /*special props, prop-range*/       0, kDefaultPropRange,
00379     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00380     /*contain-func*/                    0
00381   },
00382   {
00383     /*tag*/                             eHTMLTag_caption,
00384     /*req-parent excl-parent*/          eHTMLTag_table,eHTMLTag_unknown,
00385     /*rootnodes,endrootnodes*/          &gInTable,&gInTable,
00386     /*autoclose starttags and endtags*/ &gCaptionAutoClose,0,0,0,
00387     /*parent,incl,exclgroups*/          kNone, kFlowEntity, kSelf,
00388     /*special props, prop-range*/       (kNoPropagate|kNoStyleLeaksOut),kDefaultPropRange,
00389     /*special parents,kids,skip*/       &gInTable,0,eHTMLTag_unknown,
00390     /*contain-func*/                    0
00391   },
00392   {
00393     /*tag*/                             eHTMLTag_center,
00394     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00395     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00396     /*autoclose starttags and endtags*/ 0,0,0,0,
00397     /*parent,incl,exclgroups*/          kBlock, (kSelf|kFlowEntity), kNone,
00398     /*special props, prop-range*/       0,kDefaultPropRange,
00399     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00400     /*contain-func*/                    0
00401   },
00402   {
00403     /*tag*/                             eHTMLTag_cite,
00404     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00405     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00406     /*autoclose starttags and endtags*/ 0,0,0,0,
00407     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00408     /*special props, prop-range*/       0,kDefaultPropRange,
00409     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00410     /*contain-func*/                    0
00411   },
00412   {
00413     /*tag*/                             eHTMLTag_code,
00414     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00415     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00416     /*autoclose starttags and endtags*/ 0,0,0,0,
00417     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00418     /*special props, prop-range*/       0,kDefaultPropRange,
00419     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00420     /*contain-func*/                    0
00421   },
00422   {
00423     /*tag*/                             eHTMLTag_col,
00424     /*req-parent excl-parent*/          eHTMLTag_table,eHTMLTag_unknown,
00425     /*rootnodes,endrootnodes*/          &gColParents,&gColParents,
00426     /*autoclose starttags and endtags*/ 0,0,0,0,
00427     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00428     /*special props, prop-range*/       kNoPropagate|kNonContainer,kDefaultPropRange,
00429     /*special parents,kids,skip*/       &gColParents,0,eHTMLTag_unknown,
00430     /*contain-func*/                    0
00431   },
00432   {
00433     /*tag*/                             eHTMLTag_colgroup,
00434     /*req-parent excl-parent*/          eHTMLTag_table,eHTMLTag_unknown,
00435     /*rootnodes,endrootnodes*/          &gInTable,&gInTable,
00436     /*autoclose starttags and endtags*/ 0,0,0,0,
00437     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00438     /*special props, prop-range*/       kNoPropagate,kDefaultPropRange,
00439     /*special parents,kids,skip*/       &gInTable,&gColgroupKids,eHTMLTag_unknown,
00440     /*contain-func*/                    0
00441   },
00442   {
00443     /*tag*/                             eHTMLTag_dd,
00444     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00445     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00446     /*autoclose starttags and endtags*/ &gDTCloseTags,0,&gDLKids,0,
00447     /*parent,incl,exclgroups*/          kInlineEntity, kFlowEntity, kNone,
00448     /*special props, prop-range*/       kNoPropagate|kMustCloseSelf|kVerifyHierarchy|kRequiresBody,kDefaultPropRange,
00449     /*special parents,kids,skip*/       &gInDL,0,eHTMLTag_unknown,
00450     /*contain-func*/                    0
00451   },
00452   {
00453     /*tag*/                             eHTMLTag_del,
00454     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00455     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00456     /*autoclose starttags and endtags*/ 0,0,0,0,
00457     /*parent,incl,exclgroups*/          kFlowEntity, (kSelf|kFlowEntity), kNone,
00458     /*special props, prop-range*/       0, kDefaultPropRange,
00459     /*special parents,kids,skip*/       &gInBody,0,eHTMLTag_unknown,
00460     /*contain-func*/                    0
00461   },
00462   {
00463     /*tag*/                             eHTMLTag_dfn,
00464     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00465     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00466     /*autoclose starttags and endtags*/ 0,0,0,0,
00467     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00468     /*special props, prop-range*/       0,kDefaultPropRange,
00469     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00470     /*contain-func*/                    0
00471   },
00472   {
00473     /*tag*/                             eHTMLTag_dir,
00474     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00475     /*rootnodes,endrootnodes*/          &gOLRootTags,&gOLRootTags,
00476     /*autoclose starttags and endtags*/ &gOLAutoClose, &gULCloseTags, 0,0,
00477     /*parent,incl,exclgroups*/          kList, (kFlowEntity|kSelf), kNone,
00478     /*special props, prop-range*/       0,kDefaultPropRange,
00479     /*special parents,kids,skip*/       0,&gULKids,eHTMLTag_unknown,
00480     /*contain-func*/                    0
00481   },
00482   {
00483     /*tag*/                             eHTMLTag_div,
00484     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00485     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00486     /*autoclose starttags and endtags*/ &gDivAutoClose,0,0,0,
00487     /*parent,incl,exclgroups*/          kBlock, (kSelf|kFlowEntity), kNone,
00488     /*special props, prop-range*/       0,kDefaultPropRange,
00489     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00490     /*contain-func*/                    0
00491   },
00492   {
00493     /*tag*/                             eHTMLTag_dl,
00494     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00495     /*rootnodes,endrootnodes*/          &gDLRootTags,&gRootTags,  //fix bug 57634
00496     /*autoclose starttags and endtags*/ 0,0,0,&gDTKids,           // DT should not contain DL - bug 100466
00497     /*parent,incl,exclgroups*/          kBlock, kSelf|kFlowEntity, kNone,
00498     /*special props, prop-range*/       0, kNoPropRange,
00499     /*special parents,kids,skip*/       0,&gDLKids,eHTMLTag_unknown,
00500     /*contain-func*/                    0
00501   },
00502   {
00503     /*tag*/                             eHTMLTag_dt,
00504     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00505     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00506     /*autoclose starttags and endtags*/ &gDTCloseTags,0,&gDLKids,0,
00507     /*parent,incl,exclgroups*/          kInlineEntity, (kFlowEntity-kHeading), kNone,  // dt's parent group is inline - bug 65467
00508     /*special props, prop-range*/       (kNoPropagate|kMustCloseSelf|kVerifyHierarchy|kRequiresBody),kDefaultPropRange,
00509     /*special parents,kids,skip*/       &gInDL,0,eHTMLTag_unknown,
00510     /*contain-func*/                    0
00511   },
00512   {
00513     /*tag*/                             eHTMLTag_em,
00514     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00515     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00516     /*autoclose starttags and endtags*/ 0,0,0,0,
00517     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00518     /*special props, prop-range*/       0, kDefaultPropRange,
00519     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00520     /*contain-func*/                    0
00521   },
00522   {
00523     /*tag*/                             eHTMLTag_embed,
00524     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00525     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00526     /*autoclose starttags and endtags*/ 0,0,0,0,
00527     /*parent,incl,exclgroups*/          kBlockEntity, kNone, kNone,
00528     /*special props, prop-range*/       kNonContainer|kRequiresBody,kDefaultPropRange,
00529     /*special parents,kids,skip*/       0,&gContainsParam,eHTMLTag_unknown,
00530     /*contain-func*/                    0
00531   },
00532   {
00533     /*tag*/                             eHTMLTag_fieldset,
00534     /*requiredAncestor*/                eHTMLTag_unknown,eHTMLTag_unknown,
00535     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00536     /*autoclose starttags and endtags*/ 0,0,0,0,
00537     /*parent,incl,exclgroups*/          kBlock, (kSelf|kFlowEntity), kNone,
00538     /*special props, prop-range*/       kNoPropagate,kDefaultPropRange,
00539     /*special parents,kids,skip*/       0,&gFieldsetKids,eHTMLTag_unknown,
00540     /*contain-func*/                    0
00541   },
00542   {
00543     /*tag*/                             eHTMLTag_font,
00544     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00545     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00546     /*autoclose starttags and endtags*/ 0,0,0,0,
00547     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
00548     /*special props, prop-range*/       0, kDefaultPropRange,
00549     /*special parents,kids,skip*/       0,&gFontKids,eHTMLTag_unknown,
00550     /*contain-func*/                    0
00551   },
00552   {
00553     /*tag*/                             eHTMLTag_form,
00554     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00555     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00556     /*autoclose starttags and endtags*/ 0,0,0,0,
00557     /*parent,incl,exclgroups*/          kBlock, kFlowEntity, kNone,
00558     /*special props, prop-range*/       kNoStyleLeaksIn, kNoPropRange,
00559     /*special parents,kids,skip*/       0,&gFormKids,eHTMLTag_unknown,
00560     /*contain-func*/                    0
00561   },
00562   {
00563     /*tag*/                             eHTMLTag_frame, 
00564     /*req-parent excl-parent*/          eHTMLTag_frameset,eHTMLTag_unknown,
00565     /*rootnodes,endrootnodes*/          &gInFrameset,&gInFrameset,
00566     /*autoclose starttags and endtags*/ 0,0,0,0,
00567     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00568     /*special props, prop-range*/       kNoPropagate|kNoStyleLeaksIn|kNonContainer, kNoPropRange,
00569     /*special parents,kids,skip*/       &gInFrameset,0,eHTMLTag_unknown,
00570     /*contain-func*/                    0
00571   },
00572   {
00573     /*tag*/                             eHTMLTag_frameset,
00574     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_body,
00575     /*rootnodes,endrootnodes*/          &gFramesetParents,&gInHTML,
00576     /*autoclose starttags and endtags*/ 0,0,0,0,
00577     /*parent,incl,exclgroups*/          kHTMLContent, kSelf, kAllTags,
00578     /*special props, prop-range*/       kNoPropagate|kNoStyleLeaksIn, kNoPropRange,
00579     /*special parents,kids,skip*/       &gInHTML,&gFramesetKids,eHTMLTag_unknown,
00580     /*contain-func*/                    0
00581   },
00582 
00583   {
00584     /*tag*/                             eHTMLTag_h1,
00585     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00586     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00587     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00588     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00589     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00590     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00591     /*contain-func*/                    0
00592   },
00593   {
00594     /*tag*/                             eHTMLTag_h2,
00595     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00596     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00597     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00598     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00599     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00600     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00601     /*contain-func*/                    0
00602   },
00603   {
00604     /*tag*/                             eHTMLTag_h3,
00605     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00606     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00607     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00608     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00609     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00610     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00611     /*contain-func*/                    0
00612   },
00613   {
00614     /*tag*/                             eHTMLTag_h4,
00615     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00616     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00617     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00618     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00619     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00620     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00621     /*contain-func*/                    0
00622   },
00623   {
00624     /*tag*/                             eHTMLTag_h5,
00625     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00626     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00627     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00628     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00629     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00630     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00631     /*contain-func*/                    0
00632   },
00633   {
00634     /*tag*/                             eHTMLTag_h6,
00635     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00636     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00637     /*autoclose starttags and endtags*/ &gHeadingTags,  &gHeadingTags, &gHeadingTags,0,
00638     /*parent,incl,exclgroups*/          kHeading, kFlowEntity, kNone,
00639     /*special props, prop-range*/       kVerifyHierarchy,kDefaultPropRange,
00640     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00641     /*contain-func*/                    0
00642   },
00643   {
00644     /*tag*/                             eHTMLTag_head,
00645     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00646     /*rootnodes,endrootnodes*/          &gInHTML,&gInHTML,
00647     /*autoclose starttags and endtags*/ 0,0,0,0,
00648     /*parent,incl,exclgroups*/          kHTMLContent, (kHeadContent|kHeadMisc), kNone,
00649     /*special props, prop-range*/       kNoStyleLeaksIn, kDefaultPropRange,
00650     /*special parents,kids,skip*/       &gInHTML,0,eHTMLTag_unknown,
00651     /*contain-func*/                    0
00652   },
00653   {
00654     /*tag*/                             eHTMLTag_hr,
00655     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00656     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00657     /*autoclose starttags and endtags*/ &gHRAutoClose,0,0,0,
00658     /*parent,incl,exclgroups*/          kBlock, kNone, kNone,
00659     /*special props, prop-range*/       kNonContainer|kRequiresBody,kDefaultPropRange,
00660     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00661     /*contain-func*/                    0
00662   },
00663   {
00664     /*tag*/                             eHTMLTag_html,
00665     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_html,
00666     /*rootnodes,endrootnodes*/          &gHTMLRootTags,&gHTMLRootTags,
00667     /*autoclose starttags and endtags*/ 0,0,0,0,
00668     /*parent,incl,exclgroups*/          kNone, kHTMLContent, kNone,
00669     /*special props, prop-range*/       kSaveMisplaced|kOmitEndTag|kNoStyleLeaksIn, kDefaultPropRange,
00670     /*special parents,kids,skip*/       0,&gHtmlKids,eHTMLTag_unknown,
00671     /*contain-func*/                    0
00672   },
00673   {
00674     /*tag*/                             eHTMLTag_i,
00675     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00676     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00677     /*autoclose starttags and endtags*/ 0,0,0,0,
00678     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
00679     /*special props, prop-range*/       0, kDefaultPropRange,
00680     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00681     /*contain-func*/                    0
00682   },
00683   {
00684     /*tag*/                             eHTMLTag_iframe,
00685     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00686     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00687     /*autoclose starttags and endtags*/ 0,0,0,0,
00688     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kFlowEntity), kNone,
00689     /*special props, prop-range*/       kNoStyleLeaksIn, kNoPropRange,
00690     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00691     /*contain-func*/                    0
00692   },
00693   {
00694     /*tag*/                             eHTMLTag_image,
00695     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00696     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00697     /*autoclose starttags and endtags*/ 0,0,0,0,
00698     /*parent,incl,exclgroups*/          kSpecial, kNone, kNone,
00699     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
00700     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00701     /*contain-func*/                    0
00702   },
00703   {
00704     /*tag*/                             eHTMLTag_img,
00705     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00706     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00707     /*autoclose starttags and endtags*/ 0,0,0,0,
00708     /*parent,incl,exclgroups*/          kSpecial, kNone, kNone,
00709     /*special props, prop-range*/       kNonContainer|kRequiresBody,kDefaultPropRange,
00710     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00711     /*contain-func*/                    0
00712   },
00713   {
00714     /*tag*/                             eHTMLTag_input,
00715     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00716     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00717     /*autoclose starttags and endtags*/ &gInputAutoClose,0,0,0,
00718     /*parent,incl,exclgroups*/          kFormControl, kNone, kNone,
00719     /*special props, prop-range*/       kNonContainer|kRequiresBody,kDefaultPropRange,
00720     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00721     /*contain-func*/                    0
00722   },
00723   {
00724     /*tag*/                             eHTMLTag_ins,
00725     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00726     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00727     /*autoclose starttags and endtags*/ 0,0,0,0,
00728     /*parent,incl,exclgroups*/          kFlowEntity, (kSelf|kFlowEntity), kNone,
00729     /*special props, prop-range*/       0, kDefaultPropRange,
00730     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00731     /*contain-func*/                    0
00732   },
00733   {
00734     /*tag*/                             eHTMLTag_isindex,
00735     /*requiredAncestor*/                eHTMLTag_unknown,eHTMLTag_unknown,
00736     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00737     /*autoclose starttags and endtags*/ 0,0,0,0,
00738     /*parent,incl,exclgroups*/          kBlock, kFlowEntity, kNone,
00739     /*special props, prop-range*/       kNonContainer|kRequiresBody,kDefaultPropRange,
00740     /*special parents,kids,skip*/       &gInBody,0,eHTMLTag_unknown,
00741     /*contain-func*/                    0
00742   },
00743   {
00744     /*tag*/                             eHTMLTag_kbd,
00745     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00746     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00747     /*autoclose starttags and endtags*/ 0,0,0,0,
00748     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
00749     /*special props, prop-range*/       0,kDefaultPropRange,
00750     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00751     /*contain-func*/                    0
00752   },
00753   {
00754     /*tag*/                             eHTMLTag_keygen,
00755     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00756     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00757     /*autoclose starttags and endtags*/ 0,0,0,0,
00758     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
00759     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
00760     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00761     /*contain-func*/                    0
00762   },
00763   {
00764     /*tag*/                             eHTMLTag_label,
00765     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00766     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00767     /*autoclose starttags and endtags*/ 0,0,0,0,
00768     /*parent,incl,exclgroups*/          kFormControl, kInlineEntity, kSelf,
00769     /*special props, prop-range*/       0,kDefaultPropRange,
00770     /*special parents,kids,skip*/       0,&gLabelKids,eHTMLTag_unknown,
00771     /*contain-func*/                    0
00772   },
00773   {
00774     /*tag*/                             eHTMLTag_legend,
00775     /*requiredAncestor*/                eHTMLTag_fieldset,eHTMLTag_unknown,
00776     /*rootnodes,endrootnodes*/          &gInFieldset,&gInFieldset,
00777     /*autoclose starttags and endtags*/ 0,0,0,0,
00778     /*parent,incl,exclgroups*/          kNone, kInlineEntity, kNone,
00779     /*special props, prop-range*/       kRequiresBody,kDefaultPropRange,
00780     /*special parents,kids,skip*/       &gInFieldset,0,eHTMLTag_unknown,
00781     /*contain-func*/                    0
00782   },
00783   {
00784     /*tag*/                             eHTMLTag_li,
00785     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00786     /*rootnodes,endrootnodes*/          &gLIRootTags,&gLIRootTags,
00787     /*autoclose starttags and endtags*/ &gLIAutoClose,0,0,0,
00788     /*parent,incl,exclgroups*/          kBlockEntity, kFlowEntity, kSelf, // changed this back to kBlockEntity so we enable RS handling for phrasals. ref bug 181697
00789     /*special props, prop-range*/       kNoPropagate|kVerifyHierarchy|kRequiresBody, kDefaultPropRange,
00790     /*special parents,kids,skip*/       0,&gLIKids,eHTMLTag_unknown,
00791     /*contain-func*/                    &CanBeContainedLI
00792   },
00793   {
00794     /*tag*/                             eHTMLTag_link,
00795     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00796     /*rootnodes,endrootnodes*/          &gInHead,&gInHead,
00797     /*autoclose starttags and endtags*/ 0,0,0,0,
00798     /*parent,incl,exclgroups*/          kHeadContent, kNone, kNone,
00799     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
00800     /*special parents,kids,skip*/       &gInHead,0,eHTMLTag_unknown,
00801     /*contain-func*/                    0
00802   },
00803   {
00804     /*tag*/                             eHTMLTag_listing,
00805     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00806     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00807     /*autoclose starttags and endtags*/ 0,0,0,0,
00808     /*parent,incl,exclgroups*/          kPreformatted, (kSelf|kFlowEntity), kNone,  //add flowentity to fix 54993
00809     /*special props, prop-range*/       0,kDefaultPropRange,
00810     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00811     /*contain-func*/                    0
00812   },
00813   {
00814     /*tag*/                             eHTMLTag_map,
00815     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00816     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00817     /*autoclose starttags and endtags*/ 0,0,0,0,
00818     /*parent,incl,exclgroups*/          kSpecial, kInlineEntity|kBlockEntity, kNone,
00819     /*special props, prop-range*/       0, kDefaultPropRange,
00820     /*special parents,kids,skip*/       0,&gMapKids,eHTMLTag_unknown,
00821     /*contain-func*/                    0
00822   },
00823   {
00824     /*tag*/                             eHTMLTag_marquee,
00825     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00826     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00827     /*autoclose starttags and endtags*/ 0,0,0,0,
00828     /*parent,incl,exclgroups*/          kBlock, (kSelf|kFlowEntity), kNone,
00829     /*special props, prop-range*/       kRequiresBody, kDefaultPropRange,
00830     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00831     /*contain-func*/                    0
00832   },
00833   {
00834     /*tag*/                             eHTMLTag_menu,
00835     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00836     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00837     /*autoclose starttags and endtags*/ 0,0,0,0,
00838     /*parent,incl,exclgroups*/          kList, (kSelf|kFlowEntity), kNone,
00839     /*special props, prop-range*/       0,kDefaultPropRange,
00840     /*special parents,kids,skip*/       0,&gULKids,eHTMLTag_unknown,
00841     /*contain-func*/                    0
00842   },
00843   {
00844     /*tag*/                             eHTMLTag_meta,
00845     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00846     /*rootnodes,endrootnodes*/          &gInHead,&gInHead,
00847     /*autoclose starttags and endtags*/ 0,0,0,0,
00848     /*parent,incl,exclgroups*/          kHeadContent, kNone, kNone,
00849     /*special props, prop-range*/       kNoStyleLeaksIn|kNonContainer, kDefaultPropRange,
00850     /*special parents,kids,skip*/       &gInHead,0,eHTMLTag_unknown,
00851     /*contain-func*/                    0
00852   },
00853   {
00854     /*tag*/                             eHTMLTag_multicol,
00855     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00856     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00857     /*autoclose starttags and endtags*/ 0,0,0,0,
00858     /*parent,incl,exclgroups*/          kBlock, kFlowEntity, kNone,
00859     /*special props, prop-range*/       0,kDefaultPropRange,
00860     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00861     /*contain-func*/                    0
00862   },
00863   {
00864     /*tag*/                             eHTMLTag_nobr,
00865     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00866     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00867     /*autoclose starttags and endtags*/ 0,0,0,0,
00868     /*parent,incl,exclgroups*/          kExtensions, kFlowEntity, kNone,
00869     /*special props, prop-range*/       0,kDefaultPropRange,
00870     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00871     /*contain-func*/                    0
00872   },
00873   {
00874     /*tag*/                             eHTMLTag_noembed, 
00875     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00876     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00877     /*autoclose starttags and endtags*/ 0,0,0,0,
00878     /*parent,incl,exclgroups*/          kFlowEntity, kFlowEntity, kNone,
00879     /*special props, prop-range*/       0, kNoPropRange,
00880     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00881     /*contain-func*/                    0
00882   },
00883   {
00884     /*tag*/                             eHTMLTag_noframes,
00885     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00886     /*rootnodes,endrootnodes*/          &gNoframeRoot,&gNoframeRoot,
00887     /*autoclose starttags and endtags*/ 0,0,0,0,
00888     /*parent,incl,exclgroups*/          kBlock, kFlowEntity, kNone,
00889     /*special props, prop-range*/       0, kNoPropRange,
00890     /*special parents,kids,skip*/       &gNoframeRoot,0,eHTMLTag_unknown,
00891     /*contain-func*/                    0
00892   },
00893   {
00894     /*tag*/                             eHTMLTag_noscript,
00895     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00896     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00897     /*autoclose starttags and endtags*/ 0,0,0,0,
00898     /*parent,incl,exclgroups*/          kFlowEntity, kFlowEntity|kSelf, kNone,
00899     /*special props, prop-range*/       0, kNoPropRange,
00900     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00901     /*contain-func*/                    0
00902   },
00903   {
00904     /*tag*/                             eHTMLTag_object,
00905     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00906     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00907     /*autoclose starttags and endtags*/ 0,0,0,0,
00908     /*parent,incl,exclgroups*/          kSpecial, (kFlowEntity|kInlineEntity|kSelf), kNone, // XXX should have a kHeadMisc parent too
00909     /*special props, prop-range*/       kNoStyleLeaksOut,kDefaultPropRange,
00910     /*special parents,kids,skip*/       0,&gContainsParam,eHTMLTag_unknown,
00911     /*contain-func*/                    0
00912   },
00913   {
00914     /*tag*/                             eHTMLTag_ol,
00915     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00916     /*rootnodes,endrootnodes*/          &gOLRootTags,&gOLRootTags,
00917     /*autoclose starttags and endtags*/ &gOLAutoClose, &gULCloseTags, 0,0,
00918     /*parent,incl,exclgroups*/          kList, (kFlowEntity|kSelf), kNone,
00919     /*special props, prop-range*/       0,kDefaultPropRange,   
00920     /*special parents,kids,skip*/       0,&gULKids,eHTMLTag_unknown,
00921     /*contain-func*/                    0
00922   },
00923   {
00924     /*tag*/                             eHTMLTag_optgroup,
00925     /*requiredAncestor*/                eHTMLTag_select,eHTMLTag_unknown,
00926     /*rootnodes,endrootnodes*/          &gOptgroupParents,&gOptgroupParents,
00927     /*autoclose starttags and endtags*/ 0,0,0,0,
00928     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00929     /*special props, prop-range*/       0,kDefaultPropRange,
00930     /*special parents,kids,skip*/       &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown,
00931     /*contain-func*/                    0
00932   },
00933   {
00934     /*tag*/                             eHTMLTag_option,
00935     /*requiredAncestor*/                eHTMLTag_select,eHTMLTag_unknown,
00936     /*rootnodes,endrootnodes*/          &gOptgroupParents,&gOptgroupParents, 
00937     /*autoclose starttags and endtags*/ 0,0,0,0,
00938     /*parent,incl,exclgroups*/          kNone, kPCDATA, kFlowEntity|kHeadMisc,
00939     /*special props, prop-range*/       kNoStyleLeaksIn|kNoPropagate, kDefaultPropRange,
00940     /*special parents,kids,skip*/       &gOptgroupParents,&gContainedInOpt,eHTMLTag_unknown,
00941     /*contain-func*/                    0
00942   },
00943   {
00944     /*tag*/                             eHTMLTag_p,
00945     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00946     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00947     /*autoclose starttags and endtags*/ 0,0,0,0,
00948     /*parent,incl,exclgroups*/          kBlock, kInlineEntity, kNone,      //this used to contain FLOW. But it's really an inline container.
00949     /*special props, prop-range*/       kHandleStrayTag,kDefaultPropRange, //otherwise it tries to contain things like H1..H6
00950     /*special parents,kids,skip*/       0,&gInP,eHTMLTag_unknown,
00951     /*contain-func*/                    0
00952   },
00953   {
00954     /*tag*/                             eHTMLTag_param,
00955     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00956     /*rootnodes,endrootnodes*/          &gParamParents,&gParamParents,
00957     /*autoclose starttags and endtags*/ &gPAutoClose,0,0,0,
00958     /*parent,incl,exclgroups*/          kNone, kNone, kNone,
00959     /*special props, prop-range*/       kNonContainer, kNoPropRange,
00960     /*special parents,kids,skip*/       &gParamParents,0,eHTMLTag_unknown,
00961     /*contain-func*/                    0
00962   },
00963   {
00964     /*tag*/                             eHTMLTag_plaintext,
00965     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00966     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00967     /*autoclose starttags and endtags*/ 0,0,0,0,
00968     /*parent,incl,exclgroups*/          kExtensions, kCDATA, kNone,
00969     /*special props, prop-range*/       0, kDefaultPropRange,
00970     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00971     /*contain-func*/                    0
00972   },
00973   {
00974     /*tag*/                             eHTMLTag_pre,
00975     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00976     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00977     /*autoclose starttags and endtags*/ 0,0,0,0,
00978     /*parent,incl,exclgroups*/          kBlock|kPreformatted, (kSelf|kFlowEntity), kNone,  // Note: PRE is a block level element - bug 80009
00979     /*special props, prop-range*/       kRequiresBody, kDefaultPropRange,
00980     /*special parents,kids,skip*/       0,&gPreKids,eHTMLTag_unknown,
00981     /*contain-func*/                    0
00982   },
00983   {
00984     /*tag*/                             eHTMLTag_q,
00985     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00986     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00987     /*autoclose starttags and endtags*/ 0,0,0,0,
00988     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kInlineEntity), kNone,
00989     /*special props, prop-range*/       0, kDefaultPropRange,
00990     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
00991     /*contain-func*/                    0
00992   },
00993   {
00994     /*tag*/                             eHTMLTag_s,
00995     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
00996     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
00997     /*autoclose starttags and endtags*/ 0,0,0,0,
00998     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
00999     /*special props, prop-range*/       0, kDefaultPropRange,
01000     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01001     /*contain-func*/                    0
01002   },
01003   {
01004     /*tag*/                             eHTMLTag_samp,
01005     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01006     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01007     /*autoclose starttags and endtags*/ 0,0,0,0,
01008     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
01009     /*special props, prop-range*/       0,kDefaultPropRange,
01010     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01011     /*contain-func*/                    0
01012   },
01013   {
01014     /*tag*/                             eHTMLTag_script,
01015     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01016     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01017     /*autoclose starttags and endtags*/ 0,0,0,0,
01018     /*parent,incl,exclgroups*/          (kSpecial|kHeadContent), kCDATA, kNone,   // note: this is kHeadContent since shipping this breaks things.
01019     /*special props, prop-range*/       kNoStyleLeaksIn|kLegalOpen, kNoPropRange,
01020     /*special parents,kids,skip*/       0,&gContainsText,eHTMLTag_script,
01021     /*contain-func*/                    0
01022   },
01023   {
01024     /*tag*/                             eHTMLTag_select,
01025     /*requiredAncestor*/                eHTMLTag_unknown, eHTMLTag_unknown,
01026     /*rootnodes,endrootnodes*/          &gInForm,&gInForm,
01027     /*autoclose starttags and endtags*/ &gInputAutoClose,0,0,0,
01028     /*parent,incl,exclgroups*/          kFormControl, kNone, kFlowEntity|kDLChild|kHeadMisc, // Added kHeadMisc to fix bug 287349
01029     /*special props, prop-range*/       kNoPropagate|kNoStyleLeaksIn|kRequiresBody, kDefaultPropRange,
01030     /*special parents,kids,skip*/       &gInForm,&gContainsOpts,eHTMLTag_unknown,
01031     /*contain-func*/                    0
01032   },
01033   {
01034     /*tag*/                             eHTMLTag_server,
01035     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01036     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01037     /*autoclose starttags and endtags*/ 0,0,0,0,
01038     /*parent,incl,exclgroups*/          (kSpecial|kHeadMisc), kCDATA, kNone,
01039     /*special props, prop-range*/       (kNoStyleLeaksIn|kLegalOpen), kNoPropRange,
01040     /*special parents,kids,skip*/       0,&gContainsText,eHTMLTag_server,
01041     /*contain-func*/                    0
01042   },
01043   {
01044     /*tag*/                             eHTMLTag_small,
01045     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01046     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01047     /*autoclose starttags and endtags*/ 0,0,0,0,
01048     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
01049     /*special props, prop-range*/       0, kDefaultPropRange,
01050     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01051     /*contain-func*/                    0
01052   },
01053   {
01054     
01055     /*tag*/                             eHTMLTag_sound,
01056     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01057     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01058     /*autoclose starttags and endtags*/ 0,0,0,0,
01059     /*parent,incl,exclgroups*/          (kFlowEntity|kHeadMisc), kNone, kNone,  // Added kFlowEntity|kHeadMisc & kNonContainer in
01060     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,        // Ref. to Bug 25749
01061     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01062     /*contain-func*/                    0
01063   },
01064   {
01065     
01066     /*tag*/                             eHTMLTag_spacer,
01067     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01068     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01069     /*autoclose starttags and endtags*/ 0,0,0,0,
01070     /*parent,incl,exclgroups*/          kExtensions, kNone, kNone,
01071     /*special props, prop-range*/       kNonContainer,kDefaultPropRange,
01072     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01073     /*contain-func*/                    0
01074   },
01075   {
01076     
01077           // I made span a special% tag again, (instead of inline).
01078           // This fixes the case:  <font color="blue"><p><span>text</span>
01079 
01080     /*tag*/                             eHTMLTag_span,
01081     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01082     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01083     /*autoclose starttags and endtags*/ 0,0,0,0,
01084     /*parent,incl,exclgroups*/          kSpecial, (kInlineEntity|kSelf|kFlowEntity), kNone,
01085     /*special props, prop-range*/       0,kDefaultPropRange,
01086     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01087     /*contain-func*/                    0
01088   },
01089   {
01090     
01091     /*tag*/                             eHTMLTag_strike,
01092     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01093     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01094     /*autoclose starttags and endtags*/ 0,0,0,0,
01095     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
01096     /*special props, prop-range*/       0, kDefaultPropRange,
01097     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01098     /*contain-func*/                    0
01099   },
01100   {
01101     
01102     /*tag*/                             eHTMLTag_strong,
01103     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01104     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01105     /*autoclose starttags and endtags*/ 0,0,0,0,
01106     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,  //changed this to inline per spec; fix bug 44584.
01107     /*special props, prop-range*/       0, kDefaultPropRange,
01108     /*special parents,kids,skip*/       0,&gContainsText,eHTMLTag_unknown,
01109     /*contain-func*/                    0
01110   },
01111   {
01112     
01113     /*tag*/                             eHTMLTag_style,
01114     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01115     /*rootnodes,endrootnodes*/          &gInHead,&gInHead,
01116     /*autoclose starttags and endtags*/ 0,0,0,0,
01117     /*parent,incl,exclgroups*/          kHeadContent, kCDATA, kNone,
01118     /*special props, prop-range*/       kNoStyleLeaksIn|kNonContainer, kNoPropRange,
01119     /*special parents,kids,skip*/       &gInHead,0,eHTMLTag_style,
01120     /*contain-func*/                    0
01121   },
01122   {
01123     /*tag*/                             eHTMLTag_sub,
01124     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01125     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01126     /*autoclose starttags and endtags*/ 0,0,0,0,
01127     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kInlineEntity), kNone,
01128     /*special props, prop-range*/       0, kDefaultPropRange,
01129     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01130     /*contain-func*/                    0
01131   },
01132   {
01133     
01134     /*tag*/                             eHTMLTag_sup,
01135     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01136     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01137     /*autoclose starttags and endtags*/ 0,0,0,0,
01138     /*parent,incl,exclgroups*/          kSpecial, (kSelf|kInlineEntity), kNone,
01139     /*special props, prop-range*/       0, kDefaultPropRange,
01140     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01141     /*contain-func*/                    0
01142   },
01143   {
01144     /*tag*/                             eHTMLTag_table,
01145     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01146     /*rootnodes,endrootnodes*/          &gTableRootTags,&gTableRootTags,
01147     /*autoclose starttags and endtags*/ 0,&gTableCloseTags,0,0,
01148     /*parent,incl,exclgroups*/          kBlock, kNone, (kSelf|kInlineEntity),
01149     /*special props, prop-range*/       (kBadContentWatch|kNoStyleLeaksIn|kRequiresBody), 2,
01150     /*special parents,kids,skip*/       0,&gTableKids,eHTMLTag_unknown,
01151     /*contain-func*/                    0
01152   },
01153   {
01154     /*tag*/                             eHTMLTag_tbody,
01155     /*requiredAncestor*/                eHTMLTag_table, eHTMLTag_unknown,
01156     /*rootnodes,endrootnodes*/          &gInTable,&gInTable,
01157     /*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,0,
01158     /*parent,incl,exclgroups*/          kNone, kNone, (kSelf|kInlineEntity),
01159     /*special props, prop-range*/       (kNoPropagate|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), kDefaultPropRange,
01160     /*special parents,kids,skip*/       &gInTable,&gTBodyKids,eHTMLTag_unknown,
01161     /*contain-func*/                    0
01162   },
01163   {
01164     /*tag*/                             eHTMLTag_td,
01165     /*requiredAncestor*/                eHTMLTag_table, eHTMLTag_unknown,
01166     /*rootnodes,endrootnodes*/          &gTDRootTags,&gTDRootTags,
01167     /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0,&gExcludableParents,
01168     /*parent,incl,exclgroups*/          kNone, kFlowEntity, kSelf,
01169     /*special props, prop-range*/       kNoStyleLeaksIn|kNoStyleLeaksOut, kDefaultPropRange,
01170     /*special parents,kids,skip*/       &gTDRootTags,&gBodyKids,eHTMLTag_unknown,
01171     /*contain-func*/                    0
01172   },
01173   {
01174     /*tag*/                             eHTMLTag_textarea,
01175     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01176     /*rootnodes,endrootnodes*/          &gInForm,&gInForm,
01177     /*autoclose starttags and endtags*/ &gInputAutoClose,0,0,0,
01178     /*parent,incl,exclgroups*/          kFormControl, kPCDATA, kNone,
01179     /*special props, prop-range*/       kRequiresBody|kNoStyleLeaksIn,kDefaultPropRange,
01180     /*special parents,kids,skip*/       &gInForm,&gContainsText,eHTMLTag_unknown,
01181     /*contain-func*/                    0
01182   },
01183   {
01184     /*tag*/                             eHTMLTag_tfoot,
01185     /*requiredAncestor*/                eHTMLTag_table, eHTMLTag_unknown,
01186     /*rootnodes,endrootnodes*/          &gInTable,&gInTable,
01187     /*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,0,
01188     /*parent,incl,exclgroups*/          kNone, kNone, kSelf,
01189     /*special props, prop-range*/       (kNoPropagate|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), kNoPropRange,
01190     /*special parents,kids,skip*/       &gInTable,&gTableElemKids,eHTMLTag_unknown,
01191     /*contain-func*/                    0
01192   },
01193   {
01194     /*tag*/                             eHTMLTag_th, 
01195     /*requiredAncestor*/                eHTMLTag_table, eHTMLTag_unknown,
01196     /*rootnodes,endrootnodes*/          &gTDRootTags,&gTDRootTags,
01197     /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0,0,
01198     /*parent,incl,exclgroups*/          kNone, kFlowEntity, kSelf,
01199     /*special props, prop-range*/       (kNoStyleLeaksIn|kNoStyleLeaksOut), kDefaultPropRange,
01200     /*special parents,kids,skip*/       &gTDRootTags,&gBodyKids,eHTMLTag_unknown,
01201     /*contain-func*/                    0
01202   },
01203   {
01204     /*tag*/                             eHTMLTag_thead,
01205     /*req-parent excl-parent*/          eHTMLTag_table,eHTMLTag_unknown,  //fix bug 54840...
01206     /*rootnodes,endrootnodes*/          &gInTable,&gInTable,  
01207     /*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,0,
01208     /*parent,incl,exclgroups*/          kNone, kNone, kSelf,
01209     /*special props, prop-range*/       (kNoPropagate|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), kNoPropRange,
01210     /*special parents,kids,skip*/       &gInTable,&gTableElemKids,eHTMLTag_unknown,
01211     /*contain-func*/                    0
01212   },
01213   {
01214     /*tag*/                             eHTMLTag_title,
01215     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01216     /*rootnodes,endrootnodes*/          &gInHead,&gInHead,
01217     /*autoclose starttags and endtags*/ 0,0,0,0,
01218     /*parent,incl,exclgroups*/          kHeadContent,kPCDATA, kNone,
01219     /*special props, prop-range*/       kNoStyleLeaksIn, kNoPropRange,
01220     /*special parents,kids,skip*/       &gInHead,&gContainsText,eHTMLTag_title,
01221     /*contain-func*/                    0
01222   },
01223   {
01224     /*tag*/                             eHTMLTag_tr,
01225     /*requiredAncestor*/                eHTMLTag_table, eHTMLTag_unknown,
01226     /*rootnodes,endrootnodes*/          &gTRParents,&gTREndParents,
01227     /*autoclose starttags and endtags*/ &gTRCloseTags,0,0,0,
01228     /*parent,incl,exclgroups*/          kNone, kNone, kInlineEntity,
01229     /*special props, prop-range*/       (kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), kNoPropRange,
01230     /*special parents,kids,skip*/       &gTRParents,&gTRKids,eHTMLTag_unknown,
01231     /*contain-func*/                    0
01232   },
01233   {
01234     /*tag*/                             eHTMLTag_tt,
01235     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01236     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01237     /*autoclose starttags and endtags*/ 0,0,0,0,
01238     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
01239     /*special props, prop-range*/       0, kDefaultPropRange,
01240     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01241     /*contain-func*/                    0
01242   },
01243   {
01244     /*tag*/                             eHTMLTag_u,
01245     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01246     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01247     /*autoclose starttags and endtags*/ 0,0,0,0,
01248     /*parent,incl,exclgroups*/          kFontStyle, (kSelf|kInlineEntity), kNone,
01249     /*special props, prop-range*/       0, kDefaultPropRange,
01250     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01251     /*contain-func*/                    0
01252   },
01253   {
01254     /*tag*/                             eHTMLTag_ul,
01255     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01256     /*rootnodes,endrootnodes*/          &gOLRootTags,&gOLRootTags,
01257     /*autoclose starttags and endtags*/ &gULAutoClose,&gULCloseTags,0,0,
01258     /*parent,incl,exclgroups*/          kList, (kFlowEntity|kSelf), kNone,
01259     /*special props, prop-range*/       0,kDefaultPropRange,
01260     /*special parents,kids,skip*/       0,&gULKids,eHTMLTag_unknown,
01261     /*contain-func*/                    0
01262   },
01263   {
01264     /*tag*/                             eHTMLTag_var,
01265     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01266     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01267     /*autoclose starttags and endtags*/ 0,0,0,0,
01268     /*parent,incl,exclgroups*/          kPhrase, (kSelf|kInlineEntity), kNone,
01269     /*special props, prop-range*/       0,kDefaultPropRange,
01270     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01271     /*contain-func*/                    0
01272   },
01273   {
01274     /*tag*/                             eHTMLTag_wbr,
01275     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01276     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01277     /*autoclose starttags and endtags*/ 0,0,0,0,
01278     /*parent,incl,exclgroups*/          kExtensions, kNone, kNone,
01279     /*special props, prop-range*/       kNonContainer|kRequiresBody,kNoPropRange,
01280     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01281     /*contain-func*/                    0
01282   },
01283   {
01284     /*tag*/                             eHTMLTag_xmp,
01285     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01286     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01287     /*autoclose starttags and endtags*/ 0,0,0,0,
01288     /*parent,incl,exclgroups*/          kInlineEntity|kPreformatted, kCDATA, kNone,
01289     /*special props, prop-range*/       kNone,kDefaultPropRange,
01290     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01291     /*contain-func*/                    0
01292   },
01293   {
01294     /*tag*/                             eHTMLTag_text,
01295     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01296     /*rootnodes,endrootnodes*/          &gInBody,&gInBody,
01297     /*autoclose starttags and endtags*/ 0,0,0,0,
01298     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
01299     /*special props, prop-range*/       kNonContainer|kRequiresBody,kNoPropRange,
01300     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01301     /*contain-func*/                    0
01302   },
01303   {
01304           // Whitespace must have a parent model of kHeadMisc to ensure that we
01305           // do the right thing for whitespace in the head section of a document.
01306           // (i.e., it must be non-exclusively a child of the head).
01307 
01308     /*tag*/                             eHTMLTag_whitespace, 
01309     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01310     /*rootnodes,endrootnodes*/          &gInBody,&gInBody,
01311     /*autoclose starttags and endtags*/ 0,0,0,0,
01312     /*parent,incl,exclgroups*/          kFlowEntity|kHeadMisc, kNone, kNone,
01313     /*special props, prop-range*/       kNonContainer|kLegalOpen,kNoPropRange,
01314     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01315     /*contain-func*/                    0
01316   },
01317   {
01318           // Newlines must have a parent model of kHeadMisc to ensure that we
01319           // do the right thing for whitespace in the head section of a document.
01320           // (i.e., it must be non-exclusively a child of the head).
01321 
01322     /*tag*/                             eHTMLTag_newline,
01323     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01324     /*rootnodes,endrootnodes*/          &gInBody,&gInBody,
01325     /*autoclose starttags and endtags*/ 0,0,0,0,
01326     /*parent,incl,exclgroups*/          kFlowEntity|kHeadMisc, kNone, kNone,
01327     /*special props, prop-range*/       kNonContainer|kLegalOpen, kNoPropRange,
01328     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01329     /*contain-func*/                    0
01330   },
01331   {
01332           // Comments must have a parent model of kHeadMisc to ensure that we
01333           // do the right thing for whitespace in the head section of a document
01334           // (i.e., it must be non-exclusively a child of the head).
01335 
01336     /*tag*/                             eHTMLTag_comment,
01337     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01338     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01339     /*autoclose starttags and endtags*/ 0,0,0,0,
01340     /*parent,incl,exclgroups*/          kFlowEntity|kHeadMisc, kNone, kNone,
01341     /*special props, prop-range*/       kOmitEndTag|kLegalOpen,kNoPropRange,
01342     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01343     /*contain-func*/                    0
01344   },
01345   {
01346     /*tag*/                             eHTMLTag_entity,
01347     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01348     /*rootnodes,endrootnodes*/          &gInBody,&gInBody,
01349     /*autoclose starttags and endtags*/ 0,0,0,0,
01350     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
01351     /*special props, prop-range*/       0, kNoPropRange,
01352     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01353     /*contain-func*/                    0
01354   },
01355   {
01356     /*tag*/                             eHTMLTag_doctypeDecl,
01357     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01358     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01359     /*autoclose starttags and endtags*/ 0,0,0,0,
01360     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
01361     /*special props, prop-range*/       kOmitEndTag,kNoPropRange,
01362     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01363     /*contain-func*/                    0
01364   },
01365   {
01366     /*tag*/                             eHTMLTag_markupDecl,
01367     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01368     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01369     /*autoclose starttags and endtags*/ 0,0,0,0,
01370     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
01371     /*special props, prop-range*/       kOmitEndTag,kNoPropRange,
01372     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01373     /*contain-func*/                    0
01374   },
01375   {
01376     /*tag*/                             eHTMLTag_instruction,
01377     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_unknown,
01378     /*rootnodes,endrootnodes*/          0,0,
01379     /*autoclose starttags and endtags*/ 0,0,0,0,
01380     /*parent,incl,exclgroups*/          kFlowEntity, kNone, kNone,
01381     /*special props, prop-range*/       kOmitEndTag,kNoPropRange,
01382     /*special parents,kids,skip*/       0,0,eHTMLTag_unknown,
01383     /*contain-func*/                    0
01384   },
01385   {
01386           // Userdefined tags must have a parent model of kHeadMisc to ensure that
01387           // we do the right thing for whitespace in the head section of a document.
01388           // (i.e., it must be non-exclusively a child of the head).
01389 
01390     /*tag*/                             eHTMLTag_userdefined,
01391     /*req-parent excl-parent*/          eHTMLTag_unknown,eHTMLTag_frameset,
01392     /*rootnodes,endrootnodes*/          &gRootTags,&gRootTags,
01393     /*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
01394     /*parent,incl,exclgroups*/          (kFlowEntity|kHeadMisc), (kInlineEntity|kSelf), kNone,  // Treat userdefined as inline element - Ref bug 56245,66772
01395     /*special props, prop-range*/       kPreferBody, kBodyPropRange,
01396     /*special parents,kids,skip*/       &gInNoframes,&gBodyKids,eHTMLTag_unknown,
01397     /*contain-func*/                    0
01398   }
01399 };
01400 
01401 #ifdef NS_DEBUG  
01402 void CheckElementTable() {
01403   for (eHTMLTags t = eHTMLTag_unknown; t <= eHTMLTag_userdefined; t = eHTMLTags(t + 1)) {
01404     NS_ASSERTION(gHTMLElements[t].mTagID == t, "gHTMLElements entries does match tag list.");
01405   }
01406 }
01407 #endif
01408 
01415 PRBool CanBeContainedLI(eHTMLTags aChildTag,nsDTDContext &aContext) {
01416   PRBool result=PR_TRUE;
01417 
01418   //walk the parent hierarchy, to see if the LI is in a block or an inline.
01419   PRInt32 anIndex=aContext.GetCount();
01420   PRBool  theLIHasABlockParent=PR_FALSE;
01421 
01422   PRBool theChildIsBlock=PR_FALSE;
01423   
01424   if((aChildTag>eHTMLTag_unknown) && (aChildTag<eHTMLTag_userdefined)) {
01425     theChildIsBlock=  (eHTMLTag_dt==aChildTag) || 
01426                       (eHTMLTag_dd==aChildTag) ||
01427                       (gHTMLElements[aChildTag].IsMemberOf(kBlock))       || 
01428                       (gHTMLElements[aChildTag].IsMemberOf(kBlockEntity)) || 
01429                       (gHTMLElements[aChildTag].IsMemberOf(kHeading))     || 
01430                       (gHTMLElements[aChildTag].IsMemberOf(kPreformatted))|| 
01431                       (gHTMLElements[aChildTag].IsMemberOf(kList)); 
01432   }
01433 
01434   if(theChildIsBlock) {
01435 
01436     while(--anIndex>0) {
01437       eHTMLTags aParent=aContext.TagAt(anIndex);
01438       if((eHTMLTag_ul==aParent) ||
01439          (eHTMLTag_ol==aParent) || 
01440          (eHTMLTag_table==aParent) ||
01441          (eHTMLTag_dir==aParent)) {
01442         theLIHasABlockParent=PR_TRUE;
01443         break;
01444       }
01445     }
01446     result=theLIHasABlockParent;
01447   }    
01448   else {
01449     result=PR_TRUE;
01450   }
01451   return result;
01452 }
01453 
01463 PRBool nsHTMLElement::CanBeContained(eHTMLTags aChildTag,nsDTDContext &aContext) const {
01464   PRBool result=PR_TRUE;
01465   if(!mCanBeContained) {
01466 
01467     /* #    Interesting test cases:       Result:
01468      * 1.   <UL><LI>..<B>..<LI>           inner <LI> closes outer <LI>
01469      * 2.   <CENTER><DL><DT><A><CENTER>   allow nested <CENTER>
01470      * 3.   <TABLE><TR><TD><TABLE>...     allow nested <TABLE>
01471      * 4.   <FRAMESET> ... <FRAMESET>
01472      */
01473 
01474     //Note: This method is going away. First we need to get the elementtable to do closures right, and
01475     //      therefore we must get residual style handling to work.
01476 
01477     //the changes to this method were added to fix bug 54651...
01478 
01479     PRInt32 theCount=aContext.GetCount();
01480     result=PR_TRUE;
01481 
01482     if(0<theCount){
01483       const TagList* theRootTags=gHTMLElements[aChildTag].GetRootTags();
01484       const TagList* theSpecialParents=gHTMLElements[aChildTag].GetSpecialParents();
01485       if(theRootTags) {
01486         PRInt32 theRootIndex=LastOf(aContext,*theRootTags);
01487         PRInt32 theSPIndex=(theSpecialParents) ? LastOf(aContext,*theSpecialParents) : kNotFound;  
01488         PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aContext,aChildTag);
01489         PRInt32 theTargetIndex=(theRootIndex>theSPIndex) ? theRootIndex : theSPIndex;
01490 
01491         if((theTargetIndex==theCount-1) ||
01492           ((theTargetIndex==theChildIndex) && gHTMLElements[aChildTag].CanContainSelf())) {
01493           result=PR_TRUE;
01494         }
01495         else {
01496         
01497           result=PR_FALSE;
01498 
01499           static eHTMLTags gTableElements[]={eHTMLTag_td,eHTMLTag_th};
01500 
01501           PRInt32 theIndex=theCount-1;
01502           while(theChildIndex<theIndex) {
01503             eHTMLTags theParentTag=aContext.TagAt(theIndex--);
01504             if (gHTMLElements[theParentTag].IsMemberOf(kBlockEntity)  || 
01505                 gHTMLElements[theParentTag].IsMemberOf(kHeading)      || 
01506                 gHTMLElements[theParentTag].IsMemberOf(kPreformatted) || 
01507                 gHTMLElements[theParentTag].IsMemberOf(kFormControl) || //added this to fix bug 44479
01508                 gHTMLElements[theParentTag].IsMemberOf(kList)) {
01509               if(!HasOptionalEndTag(theParentTag)) {
01510                 result=PR_TRUE;
01511                 break;
01512               }
01513             }
01514             else if(FindTagInSet(theParentTag,gTableElements,sizeof(gTableElements)/sizeof(eHTMLTag_unknown))){
01515               result=PR_TRUE;  //added this to catch a case we missed; bug 57173.
01516               break;
01517             }
01518           }
01519         }
01520       }
01521     }
01522 
01523   }
01524   else result=(*mCanBeContained)(aChildTag,aContext);
01525   return result;
01526 }
01527 
01537 PRInt32 nsHTMLElement::GetIndexOfChildOrSynonym(nsDTDContext& aContext,eHTMLTags aChildTag) {
01538   PRInt32 theChildIndex=aContext.LastOf(aChildTag);
01539   if(kNotFound==theChildIndex) {
01540     const TagList* theSynTags=gHTMLElements[aChildTag].GetSynonymousTags(); //get the list of tags that THIS tag can close
01541     if(theSynTags) {
01542       theChildIndex=LastOf(aContext,*theSynTags);
01543     } 
01544   }
01545   return theChildIndex;
01546 }
01547 
01554 PRBool nsHTMLElement::HasSpecialProperty(PRInt32 aProperty) const{
01555   PRBool result=TestBits(mSpecialProperties,aProperty);
01556   return result;
01557 }
01558 
01565 PRBool nsHTMLElement::IsContainer(eHTMLTags aChild) {
01566   PRBool result=(eHTMLTag_unknown==aChild);
01567 
01568   if(!result){
01569     result=!TestBits(gHTMLElements[aChild].mSpecialProperties,kNonContainer);
01570   }
01571   return result;
01572 }
01573 
01583 PRBool nsHTMLElement::IsMemberOf(PRInt32 aSet) const{
01584   return TestBits(aSet,mParentBits);
01585 }
01586 
01596 PRBool nsHTMLElement::ContainsSet(PRInt32 aSet) const{
01597   return TestBits(mParentBits,aSet);
01598 }
01599 
01607 PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){
01608   PRBool result=PR_FALSE;
01609     
01610   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01611 
01612     result=(gHTMLElements[aTag].IsBlock() || 
01613             gHTMLElements[aTag].IsBlockEntity() ||
01614             (kHeading==gHTMLElements[aTag].mParentBits));
01615     if(!result) {
01616       // NOBR is a block closure   - Ref. Bug# 24462
01617       // DIR is a block closure    - Ref. Bug# 25845
01618       // TD is a block closure     - Ref. Bug# 27490
01619       // TR is a block closure     - Ref. Bug# 26488
01620       // OBJECT is a block closure - Ref. Bug# 88992
01621 
01622       static eHTMLTags gClosers[]={ eHTMLTag_table,eHTMLTag_tbody,
01623                                     eHTMLTag_td,eHTMLTag_th,
01624                                     eHTMLTag_tr,eHTMLTag_caption,
01625                                     eHTMLTag_object,eHTMLTag_applet,
01626                                     eHTMLTag_ol, eHTMLTag_ul,
01627                                     eHTMLTag_optgroup,
01628                                     eHTMLTag_nobr,eHTMLTag_dir};
01629 
01630       result=FindTagInSet(aTag,gClosers,sizeof(gClosers)/sizeof(eHTMLTag_body));
01631     }
01632   }
01633   return result;
01634 }
01635 
01636 
01643 PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){
01644   PRBool result=PR_FALSE;
01645   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01646     result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity);
01647   } 
01648   return result;
01649 }
01650 
01657 PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){
01658   PRBool result=PR_FALSE;
01659 
01660   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01661     result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity);
01662   } 
01663   return result;
01664 }
01665 
01672 PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){
01673   PRBool result=PR_FALSE;
01674   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01675     result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity);
01676   } 
01677   return result;
01678 }
01679 
01686 PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){
01687   PRBool result=PR_FALSE;
01688   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01689     result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity);
01690   } 
01691   return result;
01692 }
01693 
01694 
01701 PRBool nsHTMLElement::IsFlowParent(eHTMLTags aTag){
01702   PRBool result=PR_FALSE;
01703   if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
01704     result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity);
01705   } 
01706   return result;
01707 }
01708 
01715 PRBool nsHTMLElement::IsSpecialParent(eHTMLTags aTag) const{
01716   PRBool result=PR_FALSE;
01717   if(mSpecialParents) {
01718     if(FindTagInSet(aTag,mSpecialParents->mTags,mSpecialParents->mCount))
01719         result=PR_TRUE;
01720   }
01721   return result;
01722 }
01723 
01730 PRBool nsHTMLElement::IsSectionTag(eHTMLTags aTag){
01731   PRBool result=PR_FALSE;
01732   switch(aTag){
01733     case eHTMLTag_html:
01734     case eHTMLTag_frameset:
01735     case eHTMLTag_body:
01736     case eHTMLTag_head:
01737       result=PR_TRUE;
01738       break;
01739     default:
01740       result=PR_FALSE;
01741   }
01742   return result;
01743 }
01744 
01745 
01752 PRBool nsHTMLElement::CanContain(eHTMLTags aParent,eHTMLTags aChild,nsDTDMode aMode){
01753   PRBool result=PR_FALSE;
01754   if((aParent>=eHTMLTag_unknown) && (aParent<=eHTMLTag_userdefined)){
01755     result=gHTMLElements[aParent].CanContain(aChild,aMode);
01756   } 
01757   return result;
01758 }
01759 
01766 PRBool nsHTMLElement::CanExclude(eHTMLTags aChild) const{
01767   PRBool result=PR_FALSE;
01768 
01769   if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {
01770     // Some tags could be opened anywhere, in the document, as they please.
01771     return PR_FALSE;
01772   }
01773 
01774   //Note that special kids takes precedence over exclusions...
01775   if(mSpecialKids) {
01776     if(FindTagInSet(aChild,mSpecialKids->mTags,mSpecialKids->mCount)) {
01777       return PR_FALSE;
01778     }
01779   }
01780 
01781   if(mExclusionBits){
01782     if(gHTMLElements[aChild].IsMemberOf(mExclusionBits)) {
01783       result=PR_TRUE;
01784     }
01785   }
01786   return result;
01787 }
01788 
01795 PRBool nsHTMLElement::IsExcludableParent(eHTMLTags aParent) const{
01796   PRBool result=PR_FALSE;
01797 
01798   if(!IsTextTag(mTagID)) {
01799     if(mExcludableParents) {
01800       const TagList* theParents=mExcludableParents;
01801       if(FindTagInSet(aParent,theParents->mTags,theParents->mCount))
01802         result=PR_TRUE;
01803     }
01804     if(!result) {
01805       // If you're a block parent make sure that you're not the
01806       // parent of a TABLE element. ex. <table><tr><td><div><td></tr></table>
01807       // IE & Nav. render this as table with two cells ( which I think is correct ).
01808       // NOTE: If need arise we could use the root node to solve this problem
01809       if(nsHTMLElement::IsBlockParent(aParent)){
01810         switch(mTagID) {
01811           case eHTMLTag_caption:
01812           case eHTMLTag_thead:
01813           case eHTMLTag_tbody:
01814           case eHTMLTag_tfoot:
01815           case eHTMLTag_td:
01816           case eHTMLTag_th:
01817           case eHTMLTag_tr:
01818             result=PR_TRUE;
01819           default:
01820             break;
01821         }
01822       }
01823     }
01824   }
01825   return result;
01826 }
01827 
01834 PRBool nsHTMLElement::CanOmitEndTag(void) const{
01835   PRBool result=!IsContainer(mTagID);
01836   if(!result)
01837     result=TestBits(mSpecialProperties,kOmitEndTag);
01838   return result;
01839 }
01840 
01847 PRBool nsHTMLElement::CanOmitStartTag(eHTMLTags aChild) const{
01848   PRBool result=PR_FALSE;
01849   return result;
01850 }
01851 
01862 PRBool nsHTMLElement::IsChildOfHead(eHTMLTags aChild,PRBool& aExclusively) {
01863   aExclusively = PR_TRUE;
01864 
01865   // Is this a head-only tag?
01866   if (gHTMLElements[aChild].mParentBits & kHeadContent) {
01867     return PR_TRUE;
01868   }
01869 
01870 
01871   // If not, check if it can appear in the head.
01872   if (gHTMLElements[aChild].mParentBits & kHeadMisc) {
01873     aExclusively = PR_FALSE;
01874     return PR_TRUE;
01875   }
01876 
01877   return PR_FALSE;
01878 }
01879 
01880 
01881 
01888 PRBool nsHTMLElement::SectionContains(eHTMLTags aChild,PRBool allowDepthSearch) const {
01889   PRBool result=PR_FALSE;
01890   const TagList* theRootTags=gHTMLElements[aChild].GetRootTags();
01891 
01892   if(theRootTags){
01893     if(!FindTagInSet(mTagID,theRootTags->mTags,theRootTags->mCount)){
01894       eHTMLTags theRootBase=theRootTags->mTags[0];
01895       if((eHTMLTag_unknown!=theRootBase) && (allowDepthSearch))
01896         result=SectionContains(theRootBase,allowDepthSearch);
01897     }
01898     else result=PR_TRUE;
01899   }
01900   return result;
01901 }
01902 
01912 PRBool nsHTMLElement::ShouldVerifyHierarchy() const {
01913   PRBool result=PR_FALSE;
01914   
01915   // If the tag cannot contain itself then we need to make sure that
01916   // anywhere in the hierarchy we don't nest accidently.
01917   // Ex: <H1><LI><H1><LI>. Inner LI has the potential of getting nested
01918   // inside outer LI.If the tag can contain self, Ex: <A><B><A>,
01919   // ( B can contain self )then ask the child (<A>) if it requires a containment check.
01920   if(mTagID!=eHTMLTag_userdefined) {
01921     result=HasSpecialProperty(kVerifyHierarchy);
01922   }
01923   return result;
01924 }
01925   
01932 PRBool nsHTMLElement::IsResidualStyleTag(eHTMLTags aChild) {
01933   PRBool result=PR_FALSE;
01934   switch(aChild) {
01935     case eHTMLTag_a:       
01936     case eHTMLTag_b:
01937     case eHTMLTag_bdo:     
01938     case eHTMLTag_big:       
01939     case eHTMLTag_blink:
01940     case eHTMLTag_del:
01941     case eHTMLTag_em:
01942     case eHTMLTag_font:    
01943     case eHTMLTag_i:         
01944     case eHTMLTag_ins:
01945     case eHTMLTag_q:
01946     case eHTMLTag_s:       
01947     case eHTMLTag_small:
01948     case eHTMLTag_strong:
01949     case eHTMLTag_strike:    
01950     case eHTMLTag_sub:     
01951     case eHTMLTag_sup:       
01952     case eHTMLTag_tt:
01953     case eHTMLTag_u:       
01954       result=PR_TRUE;
01955       break;
01956 
01957     case eHTMLTag_abbr:
01958     case eHTMLTag_acronym:   
01959     case eHTMLTag_center:  
01960     case eHTMLTag_cite:      
01961     case eHTMLTag_code:
01962     case eHTMLTag_dfn:       
01963     case eHTMLTag_kbd:     
01964     case eHTMLTag_samp:      
01965     case eHTMLTag_span:    
01966     case eHTMLTag_var:
01967       result=PR_FALSE;
01968     default:
01969       break;
01970   };
01971   return result;
01972 }
01973 
01980 PRBool nsHTMLElement::CanContainType(PRInt32 aType) const{
01981   PRInt32 answer=mInclusionBits & aType;
01982   PRBool  result=PRBool(0!=answer);
01983   return result;
01984 }
01985 
01992 PRBool nsHTMLElement::IsWhitespaceTag(eHTMLTags aChild) {
01993   PRBool result=PR_FALSE;
01994 
01995   switch(aChild) {
01996     case eHTMLTag_newline:
01997     case eHTMLTag_whitespace:
01998       result=PR_TRUE;
01999       break;
02000     default:
02001       break;
02002   }
02003   return result;
02004 }
02005 
02012 PRBool nsHTMLElement::IsTextTag(eHTMLTags aChild) {
02013   PRBool result=PR_FALSE;
02014 
02015   switch(aChild) {
02016     case eHTMLTag_text:
02017     case eHTMLTag_entity:
02018     case eHTMLTag_newline:
02019     case eHTMLTag_whitespace:
02020       result=PR_TRUE;
02021       break;
02022     default:
02023       break;
02024   }
02025   return result;
02026 }
02027 
02034 PRBool nsHTMLElement::CanContainSelf(void) const {
02035   PRBool result=PRBool(TestBits(mInclusionBits,kSelf)!=0);
02036   return result;
02037 }
02038 
02050 PRBool nsHTMLElement::CanAutoCloseTag(nsDTDContext& aContext,PRInt32 aIndex,
02051                                       eHTMLTags aChildTag) const{
02052 
02053   PRInt32 thePos;
02054   PRBool  result = PR_TRUE;
02055   eHTMLTags thePrevTag;
02056 
02057   for(thePos = aContext.GetCount() - 1; thePos >= aIndex; thePos--) {
02058     thePrevTag = aContext.TagAt(thePos);
02059 
02060     if (thePrevTag == eHTMLTag_applet ||
02061         thePrevTag == eHTMLTag_td) {
02062           result = PR_FALSE;
02063           break;
02064     }
02065   }
02066   
02067   return result;
02068 }
02069 
02076 eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 anIndex,nsDTDMode aMode) const{
02077   eHTMLTags result=eHTMLTag_unknown;
02078 
02079   int theCount=aContext.GetCount();
02080   int theIndex=theCount;
02081 
02082   if(IsMemberOf(kPhrase)){
02083 
02084     while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
02085       eHTMLTags theTag = aContext.TagAt(theIndex);
02086       if(theTag != mTagID) {
02087         // Allow phrasals to close userdefined tags. bug 256731
02088         if(eHTMLTag_userdefined == theTag) {
02089           continue; // We can close this.
02090         }
02091 
02092         // Fixes a derivative of bug 22842...
02093         if(CanContainType(kBlock)) { // INS/DEL can contain blocks.
02094           if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || 
02095              gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
02096             if(HasOptionalEndTag(theTag)) {
02097               continue; // Then I can close it.
02098             }
02099           }
02100         }
02101 
02102         // Phrasal elements can close other phrasals, along with fontstyle,
02103         // extensions, and special tags...
02104         if(!gHTMLElements[theTag].IsMemberOf(kSpecial | 
02105                                              kFontStyle |
02106                                              kPhrase |
02107                                              kExtensions)) {  //fix bug 56665
02108           break; // It's not something I can close
02109         }
02110       }
02111       else {
02112         result=theTag; // Stop because you just found yourself on the stack
02113         break;
02114       }
02115     }
02116   }
02117   
02118   else if(IsMemberOf(kSpecial)){
02119 
02120     while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
02121       eHTMLTags theTag=aContext.TagAt(theIndex);
02122       if(theTag!=mTagID) {
02123         // Special elements can close other specials, along with fontstyle 
02124         // extensions, and phrasal tags...
02125 
02126         // Added Phrasal to fix bug 26347
02127         if((eHTMLTag_userdefined==theTag) ||
02128             gHTMLElements[theTag].IsSpecialEntity()  || 
02129             gHTMLElements[theTag].IsFontStyleEntity()||
02130             gHTMLElements[theTag].IsPhraseEntity()   ||
02131             gHTMLElements[theTag].IsMemberOf(kExtensions)) {
02132           continue;
02133         }
02134         else {
02135 
02136           // Fixes bug 22842...
02137           if(CanContainType(kBlock)) {
02138             if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || 
02139                gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
02140               if(HasOptionalEndTag(theTag)) {
02141                 continue; // Then I can close it.
02142               }
02143             }
02144           }
02145           break; // It's not something I can close
02146         }
02147       }
02148       else {
02149         result=theTag; // Stop because you just found yourself on the stack
02150         break;
02151       }
02152     }
02153   }
02154 
02155   else if(ContainsSet(kPreformatted) ||  
02156           IsMemberOf(kFormControl|kExtensions|kPreformatted)){  //bug54834...
02157 
02158     while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
02159       eHTMLTags theTag=aContext.TagAt(theIndex);
02160       if(theTag!=mTagID) {
02161         if(!CanContain(theTag,aMode)) {
02162           break; //it's not something I can close
02163         }
02164       }
02165       else {
02166         result=theTag; //stop because you just found yourself on the stack
02167         break; 
02168       }
02169     }
02170   }
02171 
02172   else if(IsMemberOf(kList)){
02173 
02174     while((--theIndex>=anIndex) && (eHTMLTag_unknown==result)){
02175       eHTMLTags theTag=aContext.TagAt(theIndex);
02176       if(theTag!=mTagID) {
02177         if(!CanContain(theTag,aMode)) {
02178           break; //it's not something I can close
02179         }
02180       }
02181       else {
02182         result=theTag; //stop because you just found yourself on the stack
02183         break; 
02184       }
02185     }
02186   }
02187 
02188   else if(IsResidualStyleTag(mTagID)){
02189     
02190     // Before finding a close target, for the current tag, make sure
02191     // that the tag above does not gate.
02192     // Note: we intentionally make 2 passes: 
02193     // The first pass tries to exactly match, the 2nd pass matches the group.
02194 
02195     const TagList* theRootTags=gHTMLElements[mTagID].GetEndRootTags();
02196     PRInt32 theIndexCopy=theIndex;
02197     while(--theIndex>=anIndex){
02198       eHTMLTags theTag=aContext.TagAt(theIndex);
02199       if(theTag == mTagID) {
02200         return theTag; // we found our target.
02201       }
02202       else if (!CanContain(theTag,aMode) || 
02203                (theRootTags && FindTagInSet(theTag,theRootTags->mTags,theRootTags->mCount))) {
02204         // If you cannot contain this tag then
02205         // you cannot close it either. It looks like
02206         // the tag trying to close is misplaced.
02207         // In the following Exs. notice the misplaced /font:
02208         // Ex. <font><table><tr><td></font></td></tr></table. -- Ref. bug 56245
02209         // Ex. <font><select><option></font></select> -- Ref. bug 37618
02210         // Ex. <font><select></font><option></select> -- Ref. bug 98187
02211         return eHTMLTag_unknown;
02212       }
02213     }
02214 
02215     theIndex=theIndexCopy;
02216     while(--theIndex>=anIndex){
02217       eHTMLTags theTag=aContext.TagAt(theIndex);
02218       if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
02219         return theTag;
02220       }
02221     }    
02222   }
02223 
02224   else if(gHTMLElements[mTagID].IsTableElement()) {
02225     
02226       //This fixes 57378...
02227       //example: <TABLE><THEAD><TR><TH></THEAD> which didn't close the <THEAD>
02228 
02229     PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table);
02230     PRInt32 theLastOfMe=aContext.LastOf(mTagID);
02231     if(theLastTable<theLastOfMe) {
02232       return mTagID;
02233     }
02234         
02235   }
02236 
02237   return result;
02238 }
02239 
02240 
02247 PRBool nsHTMLElement::CanContain(eHTMLTags aChild,nsDTDMode aMode) const{
02248 
02249 
02250   if(IsContainer(mTagID)){
02251 
02252     if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {
02253       // Some tags could be opened anywhere, in the document, as they please.
02254       return PR_TRUE;
02255     }
02256 
02257     if(mTagID==aChild) {
02258       return CanContainSelf();  //not many tags can contain themselves...
02259     }
02260 
02261     const TagList* theCloseTags=gHTMLElements[aChild].GetAutoCloseStartTags();
02262     if(theCloseTags){
02263       if(FindTagInSet(mTagID,theCloseTags->mTags,theCloseTags->mCount))
02264         return PR_FALSE;
02265     }
02266 
02267     if(gHTMLElements[aChild].mExcludableParents) {
02268       const TagList* theParents=gHTMLElements[aChild].mExcludableParents;
02269       if(FindTagInSet(mTagID,theParents->mTags,theParents->mCount))
02270         return PR_FALSE;
02271     }
02272     
02273     if(gHTMLElements[aChild].IsExcludableParent(mTagID))
02274       return PR_FALSE;
02275 
02276     if(gHTMLElements[aChild].IsBlockCloser(aChild)){
02277       if(nsHTMLElement::IsBlockParent(mTagID)){
02278         return PR_TRUE;
02279       }
02280     }
02281 
02282     if(nsHTMLElement::IsInlineEntity(aChild)){
02283       if(nsHTMLElement::IsInlineParent(mTagID)){
02284         return PR_TRUE;
02285       }
02286     }
02287 
02288     if(nsHTMLElement::IsFlowEntity(aChild)) {
02289       if(nsHTMLElement::IsFlowParent(mTagID)){
02290         return PR_TRUE;
02291       }
02292     }
02293 
02294     if(nsHTMLElement::IsTextTag(aChild)) {
02295       // Allow <xmp> to contain text.
02296       if(nsHTMLElement::IsInlineParent(mTagID) || CanContainType(kCDATA)){
02297         return PR_TRUE;
02298       }
02299     }
02300 
02301     if(CanContainType(gHTMLElements[aChild].mParentBits)) {
02302       return PR_TRUE;
02303     }
02304  
02305     if(mSpecialKids) {
02306       if(FindTagInSet(aChild,mSpecialKids->mTags,mSpecialKids->mCount)) {
02307         return PR_TRUE;
02308       }
02309     }
02310 
02311     // Allow <p> to contain <table> only in Quirks mode, bug 43678 and bug 91927
02312     if (aChild == eHTMLTag_table && mTagID == eHTMLTag_p && aMode == eDTDMode_quirks) {
02313       return PR_TRUE;
02314     }
02315   }
02316   
02317   return PR_FALSE;
02318 }
02319 
02320 #ifdef DEBUG
02321 void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
02322 }
02323 
02324 void nsHTMLElement::DebugDumpMembership(const char* aFilename){
02325 }
02326 
02327 void nsHTMLElement::DebugDumpContainType(const char* aFilename){
02328 }
02329 #endif