Bug 1424548 - Part 9a: clang-format generated HTML parser code. r=hsivonen

--HG--
extra : rebase_source : 67a0555475dbce49c689d27510dca252089a4a7b
This commit is contained in:
Chris Peterson 2017-12-21 00:02:43 -08:00
parent 16e0dd144e
commit 946cc287a2
16 changed files with 3042 additions and 2630 deletions

View File

@ -62,7 +62,7 @@ nsAtom** nsHtml5AttributeName::ALL_NO_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XMLNS_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XLINK_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XML_PREFIX = 0;
nsAtom**
nsAtom**
nsHtml5AttributeName::SVG_DIFFERENT(nsAtom* name, nsAtom* camel)
{
nsAtom** arr = new nsAtom*[4];
@ -72,7 +72,7 @@ nsHtml5AttributeName::SVG_DIFFERENT(nsAtom* name, nsAtom* camel)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::MATH_DIFFERENT(nsAtom* name, nsAtom* camel)
{
nsAtom** arr = new nsAtom*[4];
@ -82,7 +82,7 @@ nsHtml5AttributeName::MATH_DIFFERENT(nsAtom* name, nsAtom* camel)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix)
{
nsAtom** arr = new nsAtom*[4];
@ -92,7 +92,7 @@ nsHtml5AttributeName::COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::SAME_LOCAL(nsAtom* name)
{
nsAtom** arr = new nsAtom*[4];
@ -130,32 +130,31 @@ nsHtml5AttributeName::createAttributeName(nsAtom* name)
ALL_NO_PREFIX);
}
nsHtml5AttributeName::~nsHtml5AttributeName()
{
MOZ_COUNT_DTOR(nsHtml5AttributeName);
delete[] local;
}
int32_t
int32_t
nsHtml5AttributeName::getUri(int32_t mode)
{
return uri[mode];
}
nsAtom*
nsAtom*
nsHtml5AttributeName::getLocal(int32_t mode)
{
return local[mode];
}
nsAtom*
nsAtom*
nsHtml5AttributeName::getPrefix(int32_t mode)
{
return prefix[mode];
}
bool
bool
nsHtml5AttributeName::equalsAnother(nsHtml5AttributeName* another)
{
return this->getLocal(nsHtml5AttributeName::HTML) ==
@ -743,7 +742,10 @@ static int32_t const ATTRIBUTE_HASHES_DATA[] = {
2007064819, 2008401563, 2009041198, 2009079867, 2009231684, 2010716309,
2016711994, 2016810187, 2017010843, 2019887833, 2023342821, 2024647008
};
staticJArray<int32_t,int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = { ATTRIBUTE_HASHES_DATA, MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA) };
staticJArray<int32_t, int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = {
ATTRIBUTE_HASHES_DATA,
MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA)
};
void
nsHtml5AttributeName::initializeStatics()
{
@ -2901,5 +2903,3 @@ nsHtml5AttributeName::releaseStatics()
delete ATTR_REFY;
delete[] ATTRIBUTE_NAMES;
}

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,6 @@ nsHtml5ElementName::nsHtml5ElementName()
MOZ_COUNT_CTOR(nsHtml5ElementName);
}
nsHtml5ElementName::~nsHtml5ElementName()
{
MOZ_COUNT_DTOR(nsHtml5ElementName);
@ -330,7 +329,10 @@ static int32_t const ELEMENT_HASHES_DATA[] = {
1938817026, 1941178676, 1963982850, 1965334268, 1967128578, 1967788867,
1967795958, 1968836118
};
staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA) };
staticJArray<int32_t, int32_t> nsHtml5ElementName::ELEMENT_HASHES = {
ELEMENT_HASHES_DATA,
MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA)
};
void
nsHtml5ElementName::initializeStatics()
{
@ -1926,5 +1928,3 @@ nsHtml5ElementName::releaseStatics()
delete ELT_TBODY;
delete[] ELEMENT_NAMES;
}

View File

@ -54,7 +54,6 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5ElementName
{
public:
@ -143,276 +142,277 @@ public:
}
return elementName;
}
}
private:
inline static uint32_t bufToHash(char16_t* buf, int32_t length)
{
uint32_t len = length;
uint32_t first = buf[0];
first <<= 19;
uint32_t second = 1 << 23;
uint32_t third = 0;
uint32_t fourth = 0;
uint32_t fifth = 0;
if (length >= 4) {
second = buf[length - 4];
second <<= 4;
third = buf[length - 3];
third <<= 9;
fourth = buf[length - 2];
fourth <<= 14;
fifth = buf[length - 1];
fifth <<= 24;
} else if (length == 3) {
second = buf[1];
second <<= 4;
third = buf[2];
third <<= 9;
} else if (length == 2) {
second = buf[1];
second <<= 24;
}
return len + first + second + third + fourth + fifth;
}
private:
inline static uint32_t bufToHash(char16_t* buf, int32_t length)
{
uint32_t len = length;
uint32_t first = buf[0];
first <<= 19;
uint32_t second = 1 << 23;
uint32_t third = 0;
uint32_t fourth = 0;
uint32_t fifth = 0;
if (length >= 4) {
second = buf[length - 4];
second <<= 4;
third = buf[length - 3];
third <<= 9;
fourth = buf[length - 2];
fourth <<= 14;
fifth = buf[length - 1];
fifth <<= 24;
} else if (length == 3) {
second = buf[1];
second <<= 4;
third = buf[2];
third <<= 9;
} else if (length == 2) {
second = buf[1];
second <<= 24;
}
return len + first + second + third + fourth + fifth;
nsHtml5ElementName(nsAtom* name,
nsAtom* camelCaseName,
mozilla::dom::HTMLContentCreatorFunction htmlCreator,
mozilla::dom::SVGContentCreatorFunction svgCreator,
int32_t flags);
public:
nsHtml5ElementName();
~nsHtml5ElementName();
inline void setNameForNonInterned(nsAtom* name, bool custom)
{
this->name = name;
this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
}
nsHtml5ElementName(nsAtom* name,
nsAtom* camelCaseName,
mozilla::dom::HTMLContentCreatorFunction htmlCreator,
mozilla::dom::SVGContentCreatorFunction svgCreator,
int32_t flags);
inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
public:
nsHtml5ElementName();
~nsHtml5ElementName();
inline void setNameForNonInterned(nsAtom* name, bool custom)
{
this->name = name;
this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
}
static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_BIG;
static nsHtml5ElementName* ELT_BDO;
static nsHtml5ElementName* ELT_COL;
static nsHtml5ElementName* ELT_DEL;
static nsHtml5ElementName* ELT_DFN;
static nsHtml5ElementName* ELT_DIR;
static nsHtml5ElementName* ELT_DIV;
static nsHtml5ElementName* ELT_IMG;
static nsHtml5ElementName* ELT_INS;
static nsHtml5ElementName* ELT_KBD;
static nsHtml5ElementName* ELT_MAP;
static nsHtml5ElementName* ELT_NAV;
static nsHtml5ElementName* ELT_PRE;
static nsHtml5ElementName* ELT_A;
static nsHtml5ElementName* ELT_B;
static nsHtml5ElementName* ELT_RTC;
static nsHtml5ElementName* ELT_SUB;
static nsHtml5ElementName* ELT_SVG;
static nsHtml5ElementName* ELT_SUP;
static nsHtml5ElementName* ELT_SET;
static nsHtml5ElementName* ELT_USE;
static nsHtml5ElementName* ELT_VAR;
static nsHtml5ElementName* ELT_G;
static nsHtml5ElementName* ELT_WBR;
static nsHtml5ElementName* ELT_XMP;
static nsHtml5ElementName* ELT_I;
static nsHtml5ElementName* ELT_P;
static nsHtml5ElementName* ELT_Q;
static nsHtml5ElementName* ELT_S;
static nsHtml5ElementName* ELT_U;
static nsHtml5ElementName* ELT_H1;
static nsHtml5ElementName* ELT_H2;
static nsHtml5ElementName* ELT_H3;
static nsHtml5ElementName* ELT_H4;
static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_METADATA;
static nsHtml5ElementName* ELT_META;
static nsHtml5ElementName* ELT_TEXTAREA;
static nsHtml5ElementName* ELT_FEFUNCB;
static nsHtml5ElementName* ELT_RB;
static nsHtml5ElementName* ELT_DESC;
static nsHtml5ElementName* ELT_DD;
static nsHtml5ElementName* ELT_BGSOUND;
static nsHtml5ElementName* ELT_EMBED;
static nsHtml5ElementName* ELT_FEBLEND;
static nsHtml5ElementName* ELT_FEFLOOD;
static nsHtml5ElementName* ELT_HEAD;
static nsHtml5ElementName* ELT_LEGEND;
static nsHtml5ElementName* ELT_NOEMBED;
static nsHtml5ElementName* ELT_TD;
static nsHtml5ElementName* ELT_THEAD;
static nsHtml5ElementName* ELT_ASIDE;
static nsHtml5ElementName* ELT_ARTICLE;
static nsHtml5ElementName* ELT_ANIMATE;
static nsHtml5ElementName* ELT_BASE;
static nsHtml5ElementName* ELT_BLOCKQUOTE;
static nsHtml5ElementName* ELT_CODE;
static nsHtml5ElementName* ELT_CIRCLE;
static nsHtml5ElementName* ELT_CITE;
static nsHtml5ElementName* ELT_ELLIPSE;
static nsHtml5ElementName* ELT_FETURBULENCE;
static nsHtml5ElementName* ELT_FEMERGENODE;
static nsHtml5ElementName* ELT_FEIMAGE;
static nsHtml5ElementName* ELT_FEMERGE;
static nsHtml5ElementName* ELT_FETILE;
static nsHtml5ElementName* ELT_FRAME;
static nsHtml5ElementName* ELT_FIGURE;
static nsHtml5ElementName* ELT_FECOMPOSITE;
static nsHtml5ElementName* ELT_IMAGE;
static nsHtml5ElementName* ELT_IFRAME;
static nsHtml5ElementName* ELT_LINE;
static nsHtml5ElementName* ELT_MARQUEE;
static nsHtml5ElementName* ELT_POLYLINE;
static nsHtml5ElementName* ELT_PICTURE;
static nsHtml5ElementName* ELT_SOURCE;
static nsHtml5ElementName* ELT_STRIKE;
static nsHtml5ElementName* ELT_STYLE;
static nsHtml5ElementName* ELT_TABLE;
static nsHtml5ElementName* ELT_TITLE;
static nsHtml5ElementName* ELT_TIME;
static nsHtml5ElementName* ELT_TEMPLATE;
static nsHtml5ElementName* ELT_ALTGLYPHDEF;
static nsHtml5ElementName* ELT_GLYPHREF;
static nsHtml5ElementName* ELT_DIALOG;
static nsHtml5ElementName* ELT_FEFUNCG;
static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
static nsHtml5ElementName* ELT_LISTING;
static nsHtml5ElementName* ELT_STRONG;
static nsHtml5ElementName* ELT_ALTGLYPH;
static nsHtml5ElementName* ELT_CLIPPATH;
static nsHtml5ElementName* ELT_MGLYPH;
static nsHtml5ElementName* ELT_MATH;
static nsHtml5ElementName* ELT_MPATH;
static nsHtml5ElementName* ELT_PATH;
static nsHtml5ElementName* ELT_TH;
static nsHtml5ElementName* ELT_SWITCH;
static nsHtml5ElementName* ELT_TEXTPATH;
static nsHtml5ElementName* ELT_LI;
static nsHtml5ElementName* ELT_MI;
static nsHtml5ElementName* ELT_LINK;
static nsHtml5ElementName* ELT_MARK;
static nsHtml5ElementName* ELT_MALIGNMARK;
static nsHtml5ElementName* ELT_MASK;
static nsHtml5ElementName* ELT_TRACK;
static nsHtml5ElementName* ELT_DL;
static nsHtml5ElementName* ELT_HTML;
static nsHtml5ElementName* ELT_OL;
static nsHtml5ElementName* ELT_LABEL;
static nsHtml5ElementName* ELT_UL;
static nsHtml5ElementName* ELT_SMALL;
static nsHtml5ElementName* ELT_SYMBOL;
static nsHtml5ElementName* ELT_ALTGLYPHITEM;
static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
static nsHtml5ElementName* ELT_ACRONYM;
static nsHtml5ElementName* ELT_EM;
static nsHtml5ElementName* ELT_FORM;
static nsHtml5ElementName* ELT_MENUITEM;
static nsHtml5ElementName* ELT_PARAM;
static nsHtml5ElementName* ELT_ANIMATEMOTION;
static nsHtml5ElementName* ELT_BUTTON;
static nsHtml5ElementName* ELT_CAPTION;
static nsHtml5ElementName* ELT_FIGCAPTION;
static nsHtml5ElementName* ELT_MN;
static nsHtml5ElementName* ELT_KEYGEN;
static nsHtml5ElementName* ELT_MAIN;
static nsHtml5ElementName* ELT_OPTION;
static nsHtml5ElementName* ELT_POLYGON;
static nsHtml5ElementName* ELT_PATTERN;
static nsHtml5ElementName* ELT_SPAN;
static nsHtml5ElementName* ELT_SECTION;
static nsHtml5ElementName* ELT_TSPAN;
static nsHtml5ElementName* ELT_AUDIO;
static nsHtml5ElementName* ELT_MO;
static nsHtml5ElementName* ELT_VIDEO;
static nsHtml5ElementName* ELT_COLGROUP;
static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
static nsHtml5ElementName* ELT_HGROUP;
static nsHtml5ElementName* ELT_RP;
static nsHtml5ElementName* ELT_OPTGROUP;
static nsHtml5ElementName* ELT_SAMP;
static nsHtml5ElementName* ELT_STOP;
static nsHtml5ElementName* ELT_BR;
static nsHtml5ElementName* ELT_ABBR;
static nsHtml5ElementName* ELT_ANIMATECOLOR;
static nsHtml5ElementName* ELT_CENTER;
static nsHtml5ElementName* ELT_HR;
static nsHtml5ElementName* ELT_FEFUNCR;
static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
static nsHtml5ElementName* ELT_FILTER;
static nsHtml5ElementName* ELT_FOOTER;
static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
static nsHtml5ElementName* ELT_HEADER;
static nsHtml5ElementName* ELT_MARKER;
static nsHtml5ElementName* ELT_METER;
static nsHtml5ElementName* ELT_NOBR;
static nsHtml5ElementName* ELT_TR;
static nsHtml5ElementName* ELT_ADDRESS;
static nsHtml5ElementName* ELT_CANVAS;
static nsHtml5ElementName* ELT_DEFS;
static nsHtml5ElementName* ELT_DETAILS;
static nsHtml5ElementName* ELT_MS;
static nsHtml5ElementName* ELT_NOFRAMES;
static nsHtml5ElementName* ELT_PROGRESS;
static nsHtml5ElementName* ELT_DT;
static nsHtml5ElementName* ELT_APPLET;
static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_FOREIGNOBJECT;
static nsHtml5ElementName* ELT_FIELDSET;
static nsHtml5ElementName* ELT_FRAMESET;
static nsHtml5ElementName* ELT_FEOFFSET;
static nsHtml5ElementName* ELT_FESPOTLIGHT;
static nsHtml5ElementName* ELT_FEPOINTLIGHT;
static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
static nsHtml5ElementName* ELT_FONT;
static nsHtml5ElementName* ELT_INPUT;
static nsHtml5ElementName* ELT_LINEARGRADIENT;
static nsHtml5ElementName* ELT_MTEXT;
static nsHtml5ElementName* ELT_NOSCRIPT;
static nsHtml5ElementName* ELT_RT;
static nsHtml5ElementName* ELT_OBJECT;
static nsHtml5ElementName* ELT_OUTPUT;
static nsHtml5ElementName* ELT_PLAINTEXT;
static nsHtml5ElementName* ELT_TT;
static nsHtml5ElementName* ELT_RECT;
static nsHtml5ElementName* ELT_RADIALGRADIENT;
static nsHtml5ElementName* ELT_SELECT;
static nsHtml5ElementName* ELT_SLOT;
static nsHtml5ElementName* ELT_SCRIPT;
static nsHtml5ElementName* ELT_TFOOT;
static nsHtml5ElementName* ELT_TEXT;
static nsHtml5ElementName* ELT_MENU;
static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_FECOLORMATRIX;
static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
static nsHtml5ElementName* ELT_BODY;
static nsHtml5ElementName* ELT_FEMORPHOLOGY;
static nsHtml5ElementName* ELT_RUBY;
static nsHtml5ElementName* ELT_SUMMARY;
static nsHtml5ElementName* ELT_TBODY;
inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
private:
static nsHtml5ElementName** ELEMENT_NAMES;
static staticJArray<int32_t, int32_t> ELEMENT_HASHES;
static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_BIG;
static nsHtml5ElementName* ELT_BDO;
static nsHtml5ElementName* ELT_COL;
static nsHtml5ElementName* ELT_DEL;
static nsHtml5ElementName* ELT_DFN;
static nsHtml5ElementName* ELT_DIR;
static nsHtml5ElementName* ELT_DIV;
static nsHtml5ElementName* ELT_IMG;
static nsHtml5ElementName* ELT_INS;
static nsHtml5ElementName* ELT_KBD;
static nsHtml5ElementName* ELT_MAP;
static nsHtml5ElementName* ELT_NAV;
static nsHtml5ElementName* ELT_PRE;
static nsHtml5ElementName* ELT_A;
static nsHtml5ElementName* ELT_B;
static nsHtml5ElementName* ELT_RTC;
static nsHtml5ElementName* ELT_SUB;
static nsHtml5ElementName* ELT_SVG;
static nsHtml5ElementName* ELT_SUP;
static nsHtml5ElementName* ELT_SET;
static nsHtml5ElementName* ELT_USE;
static nsHtml5ElementName* ELT_VAR;
static nsHtml5ElementName* ELT_G;
static nsHtml5ElementName* ELT_WBR;
static nsHtml5ElementName* ELT_XMP;
static nsHtml5ElementName* ELT_I;
static nsHtml5ElementName* ELT_P;
static nsHtml5ElementName* ELT_Q;
static nsHtml5ElementName* ELT_S;
static nsHtml5ElementName* ELT_U;
static nsHtml5ElementName* ELT_H1;
static nsHtml5ElementName* ELT_H2;
static nsHtml5ElementName* ELT_H3;
static nsHtml5ElementName* ELT_H4;
static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_METADATA;
static nsHtml5ElementName* ELT_META;
static nsHtml5ElementName* ELT_TEXTAREA;
static nsHtml5ElementName* ELT_FEFUNCB;
static nsHtml5ElementName* ELT_RB;
static nsHtml5ElementName* ELT_DESC;
static nsHtml5ElementName* ELT_DD;
static nsHtml5ElementName* ELT_BGSOUND;
static nsHtml5ElementName* ELT_EMBED;
static nsHtml5ElementName* ELT_FEBLEND;
static nsHtml5ElementName* ELT_FEFLOOD;
static nsHtml5ElementName* ELT_HEAD;
static nsHtml5ElementName* ELT_LEGEND;
static nsHtml5ElementName* ELT_NOEMBED;
static nsHtml5ElementName* ELT_TD;
static nsHtml5ElementName* ELT_THEAD;
static nsHtml5ElementName* ELT_ASIDE;
static nsHtml5ElementName* ELT_ARTICLE;
static nsHtml5ElementName* ELT_ANIMATE;
static nsHtml5ElementName* ELT_BASE;
static nsHtml5ElementName* ELT_BLOCKQUOTE;
static nsHtml5ElementName* ELT_CODE;
static nsHtml5ElementName* ELT_CIRCLE;
static nsHtml5ElementName* ELT_CITE;
static nsHtml5ElementName* ELT_ELLIPSE;
static nsHtml5ElementName* ELT_FETURBULENCE;
static nsHtml5ElementName* ELT_FEMERGENODE;
static nsHtml5ElementName* ELT_FEIMAGE;
static nsHtml5ElementName* ELT_FEMERGE;
static nsHtml5ElementName* ELT_FETILE;
static nsHtml5ElementName* ELT_FRAME;
static nsHtml5ElementName* ELT_FIGURE;
static nsHtml5ElementName* ELT_FECOMPOSITE;
static nsHtml5ElementName* ELT_IMAGE;
static nsHtml5ElementName* ELT_IFRAME;
static nsHtml5ElementName* ELT_LINE;
static nsHtml5ElementName* ELT_MARQUEE;
static nsHtml5ElementName* ELT_POLYLINE;
static nsHtml5ElementName* ELT_PICTURE;
static nsHtml5ElementName* ELT_SOURCE;
static nsHtml5ElementName* ELT_STRIKE;
static nsHtml5ElementName* ELT_STYLE;
static nsHtml5ElementName* ELT_TABLE;
static nsHtml5ElementName* ELT_TITLE;
static nsHtml5ElementName* ELT_TIME;
static nsHtml5ElementName* ELT_TEMPLATE;
static nsHtml5ElementName* ELT_ALTGLYPHDEF;
static nsHtml5ElementName* ELT_GLYPHREF;
static nsHtml5ElementName* ELT_DIALOG;
static nsHtml5ElementName* ELT_FEFUNCG;
static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
static nsHtml5ElementName* ELT_LISTING;
static nsHtml5ElementName* ELT_STRONG;
static nsHtml5ElementName* ELT_ALTGLYPH;
static nsHtml5ElementName* ELT_CLIPPATH;
static nsHtml5ElementName* ELT_MGLYPH;
static nsHtml5ElementName* ELT_MATH;
static nsHtml5ElementName* ELT_MPATH;
static nsHtml5ElementName* ELT_PATH;
static nsHtml5ElementName* ELT_TH;
static nsHtml5ElementName* ELT_SWITCH;
static nsHtml5ElementName* ELT_TEXTPATH;
static nsHtml5ElementName* ELT_LI;
static nsHtml5ElementName* ELT_MI;
static nsHtml5ElementName* ELT_LINK;
static nsHtml5ElementName* ELT_MARK;
static nsHtml5ElementName* ELT_MALIGNMARK;
static nsHtml5ElementName* ELT_MASK;
static nsHtml5ElementName* ELT_TRACK;
static nsHtml5ElementName* ELT_DL;
static nsHtml5ElementName* ELT_HTML;
static nsHtml5ElementName* ELT_OL;
static nsHtml5ElementName* ELT_LABEL;
static nsHtml5ElementName* ELT_UL;
static nsHtml5ElementName* ELT_SMALL;
static nsHtml5ElementName* ELT_SYMBOL;
static nsHtml5ElementName* ELT_ALTGLYPHITEM;
static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
static nsHtml5ElementName* ELT_ACRONYM;
static nsHtml5ElementName* ELT_EM;
static nsHtml5ElementName* ELT_FORM;
static nsHtml5ElementName* ELT_MENUITEM;
static nsHtml5ElementName* ELT_PARAM;
static nsHtml5ElementName* ELT_ANIMATEMOTION;
static nsHtml5ElementName* ELT_BUTTON;
static nsHtml5ElementName* ELT_CAPTION;
static nsHtml5ElementName* ELT_FIGCAPTION;
static nsHtml5ElementName* ELT_MN;
static nsHtml5ElementName* ELT_KEYGEN;
static nsHtml5ElementName* ELT_MAIN;
static nsHtml5ElementName* ELT_OPTION;
static nsHtml5ElementName* ELT_POLYGON;
static nsHtml5ElementName* ELT_PATTERN;
static nsHtml5ElementName* ELT_SPAN;
static nsHtml5ElementName* ELT_SECTION;
static nsHtml5ElementName* ELT_TSPAN;
static nsHtml5ElementName* ELT_AUDIO;
static nsHtml5ElementName* ELT_MO;
static nsHtml5ElementName* ELT_VIDEO;
static nsHtml5ElementName* ELT_COLGROUP;
static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
static nsHtml5ElementName* ELT_HGROUP;
static nsHtml5ElementName* ELT_RP;
static nsHtml5ElementName* ELT_OPTGROUP;
static nsHtml5ElementName* ELT_SAMP;
static nsHtml5ElementName* ELT_STOP;
static nsHtml5ElementName* ELT_BR;
static nsHtml5ElementName* ELT_ABBR;
static nsHtml5ElementName* ELT_ANIMATECOLOR;
static nsHtml5ElementName* ELT_CENTER;
static nsHtml5ElementName* ELT_HR;
static nsHtml5ElementName* ELT_FEFUNCR;
static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
static nsHtml5ElementName* ELT_FILTER;
static nsHtml5ElementName* ELT_FOOTER;
static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
static nsHtml5ElementName* ELT_HEADER;
static nsHtml5ElementName* ELT_MARKER;
static nsHtml5ElementName* ELT_METER;
static nsHtml5ElementName* ELT_NOBR;
static nsHtml5ElementName* ELT_TR;
static nsHtml5ElementName* ELT_ADDRESS;
static nsHtml5ElementName* ELT_CANVAS;
static nsHtml5ElementName* ELT_DEFS;
static nsHtml5ElementName* ELT_DETAILS;
static nsHtml5ElementName* ELT_MS;
static nsHtml5ElementName* ELT_NOFRAMES;
static nsHtml5ElementName* ELT_PROGRESS;
static nsHtml5ElementName* ELT_DT;
static nsHtml5ElementName* ELT_APPLET;
static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_FOREIGNOBJECT;
static nsHtml5ElementName* ELT_FIELDSET;
static nsHtml5ElementName* ELT_FRAMESET;
static nsHtml5ElementName* ELT_FEOFFSET;
static nsHtml5ElementName* ELT_FESPOTLIGHT;
static nsHtml5ElementName* ELT_FEPOINTLIGHT;
static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
static nsHtml5ElementName* ELT_FONT;
static nsHtml5ElementName* ELT_INPUT;
static nsHtml5ElementName* ELT_LINEARGRADIENT;
static nsHtml5ElementName* ELT_MTEXT;
static nsHtml5ElementName* ELT_NOSCRIPT;
static nsHtml5ElementName* ELT_RT;
static nsHtml5ElementName* ELT_OBJECT;
static nsHtml5ElementName* ELT_OUTPUT;
static nsHtml5ElementName* ELT_PLAINTEXT;
static nsHtml5ElementName* ELT_TT;
static nsHtml5ElementName* ELT_RECT;
static nsHtml5ElementName* ELT_RADIALGRADIENT;
static nsHtml5ElementName* ELT_SELECT;
static nsHtml5ElementName* ELT_SLOT;
static nsHtml5ElementName* ELT_SCRIPT;
static nsHtml5ElementName* ELT_TFOOT;
static nsHtml5ElementName* ELT_TEXT;
static nsHtml5ElementName* ELT_MENU;
static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_FECOLORMATRIX;
static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
static nsHtml5ElementName* ELT_BODY;
static nsHtml5ElementName* ELT_FEMORPHOLOGY;
static nsHtml5ElementName* ELT_RUBY;
static nsHtml5ElementName* ELT_SUMMARY;
static nsHtml5ElementName* ELT_TBODY;
private:
static nsHtml5ElementName** ELEMENT_NAMES;
static staticJArray<int32_t,int32_t> ELEMENT_HASHES;
public:
static void initializeStatics();
static void releaseStatics();
public:
static void initializeStatics();
static void releaseStatics();
};
#endif

View File

@ -56,13 +56,27 @@
#include "nsHtml5MetaScanner.h"
static char16_t const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CHARSET = {
CHARSET_DATA,
MOZ_ARRAY_LENGTH(CHARSET_DATA)
};
static char16_t const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) };
static char16_t const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
static char16_t const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CONTENT = {
CONTENT_DATA,
MOZ_ARRAY_LENGTH(CONTENT_DATA)
};
static char16_t const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e',
'q', 'u', 'i', 'v' };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::HTTP_EQUIV = {
HTTP_EQUIV_DATA,
MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA)
};
static char16_t const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n',
't', '-', 't', 'y', 'p', 'e' };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CONTENT_TYPE = {
CONTENT_TYPE_DATA,
MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA)
};
nsHtml5MetaScanner::nsHtml5MetaScanner(nsHtml5TreeBuilder* tb)
: readable(nullptr)
@ -83,7 +97,6 @@ nsHtml5MetaScanner::nsHtml5MetaScanner(nsHtml5TreeBuilder* tb)
MOZ_COUNT_CTOR(nsHtml5MetaScanner);
}
nsHtml5MetaScanner::~nsHtml5MetaScanner()
{
MOZ_COUNT_DTOR(nsHtml5MetaScanner);
@ -91,21 +104,22 @@ nsHtml5MetaScanner::~nsHtml5MetaScanner()
charset.Release();
}
void
void
nsHtml5MetaScanner::stateLoop(int32_t state)
{
int32_t c = -1;
bool reconsume = false;
stateloop: for (; ; ) {
switch(state) {
stateloop:
for (;;) {
switch (state) {
case DATA: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -118,12 +132,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
dataloop_end: ;
dataloop_end:;
}
case TAG_OPEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -158,12 +172,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
tagopenloop_end: ;
tagopenloop_end:;
}
case TAG_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -215,16 +229,16 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
tagnameloop_end: ;
tagnameloop_end:;
}
case BEFORE_ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -273,12 +287,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
beforeattributenameloop_end: ;
beforeattributenameloop_end:;
}
case ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -311,17 +325,20 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
if (c >= 'A' && c <= 'Z') {
c += 0x20;
}
if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
if (contentIndex < CONTENT.length &&
c == CONTENT[contentIndex]) {
++contentIndex;
} else {
contentIndex = INT32_MAX;
}
if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
if (charsetIndex < CHARSET.length &&
c == CHARSET[charsetIndex]) {
++charsetIndex;
} else {
charsetIndex = INT32_MAX;
}
if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
if (httpEquivIndex < HTTP_EQUIV.length &&
c == HTTP_EQUIV[httpEquivIndex]) {
++httpEquivIndex;
} else {
httpEquivIndex = INT32_MAX;
@ -331,12 +348,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
attributenameloop_end: ;
attributenameloop_end:;
}
case BEFORE_ATTRIBUTE_VALUE: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -368,16 +385,16 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
beforeattributevalueloop_end: ;
beforeattributevalueloop_end:;
}
case ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -392,12 +409,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
attributevaluedoublequotedloop_end: ;
attributevaluedoublequotedloop_end:;
}
case AFTER_ATTRIBUTE_VALUE_QUOTED: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -426,11 +443,11 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
afterattributevaluequotedloop_end: ;
afterattributevaluequotedloop_end:;
}
case SELF_CLOSING_START_TAG: {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -449,13 +466,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case ATTRIBUTE_VALUE_UNQUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -483,9 +500,9 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case AFTER_ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -531,9 +548,9 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case MARKUP_DECLARATION_OPEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -548,12 +565,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
markupdeclarationopenloop_end: ;
markupdeclarationopenloop_end:;
}
case MARKUP_DECLARATION_HYPHEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -568,12 +585,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
markupdeclarationhyphenloop_end: ;
markupdeclarationhyphenloop_end:;
}
case COMMENT_START: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -591,12 +608,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentstartloop_end: ;
commentstartloop_end:;
}
case COMMENT: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -609,12 +626,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentloop_end: ;
commentloop_end:;
}
case COMMENT_END_DASH: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -628,12 +645,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentenddashloop_end: ;
commentenddashloop_end:;
}
case COMMENT_END: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -653,7 +670,7 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
case COMMENT_START_DASH: {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -672,13 +689,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case ATTRIBUTE_VALUE_SINGLE_QUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -695,13 +712,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case SCAN_UNTIL_GT: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -717,18 +734,19 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
stateloop_end: ;
stateloop_end:;
stateSave = state;
}
void
void
nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c)
{
if (metaState == A) {
if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
addToBuffer(c);
} else if (httpEquivIndex == HTTP_EQUIV.length) {
if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
if (contentTypeIndex < CONTENT_TYPE.length &&
toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
++contentTypeIndex;
} else {
contentTypeIndex = INT32_MAX;
@ -737,18 +755,19 @@ nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c)
}
}
void
void
nsHtml5MetaScanner::addToBuffer(int32_t c)
{
if (strBufLen == strBuf.length) {
jArray<char16_t,int32_t> newBuf = jArray<char16_t,int32_t>::newJArray(strBuf.length + (strBuf.length << 1));
jArray<char16_t, int32_t> newBuf = jArray<char16_t, int32_t>::newJArray(
strBuf.length + (strBuf.length << 1));
nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length);
strBuf = newBuf;
}
strBuf[strBufLen++] = (char16_t) c;
strBuf[strBufLen++] = (char16_t)c;
}
void
void
nsHtml5MetaScanner::handleAttributeValue()
{
if (metaState != A) {
@ -773,7 +792,7 @@ nsHtml5MetaScanner::handleAttributeValue()
}
}
bool
bool
nsHtml5MetaScanner::handleTag()
{
bool stop = handleTagInner();
@ -785,7 +804,7 @@ nsHtml5MetaScanner::handleTag()
return stop;
}
bool
bool
nsHtml5MetaScanner::handleTagInner()
{
if (!!charset && tryCharset(charset)) {
@ -814,6 +833,4 @@ nsHtml5MetaScanner::releaseStatics()
{
}
#include "nsHtml5MetaScannerCppSupplement.h"

View File

@ -55,114 +55,120 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5MetaScanner
{
private:
static staticJArray<char16_t,int32_t> CHARSET;
static staticJArray<char16_t,int32_t> CONTENT;
static staticJArray<char16_t,int32_t> HTTP_EQUIV;
static staticJArray<char16_t,int32_t> CONTENT_TYPE;
static const int32_t NO = 0;
private:
static staticJArray<char16_t, int32_t> CHARSET;
static staticJArray<char16_t, int32_t> CONTENT;
static staticJArray<char16_t, int32_t> HTTP_EQUIV;
static staticJArray<char16_t, int32_t> CONTENT_TYPE;
static const int32_t NO = 0;
static const int32_t M = 1;
static const int32_t M = 1;
static const int32_t E = 2;
static const int32_t E = 2;
static const int32_t T = 3;
static const int32_t T = 3;
static const int32_t A = 4;
static const int32_t A = 4;
static const int32_t DATA = 0;
static const int32_t DATA = 0;
static const int32_t TAG_OPEN = 1;
static const int32_t TAG_OPEN = 1;
static const int32_t SCAN_UNTIL_GT = 2;
static const int32_t SCAN_UNTIL_GT = 2;
static const int32_t TAG_NAME = 3;
static const int32_t TAG_NAME = 3;
static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
static const int32_t ATTRIBUTE_NAME = 5;
static const int32_t ATTRIBUTE_NAME = 5;
static const int32_t AFTER_ATTRIBUTE_NAME = 6;
static const int32_t AFTER_ATTRIBUTE_NAME = 6;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
static const int32_t MARKUP_DECLARATION_OPEN = 13;
static const int32_t MARKUP_DECLARATION_OPEN = 13;
static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
static const int32_t COMMENT_START = 15;
static const int32_t COMMENT_START = 15;
static const int32_t COMMENT_START_DASH = 16;
static const int32_t COMMENT_START_DASH = 16;
static const int32_t COMMENT = 17;
static const int32_t COMMENT = 17;
static const int32_t COMMENT_END_DASH = 18;
static const int32_t COMMENT_END_DASH = 18;
static const int32_t COMMENT_END = 19;
static const int32_t COMMENT_END = 19;
static const int32_t SELF_CLOSING_START_TAG = 20;
static const int32_t SELF_CLOSING_START_TAG = 20;
static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
static const int32_t HTTP_EQUIV_OTHER = 2;
static const int32_t HTTP_EQUIV_OTHER = 2;
protected:
nsHtml5ByteReadable* readable;
private:
int32_t metaState;
int32_t contentIndex;
int32_t charsetIndex;
int32_t httpEquivIndex;
int32_t contentTypeIndex;
protected:
int32_t stateSave;
private:
int32_t strBufLen;
autoJArray<char16_t,int32_t> strBuf;
nsHtml5String content;
nsHtml5String charset;
int32_t httpEquivState;
nsHtml5TreeBuilder* treeBuilder;
public:
explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
~nsHtml5MetaScanner();
protected:
void stateLoop(int32_t state);
private:
void handleCharInAttributeValue(int32_t c);
inline int32_t toAsciiLowerCase(int32_t c)
{
if (c >= 'A' && c <= 'Z') {
return c + 0x20;
}
return c;
protected:
nsHtml5ByteReadable* readable;
private:
int32_t metaState;
int32_t contentIndex;
int32_t charsetIndex;
int32_t httpEquivIndex;
int32_t contentTypeIndex;
protected:
int32_t stateSave;
private:
int32_t strBufLen;
autoJArray<char16_t, int32_t> strBuf;
nsHtml5String content;
nsHtml5String charset;
int32_t httpEquivState;
nsHtml5TreeBuilder* treeBuilder;
public:
explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
~nsHtml5MetaScanner();
protected:
void stateLoop(int32_t state);
private:
void handleCharInAttributeValue(int32_t c);
inline int32_t toAsciiLowerCase(int32_t c)
{
if (c >= 'A' && c <= 'Z') {
return c + 0x20;
}
return c;
}
void addToBuffer(int32_t c);
void handleAttributeValue();
bool handleTag();
bool handleTagInner();
protected:
bool tryCharset(nsHtml5String encoding);
public:
static void initializeStatics();
static void releaseStatics();
void addToBuffer(int32_t c);
void handleAttributeValue();
bool handleTag();
bool handleTagInner();
protected:
bool tryCharset(nsHtml5String encoding);
public:
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5MetaScannerHSupplement.h"
};
#endif

View File

@ -53,35 +53,34 @@ class nsHtml5MetaScanner;
class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability
{
public:
static nsAtom* newLocalNameFromBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner);
static nsHtml5String newStringFromBuffer(char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5TreeBuilder* treeBuilder,
bool maybeAtomize);
static nsHtml5String newEmptyString();
static nsHtml5String newStringFromLiteral(const char* literal);
static nsHtml5String newStringFromString(nsHtml5String string);
static jArray<char16_t,int32_t> newCharArrayFromLocal(nsAtom* local);
static jArray<char16_t, int32_t> newCharArrayFromString(
nsHtml5String string);
static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool literalEqualsString(const char* literal, nsHtml5String string);
static bool stringEqualsString(nsHtml5String one, nsHtml5String other);
static void initializeStatics();
static void releaseStatics();
public:
static nsAtom* newLocalNameFromBuffer(char16_t* buf,
int32_t length,
nsHtml5AtomTable* interner);
static nsHtml5String newStringFromBuffer(char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5TreeBuilder* treeBuilder,
bool maybeAtomize);
static nsHtml5String newEmptyString();
static nsHtml5String newStringFromLiteral(const char* literal);
static nsHtml5String newStringFromString(nsHtml5String string);
static jArray<char16_t, int32_t> newCharArrayFromLocal(nsAtom* local);
static jArray<char16_t, int32_t> newCharArrayFromString(nsHtml5String string);
static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool literalEqualsString(const char* literal, nsHtml5String string);
static bool stringEqualsString(nsHtml5String one, nsHtml5String other);
static void initializeStatics();
static void releaseStatics();
};
#endif

View File

@ -55,31 +55,31 @@
#include "nsHtml5StackNode.h"
int32_t
int32_t
nsHtml5StackNode::getGroup()
{
return flags & nsHtml5ElementName::GROUP_MASK;
}
bool
bool
nsHtml5StackNode::isScoping()
{
return (flags & nsHtml5ElementName::SCOPING);
}
bool
bool
nsHtml5StackNode::isSpecial()
{
return (flags & nsHtml5ElementName::SPECIAL);
}
bool
bool
nsHtml5StackNode::isFosterParenting()
{
return (flags & nsHtml5ElementName::FOSTER_PARENTING);
}
bool
bool
nsHtml5StackNode::isHtmlIntegrationPoint()
{
return (flags & nsHtml5ElementName::HTML_INTEGRATION_POINT);
@ -204,7 +204,7 @@ nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
this->htmlCreator = nullptr;
}
int32_t
int32_t
nsHtml5StackNode::prepareSvgFlags(int32_t flags)
{
flags &=
@ -217,7 +217,7 @@ nsHtml5StackNode::prepareSvgFlags(int32_t flags)
return flags;
}
int32_t
int32_t
nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
{
flags &=
@ -232,19 +232,18 @@ nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
return flags;
}
nsHtml5StackNode::~nsHtml5StackNode()
{
MOZ_COUNT_DTOR(nsHtml5StackNode);
}
void
void
nsHtml5StackNode::dropAttributes()
{
attributes = nullptr;
}
void
void
nsHtml5StackNode::retain()
{
refcount++;
@ -281,5 +280,3 @@ void
nsHtml5StackNode::releaseStatics()
{
}

View File

@ -56,67 +56,65 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5StackNode
{
public:
int32_t idxInTreeBuilder;
int32_t flags;
nsAtom* name;
nsAtom* popName;
int32_t ns;
nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes;
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
public:
inline int32_t getFlags()
{
return flags;
}
public:
int32_t idxInTreeBuilder;
int32_t flags;
nsAtom* name;
nsAtom* popName;
int32_t ns;
nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes;
int32_t getGroup();
bool isScoping();
bool isSpecial();
bool isFosterParenting();
bool isHtmlIntegrationPoint();
explicit nsHtml5StackNode(int32_t idxInTreeBuilder);
mozilla::dom::HTMLContentCreatorFunction getHtmlCreator();
void setValues(int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
void setValues(nsHtml5ElementName* elementName, nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
void setValues(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
public:
~nsHtml5StackNode();
void dropAttributes();
void retain();
void release(nsHtml5TreeBuilder* owningTreeBuilder);
bool isUnused();
static void initializeStatics();
static void releaseStatics();
public:
inline int32_t getFlags() { return flags; }
int32_t getGroup();
bool isScoping();
bool isSpecial();
bool isFosterParenting();
bool isHtmlIntegrationPoint();
explicit nsHtml5StackNode(int32_t idxInTreeBuilder);
mozilla::dom::HTMLContentCreatorFunction getHtmlCreator();
void setValues(int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
void setValues(nsHtml5ElementName* elementName, nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
void setValues(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
public:
~nsHtml5StackNode();
void dropAttributes();
void retain();
void release(nsHtml5TreeBuilder* owningTreeBuilder);
bool isUnused();
static void initializeStatics();
static void releaseStatics();
};
#endif

View File

@ -1,22 +1,22 @@
/*
* Copyright (c) 2009-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,108 +54,117 @@
#include "nsHtml5StateSnapshot.h"
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks)
: stack(stack),
listOfActiveFormattingElements(listOfActiveFormattingElements),
templateModeStack(templateModeStack),
formPointer(formPointer),
headPointer(headPointer),
deepTreeSurrogateParent(deepTreeSurrogateParent),
mode(mode),
originalMode(originalMode),
framesetOk(framesetOk),
needToDropLF(needToDropLF),
quirks(quirks)
nsHtml5StateSnapshot::nsHtml5StateSnapshot(
jArray<nsHtml5StackNode*, int32_t> stack,
jArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements,
jArray<int32_t, int32_t> templateModeStack,
nsIContentHandle* formPointer,
nsIContentHandle* headPointer,
nsIContentHandle* deepTreeSurrogateParent,
int32_t mode,
int32_t originalMode,
bool framesetOk,
bool needToDropLF,
bool quirks)
: stack(stack)
, listOfActiveFormattingElements(listOfActiveFormattingElements)
, templateModeStack(templateModeStack)
, formPointer(formPointer)
, headPointer(headPointer)
, deepTreeSurrogateParent(deepTreeSurrogateParent)
, mode(mode)
, originalMode(originalMode)
, framesetOk(framesetOk)
, needToDropLF(needToDropLF)
, quirks(quirks)
{
MOZ_COUNT_CTOR(nsHtml5StateSnapshot);
}
jArray<nsHtml5StackNode*,int32_t>
jArray<nsHtml5StackNode*, int32_t>
nsHtml5StateSnapshot::getStack()
{
return stack;
}
jArray<int32_t,int32_t>
jArray<int32_t, int32_t>
nsHtml5StateSnapshot::getTemplateModeStack()
{
return templateModeStack;
}
jArray<nsHtml5StackNode*,int32_t>
jArray<nsHtml5StackNode*, int32_t>
nsHtml5StateSnapshot::getListOfActiveFormattingElements()
{
return listOfActiveFormattingElements;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getFormPointer()
{
return formPointer;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getHeadPointer()
{
return headPointer;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getDeepTreeSurrogateParent()
{
return deepTreeSurrogateParent;
}
int32_t
int32_t
nsHtml5StateSnapshot::getMode()
{
return mode;
}
int32_t
int32_t
nsHtml5StateSnapshot::getOriginalMode()
{
return originalMode;
}
bool
bool
nsHtml5StateSnapshot::isFramesetOk()
{
return framesetOk;
}
bool
bool
nsHtml5StateSnapshot::isNeedToDropLF()
{
return needToDropLF;
}
bool
bool
nsHtml5StateSnapshot::isQuirks()
{
return quirks;
}
int32_t
int32_t
nsHtml5StateSnapshot::getListOfActiveFormattingElementsLength()
{
return listOfActiveFormattingElements.length;
}
int32_t
int32_t
nsHtml5StateSnapshot::getStackLength()
{
return stack.length;
}
int32_t
int32_t
nsHtml5StateSnapshot::getTemplateModeStackLength()
{
return templateModeStack.length;
}
nsHtml5StateSnapshot::~nsHtml5StateSnapshot()
{
MOZ_COUNT_DTOR(nsHtml5StateSnapshot);
@ -178,5 +187,3 @@ void
nsHtml5StateSnapshot::releaseStatics()
{
}

View File

@ -1,22 +1,22 @@
/*
* Copyright (c) 2009-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,41 +54,51 @@ class nsHtml5MetaScanner;
class nsHtml5UTF16Buffer;
class nsHtml5Portability;
class nsHtml5StateSnapshot : public nsAHtml5TreeBuilderState
{
private:
autoJArray<nsHtml5StackNode*,int32_t> stack;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
autoJArray<int32_t,int32_t> templateModeStack;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
int32_t mode;
int32_t originalMode;
bool framesetOk;
bool needToDropLF;
bool quirks;
public:
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks);
jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
~nsHtml5StateSnapshot();
static void initializeStatics();
static void releaseStatics();
private:
autoJArray<nsHtml5StackNode*, int32_t> stack;
autoJArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements;
autoJArray<int32_t, int32_t> templateModeStack;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
int32_t mode;
int32_t originalMode;
bool framesetOk;
bool needToDropLF;
bool quirks;
public:
nsHtml5StateSnapshot(
jArray<nsHtml5StackNode*, int32_t> stack,
jArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements,
jArray<int32_t, int32_t> templateModeStack,
nsIContentHandle* formPointer,
nsIContentHandle* headPointer,
nsIContentHandle* deepTreeSurrogateParent,
int32_t mode,
int32_t originalMode,
bool framesetOk,
bool needToDropLF,
bool quirks);
jArray<nsHtml5StackNode*, int32_t> getStack();
jArray<int32_t, int32_t> getTemplateModeStack();
jArray<nsHtml5StackNode*, int32_t> getListOfActiveFormattingElements();
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
~nsHtml5StateSnapshot();
static void initializeStatics();
static void releaseStatics();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -57,410 +57,435 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5Tokenizer
{
private:
static const int32_t DATA_AND_RCDATA_MASK = ~1;
private:
static const int32_t DATA_AND_RCDATA_MASK = ~1;
public:
static const int32_t DATA = 0;
public:
static const int32_t DATA = 0;
static const int32_t RCDATA = 1;
static const int32_t RCDATA = 1;
static const int32_t SCRIPT_DATA = 2;
static const int32_t SCRIPT_DATA = 2;
static const int32_t RAWTEXT = 3;
static const int32_t RAWTEXT = 3;
static const int32_t SCRIPT_DATA_ESCAPED = 4;
static const int32_t SCRIPT_DATA_ESCAPED = 4;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 7;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 7;
static const int32_t PLAINTEXT = 8;
static const int32_t PLAINTEXT = 8;
static const int32_t TAG_OPEN = 9;
static const int32_t TAG_OPEN = 9;
static const int32_t CLOSE_TAG_OPEN = 10;
static const int32_t CLOSE_TAG_OPEN = 10;
static const int32_t TAG_NAME = 11;
static const int32_t TAG_NAME = 11;
static const int32_t BEFORE_ATTRIBUTE_NAME = 12;
static const int32_t BEFORE_ATTRIBUTE_NAME = 12;
static const int32_t ATTRIBUTE_NAME = 13;
static const int32_t ATTRIBUTE_NAME = 13;
static const int32_t AFTER_ATTRIBUTE_NAME = 14;
static const int32_t AFTER_ATTRIBUTE_NAME = 14;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 15;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 15;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
static const int32_t BOGUS_COMMENT = 17;
static const int32_t BOGUS_COMMENT = 17;
static const int32_t MARKUP_DECLARATION_OPEN = 18;
static const int32_t MARKUP_DECLARATION_OPEN = 18;
static const int32_t DOCTYPE = 19;
static const int32_t DOCTYPE = 19;
static const int32_t BEFORE_DOCTYPE_NAME = 20;
static const int32_t BEFORE_DOCTYPE_NAME = 20;
static const int32_t DOCTYPE_NAME = 21;
static const int32_t DOCTYPE_NAME = 21;
static const int32_t AFTER_DOCTYPE_NAME = 22;
static const int32_t AFTER_DOCTYPE_NAME = 22;
static const int32_t BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
static const int32_t BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
static const int32_t AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
static const int32_t AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
static const int32_t BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
static const int32_t BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
static const int32_t AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
static const int32_t AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
static const int32_t BOGUS_DOCTYPE = 31;
static const int32_t BOGUS_DOCTYPE = 31;
static const int32_t COMMENT_START = 32;
static const int32_t COMMENT_START = 32;
static const int32_t COMMENT_START_DASH = 33;
static const int32_t COMMENT_START_DASH = 33;
static const int32_t COMMENT = 34;
static const int32_t COMMENT = 34;
static const int32_t COMMENT_END_DASH = 35;
static const int32_t COMMENT_END_DASH = 35;
static const int32_t COMMENT_END = 36;
static const int32_t COMMENT_END = 36;
static const int32_t COMMENT_END_BANG = 37;
static const int32_t COMMENT_END_BANG = 37;
static const int32_t NON_DATA_END_TAG_NAME = 38;
static const int32_t NON_DATA_END_TAG_NAME = 38;
static const int32_t MARKUP_DECLARATION_HYPHEN = 39;
static const int32_t MARKUP_DECLARATION_HYPHEN = 39;
static const int32_t MARKUP_DECLARATION_OCTYPE = 40;
static const int32_t MARKUP_DECLARATION_OCTYPE = 40;
static const int32_t DOCTYPE_UBLIC = 41;
static const int32_t DOCTYPE_UBLIC = 41;
static const int32_t DOCTYPE_YSTEM = 42;
static const int32_t DOCTYPE_YSTEM = 42;
static const int32_t AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
static const int32_t AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
static const int32_t BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
static const int32_t BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
static const int32_t AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
static const int32_t AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
static const int32_t CONSUME_CHARACTER_REFERENCE = 46;
static const int32_t CONSUME_CHARACTER_REFERENCE = 46;
static const int32_t CONSUME_NCR = 47;
static const int32_t CONSUME_NCR = 47;
static const int32_t CHARACTER_REFERENCE_TAIL = 48;
static const int32_t CHARACTER_REFERENCE_TAIL = 48;
static const int32_t HEX_NCR_LOOP = 49;
static const int32_t HEX_NCR_LOOP = 49;
static const int32_t DECIMAL_NRC_LOOP = 50;
static const int32_t DECIMAL_NRC_LOOP = 50;
static const int32_t HANDLE_NCR_VALUE = 51;
static const int32_t HANDLE_NCR_VALUE = 51;
static const int32_t HANDLE_NCR_VALUE_RECONSUME = 52;
static const int32_t HANDLE_NCR_VALUE_RECONSUME = 52;
static const int32_t CHARACTER_REFERENCE_HILO_LOOKUP = 53;
static const int32_t CHARACTER_REFERENCE_HILO_LOOKUP = 53;
static const int32_t SELF_CLOSING_START_TAG = 54;
static const int32_t SELF_CLOSING_START_TAG = 54;
static const int32_t CDATA_START = 55;
static const int32_t CDATA_START = 55;
static const int32_t CDATA_SECTION = 56;
static const int32_t CDATA_SECTION = 56;
static const int32_t CDATA_RSQB = 57;
static const int32_t CDATA_RSQB = 57;
static const int32_t CDATA_RSQB_RSQB = 58;
static const int32_t CDATA_RSQB_RSQB = 58;
static const int32_t SCRIPT_DATA_LESS_THAN_SIGN = 59;
static const int32_t SCRIPT_DATA_LESS_THAN_SIGN = 59;
static const int32_t SCRIPT_DATA_ESCAPE_START = 60;
static const int32_t SCRIPT_DATA_ESCAPE_START = 60;
static const int32_t SCRIPT_DATA_ESCAPE_START_DASH = 61;
static const int32_t SCRIPT_DATA_ESCAPE_START_DASH = 61;
static const int32_t SCRIPT_DATA_ESCAPED_DASH = 62;
static const int32_t SCRIPT_DATA_ESCAPED_DASH = 62;
static const int32_t SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
static const int32_t SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
static const int32_t BOGUS_COMMENT_HYPHEN = 64;
static const int32_t BOGUS_COMMENT_HYPHEN = 64;
static const int32_t RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
static const int32_t RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
static const int32_t SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
static const int32_t SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED = 68;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED = 68;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
static const int32_t PROCESSING_INSTRUCTION = 73;
static const int32_t PROCESSING_INSTRUCTION = 73;
static const int32_t PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
static const int32_t PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
private:
static const int32_t LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
private:
static const int32_t LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
static char16_t LT_GT[];
static char16_t LT_SOLIDUS[];
static char16_t RSQB_RSQB[];
static char16_t REPLACEMENT_CHARACTER[];
static char16_t LF[];
static char16_t CDATA_LSQB[];
static char16_t OCTYPE[];
static char16_t UBLIC[];
static char16_t YSTEM[];
static staticJArray<char16_t,int32_t> TITLE_ARR;
static staticJArray<char16_t,int32_t> SCRIPT_ARR;
static staticJArray<char16_t,int32_t> STYLE_ARR;
static staticJArray<char16_t,int32_t> PLAINTEXT_ARR;
static staticJArray<char16_t,int32_t> XMP_ARR;
static staticJArray<char16_t,int32_t> TEXTAREA_ARR;
static staticJArray<char16_t,int32_t> IFRAME_ARR;
static staticJArray<char16_t,int32_t> NOEMBED_ARR;
static staticJArray<char16_t,int32_t> NOSCRIPT_ARR;
static staticJArray<char16_t,int32_t> NOFRAMES_ARR;
protected:
nsHtml5TreeBuilder* tokenHandler;
nsHtml5StreamParser* encodingDeclarationHandler;
bool lastCR;
int32_t stateSave;
private:
int32_t returnStateSave;
protected:
int32_t index;
private:
bool forceQuirks;
char16_t additional;
int32_t entCol;
int32_t firstCharKey;
int32_t lo;
int32_t hi;
int32_t candidate;
int32_t charRefBufMark;
protected:
int32_t value;
private:
bool seenDigits;
protected:
int32_t cstart;
private:
nsHtml5String publicId;
nsHtml5String systemId;
autoJArray<char16_t,int32_t> strBuf;
int32_t strBufLen;
autoJArray<char16_t,int32_t> charRefBuf;
int32_t charRefBufLen;
autoJArray<char16_t,int32_t> bmpChar;
autoJArray<char16_t,int32_t> astralChar;
protected:
nsHtml5ElementName* endTagExpectation;
private:
jArray<char16_t,int32_t> endTagExpectationAsArray;
protected:
bool endTag;
private:
bool containsHyphen;
nsHtml5ElementName* tagName;
nsHtml5ElementName* nonInternedTagName;
protected:
nsHtml5AttributeName* attributeName;
private:
nsHtml5AttributeName* nonInternedAttributeName;
nsAtom* doctypeName;
nsHtml5String publicIdentifier;
nsHtml5String systemIdentifier;
nsHtml5HtmlAttributes* attributes;
bool newAttributesEachTime;
bool shouldSuspend;
protected:
bool confident;
private:
int32_t line;
int32_t attributeLine;
nsHtml5AtomTable* interner;
bool viewingXmlSource;
public:
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource);
void setInterner(nsHtml5AtomTable* interner);
void initLocation(nsHtml5String newPublicId, nsHtml5String newSystemId);
bool isViewingXmlSource();
void setStateAndEndTagExpectation(int32_t specialTokenizerState, nsAtom* endTagExpectation);
void setStateAndEndTagExpectation(int32_t specialTokenizerState, nsHtml5ElementName* endTagExpectation);
private:
void endTagExpectationToArray();
public:
void setLineNumber(int32_t line);
inline int32_t getLineNumber()
{
return line;
}
nsHtml5HtmlAttributes* emptyAttributes();
private:
inline void appendCharRefBuf(char16_t c)
{
MOZ_RELEASE_ASSERT(charRefBufLen < charRefBuf.length, "Attempted to overrun charRefBuf!");
charRefBuf[charRefBufLen++] = c;
}
void emitOrAppendCharRefBuf(int32_t returnState);
inline void clearStrBufAfterUse()
{
strBufLen = 0;
}
inline void clearStrBufBeforeUse()
{
MOZ_ASSERT(!strBufLen, "strBufLen not reset after previous use!");
strBufLen = 0;
}
inline void clearStrBufAfterOneHyphen()
{
MOZ_ASSERT(strBufLen == 1, "strBufLen length not one!");
MOZ_ASSERT(strBuf[0] == '-', "strBuf does not start with a hyphen!");
strBufLen = 0;
}
inline void appendStrBuf(char16_t c)
{
MOZ_ASSERT(strBufLen < strBuf.length, "Previous buffer length insufficient.");
if (MOZ_UNLIKELY(strBufLen == strBuf.length)) {
if (MOZ_UNLIKELY(!EnsureBufferSpace(1))) {
MOZ_CRASH("Unable to recover from buffer reallocation failure");
}
static char16_t LT_GT[];
static char16_t LT_SOLIDUS[];
static char16_t RSQB_RSQB[];
static char16_t REPLACEMENT_CHARACTER[];
static char16_t LF[];
static char16_t CDATA_LSQB[];
static char16_t OCTYPE[];
static char16_t UBLIC[];
static char16_t YSTEM[];
static staticJArray<char16_t, int32_t> TITLE_ARR;
static staticJArray<char16_t, int32_t> SCRIPT_ARR;
static staticJArray<char16_t, int32_t> STYLE_ARR;
static staticJArray<char16_t, int32_t> PLAINTEXT_ARR;
static staticJArray<char16_t, int32_t> XMP_ARR;
static staticJArray<char16_t, int32_t> TEXTAREA_ARR;
static staticJArray<char16_t, int32_t> IFRAME_ARR;
static staticJArray<char16_t, int32_t> NOEMBED_ARR;
static staticJArray<char16_t, int32_t> NOSCRIPT_ARR;
static staticJArray<char16_t, int32_t> NOFRAMES_ARR;
protected:
nsHtml5TreeBuilder* tokenHandler;
nsHtml5StreamParser* encodingDeclarationHandler;
bool lastCR;
int32_t stateSave;
private:
int32_t returnStateSave;
protected:
int32_t index;
private:
bool forceQuirks;
char16_t additional;
int32_t entCol;
int32_t firstCharKey;
int32_t lo;
int32_t hi;
int32_t candidate;
int32_t charRefBufMark;
protected:
int32_t value;
private:
bool seenDigits;
protected:
int32_t cstart;
private:
nsHtml5String publicId;
nsHtml5String systemId;
autoJArray<char16_t, int32_t> strBuf;
int32_t strBufLen;
autoJArray<char16_t, int32_t> charRefBuf;
int32_t charRefBufLen;
autoJArray<char16_t, int32_t> bmpChar;
autoJArray<char16_t, int32_t> astralChar;
protected:
nsHtml5ElementName* endTagExpectation;
private:
jArray<char16_t, int32_t> endTagExpectationAsArray;
protected:
bool endTag;
private:
bool containsHyphen;
nsHtml5ElementName* tagName;
nsHtml5ElementName* nonInternedTagName;
protected:
nsHtml5AttributeName* attributeName;
private:
nsHtml5AttributeName* nonInternedAttributeName;
nsAtom* doctypeName;
nsHtml5String publicIdentifier;
nsHtml5String systemIdentifier;
nsHtml5HtmlAttributes* attributes;
bool newAttributesEachTime;
bool shouldSuspend;
protected:
bool confident;
private:
int32_t line;
int32_t attributeLine;
nsHtml5AtomTable* interner;
bool viewingXmlSource;
public:
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource);
void setInterner(nsHtml5AtomTable* interner);
void initLocation(nsHtml5String newPublicId, nsHtml5String newSystemId);
bool isViewingXmlSource();
void setStateAndEndTagExpectation(int32_t specialTokenizerState,
nsAtom* endTagExpectation);
void setStateAndEndTagExpectation(int32_t specialTokenizerState,
nsHtml5ElementName* endTagExpectation);
private:
void endTagExpectationToArray();
public:
void setLineNumber(int32_t line);
inline int32_t getLineNumber() { return line; }
nsHtml5HtmlAttributes* emptyAttributes();
private:
inline void appendCharRefBuf(char16_t c)
{
MOZ_RELEASE_ASSERT(charRefBufLen < charRefBuf.length,
"Attempted to overrun charRefBuf!");
charRefBuf[charRefBufLen++] = c;
}
void emitOrAppendCharRefBuf(int32_t returnState);
inline void clearStrBufAfterUse() { strBufLen = 0; }
inline void clearStrBufBeforeUse()
{
MOZ_ASSERT(!strBufLen, "strBufLen not reset after previous use!");
strBufLen = 0;
}
inline void clearStrBufAfterOneHyphen()
{
MOZ_ASSERT(strBufLen == 1, "strBufLen length not one!");
MOZ_ASSERT(strBuf[0] == '-', "strBuf does not start with a hyphen!");
strBufLen = 0;
}
inline void appendStrBuf(char16_t c)
{
MOZ_ASSERT(strBufLen < strBuf.length,
"Previous buffer length insufficient.");
if (MOZ_UNLIKELY(strBufLen == strBuf.length)) {
if (MOZ_UNLIKELY(!EnsureBufferSpace(1))) {
MOZ_CRASH("Unable to recover from buffer reallocation failure");
}
strBuf[strBufLen++] = c;
}
strBuf[strBufLen++] = c;
}
protected:
nsHtml5String strBufToString();
private:
void strBufToDoctypeName();
void emitStrBuf();
inline void appendSecondHyphenToBogusComment()
{
appendStrBuf('-');
}
protected:
nsHtml5String strBufToString();
inline void adjustDoubleHyphenAndAppendToStrBufAndErr(char16_t c)
{
errConsecutiveHyphens();
appendStrBuf(c);
}
private:
void strBufToDoctypeName();
void emitStrBuf();
inline void appendSecondHyphenToBogusComment() { appendStrBuf('-'); }
void appendStrBuf(char16_t* buffer, int32_t offset, int32_t length);
inline void appendCharRefBufToStrBuf()
{
appendStrBuf(charRefBuf, 0, charRefBufLen);
charRefBufLen = 0;
}
inline void adjustDoubleHyphenAndAppendToStrBufAndErr(char16_t c)
{
errConsecutiveHyphens();
appendStrBuf(c);
}
void emitComment(int32_t provisionalHyphens, int32_t pos);
protected:
void flushChars(char16_t* buf, int32_t pos);
private:
void strBufToElementNameString();
int32_t emitCurrentTagToken(bool selfClosing, int32_t pos);
void attributeNameComplete();
void addAttributeWithoutValue();
void addAttributeWithValue();
public:
void start();
bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
private:
template<class P> int32_t stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* buf, bool reconsume, int32_t returnState, int32_t endPos);
void initDoctypeFields();
inline void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
{
silentCarriageReturn();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
void appendStrBuf(char16_t* buffer, int32_t offset, int32_t length);
inline void appendCharRefBufToStrBuf()
{
appendStrBuf(charRefBuf, 0, charRefBufLen);
charRefBufLen = 0;
}
inline void adjustDoubleHyphenAndAppendToStrBufLineFeed()
{
silentLineFeed();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
void emitComment(int32_t provisionalHyphens, int32_t pos);
inline void appendStrBufLineFeed()
{
silentLineFeed();
appendStrBuf('\n');
}
protected:
void flushChars(char16_t* buf, int32_t pos);
inline void appendStrBufCarriageReturn()
{
silentCarriageReturn();
appendStrBuf('\n');
}
private:
void strBufToElementNameString();
int32_t emitCurrentTagToken(bool selfClosing, int32_t pos);
void attributeNameComplete();
void addAttributeWithoutValue();
void addAttributeWithValue();
protected:
inline void silentCarriageReturn()
{
++line;
lastCR = true;
}
public:
void start();
bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
inline void silentLineFeed()
{
++line;
}
private:
template<class P>
int32_t stateLoop(int32_t state,
char16_t c,
int32_t pos,
char16_t* buf,
bool reconsume,
int32_t returnState,
int32_t endPos);
void initDoctypeFields();
inline void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
{
silentCarriageReturn();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
private:
void emitCarriageReturn(char16_t* buf, int32_t pos);
void emitReplacementCharacter(char16_t* buf, int32_t pos);
void emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos);
void setAdditionalAndRememberAmpersandLocation(char16_t add);
void bogusDoctype();
void bogusDoctypeWithoutQuirks();
void handleNcrValue(int32_t returnState);
public:
void eof();
private:
void emitDoctypeToken(int32_t pos);
protected:
inline char16_t checkChar(char16_t* buf, int32_t pos)
{
return buf[pos];
}
inline void adjustDoubleHyphenAndAppendToStrBufLineFeed()
{
silentLineFeed();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
public:
bool internalEncodingDeclaration(nsHtml5String internalCharset);
private:
void emitOrAppendTwo(const char16_t* val, int32_t returnState);
void emitOrAppendOne(const char16_t* val, int32_t returnState);
public:
void end();
void requestSuspension();
bool isInDataState();
void resetToDataState();
void loadState(nsHtml5Tokenizer* other);
void initializeWithoutStarting();
void setEncodingDeclarationHandler(nsHtml5StreamParser* encodingDeclarationHandler);
~nsHtml5Tokenizer();
static void initializeStatics();
static void releaseStatics();
inline void appendStrBufLineFeed()
{
silentLineFeed();
appendStrBuf('\n');
}
inline void appendStrBufCarriageReturn()
{
silentCarriageReturn();
appendStrBuf('\n');
}
protected:
inline void silentCarriageReturn()
{
++line;
lastCR = true;
}
inline void silentLineFeed() { ++line; }
private:
void emitCarriageReturn(char16_t* buf, int32_t pos);
void emitReplacementCharacter(char16_t* buf, int32_t pos);
void emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos);
void setAdditionalAndRememberAmpersandLocation(char16_t add);
void bogusDoctype();
void bogusDoctypeWithoutQuirks();
void handleNcrValue(int32_t returnState);
public:
void eof();
private:
void emitDoctypeToken(int32_t pos);
protected:
inline char16_t checkChar(char16_t* buf, int32_t pos) { return buf[pos]; }
public:
bool internalEncodingDeclaration(nsHtml5String internalCharset);
private:
void emitOrAppendTwo(const char16_t* val, int32_t returnState);
void emitOrAppendOne(const char16_t* val, int32_t returnState);
public:
void end();
void requestSuspension();
bool isInDataState();
void resetToDataState();
void loadState(nsHtml5Tokenizer* other);
void initializeWithoutStarting();
void setEncodingDeclarationHandler(
nsHtml5StreamParser* encodingDeclarationHandler);
~nsHtml5Tokenizer();
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5TokenizerHSupplement.h"
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -67,518 +67,573 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
{
private:
static char16_t REPLACEMENT_CHARACTER[];
public:
static const int32_t OTHER = 0;
private:
static char16_t REPLACEMENT_CHARACTER[];
static const int32_t A = 1;
public:
static const int32_t OTHER = 0;
static const int32_t BASE = 2;
static const int32_t A = 1;
static const int32_t BODY = 3;
static const int32_t BASE = 2;
static const int32_t BR = 4;
static const int32_t BODY = 3;
static const int32_t BUTTON = 5;
static const int32_t BR = 4;
static const int32_t CAPTION = 6;
static const int32_t BUTTON = 5;
static const int32_t COL = 7;
static const int32_t CAPTION = 6;
static const int32_t COLGROUP = 8;
static const int32_t COL = 7;
static const int32_t FORM = 9;
static const int32_t COLGROUP = 8;
static const int32_t FRAME = 10;
static const int32_t FORM = 9;
static const int32_t FRAMESET = 11;
static const int32_t FRAME = 10;
static const int32_t IMAGE = 12;
static const int32_t FRAMESET = 11;
static const int32_t INPUT = 13;
static const int32_t IMAGE = 12;
static const int32_t RT_OR_RP = 14;
static const int32_t INPUT = 13;
static const int32_t LI = 15;
static const int32_t RT_OR_RP = 14;
static const int32_t LINK_OR_BASEFONT_OR_BGSOUND = 16;
static const int32_t LI = 15;
static const int32_t MATH = 17;
static const int32_t LINK_OR_BASEFONT_OR_BGSOUND = 16;
static const int32_t META = 18;
static const int32_t MATH = 17;
static const int32_t SVG = 19;
static const int32_t META = 18;
static const int32_t HEAD = 20;
static const int32_t SVG = 19;
static const int32_t HR = 22;
static const int32_t HEAD = 20;
static const int32_t HTML = 23;
static const int32_t HR = 22;
static const int32_t NOBR = 24;
static const int32_t HTML = 23;
static const int32_t NOFRAMES = 25;
static const int32_t NOBR = 24;
static const int32_t NOSCRIPT = 26;
static const int32_t NOFRAMES = 25;
static const int32_t OPTGROUP = 27;
static const int32_t NOSCRIPT = 26;
static const int32_t OPTION = 28;
static const int32_t OPTGROUP = 27;
static const int32_t P = 29;
static const int32_t OPTION = 28;
static const int32_t PLAINTEXT = 30;
static const int32_t P = 29;
static const int32_t SCRIPT = 31;
static const int32_t PLAINTEXT = 30;
static const int32_t SELECT = 32;
static const int32_t SCRIPT = 31;
static const int32_t STYLE = 33;
static const int32_t SELECT = 32;
static const int32_t TABLE = 34;
static const int32_t STYLE = 33;
static const int32_t TEXTAREA = 35;
static const int32_t TABLE = 34;
static const int32_t TITLE = 36;
static const int32_t TEXTAREA = 35;
static const int32_t TR = 37;
static const int32_t TITLE = 36;
static const int32_t XMP = 38;
static const int32_t TR = 37;
static const int32_t TBODY_OR_THEAD_OR_TFOOT = 39;
static const int32_t XMP = 38;
static const int32_t TD_OR_TH = 40;
static const int32_t TBODY_OR_THEAD_OR_TFOOT = 39;
static const int32_t DD_OR_DT = 41;
static const int32_t TD_OR_TH = 40;
static const int32_t H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
static const int32_t DD_OR_DT = 41;
static const int32_t MARQUEE_OR_APPLET = 43;
static const int32_t H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
static const int32_t PRE_OR_LISTING = 44;
static const int32_t MARQUEE_OR_APPLET = 43;
static const int32_t
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U =
45;
static const int32_t PRE_OR_LISTING = 44;
static const int32_t UL_OR_OL_OR_DL = 46;
static const int32_t
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U =
45;
static const int32_t IFRAME = 47;
static const int32_t UL_OR_OL_OR_DL = 46;
static const int32_t EMBED = 48;
static const int32_t IFRAME = 47;
static const int32_t AREA_OR_WBR = 49;
static const int32_t EMBED = 48;
static const int32_t DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
static const int32_t AREA_OR_WBR = 49;
static const int32_t
ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY =
51;
static const int32_t DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
static const int32_t RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
static const int32_t
ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY =
51;
static const int32_t RB_OR_RTC = 53;
static const int32_t RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
static const int32_t PARAM_OR_SOURCE_OR_TRACK = 55;
static const int32_t RB_OR_RTC = 53;
static const int32_t MGLYPH_OR_MALIGNMARK = 56;
static const int32_t PARAM_OR_SOURCE_OR_TRACK = 55;
static const int32_t MI_MO_MN_MS_MTEXT = 57;
static const int32_t MGLYPH_OR_MALIGNMARK = 56;
static const int32_t ANNOTATION_XML = 58;
static const int32_t MI_MO_MN_MS_MTEXT = 57;
static const int32_t FOREIGNOBJECT_OR_DESC = 59;
static const int32_t ANNOTATION_XML = 58;
static const int32_t NOEMBED = 60;
static const int32_t FOREIGNOBJECT_OR_DESC = 59;
static const int32_t FIELDSET = 61;
static const int32_t NOEMBED = 60;
static const int32_t OUTPUT = 62;
static const int32_t FIELDSET = 61;
static const int32_t OBJECT = 63;
static const int32_t OUTPUT = 62;
static const int32_t FONT = 64;
static const int32_t OBJECT = 63;
static const int32_t KEYGEN = 65;
static const int32_t FONT = 64;
static const int32_t MENUITEM = 66;
static const int32_t KEYGEN = 65;
static const int32_t TEMPLATE = 67;
static const int32_t MENUITEM = 66;
static const int32_t IMG = 68;
static const int32_t TEMPLATE = 67;
private:
static const int32_t IN_ROW = 0;
static const int32_t IMG = 68;
static const int32_t IN_TABLE_BODY = 1;
private:
static const int32_t IN_ROW = 0;
static const int32_t IN_TABLE = 2;
static const int32_t IN_TABLE_BODY = 1;
static const int32_t IN_CAPTION = 3;
static const int32_t IN_TABLE = 2;
static const int32_t IN_CELL = 4;
static const int32_t IN_CAPTION = 3;
static const int32_t FRAMESET_OK = 5;
static const int32_t IN_CELL = 4;
static const int32_t IN_BODY = 6;
static const int32_t FRAMESET_OK = 5;
static const int32_t IN_HEAD = 7;
static const int32_t IN_BODY = 6;
static const int32_t IN_HEAD_NOSCRIPT = 8;
static const int32_t IN_HEAD = 7;
static const int32_t IN_COLUMN_GROUP = 9;
static const int32_t IN_HEAD_NOSCRIPT = 8;
static const int32_t IN_SELECT_IN_TABLE = 10;
static const int32_t IN_COLUMN_GROUP = 9;
static const int32_t IN_SELECT = 11;
static const int32_t IN_SELECT_IN_TABLE = 10;
static const int32_t AFTER_BODY = 12;
static const int32_t IN_SELECT = 11;
static const int32_t IN_FRAMESET = 13;
static const int32_t AFTER_BODY = 12;
static const int32_t AFTER_FRAMESET = 14;
static const int32_t IN_FRAMESET = 13;
static const int32_t INITIAL = 15;
static const int32_t AFTER_FRAMESET = 14;
static const int32_t BEFORE_HTML = 16;
static const int32_t INITIAL = 15;
static const int32_t BEFORE_HEAD = 17;
static const int32_t BEFORE_HTML = 16;
static const int32_t AFTER_HEAD = 18;
static const int32_t BEFORE_HEAD = 17;
static const int32_t AFTER_AFTER_BODY = 19;
static const int32_t AFTER_HEAD = 18;
static const int32_t AFTER_AFTER_FRAMESET = 20;
static const int32_t AFTER_AFTER_BODY = 19;
static const int32_t TEXT = 21;
static const int32_t AFTER_AFTER_FRAMESET = 20;
static const int32_t IN_TEMPLATE = 22;
static const int32_t TEXT = 21;
static const int32_t CHARSET_INITIAL = 0;
static const int32_t IN_TEMPLATE = 22;
static const int32_t CHARSET_C = 1;
static const int32_t CHARSET_INITIAL = 0;
static const int32_t CHARSET_H = 2;
static const int32_t CHARSET_C = 1;
static const int32_t CHARSET_A = 3;
static const int32_t CHARSET_H = 2;
static const int32_t CHARSET_R = 4;
static const int32_t CHARSET_A = 3;
static const int32_t CHARSET_S = 5;
static const int32_t CHARSET_R = 4;
static const int32_t CHARSET_E = 6;
static const int32_t CHARSET_S = 5;
static const int32_t CHARSET_T = 7;
static const int32_t CHARSET_E = 6;
static const int32_t CHARSET_EQUALS = 8;
static const int32_t CHARSET_T = 7;
static const int32_t CHARSET_SINGLE_QUOTED = 9;
static const int32_t CHARSET_EQUALS = 8;
static const int32_t CHARSET_DOUBLE_QUOTED = 10;
static const int32_t CHARSET_SINGLE_QUOTED = 9;
static const int32_t CHARSET_UNQUOTED = 11;
static const int32_t CHARSET_DOUBLE_QUOTED = 10;
static staticJArray<const char*,int32_t> QUIRKY_PUBLIC_IDS;
static const int32_t NOT_FOUND_ON_STACK = INT32_MAX;
static const int32_t CHARSET_UNQUOTED = 11;
int32_t mode;
int32_t originalMode;
bool framesetOk;
protected:
nsHtml5Tokenizer* tokenizer;
private:
bool scriptingEnabled;
bool needToDropLF;
bool fragment;
nsAtom* contextName;
int32_t contextNamespace;
nsIContentHandle* contextNode;
autoJArray<int32_t,int32_t> templateModeStack;
int32_t templateModePtr;
autoJArray<nsHtml5StackNode*, int32_t> stackNodes;
int32_t stackNodesIdx;
int32_t numStackNodes;
autoJArray<nsHtml5StackNode*,int32_t> stack;
int32_t currentPtr;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
int32_t listPtr;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
protected:
autoJArray<char16_t,int32_t> charBuffer;
int32_t charBufferLen;
private:
bool quirks;
bool isSrcdocDocument;
inline nsHtml5ContentCreatorFunction htmlCreator(
mozilla::dom::HTMLContentCreatorFunction htmlCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.html = htmlCreator;
return creator;
}
inline nsHtml5ContentCreatorFunction svgCreator(
mozilla::dom::SVGContentCreatorFunction svgCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.svg = svgCreator;
return creator;
}
public:
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void comment(char16_t* buf, int32_t start, int32_t length);
void characters(const char16_t* buf, int32_t start, int32_t length);
void zeroOriginatingReplacementCharacter();
void eof();
void endTokenization();
void startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, bool selfClosing);
private:
void startTagTitleInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagGenericRawText(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagScriptInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagTemplateInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
bool isTemplateContents();
bool isTemplateModeStackEmpty();
bool isSpecialParentInForeign(nsHtml5StackNode* stackNode);
public:
static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue,
nsHtml5TreeBuilder* tb);
private:
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
public:
void endTag(nsHtml5ElementName* elementName);
private:
void endTagTemplateInHead();
int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
int32_t findLast(nsAtom* name);
int32_t findLastInTableScope(nsAtom* name);
int32_t findLastInButtonScope(nsAtom* name);
int32_t findLastInScope(nsAtom* name);
int32_t findLastInListScope(nsAtom* name);
int32_t findLastInScopeHn();
void generateImpliedEndTagsExceptFor(nsAtom* name);
void generateImpliedEndTags();
bool isSecondOnStackBody();
void documentModeInternal(nsHtml5DocumentMode m,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool html4SpecificAdditionalErrorChecks);
bool isAlmostStandards(nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
bool isQuirky(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void closeTheCell(int32_t eltPos);
int32_t findLastInTableScopeTdTh();
void clearStackBackTo(int32_t eltPos);
void resetTheInsertionMode();
void implicitlyCloseP();
bool debugOnlyClearLastStackSlot();
bool debugOnlyClearLastListSlot();
void pushTemplateMode(int32_t mode);
void push(nsHtml5StackNode* node);
void silentPush(nsHtml5StackNode* node);
void append(nsHtml5StackNode* node);
inline void insertMarker()
{
append(nullptr);
}
void clearTheListOfActiveFormattingElementsUpToTheLastMarker();
inline bool isCurrent(nsAtom* name)
{
return stack[currentPtr]->ns == kNameSpaceID_XHTML && name == stack[currentPtr]->name;
}
void removeFromStack(int32_t pos);
void removeFromStack(nsHtml5StackNode* node);
void removeFromListOfActiveFormattingElements(int32_t pos);
bool adoptionAgencyEndTag(nsAtom* name);
void insertIntoStack(nsHtml5StackNode* node, int32_t position);
void insertIntoListOfActiveFormattingElements(nsHtml5StackNode* formattingClone, int32_t bookmark);
int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node);
int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
nsAtom* name);
void maybeForgetEarlierDuplicateFormattingElement(
nsAtom* name,
nsHtml5HtmlAttributes* attributes);
int32_t findLastOrRoot(nsAtom* name);
int32_t findLastOrRoot(int32_t group);
bool addAttributesToBody(nsHtml5HtmlAttributes* attributes);
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
public:
void notifyUnusedStackNode(int32_t idxInStackNodes);
private:
nsHtml5StackNode* getUnusedStackNode();
nsHtml5StackNode* createStackNode(
int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node);
void popTemplateMode();
void pop();
void silentPop();
void popOnEof();
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
void appendHtmlElementToDocumentAndPush();
void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement();
void appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContentHandle* child, nsIContentHandle* table, nsIContentHandle* stackParent);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* table,
nsIContentHandle* stackParent,
nsHtml5ContentCreatorFunction creator);
;void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContentHandle* table, nsIContentHandle* stackParent);
void appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendComment(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length);
void addAttributesToElement(nsIContentHandle* element, nsHtml5HtmlAttributes* attributes);
void markMalformedIfScript(nsIContentHandle* elt);
void start(bool fragmentMode);
void end();
void appendDoctypeToDocument(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
public:
inline bool cdataSectionAllowed()
{
return isInForeign();
}
private:
bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsAtom* context,
int32_t ns,
nsIContentHandle* node,
bool quirks);
protected:
nsIContentHandle* currentNode();
public:
bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled);
void setIsSrcdocDocument(bool isSrcdocDocument);
void flushCharacters();
private:
bool charBufferContainsNonWhitespace();
public:
nsAHtml5TreeBuilderState* newSnapshot();
bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);
void loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTable* interner);
private:
int32_t findInArray(nsHtml5StackNode* node, jArray<nsHtml5StackNode*,int32_t> arr);
public:
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
static void initializeStatics();
static void releaseStatics();
static staticJArray<const char*, int32_t> QUIRKY_PUBLIC_IDS;
static const int32_t NOT_FOUND_ON_STACK = INT32_MAX;
int32_t mode;
int32_t originalMode;
bool framesetOk;
protected:
nsHtml5Tokenizer* tokenizer;
private:
bool scriptingEnabled;
bool needToDropLF;
bool fragment;
nsAtom* contextName;
int32_t contextNamespace;
nsIContentHandle* contextNode;
autoJArray<int32_t, int32_t> templateModeStack;
int32_t templateModePtr;
autoJArray<nsHtml5StackNode*, int32_t> stackNodes;
int32_t stackNodesIdx;
int32_t numStackNodes;
autoJArray<nsHtml5StackNode*, int32_t> stack;
int32_t currentPtr;
autoJArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements;
int32_t listPtr;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
protected:
autoJArray<char16_t, int32_t> charBuffer;
int32_t charBufferLen;
private:
bool quirks;
bool isSrcdocDocument;
inline nsHtml5ContentCreatorFunction htmlCreator(
mozilla::dom::HTMLContentCreatorFunction htmlCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.html = htmlCreator;
return creator;
}
inline nsHtml5ContentCreatorFunction svgCreator(
mozilla::dom::SVGContentCreatorFunction svgCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.svg = svgCreator;
return creator;
}
public:
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void comment(char16_t* buf, int32_t start, int32_t length);
void characters(const char16_t* buf, int32_t start, int32_t length);
void zeroOriginatingReplacementCharacter();
void eof();
void endTokenization();
void startTag(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
bool selfClosing);
private:
void startTagTitleInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagGenericRawText(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagScriptInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagTemplateInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
bool isTemplateContents();
bool isTemplateModeStackEmpty();
bool isSpecialParentInForeign(nsHtml5StackNode* stackNode);
public:
static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue,
nsHtml5TreeBuilder* tb);
private:
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
public:
void endTag(nsHtml5ElementName* elementName);
private:
void endTagTemplateInHead();
int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
int32_t findLast(nsAtom* name);
int32_t findLastInTableScope(nsAtom* name);
int32_t findLastInButtonScope(nsAtom* name);
int32_t findLastInScope(nsAtom* name);
int32_t findLastInListScope(nsAtom* name);
int32_t findLastInScopeHn();
void generateImpliedEndTagsExceptFor(nsAtom* name);
void generateImpliedEndTags();
bool isSecondOnStackBody();
void documentModeInternal(nsHtml5DocumentMode m,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool html4SpecificAdditionalErrorChecks);
bool isAlmostStandards(nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
bool isQuirky(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void closeTheCell(int32_t eltPos);
int32_t findLastInTableScopeTdTh();
void clearStackBackTo(int32_t eltPos);
void resetTheInsertionMode();
void implicitlyCloseP();
bool debugOnlyClearLastStackSlot();
bool debugOnlyClearLastListSlot();
void pushTemplateMode(int32_t mode);
void push(nsHtml5StackNode* node);
void silentPush(nsHtml5StackNode* node);
void append(nsHtml5StackNode* node);
inline void insertMarker() { append(nullptr); }
void clearTheListOfActiveFormattingElementsUpToTheLastMarker();
inline bool isCurrent(nsAtom* name)
{
return stack[currentPtr]->ns == kNameSpaceID_XHTML &&
name == stack[currentPtr]->name;
}
void removeFromStack(int32_t pos);
void removeFromStack(nsHtml5StackNode* node);
void removeFromListOfActiveFormattingElements(int32_t pos);
bool adoptionAgencyEndTag(nsAtom* name);
void insertIntoStack(nsHtml5StackNode* node, int32_t position);
void insertIntoListOfActiveFormattingElements(
nsHtml5StackNode* formattingClone,
int32_t bookmark);
int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node);
int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
nsAtom* name);
void maybeForgetEarlierDuplicateFormattingElement(
nsAtom* name,
nsHtml5HtmlAttributes* attributes);
int32_t findLastOrRoot(nsAtom* name);
int32_t findLastOrRoot(int32_t group);
bool addAttributesToBody(nsHtml5HtmlAttributes* attributes);
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
public:
void notifyUnusedStackNode(int32_t idxInStackNodes);
private:
nsHtml5StackNode* getUnusedStackNode();
nsHtml5StackNode* createStackNode(
int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node);
void popTemplateMode();
void pop();
void silentPop();
void popOnEof();
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
void appendHtmlElementToDocumentAndPush();
void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement();
void appendToCurrentNodeAndPushFormElementMayFoster(
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushFormattingElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterMathML(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(
nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent,
nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContentHandle* child,
nsIContentHandle* table,
nsIContentHandle* stackParent);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* table,
nsIContentHandle* stackParent,
nsHtml5ContentCreatorFunction creator);
;
void insertFosterParentedCharacters(char16_t* buf,
int32_t start,
int32_t length,
nsIContentHandle* table,
nsIContentHandle* stackParent);
void appendCharacters(nsIContentHandle* parent,
char16_t* buf,
int32_t start,
int32_t length);
void appendComment(nsIContentHandle* parent,
char16_t* buf,
int32_t start,
int32_t length);
void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length);
void addAttributesToElement(nsIContentHandle* element,
nsHtml5HtmlAttributes* attributes);
void markMalformedIfScript(nsIContentHandle* elt);
void start(bool fragmentMode);
void end();
void appendDoctypeToDocument(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
public:
inline bool cdataSectionAllowed() { return isInForeign(); }
private:
bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsAtom* context,
int32_t ns,
nsIContentHandle* node,
bool quirks);
protected:
nsIContentHandle* currentNode();
public:
bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled);
void setIsSrcdocDocument(bool isSrcdocDocument);
void flushCharacters();
private:
bool charBufferContainsNonWhitespace();
public:
nsAHtml5TreeBuilderState* newSnapshot();
bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);
void loadState(nsAHtml5TreeBuilderState* snapshot,
nsHtml5AtomTable* interner);
private:
int32_t findInArray(nsHtml5StackNode* node,
jArray<nsHtml5StackNode*, int32_t> arr);
public:
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
jArray<nsHtml5StackNode*, int32_t> getListOfActiveFormattingElements();
jArray<nsHtml5StackNode*, int32_t> getStack();
jArray<int32_t, int32_t> getTemplateModeStack();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5TreeBuilderHSupplement.h"
};
#endif

View File

@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,27 +54,26 @@ class nsHtml5MetaScanner;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5UTF16Buffer
{
private:
char16_t* buffer;
int32_t start;
int32_t end;
public:
int32_t getStart();
void setStart(int32_t start);
char16_t* getBuffer();
int32_t getEnd();
bool hasMore();
int32_t getLength();
void adjust(bool lastWasCR);
void setEnd(int32_t end);
static void initializeStatics();
static void releaseStatics();
private:
char16_t* buffer;
int32_t start;
int32_t end;
public:
int32_t getStart();
void setStart(int32_t start);
char16_t* getBuffer();
int32_t getEnd();
bool hasMore();
int32_t getLength();
void adjust(bool lastWasCR);
void setEnd(int32_t end);
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5UTF16BufferHSupplement.h"
};
#endif