parser/htmlparser/src/nsElementTable.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:d37a92322c4e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /**
8 * MODULE NOTES:
9 * @update gess 4/1/98
10 *
11 */
12
13
14
15 #ifndef _NSELEMENTABLE
16 #define _NSELEMENTABLE
17
18 #include "nsHTMLTags.h"
19 #include "nsIDTD.h"
20
21 //*********************************************************************************************
22 // The following ints define the standard groups of HTML elements...
23 //*********************************************************************************************
24
25 static const int kNone= 0x0;
26
27 static const int kHTMLContent = 0x0001; // HEAD, (FRAMESET | BODY)
28 static const int kHeadContent = 0x0002; // Elements that *must* be in the head.
29 static const int kHeadMisc = 0x0004; // Elements that *can* be in the head.
30
31 static const int kSpecial = 0x0008; // A, IMG, APPLET, OBJECT, FONT, BASEFONT, BR, SCRIPT,
32 // MAP, Q, SUB, SUP, SPAN, BDO, IFRAME
33
34 static const int kFormControl = 0x0010; // INPUT SELECT TEXTAREA LABEL BUTTON
35 static const int kPreformatted = 0x0020; // PRE
36 static const int kPreExclusion = 0x0040; // IMG, OBJECT, APPLET, BIG, SMALL, SUB, SUP, FONT, BASEFONT
37 static const int kFontStyle = 0x0080; // TT, I, B, U, S, STRIKE, BIG, SMALL
38 static const int kPhrase = 0x0100; // EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM
39 static const int kHeading = 0x0200; // H1..H6
40 static const int kBlockMisc = 0x0400; // OBJECT, SCRIPT
41 static const int kBlock = 0x0800; // ADDRESS, BLOCKQUOTE, CENTER, DIV, DL, FIELDSET, FORM,
42 // ISINDEX, HR, NOSCRIPT, NOFRAMES, P, TABLE
43 static const int kList = 0x1000; // UL, OL, DIR, MENU
44 static const int kPCDATA = 0x2000; // plain text and entities...
45 static const int kSelf = 0x4000; // whatever THIS tag is...
46 static const int kExtensions = 0x8000; // BGSOUND, WBR, NOBR
47 static const int kTable = 0x10000;// TR,TD,THEAD,TBODY,TFOOT,CAPTION,TH
48 static const int kDLChild = 0x20000;// DL, DT
49 static const int kCDATA = 0x40000;// just plain text...
50
51 static const int kInlineEntity = (kPCDATA|kFontStyle|kPhrase|kSpecial|kFormControl|kExtensions); // #PCDATA, %fontstyle, %phrase, %special, %formctrl
52 static const int kBlockEntity = (kHeading|kList|kPreformatted|kBlock); // %heading, %list, %preformatted, %block
53 static const int kFlowEntity = (kBlockEntity|kInlineEntity); // %blockentity, %inlineentity
54 static const int kAllTags = 0xffffff;
55
56
57 //*********************************************************************************************
58 // The following ints define the standard groups of HTML elements...
59 //*********************************************************************************************
60
61 #ifdef DEBUG
62 extern void CheckElementTable();
63 #endif
64
65
66 /**
67 * We're asking the question: is aTest a member of bitset.
68 *
69 * @param
70 * @return TRUE or FALSE
71 */
72 inline bool TestBits(int aBitset,int aTest) {
73 if(aTest) {
74 int32_t result=(aBitset & aTest);
75 return bool(result==aTest);
76 }
77 return false;
78 }
79
80 struct nsHTMLElement {
81 bool IsMemberOf(int32_t aType) const;
82
83 eHTMLTags mTagID;
84 int mParentBits; //defines groups that can contain this element
85 bool mLeaf;
86
87 static bool IsContainer(eHTMLTags aTag);
88 };
89
90 extern const nsHTMLElement gHTMLElements[];
91
92 #endif

mercurial