From 616283266dc195c81ff19bebade1eddca1e0b3ed Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Mon, 13 Sep 2004 20:43:15 +0000 Subject: [PATCH] Remove bogus "support" for and . Bug 210658, patch by Blake Kaplan , r+sr=bzbarsky --- parser/htmlparser/public/nsHTMLTagList.h | 2 - parser/htmlparser/public/nsHTMLTags.h | 2 +- parser/htmlparser/src/COtherElements.h | 2 - parser/htmlparser/src/nsElementTable.cpp | 18 -- parser/htmlparser/src/nsHTMLTags.cpp | 6 +- parser/htmlparser/tools/gentags.pl | 375 ----------------------- 6 files changed, 2 insertions(+), 403 deletions(-) diff --git a/parser/htmlparser/public/nsHTMLTagList.h b/parser/htmlparser/public/nsHTMLTagList.h index 70def89f2b5..aadb05edac1 100644 --- a/parser/htmlparser/public/nsHTMLTagList.h +++ b/parser/htmlparser/public/nsHTMLTagList.h @@ -140,7 +140,6 @@ HTML_TAG(optgroup, OptGroup) HTML_TAG(option, Option) HTML_TAG(p, Paragraph) HTML_TAG(param, Shared) -HTML_TAG(parsererror, Div) HTML_TAG(plaintext, Span) HTML_TAG(pre, Pre) HTML_TAG(q, Shared) @@ -151,7 +150,6 @@ HTML_TAG(select, Select) HTML_TAG(server, Span) HTML_TAG(small, Span) HTML_TAG(sound, Span) -HTML_TAG(sourcetext, Div) HTML_TAG(spacer, Shared) HTML_TAG(span, Span) HTML_TAG(strike, Span) diff --git a/parser/htmlparser/public/nsHTMLTags.h b/parser/htmlparser/public/nsHTMLTags.h index f9243468948..214b732b504 100644 --- a/parser/htmlparser/public/nsHTMLTags.h +++ b/parser/htmlparser/public/nsHTMLTags.h @@ -63,7 +63,7 @@ enum nsHTMLTag { #undef HTML_TAG #undef HTML_OTHER -// Currently there are 110 HTML tags. eHTMLTag_text = 112. +// Currently there are 108 HTML tags. eHTMLTag_text = 110. #define NS_HTML_TAG_MAX PRInt32(eHTMLTag_text - 1) class nsHTMLTags { diff --git a/parser/htmlparser/src/COtherElements.h b/parser/htmlparser/src/COtherElements.h index 7d40be9428a..0b2c1b4a6fb 100644 --- a/parser/htmlparser/src/COtherElements.h +++ b/parser/htmlparser/src/COtherElements.h @@ -2345,7 +2345,6 @@ void CElementTable::InitializeElements() { mDfltElements[eHTMLTag_p].mContainsGroups.mBits.mSelf=0; CElement::InitializeLeaf( mDfltElements[eHTMLTag_param], eHTMLTag_param, CElement::GetEmptyGroup(), CLeafElement::GetContainedGroups()); - CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror); CElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext); CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre); mDfltElements[eHTMLTag_pre].mExcludeKids=kPreExcludeKids; @@ -2365,7 +2364,6 @@ void CElementTable::InitializeElements() { CElement::Initialize( mDfltElements[eHTMLTag_server], eHTMLTag_server); CFontStyleElement::Initialize( mDfltElements[eHTMLTag_small], eHTMLTag_small); - CElement::Initialize( mDfltElements[eHTMLTag_sourcetext], eHTMLTag_sourcetext); CElement::Initialize( mDfltElements[eHTMLTag_spacer], eHTMLTag_spacer); CSpecialElement::Initialize( mDfltElements[eHTMLTag_span], eHTMLTag_span); CFontStyleElement::Initialize( mDfltElements[eHTMLTag_strike], eHTMLTag_strike); diff --git a/parser/htmlparser/src/nsElementTable.cpp b/parser/htmlparser/src/nsElementTable.cpp index 23b0f792744..9bb9320f9ad 100644 --- a/parser/htmlparser/src/nsElementTable.cpp +++ b/parser/htmlparser/src/nsElementTable.cpp @@ -943,15 +943,6 @@ void InitializeElementTable(void) { /*special props, prop-range*/ kNonContainer, kNoPropRange, /*special parents,kids,skip*/ &gParamParents,0,eHTMLTag_unknown); - Initialize( - /*tag*/ eHTMLTag_parsererror, - /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, - /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, - /*autoclose starttags and endtags*/ &gDivAutoClose,0,0,0, - /*parent,incl,exclgroups*/ kNone, (kSelf|kFlowEntity), kNone, - /*special props, prop-range*/ 0, kNoPropRange, - /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); - Initialize( /*tag*/ eHTMLTag_plaintext, /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, @@ -1043,15 +1034,6 @@ void InitializeElementTable(void) { /*special props, prop-range*/ kNonContainer,kDefaultPropRange, // Ref. to Bug 25749 /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); - Initialize( - /*tag*/ eHTMLTag_sourcetext, - /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, - /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, - /*autoclose starttags and endtags*/ &gDivAutoClose,0,0,0, - /*parent,incl,exclgroups*/ kNone, (kSelf|kFlowEntity), kNone, - /*special props, prop-range*/ 0,kDefaultPropRange, - /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); - Initialize( /*tag*/ eHTMLTag_spacer, diff --git a/parser/htmlparser/src/nsHTMLTags.cpp b/parser/htmlparser/src/nsHTMLTags.cpp index cac9ab4db85..a39a785232f 100644 --- a/parser/htmlparser/src/nsHTMLTags.cpp +++ b/parser/htmlparser/src/nsHTMLTags.cpp @@ -199,8 +199,6 @@ static const PRUnichar sHTMLTagUnicodeName_p[] = {'p', '\0'}; static const PRUnichar sHTMLTagUnicodeName_param[] = {'p', 'a', 'r', 'a', 'm', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_parsererror[] = - {'p', 'a', 'r', 's', 'e', 'r', 'e', 'r', 'r', 'o', 'r', '\0'}; static const PRUnichar sHTMLTagUnicodeName_plaintext[] = {'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't', '\0'}; static const PRUnichar sHTMLTagUnicodeName_pre[] = @@ -221,8 +219,6 @@ static const PRUnichar sHTMLTagUnicodeName_small[] = {'s', 'm', 'a', 'l', 'l', '\0'}; static const PRUnichar sHTMLTagUnicodeName_sound[] = {'s', 'o', 'u', 'n', 'd', '\0'}; -static const PRUnichar sHTMLTagUnicodeName_sourcetext[] = - {'s', 'o', 'u', 'r', 'c', 'e', 't', 'e', 'x', 't', '\0'}; static const PRUnichar sHTMLTagUnicodeName_spacer[] = {'s', 'p', 'a', 'c', 'e', 'r', '\0'}; static const PRUnichar sHTMLTagUnicodeName_span[] = @@ -310,7 +306,7 @@ HTMLTagsKeyCompareUCPtr(const void *key1, const void *key2) static PRUint32 sMaxTagNameLength; -#define NS_HTMLTAG_NAME_MAX_LENGTH 11 +#define NS_HTMLTAG_NAME_MAX_LENGTH 10 // static nsresult diff --git a/parser/htmlparser/tools/gentags.pl b/parser/htmlparser/tools/gentags.pl index 97a9e78713f..e69de29bb2d 100644 --- a/parser/htmlparser/tools/gentags.pl +++ b/parser/htmlparser/tools/gentags.pl @@ -1,375 +0,0 @@ -#! /usr/local/bin/perl - -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla Communicator client code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -###################################################################### - -# Table of tag names; it doesn't have to be sorted because code -# below will do it. However, for the sake of ease of additions, keep -# it sorted so that its easy to tell where to add a new tag and that -# the tag hasn't already been added. -$i = 0; -$tags[$i++] = "a"; -$tags[$i++] = "abbr"; -$tags[$i++] = "acronym"; -$tags[$i++] = "address"; -$tags[$i++] = "applet"; -$tags[$i++] = "area"; -$tags[$i++] = "b"; -$tags[$i++] = "base"; -$tags[$i++] = "basefont"; -$tags[$i++] = "bdo"; -$tags[$i++] = "bgsound"; -$tags[$i++] = "big"; -$tags[$i++] = "blink"; -$tags[$i++] = "blockquote"; -$tags[$i++] = "body"; -$tags[$i++] = "br"; -$tags[$i++] = "button"; -$tags[$i++] = "caption"; -$tags[$i++] = "center"; -$tags[$i++] = "cite"; -$tags[$i++] = "code"; -$tags[$i++] = "col"; -$tags[$i++] = "colgroup"; -$tags[$i++] = "dd"; -$tags[$i++] = "del"; -$tags[$i++] = "dfn"; -$tags[$i++] = "dir"; -$tags[$i++] = "div"; -$tags[$i++] = "dl"; -$tags[$i++] = "dt"; -$tags[$i++] = "em"; -$tags[$i++] = "embed"; -$tags[$i++] = "endnote"; -$tags[$i++] = "fieldset"; -$tags[$i++] = "font"; -$tags[$i++] = "form"; -$tags[$i++] = "frame"; -$tags[$i++] = "frameset"; -$tags[$i++] = "h1"; -$tags[$i++] = "h2"; -$tags[$i++] = "h3"; -$tags[$i++] = "h4"; -$tags[$i++] = "h5"; -$tags[$i++] = "h6"; -$tags[$i++] = "head"; -$tags[$i++] = "hr"; -$tags[$i++] = "html"; -$tags[$i++] = "i"; -$tags[$i++] = "iframe"; -$tags[$i++] = "ilayer"; -$tags[$i++] = "image"; -$tags[$i++] = "img"; -$tags[$i++] = "input"; -$tags[$i++] = "ins"; -$tags[$i++] = "isindex"; -$tags[$i++] = "kbd"; -$tags[$i++] = "keygen"; -$tags[$i++] = "label"; -$tags[$i++] = "layer"; -$tags[$i++] = "legend"; -$tags[$i++] = "li"; -$tags[$i++] = "link"; -$tags[$i++] = "listing"; -$tags[$i++] = "map"; -$tags[$i++] = "menu"; -$tags[$i++] = "meta"; -$tags[$i++] = "multicol"; -$tags[$i++] = "nobr"; -$tags[$i++] = "noembed"; -$tags[$i++] = "noframes"; -$tags[$i++] = "nolayer"; -$tags[$i++] = "noscript"; -$tags[$i++] = "object"; -$tags[$i++] = "ol"; -$tags[$i++] = "optgroup"; -$tags[$i++] = "option"; -$tags[$i++] = "p"; -$tags[$i++] = "param"; -$tags[$i++] = "parsererror"; -$tags[$i++] = "plaintext"; -$tags[$i++] = "pre"; -$tags[$i++] = "q"; -$tags[$i++] = "s"; -$tags[$i++] = "samp"; -$tags[$i++] = "script"; -$tags[$i++] = "select"; -$tags[$i++] = "server"; -$tags[$i++] = "small"; -$tags[$i++] = "sound"; -$tags[$i++] = "sourcetext"; -$tags[$i++] = "spacer"; -$tags[$i++] = "span"; -$tags[$i++] = "strike"; -$tags[$i++] = "strong"; -$tags[$i++] = "style"; -$tags[$i++] = "sub"; -$tags[$i++] = "sup"; -$tags[$i++] = "table"; -$tags[$i++] = "tbody"; -$tags[$i++] = "td"; -$tags[$i++] = "textarea"; -$tags[$i++] = "tfoot"; -$tags[$i++] = "th"; -$tags[$i++] = "thead"; -$tags[$i++] = "title"; -$tags[$i++] = "tr"; -$tags[$i++] = "tt"; -$tags[$i++] = "u"; -$tags[$i++] = "ul"; -$tags[$i++] = "var"; -$tags[$i++] = "wbr"; -$tags[$i++] = "xmp"; - -###################################################################### - -# These are not tags; rather they are extra values to place into the -# tag enumeration after the normal tags. These do not need to be sorted -# and they do not go into the tag table, just into the tag enumeration. -$extra = 0; -$extra_tags[$extra++] = "text"; -$extra_tags[$extra++] = "whitespace"; -$extra_tags[$extra++] = "newline"; -$extra_tags[$extra++] = "comment"; -$extra_tags[$extra++] = "entity"; -$extra_tags[$extra++] = "userdefined"; -$extra_tags[$extra++] = "secret_h1style"; -$extra_tags[$extra++] = "secret_h2style"; -$extra_tags[$extra++] = "secret_h3style"; -$extra_tags[$extra++] = "secret_h4style"; -$extra_tags[$extra++] = "secret_h5style"; -$extra_tags[$extra++] = "secret_h6style"; - -###################################################################### - -# Sort the tag table before using it -@tags = sort @tags; - -$copyright = <$file_base.h"); - -# Print out copyright and do not edit notice -print HEADER_FILE $copyright; -print HEADER_FILE "#ifndef " . $file_base . "_h___\n"; -print HEADER_FILE "#define " . $file_base . "_h___\n"; - -# Print out enum's for the tag symbols -print HEADER_FILE "enum nsHTMLTag {\n"; -print HEADER_FILE " /* this enum must be first and must be zero */\n"; -print HEADER_FILE " eHTMLTag_unknown=0,\n\n"; -print HEADER_FILE " /* begin tag enums */\n "; -$width = 2; -print HEADER_FILE $str; -for ($j = 0; $j < $i; $j++) { - $lower = $tags[$j]; - $lower =~ tr/A-Z/a-z/; - $str = "eHTMLTag_" . $lower . "=" . ($j + 1); - $str = $str . ", "; - $len = length($str); - if ($width + $len > 78) { - print HEADER_FILE "\n "; - $width = 2; - } - print HEADER_FILE $str; - $width = $width + $len; -} -print HEADER_FILE "\n\n /* The remaining enums are not for tags */\n "; - -# Print out extra enum's that are not in the tag table -$width = 2; -for ($k = 0; $k < $extra; $k++) { - $lower = $extra_tags[$k]; - $lower =~ tr/A-Z/a-z/; - $str = "eHTMLTag_" . $lower . "=" . ($j + $k + 1); - if ($k < $extra - 1) { - $str = $str . ", "; - } - $len = length($str); - if ($width + $len > 78) { - print HEADER_FILE "\n "; - $width = 2; - } - print HEADER_FILE $str; - $width = $width + $len; -} - -print HEADER_FILE "\n};\n#define NS_HTML_TAG_MAX " . $j . "\n\n"; -print HEADER_FILE - "extern nsHTMLTag NS_TagToEnum(const char* aTag);\n"; -print HEADER_FILE - "extern const char* NS_EnumToTag(nsHTMLTag aEnum);\n\n"; -print HEADER_FILE "#endif /* " . $file_base . "_h___ */\n"; -close(HEADER_FILE); - -###################################################################### - -# Generate the source file -open(CPP_FILE, ">$file_base.cpp"); -print CPP_FILE $copyright; -print CPP_FILE "#include \"nsCRT.h\"\n"; -print CPP_FILE "#include \"$file_base.h\"\n\n"; - -# Print out table of tag names -print CPP_FILE "static char* tagTable[] = {\n "; -$width = 2; -for ($j = 0; $j < $i; $j++) { - $lower = $tags[$j]; - $lower =~ tr/A-Z/a-z/; - $str = "\"" . $lower . "\""; - if ($j < $i - 1) { - $str = $str . ", "; - } - $len = length($str); - if ($width + $len > 78) { - print CPP_FILE "\n "; - $width = 2; - } - print CPP_FILE $str; - $width = $width + $len; -} -print CPP_FILE "\n};\n"; - -# Finally, dump out the search routine that takes a char* and finds it -# in the table. -print CPP_FILE " -nsHTMLTag NS_TagToEnum(const char* aTagName) { - int low = 0; - int high = NS_HTML_TAG_MAX - 1; - while (low <= high) { - int middle = (low + high) >> 1; - int result = nsCRT::strcasecmp(aTagName, tagTable[middle]); - if (result == 0) - return (nsHTMLTag) (middle + 1); - if (result < 0) - high = middle - 1; - else - low = middle + 1; - } - return eHTMLTag_userdefined; -} - -const char* NS_EnumToTag(nsHTMLTag aTagID) { - if ((int(aTagID) <= 0) || (int(aTagID) > NS_HTML_TAG_MAX)) { - return 0; - } - return tagTable[int(aTagID) - 1]; -} - -#ifdef NS_DEBUG -#include - -class nsTestTagTable { -public: - nsTestTagTable() { - const char *tag; - nsHTMLTag id; - - // Make sure we can find everything we are supposed to - for (int i = 0; i < NS_HTML_TAG_MAX; i++) { - tag = tagTable[i]; - id = NS_TagToEnum(tag); - NS_ASSERTION(id != eHTMLTag_userdefined, \"can't find tag id\"); - const char* check = NS_EnumToTag(id); - NS_ASSERTION(check == tag, \"can't map id back to tag\"); - } - - // Make sure we don't find things that aren't there - id = NS_TagToEnum(\"@\"); - NS_ASSERTION(id == eHTMLTag_userdefined, \"found @\"); - id = NS_TagToEnum(\"zzzzz\"); - NS_ASSERTION(id == eHTMLTag_userdefined, \"found zzzzz\"); - - tag = NS_EnumToTag((nsHTMLTag) 0); - NS_ASSERTION(0 == tag, \"found enum 0\"); - tag = NS_EnumToTag((nsHTMLTag) -1); - NS_ASSERTION(0 == tag, \"found enum -1\"); - tag = NS_EnumToTag((nsHTMLTag) (NS_HTML_TAG_MAX + 1)); - NS_ASSERTION(0 == tag, \"found past max enum\"); - } -}; -nsTestTagTable validateTagTable; -#endif - -"; - -close(CPP_FILE);