Bug 170985 : table-based content object creation r=peterv sr=jst

This commit is contained in:
hpradhan%hotpop.com 2003-09-24 06:16:52 +00:00
Родитель 24a516ecd9
Коммит 0e053b8dd8
7 изменённых файлов: 343 добавлений и 530 удалений

Просмотреть файл

@ -215,6 +215,24 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
// sampling the clock too often.
#define NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE 200
typedef nsresult (*contentCreatorCallback)(nsIHTMLContent**, nsINodeInfo*);
nsresult
NS_NewHTMLNOTUSEDElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo)
{
NS_NOTREACHED("The element ctor should never be called");
return NS_ERROR_FAILURE;
}
#define HTML_TAG(_tag, _classname) NS_NewHTML##_classname##Element,
#define HTML_OTHER(_tag, _classname) NS_NewHTML##_classname##Element,
static const contentCreatorCallback sContentCreatorCallbacks[] = {
NS_NewHTMLUnknownElement,
#include "nsHTMLTagList.h"
};
#undef HTML_TAG
#undef HTML_OTHER
class SinkContext;
class HTMLContentSink : public nsIHTMLContentSink,
@ -903,17 +921,15 @@ static void
SetForm(nsIHTMLContent* aContent, nsIDOMHTMLFormElement* aForm)
{
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aContent));
NS_ASSERTION(formControl, "nsIDOMHTMLFormElement doesnt implement nsIFormControl?");
if (formControl) {
formControl->SetForm(aForm);
}
}
static nsresult
MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo,
nsIDOMHTMLFormElement* aForm, nsIDocShell* aDocShell,
nsIHTMLContent** aResult, PRBool aInsideNoXXXTag,
PRBool aFromParser);
nsIDOMHTMLFormElement* aForm, nsIHTMLContent** aResult,
PRBool aInsideNoXXXTag, PRBool aFromParser);
/**
* Factory subroutine to create all of the html content objects.
@ -965,7 +981,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
}
// Make the content object
rv = MakeContentObject(aNodeType, nodeInfo, aForm, aDocShell, aResult,
rv = MakeContentObject(aNodeType, nodeInfo, aForm, aResult,
!!mInsideNoXXXTag, PR_TRUE);
if (aNodeType == eHTMLTag_textarea && !mSkippedContent.IsEmpty()) {
@ -1028,7 +1044,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
}
if (aCaseSensitive) {
rv = MakeContentObject(nsHTMLTag(id), aNodeInfo, nsnull, nsnull,
rv = MakeContentObject(nsHTMLTag(id), aNodeInfo, nsnull,
aResult, PR_FALSE, PR_FALSE);
} else {
// Revese map id to name to get the correct character case in
@ -1052,7 +1068,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
}
}
rv = MakeContentObject(nsHTMLTag(id), nodeInfo, nsnull, nsnull, aResult,
rv = MakeContentObject(nsHTMLTag(id), nodeInfo, nsnull, aResult,
PR_FALSE, PR_FALSE);
}
@ -1117,306 +1133,57 @@ nsHTMLElementFactory::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
return rv;
}
// XXX compare switch statement against nsHTMLTags.h's list
nsresult
MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo,
nsIDOMHTMLFormElement* aForm, nsIDocShell* aDocShell,
nsIHTMLContent** aResult, PRBool aInsideNoXXXTag,
PRBool aFromParser)
nsIDOMHTMLFormElement* aForm, nsIHTMLContent** aResult,
PRBool aInsideNoXXXTag, PRBool aFromParser)
{
nsresult rv = NS_OK;
switch (aNodeType) {
case eHTMLTag_a:
rv = NS_NewHTMLAnchorElement(aResult, aNodeInfo);
break;
case eHTMLTag_applet:
rv = NS_NewHTMLAppletElement(aResult, aNodeInfo);
break;
case eHTMLTag_area:
rv = NS_NewHTMLAreaElement(aResult, aNodeInfo);
break;
case eHTMLTag_base:
rv = NS_NewHTMLBaseElement(aResult, aNodeInfo);
break;
case eHTMLTag_basefont:
rv = NS_NewHTMLBaseFontElement(aResult, aNodeInfo);
break;
case eHTMLTag_blockquote:
rv = NS_NewHTMLQuoteElement(aResult, aNodeInfo);
break;
case eHTMLTag_body:
rv = NS_NewHTMLBodyElement(aResult, aNodeInfo);
break;
case eHTMLTag_br:
rv = NS_NewHTMLBRElement(aResult, aNodeInfo);
break;
case eHTMLTag_button:
rv = NS_NewHTMLButtonElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_caption:
rv = NS_NewHTMLTableCaptionElement(aResult, aNodeInfo);
break;
case eHTMLTag_col:
rv = NS_NewHTMLTableColElement(aResult, aNodeInfo);
break;
case eHTMLTag_colgroup:
rv = NS_NewHTMLTableColGroupElement(aResult, aNodeInfo);
break;
case eHTMLTag_dir:
rv = NS_NewHTMLDirectoryElement(aResult, aNodeInfo);
break;
case eHTMLTag_del:
rv = NS_NewHTMLDelElement(aResult, aNodeInfo);
break;
case eHTMLTag_div:
case eHTMLTag_marquee:
case eHTMLTag_noembed:
case eHTMLTag_noframes:
case eHTMLTag_noscript:
case eHTMLTag_parsererror:
case eHTMLTag_sourcetext:
rv = NS_NewHTMLDivElement(aResult, aNodeInfo);
break;
case eHTMLTag_dl:
rv = NS_NewHTMLDListElement(aResult, aNodeInfo);
break;
case eHTMLTag_embed:
rv = NS_NewHTMLEmbedElement(aResult, aNodeInfo);
break;
case eHTMLTag_fieldset:
rv = NS_NewHTMLFieldSetElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_font:
rv = NS_NewHTMLFontElement(aResult, aNodeInfo);
break;
case eHTMLTag_form:
// the form was already created
if (aNodeType == eHTMLTag_form) {
if (aForm) {
rv = CallQueryInterface(aForm, aResult);
} else {
rv = NS_NewHTMLFormElement(aResult, aNodeInfo);
// the form was already created
return CallQueryInterface(aForm, aResult);
}
return NS_NewHTMLFormElement(aResult, aNodeInfo);
}
break;
case eHTMLTag_frame:
rv = NS_NewHTMLFrameElement(aResult, aNodeInfo);
break;
case eHTMLTag_frameset:
rv = NS_NewHTMLFrameSetElement(aResult, aNodeInfo);
break;
case eHTMLTag_h1:
case eHTMLTag_h2:
case eHTMLTag_h3:
case eHTMLTag_h4:
case eHTMLTag_h5:
case eHTMLTag_h6:
rv = NS_NewHTMLHeadingElement(aResult, aNodeInfo);
break;
case eHTMLTag_head:
rv = NS_NewHTMLHeadElement(aResult, aNodeInfo);
break;
case eHTMLTag_hr:
rv = NS_NewHTMLHRElement(aResult, aNodeInfo);
break;
case eHTMLTag_html:
rv = NS_NewHTMLHtmlElement(aResult, aNodeInfo);
break;
case eHTMLTag_iframe:
rv = NS_NewHTMLIFrameElement(aResult, aNodeInfo);
break;
case eHTMLTag_img:
rv = NS_NewHTMLImageElement(aResult, aNodeInfo);
break;
case eHTMLTag_input:
nsresult rv;
// The "creator" functions for input and select elements don't have
// the usual prototype and hence are not in the creator callback
// table
if (aNodeType == eHTMLTag_input) {
rv = NS_NewHTMLInputElement(aResult, aNodeInfo, aFromParser);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_ins:
rv = NS_NewHTMLInsElement(aResult, aNodeInfo);
break;
case eHTMLTag_isindex:
rv = NS_NewHTMLIsIndexElement(aResult, aNodeInfo);
break;
case eHTMLTag_label:
rv = NS_NewHTMLLabelElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
return rv;
}
break;
case eHTMLTag_legend:
rv = NS_NewHTMLLegendElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_li:
rv = NS_NewHTMLLIElement(aResult, aNodeInfo);
break;
case eHTMLTag_link:
rv = NS_NewHTMLLinkElement(aResult, aNodeInfo);
break;
case eHTMLTag_map:
rv = NS_NewHTMLMapElement(aResult, aNodeInfo);
break;
case eHTMLTag_menu:
rv = NS_NewHTMLMenuElement(aResult, aNodeInfo);
break;
case eHTMLTag_meta:
rv = NS_NewHTMLMetaElement(aResult, aNodeInfo);
break;
case eHTMLTag_object:
rv = NS_NewHTMLObjectElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_ol:
rv = NS_NewHTMLOListElement(aResult, aNodeInfo);
break;
case eHTMLTag_optgroup:
rv = NS_NewHTMLOptGroupElement(aResult, aNodeInfo);
break;
case eHTMLTag_option:
rv = NS_NewHTMLOptionElement(aResult, aNodeInfo);
break;
case eHTMLTag_p:
rv = NS_NewHTMLParagraphElement(aResult, aNodeInfo);
break;
case eHTMLTag_pre:
rv = NS_NewHTMLPreElement(aResult, aNodeInfo);
break;
case eHTMLTag_param:
rv = NS_NewHTMLParamElement(aResult, aNodeInfo);
break;
case eHTMLTag_q:
rv = NS_NewHTMLQuoteElement(aResult, aNodeInfo);
break;
case eHTMLTag_script:
rv = NS_NewHTMLScriptElement(aResult, aNodeInfo);
break;
case eHTMLTag_select:
if (aNodeType == eHTMLTag_select) {
rv = NS_NewHTMLSelectElement(aResult, aNodeInfo, aFromParser);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
return rv;
}
break;
case eHTMLTag_spacer:
rv = NS_NewHTMLSpacerElement(aResult, aNodeInfo);
rv = sContentCreatorCallbacks[aNodeType](aResult, aNodeInfo);
break;
case eHTMLTag_style:
rv = NS_NewHTMLStyleElement(aResult, aNodeInfo);
break;
case eHTMLTag_table:
rv = NS_NewHTMLTableElement(aResult, aNodeInfo);
break;
case eHTMLTag_tbody:
case eHTMLTag_thead:
case eHTMLTag_tfoot:
rv = NS_NewHTMLTableSectionElement(aResult, aNodeInfo);
break;
case eHTMLTag_td:
case eHTMLTag_th:
rv = NS_NewHTMLTableCellElement(aResult, aNodeInfo);
break;
switch (aNodeType) {
case eHTMLTag_button:
case eHTMLTag_fieldset:
case eHTMLTag_label:
case eHTMLTag_legend:
case eHTMLTag_object:
case eHTMLTag_textarea:
rv = NS_NewHTMLTextAreaElement(aResult, aNodeInfo);
if (!aInsideNoXXXTag) {
SetForm(*aResult, aForm);
}
break;
case eHTMLTag_title:
rv = NS_NewHTMLTitleElement(aResult, aNodeInfo);
break;
case eHTMLTag_tr:
rv = NS_NewHTMLTableRowElement(aResult, aNodeInfo);
break;
case eHTMLTag_ul:
rv = NS_NewHTMLUListElement(aResult, aNodeInfo);
break;
case eHTMLTag_wbr:
rv = NS_NewHTMLWBRElement(aResult, aNodeInfo);
break;
case eHTMLTag_unknown:
case eHTMLTag_userdefined:
rv = NS_NewHTMLUnknownElement(aResult, aNodeInfo);
break;
default:
rv = NS_NewHTMLSpanElement(aResult, aNodeInfo);
break;
}
return rv;
}
//----------------------------------------------------------------------
MOZ_DECL_CTOR_COUNTER(SinkContext)

Просмотреть файл

@ -41,8 +41,8 @@
This file contains the list of all HTML tags
See nsHTMLTags.h for access to the enum values for tags
It is designed to be used as inline input to nsHTMLTags.cpp *only*
through the magic of C preprocessing.
It is designed to be used as inline input to nsHTMLTags.cpp and
nsHTMLContentSink *only* through the magic of C preprocessing.
All entires must be enclosed in the macro HTML_TAG which will have cruel
and unusual things done to it
@ -50,123 +50,146 @@
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to HTML_TAG is both the enum identifier of the property
and the string value
The first argument to HTML_TAG is both the enum identifier of the
property and the string value. The second argument is the "creator"
method of the form NS_New$TAGNAMEElement, that will be used by
nsHTMLContentSink.cpp to create a content object for a tag of that
type. Use NOTUSED, if the particular tag has a non-standard creator.
The HTML_OTHER macro is for values in the nsHTMLTag enum that are
not strictly tags.
Entries *must* use only lowercase characters.
** Break these invarient and bad things will happen. **
******/
HTML_TAG(a, Anchor)
HTML_TAG(abbr, Span)
HTML_TAG(acronym, Span)
HTML_TAG(address, Span)
HTML_TAG(applet, Applet)
HTML_TAG(area, Area)
HTML_TAG(b, Span)
HTML_TAG(base, Base)
HTML_TAG(basefont, BaseFont)
HTML_TAG(bdo, Span)
HTML_TAG(bgsound, Span)
HTML_TAG(big, Span)
HTML_TAG(blink, Span)
HTML_TAG(blockquote, Quote)
HTML_TAG(body, Body)
HTML_TAG(br, BR)
HTML_TAG(button, Button)
HTML_TAG(caption, TableCaption)
HTML_TAG(center, Span)
HTML_TAG(cite, Span)
HTML_TAG(code, Span)
HTML_TAG(col, TableCol)
HTML_TAG(colgroup, TableColGroup)
HTML_TAG(counter, Span)
HTML_TAG(dd, Span)
HTML_TAG(del, Del)
HTML_TAG(dfn, Span)
HTML_TAG(dir, Directory)
HTML_TAG(div, Div)
HTML_TAG(dl, DList)
HTML_TAG(dt, Span)
HTML_TAG(em, Span)
HTML_TAG(embed, Embed)
HTML_TAG(endnote, Span)
HTML_TAG(fieldset, FieldSet)
HTML_TAG(font, Font)
HTML_TAG(form, NOTUSED)
HTML_TAG(frame, Frame)
HTML_TAG(frameset, FrameSet)
HTML_TAG(h1, Heading)
HTML_TAG(h2, Heading)
HTML_TAG(h3, Heading)
HTML_TAG(h4, Heading)
HTML_TAG(h5, Heading)
HTML_TAG(h6, Heading)
HTML_TAG(head, Head)
HTML_TAG(hr, HR)
HTML_TAG(html, Html)
HTML_TAG(i, Span)
HTML_TAG(iframe, IFrame)
HTML_TAG(image, Span)
HTML_TAG(img, Image)
HTML_TAG(input, NOTUSED)
HTML_TAG(ins, Ins)
HTML_TAG(isindex, IsIndex)
HTML_TAG(kbd, Span)
HTML_TAG(keygen, Span)
HTML_TAG(label, Label)
HTML_TAG(legend, Legend)
HTML_TAG(li, LI)
HTML_TAG(link, Link)
HTML_TAG(listing, Span)
HTML_TAG(map, Map)
HTML_TAG(marquee, Div)
HTML_TAG(menu, Menu)
HTML_TAG(meta, Meta)
HTML_TAG(multicol, Span)
HTML_TAG(nobr, Span)
HTML_TAG(noembed, Div)
HTML_TAG(noframes, Div)
HTML_TAG(noscript, Div)
HTML_TAG(object, Object)
HTML_TAG(ol, OList)
HTML_TAG(optgroup, OptGroup)
HTML_TAG(option, Option)
HTML_TAG(p, Paragraph)
HTML_TAG(param, Param)
HTML_TAG(parsererror, Div)
HTML_TAG(plaintext, Span)
HTML_TAG(pre, Pre)
HTML_TAG(q, Quote)
HTML_TAG(s, Span)
HTML_TAG(samp, Span)
HTML_TAG(script, Script)
HTML_TAG(select, NOTUSED)
HTML_TAG(server, Span)
HTML_TAG(small, Span)
HTML_TAG(sound, Span)
HTML_TAG(sourcetext, Div)
HTML_TAG(spacer, Spacer)
HTML_TAG(span, Span)
HTML_TAG(strike, Span)
HTML_TAG(strong, Span)
HTML_TAG(style, Style)
HTML_TAG(sub, Span)
HTML_TAG(sup, Span)
HTML_TAG(table, Table)
HTML_TAG(tbody, TableSection)
HTML_TAG(td, TableCell)
HTML_TAG(textarea, TextArea)
HTML_TAG(tfoot, TableSection)
HTML_TAG(th, TableCell)
HTML_TAG(thead, TableSection)
HTML_TAG(title, Title)
HTML_TAG(tr, TableRow)
HTML_TAG(tt, Span)
HTML_TAG(u, Span)
HTML_TAG(ul, UList)
HTML_TAG(var, Span)
HTML_TAG(wbr, WBR)
HTML_TAG(xmp, Span)
HTML_TAG(a)
HTML_TAG(abbr)
HTML_TAG(acronym)
HTML_TAG(address)
HTML_TAG(applet)
HTML_TAG(area)
HTML_TAG(b)
HTML_TAG(base)
HTML_TAG(basefont)
HTML_TAG(bdo)
HTML_TAG(bgsound)
HTML_TAG(big)
HTML_TAG(blink)
HTML_TAG(blockquote)
HTML_TAG(body)
HTML_TAG(br)
HTML_TAG(button)
HTML_TAG(caption)
HTML_TAG(center)
HTML_TAG(cite)
HTML_TAG(code)
HTML_TAG(col)
HTML_TAG(colgroup)
HTML_TAG(counter)
HTML_TAG(dd)
HTML_TAG(del)
HTML_TAG(dfn)
HTML_TAG(dir)
HTML_TAG(div)
HTML_TAG(dl)
HTML_TAG(dt)
HTML_TAG(em)
HTML_TAG(embed)
HTML_TAG(endnote)
HTML_TAG(fieldset)
HTML_TAG(font)
HTML_TAG(form)
HTML_TAG(frame)
HTML_TAG(frameset)
HTML_TAG(h1)
HTML_TAG(h2)
HTML_TAG(h3)
HTML_TAG(h4)
HTML_TAG(h5)
HTML_TAG(h6)
HTML_TAG(head)
HTML_TAG(hr)
HTML_TAG(html)
HTML_TAG(i)
HTML_TAG(iframe)
HTML_TAG(image)
HTML_TAG(img)
HTML_TAG(input)
HTML_TAG(ins)
HTML_TAG(isindex)
HTML_TAG(kbd)
HTML_TAG(keygen)
HTML_TAG(label)
HTML_TAG(legend)
HTML_TAG(li)
HTML_TAG(link)
HTML_TAG(listing)
HTML_TAG(map)
HTML_TAG(marquee)
HTML_TAG(menu)
HTML_TAG(meta)
HTML_TAG(multicol)
HTML_TAG(nobr)
HTML_TAG(noembed)
HTML_TAG(noframes)
HTML_TAG(noscript)
HTML_TAG(object)
HTML_TAG(ol)
HTML_TAG(optgroup)
HTML_TAG(option)
HTML_TAG(p)
HTML_TAG(param)
HTML_TAG(parsererror)
HTML_TAG(plaintext)
HTML_TAG(pre)
HTML_TAG(q)
HTML_TAG(s)
HTML_TAG(samp)
HTML_TAG(script)
HTML_TAG(select)
HTML_TAG(server)
HTML_TAG(small)
HTML_TAG(sound)
HTML_TAG(sourcetext)
HTML_TAG(spacer)
HTML_TAG(span)
HTML_TAG(strike)
HTML_TAG(strong)
HTML_TAG(style)
HTML_TAG(sub)
HTML_TAG(sup)
HTML_TAG(table)
HTML_TAG(tbody)
HTML_TAG(td)
HTML_TAG(textarea)
HTML_TAG(tfoot)
HTML_TAG(th)
HTML_TAG(thead)
HTML_TAG(title)
HTML_TAG(tr)
HTML_TAG(tt)
HTML_TAG(u)
HTML_TAG(ul)
HTML_TAG(var)
HTML_TAG(wbr)
HTML_TAG(xmp)
/* These are not for tags. But they will be included in the nsHTMLTag
enum anyway */
/* XXX: The second parameters in some of the following entries look
like they are just wrong. They should really be NOTUSED. For now,
I'm just emulating what nsHTMLContentSink has done all along.
*/
HTML_OTHER(text, Span)
HTML_OTHER(whitespace, Span)
HTML_OTHER(newline, Span)
HTML_OTHER(comment, Span)
HTML_OTHER(entity, Span)
HTML_OTHER(doctypeDecl, Span)
HTML_OTHER(markupDecl, Span)
HTML_OTHER(instruction, Span)
HTML_OTHER(userdefined, Unknown)

Просмотреть файл

@ -48,19 +48,15 @@
To change the list of tags, see nsHTMLTagList.h
*/
#define HTML_TAG(_tag) eHTMLTag_##_tag,
#define HTML_TAG(_tag, _classname) eHTMLTag_##_tag,
#define HTML_OTHER(_tag, _classname) eHTMLTag_##_tag,
enum nsHTMLTag {
/* this enum must be first and must be zero */
eHTMLTag_unknown = 0,
#include "nsHTMLTagList.h"
/* The remaining enums are not for tags */
eHTMLTag_text, eHTMLTag_whitespace, eHTMLTag_newline,
eHTMLTag_comment, eHTMLTag_entity, eHTMLTag_doctypeDecl,
eHTMLTag_markupDecl, eHTMLTag_instruction,
eHTMLTag_userdefined
};
#undef HTML_TAG
#undef HTML_OTHER
// Currently there are 110 HTML tags. eHTMLTag_text = 112.
#define NS_HTML_TAG_MAX PRInt32(eHTMLTag_text - 1)

Просмотреть файл

@ -269,20 +269,24 @@ static const PRUnichar sHTMLTagUnicodeName_xmp[] =
{'x', 'm', 'p', '\0'};
// static array of unicode tag names
#define HTML_TAG(_tag) sHTMLTagUnicodeName_##_tag,
#define HTML_TAG(_tag, _classname) sHTMLTagUnicodeName_##_tag,
#define HTML_OTHER(_tag, _classname)
static const PRUnichar* const kTagUnicodeTable[] = {
#include "nsHTMLTagList.h"
};
#undef HTML_TAG
#undef HTML_OTHER
#ifdef DEBUG
// static array of ASCII tag names for debugging purposes
#define HTML_TAG(_tag) #_tag,
#define HTML_TAG(_tag, _classname) #_tag,
#define HTML_OTHER(_tag, _classname)
static const char* const kTagASCIIDebugTable[] = {
#include "nsHTMLTagList.h"
};
#undef HTML_TAG
#undef HTML_OTHER
#endif
static PRInt32 gTableRefCount;

Просмотреть файл

@ -41,8 +41,8 @@
This file contains the list of all HTML tags
See nsHTMLTags.h for access to the enum values for tags
It is designed to be used as inline input to nsHTMLTags.cpp *only*
through the magic of C preprocessing.
It is designed to be used as inline input to nsHTMLTags.cpp and
nsHTMLContentSink *only* through the magic of C preprocessing.
All entires must be enclosed in the macro HTML_TAG which will have cruel
and unusual things done to it
@ -50,123 +50,146 @@
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to HTML_TAG is both the enum identifier of the property
and the string value
The first argument to HTML_TAG is both the enum identifier of the
property and the string value. The second argument is the "creator"
method of the form NS_New$TAGNAMEElement, that will be used by
nsHTMLContentSink.cpp to create a content object for a tag of that
type. Use NOTUSED, if the particular tag has a non-standard creator.
The HTML_OTHER macro is for values in the nsHTMLTag enum that are
not strictly tags.
Entries *must* use only lowercase characters.
** Break these invarient and bad things will happen. **
******/
HTML_TAG(a, Anchor)
HTML_TAG(abbr, Span)
HTML_TAG(acronym, Span)
HTML_TAG(address, Span)
HTML_TAG(applet, Applet)
HTML_TAG(area, Area)
HTML_TAG(b, Span)
HTML_TAG(base, Base)
HTML_TAG(basefont, BaseFont)
HTML_TAG(bdo, Span)
HTML_TAG(bgsound, Span)
HTML_TAG(big, Span)
HTML_TAG(blink, Span)
HTML_TAG(blockquote, Quote)
HTML_TAG(body, Body)
HTML_TAG(br, BR)
HTML_TAG(button, Button)
HTML_TAG(caption, TableCaption)
HTML_TAG(center, Span)
HTML_TAG(cite, Span)
HTML_TAG(code, Span)
HTML_TAG(col, TableCol)
HTML_TAG(colgroup, TableColGroup)
HTML_TAG(counter, Span)
HTML_TAG(dd, Span)
HTML_TAG(del, Del)
HTML_TAG(dfn, Span)
HTML_TAG(dir, Directory)
HTML_TAG(div, Div)
HTML_TAG(dl, DList)
HTML_TAG(dt, Span)
HTML_TAG(em, Span)
HTML_TAG(embed, Embed)
HTML_TAG(endnote, Span)
HTML_TAG(fieldset, FieldSet)
HTML_TAG(font, Font)
HTML_TAG(form, NOTUSED)
HTML_TAG(frame, Frame)
HTML_TAG(frameset, FrameSet)
HTML_TAG(h1, Heading)
HTML_TAG(h2, Heading)
HTML_TAG(h3, Heading)
HTML_TAG(h4, Heading)
HTML_TAG(h5, Heading)
HTML_TAG(h6, Heading)
HTML_TAG(head, Head)
HTML_TAG(hr, HR)
HTML_TAG(html, Html)
HTML_TAG(i, Span)
HTML_TAG(iframe, IFrame)
HTML_TAG(image, Span)
HTML_TAG(img, Image)
HTML_TAG(input, NOTUSED)
HTML_TAG(ins, Ins)
HTML_TAG(isindex, IsIndex)
HTML_TAG(kbd, Span)
HTML_TAG(keygen, Span)
HTML_TAG(label, Label)
HTML_TAG(legend, Legend)
HTML_TAG(li, LI)
HTML_TAG(link, Link)
HTML_TAG(listing, Span)
HTML_TAG(map, Map)
HTML_TAG(marquee, Div)
HTML_TAG(menu, Menu)
HTML_TAG(meta, Meta)
HTML_TAG(multicol, Span)
HTML_TAG(nobr, Span)
HTML_TAG(noembed, Div)
HTML_TAG(noframes, Div)
HTML_TAG(noscript, Div)
HTML_TAG(object, Object)
HTML_TAG(ol, OList)
HTML_TAG(optgroup, OptGroup)
HTML_TAG(option, Option)
HTML_TAG(p, Paragraph)
HTML_TAG(param, Param)
HTML_TAG(parsererror, Div)
HTML_TAG(plaintext, Span)
HTML_TAG(pre, Pre)
HTML_TAG(q, Quote)
HTML_TAG(s, Span)
HTML_TAG(samp, Span)
HTML_TAG(script, Script)
HTML_TAG(select, NOTUSED)
HTML_TAG(server, Span)
HTML_TAG(small, Span)
HTML_TAG(sound, Span)
HTML_TAG(sourcetext, Div)
HTML_TAG(spacer, Spacer)
HTML_TAG(span, Span)
HTML_TAG(strike, Span)
HTML_TAG(strong, Span)
HTML_TAG(style, Style)
HTML_TAG(sub, Span)
HTML_TAG(sup, Span)
HTML_TAG(table, Table)
HTML_TAG(tbody, TableSection)
HTML_TAG(td, TableCell)
HTML_TAG(textarea, TextArea)
HTML_TAG(tfoot, TableSection)
HTML_TAG(th, TableCell)
HTML_TAG(thead, TableSection)
HTML_TAG(title, Title)
HTML_TAG(tr, TableRow)
HTML_TAG(tt, Span)
HTML_TAG(u, Span)
HTML_TAG(ul, UList)
HTML_TAG(var, Span)
HTML_TAG(wbr, WBR)
HTML_TAG(xmp, Span)
HTML_TAG(a)
HTML_TAG(abbr)
HTML_TAG(acronym)
HTML_TAG(address)
HTML_TAG(applet)
HTML_TAG(area)
HTML_TAG(b)
HTML_TAG(base)
HTML_TAG(basefont)
HTML_TAG(bdo)
HTML_TAG(bgsound)
HTML_TAG(big)
HTML_TAG(blink)
HTML_TAG(blockquote)
HTML_TAG(body)
HTML_TAG(br)
HTML_TAG(button)
HTML_TAG(caption)
HTML_TAG(center)
HTML_TAG(cite)
HTML_TAG(code)
HTML_TAG(col)
HTML_TAG(colgroup)
HTML_TAG(counter)
HTML_TAG(dd)
HTML_TAG(del)
HTML_TAG(dfn)
HTML_TAG(dir)
HTML_TAG(div)
HTML_TAG(dl)
HTML_TAG(dt)
HTML_TAG(em)
HTML_TAG(embed)
HTML_TAG(endnote)
HTML_TAG(fieldset)
HTML_TAG(font)
HTML_TAG(form)
HTML_TAG(frame)
HTML_TAG(frameset)
HTML_TAG(h1)
HTML_TAG(h2)
HTML_TAG(h3)
HTML_TAG(h4)
HTML_TAG(h5)
HTML_TAG(h6)
HTML_TAG(head)
HTML_TAG(hr)
HTML_TAG(html)
HTML_TAG(i)
HTML_TAG(iframe)
HTML_TAG(image)
HTML_TAG(img)
HTML_TAG(input)
HTML_TAG(ins)
HTML_TAG(isindex)
HTML_TAG(kbd)
HTML_TAG(keygen)
HTML_TAG(label)
HTML_TAG(legend)
HTML_TAG(li)
HTML_TAG(link)
HTML_TAG(listing)
HTML_TAG(map)
HTML_TAG(marquee)
HTML_TAG(menu)
HTML_TAG(meta)
HTML_TAG(multicol)
HTML_TAG(nobr)
HTML_TAG(noembed)
HTML_TAG(noframes)
HTML_TAG(noscript)
HTML_TAG(object)
HTML_TAG(ol)
HTML_TAG(optgroup)
HTML_TAG(option)
HTML_TAG(p)
HTML_TAG(param)
HTML_TAG(parsererror)
HTML_TAG(plaintext)
HTML_TAG(pre)
HTML_TAG(q)
HTML_TAG(s)
HTML_TAG(samp)
HTML_TAG(script)
HTML_TAG(select)
HTML_TAG(server)
HTML_TAG(small)
HTML_TAG(sound)
HTML_TAG(sourcetext)
HTML_TAG(spacer)
HTML_TAG(span)
HTML_TAG(strike)
HTML_TAG(strong)
HTML_TAG(style)
HTML_TAG(sub)
HTML_TAG(sup)
HTML_TAG(table)
HTML_TAG(tbody)
HTML_TAG(td)
HTML_TAG(textarea)
HTML_TAG(tfoot)
HTML_TAG(th)
HTML_TAG(thead)
HTML_TAG(title)
HTML_TAG(tr)
HTML_TAG(tt)
HTML_TAG(u)
HTML_TAG(ul)
HTML_TAG(var)
HTML_TAG(wbr)
HTML_TAG(xmp)
/* These are not for tags. But they will be included in the nsHTMLTag
enum anyway */
/* XXX: The second parameters in some of the following entries look
like they are just wrong. They should really be NOTUSED. For now,
I'm just emulating what nsHTMLContentSink has done all along.
*/
HTML_OTHER(text, Span)
HTML_OTHER(whitespace, Span)
HTML_OTHER(newline, Span)
HTML_OTHER(comment, Span)
HTML_OTHER(entity, Span)
HTML_OTHER(doctypeDecl, Span)
HTML_OTHER(markupDecl, Span)
HTML_OTHER(instruction, Span)
HTML_OTHER(userdefined, Unknown)

Просмотреть файл

@ -48,19 +48,15 @@
To change the list of tags, see nsHTMLTagList.h
*/
#define HTML_TAG(_tag) eHTMLTag_##_tag,
#define HTML_TAG(_tag, _classname) eHTMLTag_##_tag,
#define HTML_OTHER(_tag, _classname) eHTMLTag_##_tag,
enum nsHTMLTag {
/* this enum must be first and must be zero */
eHTMLTag_unknown = 0,
#include "nsHTMLTagList.h"
/* The remaining enums are not for tags */
eHTMLTag_text, eHTMLTag_whitespace, eHTMLTag_newline,
eHTMLTag_comment, eHTMLTag_entity, eHTMLTag_doctypeDecl,
eHTMLTag_markupDecl, eHTMLTag_instruction,
eHTMLTag_userdefined
};
#undef HTML_TAG
#undef HTML_OTHER
// Currently there are 110 HTML tags. eHTMLTag_text = 112.
#define NS_HTML_TAG_MAX PRInt32(eHTMLTag_text - 1)

Просмотреть файл

@ -269,20 +269,24 @@ static const PRUnichar sHTMLTagUnicodeName_xmp[] =
{'x', 'm', 'p', '\0'};
// static array of unicode tag names
#define HTML_TAG(_tag) sHTMLTagUnicodeName_##_tag,
#define HTML_TAG(_tag, _classname) sHTMLTagUnicodeName_##_tag,
#define HTML_OTHER(_tag, _classname)
static const PRUnichar* const kTagUnicodeTable[] = {
#include "nsHTMLTagList.h"
};
#undef HTML_TAG
#undef HTML_OTHER
#ifdef DEBUG
// static array of ASCII tag names for debugging purposes
#define HTML_TAG(_tag) #_tag,
#define HTML_TAG(_tag, _classname) #_tag,
#define HTML_OTHER(_tag, _classname)
static const char* const kTagASCIIDebugTable[] = {
#include "nsHTMLTagList.h"
};
#undef HTML_TAG
#undef HTML_OTHER
#endif
static PRInt32 gTableRefCount;