1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/htmlparser/src/nsElementTable.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + * MODULE NOTES: 1.12 + * @update gess 4/1/98 1.13 + * 1.14 + */ 1.15 + 1.16 + 1.17 + 1.18 +#ifndef _NSELEMENTABLE 1.19 +#define _NSELEMENTABLE 1.20 + 1.21 +#include "nsHTMLTags.h" 1.22 +#include "nsIDTD.h" 1.23 + 1.24 +//********************************************************************************************* 1.25 +// The following ints define the standard groups of HTML elements... 1.26 +//********************************************************************************************* 1.27 + 1.28 +static const int kNone= 0x0; 1.29 + 1.30 +static const int kHTMLContent = 0x0001; // HEAD, (FRAMESET | BODY) 1.31 +static const int kHeadContent = 0x0002; // Elements that *must* be in the head. 1.32 +static const int kHeadMisc = 0x0004; // Elements that *can* be in the head. 1.33 + 1.34 +static const int kSpecial = 0x0008; // A, IMG, APPLET, OBJECT, FONT, BASEFONT, BR, SCRIPT, 1.35 + // MAP, Q, SUB, SUP, SPAN, BDO, IFRAME 1.36 + 1.37 +static const int kFormControl = 0x0010; // INPUT SELECT TEXTAREA LABEL BUTTON 1.38 +static const int kPreformatted = 0x0020; // PRE 1.39 +static const int kPreExclusion = 0x0040; // IMG, OBJECT, APPLET, BIG, SMALL, SUB, SUP, FONT, BASEFONT 1.40 +static const int kFontStyle = 0x0080; // TT, I, B, U, S, STRIKE, BIG, SMALL 1.41 +static const int kPhrase = 0x0100; // EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM 1.42 +static const int kHeading = 0x0200; // H1..H6 1.43 +static const int kBlockMisc = 0x0400; // OBJECT, SCRIPT 1.44 +static const int kBlock = 0x0800; // ADDRESS, BLOCKQUOTE, CENTER, DIV, DL, FIELDSET, FORM, 1.45 + // ISINDEX, HR, NOSCRIPT, NOFRAMES, P, TABLE 1.46 +static const int kList = 0x1000; // UL, OL, DIR, MENU 1.47 +static const int kPCDATA = 0x2000; // plain text and entities... 1.48 +static const int kSelf = 0x4000; // whatever THIS tag is... 1.49 +static const int kExtensions = 0x8000; // BGSOUND, WBR, NOBR 1.50 +static const int kTable = 0x10000;// TR,TD,THEAD,TBODY,TFOOT,CAPTION,TH 1.51 +static const int kDLChild = 0x20000;// DL, DT 1.52 +static const int kCDATA = 0x40000;// just plain text... 1.53 + 1.54 +static const int kInlineEntity = (kPCDATA|kFontStyle|kPhrase|kSpecial|kFormControl|kExtensions); // #PCDATA, %fontstyle, %phrase, %special, %formctrl 1.55 +static const int kBlockEntity = (kHeading|kList|kPreformatted|kBlock); // %heading, %list, %preformatted, %block 1.56 +static const int kFlowEntity = (kBlockEntity|kInlineEntity); // %blockentity, %inlineentity 1.57 +static const int kAllTags = 0xffffff; 1.58 + 1.59 + 1.60 +//********************************************************************************************* 1.61 +// The following ints define the standard groups of HTML elements... 1.62 +//********************************************************************************************* 1.63 + 1.64 +#ifdef DEBUG 1.65 +extern void CheckElementTable(); 1.66 +#endif 1.67 + 1.68 + 1.69 +/** 1.70 + * We're asking the question: is aTest a member of bitset. 1.71 + * 1.72 + * @param 1.73 + * @return TRUE or FALSE 1.74 + */ 1.75 +inline bool TestBits(int aBitset,int aTest) { 1.76 + if(aTest) { 1.77 + int32_t result=(aBitset & aTest); 1.78 + return bool(result==aTest); 1.79 + } 1.80 + return false; 1.81 +} 1.82 + 1.83 +struct nsHTMLElement { 1.84 + bool IsMemberOf(int32_t aType) const; 1.85 + 1.86 + eHTMLTags mTagID; 1.87 + int mParentBits; //defines groups that can contain this element 1.88 + bool mLeaf; 1.89 + 1.90 + static bool IsContainer(eHTMLTags aTag); 1.91 +}; 1.92 + 1.93 +extern const nsHTMLElement gHTMLElements[]; 1.94 + 1.95 +#endif