From 72a6fd4d2a7a2242dc4af3a25a7a175995e7fa9b Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 10:35:50 -0500 Subject: Bug 1352082 - Avoid shifting a signed integer left in C++. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 99c6de323..b00d245a5 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -73,7 +73,7 @@ class nsHtml5ElementName bool isCustom(); static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); private: - static int32_t bufToHash(char16_t* buf, int32_t len); + static uint32_t bufToHash(char16_t* buf, int32_t len); nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); protected: explicit nsHtml5ElementName(nsIAtom* name); -- cgit v1.2.3 From 738190dfde25514521d6c6e4af747abb2505b973 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 12:31:36 -0500 Subject: Bug 1355493 - Tweak bufToHash() and reduce the number of pre-interned elements. HTML Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 647 ++++++++++++++++++++------------------- 1 file changed, 338 insertions(+), 309 deletions(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index b00d245a5..3bf2ed92b 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2016 Mozilla Foundation + * Copyright (c) 2008-2017 Mozilla Foundation * Copyright (c) 2018-2020 Moonchild Productions * Copyright (c) 2020 Binary Outcast * @@ -73,7 +73,36 @@ class nsHtml5ElementName bool isCustom(); static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); private: - static uint32_t bufToHash(char16_t* buf, int32_t len); + 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(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); protected: explicit nsHtml5ElementName(nsIAtom* name); @@ -81,50 +110,6 @@ class nsHtml5ElementName virtual void release(); virtual ~nsHtml5ElementName(); virtual nsHtml5ElementName* cloneElementName(nsHtml5AtomTable* interner); - static nsHtml5ElementName* ELT_A; - static nsHtml5ElementName* ELT_B; - static nsHtml5ElementName* ELT_G; - static nsHtml5ElementName* ELT_I; - static nsHtml5ElementName* ELT_P; - static nsHtml5ElementName* ELT_Q; - static nsHtml5ElementName* ELT_S; - static nsHtml5ElementName* ELT_U; - static nsHtml5ElementName* ELT_BR; - static nsHtml5ElementName* ELT_CI; - static nsHtml5ElementName* ELT_CN; - static nsHtml5ElementName* ELT_DD; - static nsHtml5ElementName* ELT_DL; - static nsHtml5ElementName* ELT_DT; - static nsHtml5ElementName* ELT_EM; - static nsHtml5ElementName* ELT_EQ; - static nsHtml5ElementName* ELT_FN; - 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_GT; - static nsHtml5ElementName* ELT_HR; - static nsHtml5ElementName* ELT_IN; - static nsHtml5ElementName* ELT_LI; - static nsHtml5ElementName* ELT_LN; - static nsHtml5ElementName* ELT_LT; - static nsHtml5ElementName* ELT_MI; - static nsHtml5ElementName* ELT_MN; - static nsHtml5ElementName* ELT_MO; - static nsHtml5ElementName* ELT_MS; - static nsHtml5ElementName* ELT_OL; - static nsHtml5ElementName* ELT_OR; - static nsHtml5ElementName* ELT_PI; - static nsHtml5ElementName* ELT_RB; - static nsHtml5ElementName* ELT_RP; - static nsHtml5ElementName* ELT_RT; - static nsHtml5ElementName* ELT_TD; - static nsHtml5ElementName* ELT_TH; - static nsHtml5ElementName* ELT_TR; - static nsHtml5ElementName* ELT_TT; - static nsHtml5ElementName* ELT_UL; static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_ARG; static nsHtml5ElementName* ELT_ABS; @@ -157,6 +142,8 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_NOT; static nsHtml5ElementName* ELT_NAV; static nsHtml5ElementName* ELT_PRE; + static nsHtml5ElementName* ELT_A; + static nsHtml5ElementName* ELT_B; static nsHtml5ElementName* ELT_RTC; static nsHtml5ElementName* ELT_REM; static nsHtml5ElementName* ELT_SUB; @@ -170,315 +157,357 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_TAN; static nsHtml5ElementName* ELT_USE; static nsHtml5ElementName* ELT_VAR; + static nsHtml5ElementName* ELT_G; static nsHtml5ElementName* ELT_WBR; static nsHtml5ElementName* ELT_XMP; static nsHtml5ElementName* ELT_XOR; + 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_ABBR; - static nsHtml5ElementName* ELT_BASE; - static nsHtml5ElementName* ELT_BVAR; - static nsHtml5ElementName* ELT_BODY; - static nsHtml5ElementName* ELT_CARD; - static nsHtml5ElementName* ELT_CODE; - static nsHtml5ElementName* ELT_CITE; - static nsHtml5ElementName* ELT_CSCH; - static nsHtml5ElementName* ELT_COSH; - static nsHtml5ElementName* ELT_COTH; - static nsHtml5ElementName* ELT_CURL; - static nsHtml5ElementName* ELT_DESC; - static nsHtml5ElementName* ELT_DIFF; - static nsHtml5ElementName* ELT_DEFS; - static nsHtml5ElementName* ELT_FORM; - static nsHtml5ElementName* ELT_FONT; - static nsHtml5ElementName* ELT_GRAD; - static nsHtml5ElementName* ELT_HEAD; - static nsHtml5ElementName* ELT_HTML; - static nsHtml5ElementName* ELT_LINE; - static nsHtml5ElementName* ELT_LINK; - static nsHtml5ElementName* ELT_LIST; + static nsHtml5ElementName* ELT_EULERGAMMA; + static nsHtml5ElementName* ELT_FEFUNCA; + static nsHtml5ElementName* ELT_LAMBDA; + static nsHtml5ElementName* ELT_METADATA; static nsHtml5ElementName* ELT_META; + static nsHtml5ElementName* ELT_TEXTAREA; + static nsHtml5ElementName* ELT_FEFUNCB; static nsHtml5ElementName* ELT_MSUB; - static nsHtml5ElementName* ELT_MODE; - static nsHtml5ElementName* ELT_MATH; - static nsHtml5ElementName* ELT_MARK; - static nsHtml5ElementName* ELT_MASK; - static nsHtml5ElementName* ELT_MEAN; - static nsHtml5ElementName* ELT_MAIN; - static nsHtml5ElementName* ELT_MSUP; - static nsHtml5ElementName* ELT_MENU; - static nsHtml5ElementName* ELT_MROW; - static nsHtml5ElementName* ELT_NONE; - static nsHtml5ElementName* ELT_NOBR; - static nsHtml5ElementName* ELT_NEST; - static nsHtml5ElementName* ELT_PATH; - static nsHtml5ElementName* ELT_PLUS; - static nsHtml5ElementName* ELT_RULE; - static nsHtml5ElementName* ELT_REAL; - static nsHtml5ElementName* ELT_RELN; - static nsHtml5ElementName* ELT_RECT; - static nsHtml5ElementName* ELT_ROOT; - static nsHtml5ElementName* ELT_RUBY; - static nsHtml5ElementName* ELT_SECH; - static nsHtml5ElementName* ELT_SINH; - static nsHtml5ElementName* ELT_SPAN; - static nsHtml5ElementName* ELT_SAMP; - static nsHtml5ElementName* ELT_STOP; - static nsHtml5ElementName* ELT_SDEV; - static nsHtml5ElementName* ELT_TIME; - static nsHtml5ElementName* ELT_TRUE; - static nsHtml5ElementName* ELT_TREF; - static nsHtml5ElementName* ELT_TANH; - static nsHtml5ElementName* ELT_TEXT; - static nsHtml5ElementName* ELT_VIEW; - static nsHtml5ElementName* ELT_ASIDE; - static nsHtml5ElementName* ELT_AUDIO; - static nsHtml5ElementName* ELT_APPLY; - static nsHtml5ElementName* ELT_EMBED; - static nsHtml5ElementName* ELT_FRAME; - static nsHtml5ElementName* ELT_FALSE; - static nsHtml5ElementName* ELT_FLOOR; - static nsHtml5ElementName* ELT_GLYPH; - static nsHtml5ElementName* ELT_HKERN; - static nsHtml5ElementName* ELT_IMAGE; - static nsHtml5ElementName* ELT_IDENT; - static nsHtml5ElementName* ELT_INPUT; - static nsHtml5ElementName* ELT_LABEL; - static nsHtml5ElementName* ELT_LIMIT; - static nsHtml5ElementName* ELT_MFRAC; - static nsHtml5ElementName* ELT_MPATH; - static nsHtml5ElementName* ELT_METER; - static nsHtml5ElementName* ELT_MOVER; - static nsHtml5ElementName* ELT_MINUS; - static nsHtml5ElementName* ELT_MROOT; - static nsHtml5ElementName* ELT_MSQRT; - static nsHtml5ElementName* ELT_MTEXT; - static nsHtml5ElementName* ELT_NOTIN; - static nsHtml5ElementName* ELT_PIECE; - static nsHtml5ElementName* ELT_PARAM; - static nsHtml5ElementName* ELT_POWER; - static nsHtml5ElementName* ELT_REALS; - static nsHtml5ElementName* ELT_STYLE; - static nsHtml5ElementName* ELT_SMALL; - static nsHtml5ElementName* ELT_THEAD; - static nsHtml5ElementName* ELT_TABLE; - static nsHtml5ElementName* ELT_TITLE; - static nsHtml5ElementName* ELT_TRACK; - static nsHtml5ElementName* ELT_TSPAN; - static nsHtml5ElementName* ELT_TIMES; - static nsHtml5ElementName* ELT_TFOOT; - static nsHtml5ElementName* ELT_TBODY; - static nsHtml5ElementName* ELT_UNION; - static nsHtml5ElementName* ELT_VKERN; - static nsHtml5ElementName* ELT_VIDEO; + static nsHtml5ElementName* ELT_RB; static nsHtml5ElementName* ELT_ARCSEC; static nsHtml5ElementName* ELT_ARCCSC; - static nsHtml5ElementName* ELT_ARCTAN; - static nsHtml5ElementName* ELT_ARCSIN; - static nsHtml5ElementName* ELT_ARCCOS; - static nsHtml5ElementName* ELT_APPLET; - static nsHtml5ElementName* ELT_ARCCOT; - static nsHtml5ElementName* ELT_APPROX; - static nsHtml5ElementName* ELT_BUTTON; + static nsHtml5ElementName* ELT_DEFINITION_SRC; + static nsHtml5ElementName* ELT_DESC; + static nsHtml5ElementName* ELT_FONT_FACE_SRC; + static nsHtml5ElementName* ELT_MFRAC; + static nsHtml5ElementName* ELT_DD; + static nsHtml5ElementName* ELT_BGSOUND; + static nsHtml5ElementName* ELT_CARD; + static nsHtml5ElementName* ELT_DISCARD; + static nsHtml5ElementName* ELT_EMBED; + static nsHtml5ElementName* ELT_FEBLEND; + static nsHtml5ElementName* ELT_FEFLOOD; + static nsHtml5ElementName* ELT_GRAD; + static nsHtml5ElementName* ELT_HEAD; + static nsHtml5ElementName* ELT_LEGEND; + static nsHtml5ElementName* ELT_MFENCED; + static nsHtml5ElementName* ELT_MPADDED; + 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_CENTER; - static nsHtml5ElementName* ELT_CURSOR; - static nsHtml5ElementName* ELT_CANVAS; + static nsHtml5ElementName* ELT_COLOR_PROFILE; + static nsHtml5ElementName* ELT_COMPOSE; + static nsHtml5ElementName* ELT_CONJUGATE; + static nsHtml5ElementName* ELT_CITE; + static nsHtml5ElementName* ELT_DIVERGENCE; static nsHtml5ElementName* ELT_DIVIDE; static nsHtml5ElementName* ELT_DEGREE; - static nsHtml5ElementName* ELT_DIALOG; - static nsHtml5ElementName* ELT_DOMAIN; - static nsHtml5ElementName* ELT_EXISTS; + static nsHtml5ElementName* ELT_DECLARE; + static nsHtml5ElementName* ELT_DATATEMPLATE; + static nsHtml5ElementName* ELT_EXPONENTIALE; + static nsHtml5ElementName* ELT_ELLIPSE; + static nsHtml5ElementName* ELT_FONT_FACE; + static nsHtml5ElementName* ELT_FETURBULENCE; + static nsHtml5ElementName* ELT_FEMERGENODE; + static nsHtml5ElementName* ELT_FEIMAGE; + static nsHtml5ElementName* ELT_FEMERGE; static nsHtml5ElementName* ELT_FETILE; + static nsHtml5ElementName* ELT_FONT_FACE_NAME; + static nsHtml5ElementName* ELT_FRAME; static nsHtml5ElementName* ELT_FIGURE; - static nsHtml5ElementName* ELT_FORALL; - static nsHtml5ElementName* ELT_FILTER; - static nsHtml5ElementName* ELT_FOOTER; - static nsHtml5ElementName* ELT_HGROUP; - static nsHtml5ElementName* ELT_HEADER; + static nsHtml5ElementName* ELT_FALSE; + static nsHtml5ElementName* ELT_FECOMPOSITE; + static nsHtml5ElementName* ELT_IMAGE; static nsHtml5ElementName* ELT_IFRAME; - static nsHtml5ElementName* ELT_KEYGEN; - static nsHtml5ElementName* ELT_LAMBDA; - static nsHtml5ElementName* ELT_LEGEND; + static nsHtml5ElementName* ELT_INVERSE; + static nsHtml5ElementName* ELT_LINE; + static nsHtml5ElementName* ELT_LOGBASE; static nsHtml5ElementName* ELT_MSPACE; + static nsHtml5ElementName* ELT_MODE; + static nsHtml5ElementName* ELT_MARQUEE; static nsHtml5ElementName* ELT_MTABLE; static nsHtml5ElementName* ELT_MSTYLE; - static nsHtml5ElementName* ELT_MGLYPH; - static nsHtml5ElementName* ELT_MEDIAN; - static nsHtml5ElementName* ELT_MUNDER; - static nsHtml5ElementName* ELT_MARKER; - static nsHtml5ElementName* ELT_MERROR; - static nsHtml5ElementName* ELT_MOMENT; - static nsHtml5ElementName* ELT_MATRIX; - static nsHtml5ElementName* ELT_OPTION; - static nsHtml5ElementName* ELT_OBJECT; - static nsHtml5ElementName* ELT_OUTPUT; - static nsHtml5ElementName* ELT_PRIMES; + static nsHtml5ElementName* ELT_MENCLOSE; + static nsHtml5ElementName* ELT_NONE; + static nsHtml5ElementName* ELT_OTHERWISE; + static nsHtml5ElementName* ELT_PIECE; + static nsHtml5ElementName* ELT_POLYLINE; + static nsHtml5ElementName* ELT_PICTURE; + static nsHtml5ElementName* ELT_PIECEWISE; + static nsHtml5ElementName* ELT_RULE; static nsHtml5ElementName* ELT_SOURCE; static nsHtml5ElementName* ELT_STRIKE; - static nsHtml5ElementName* ELT_STRONG; - static nsHtml5ElementName* ELT_SWITCH; - static nsHtml5ElementName* ELT_SYMBOL; - static nsHtml5ElementName* ELT_SELECT; - static nsHtml5ElementName* ELT_SUBSET; - static nsHtml5ElementName* ELT_SCRIPT; - static nsHtml5ElementName* ELT_TBREAK; - static nsHtml5ElementName* ELT_VECTOR; - static nsHtml5ElementName* ELT_ARTICLE; - static nsHtml5ElementName* ELT_ANIMATE; + static nsHtml5ElementName* ELT_STYLE; + static nsHtml5ElementName* ELT_TABLE; + static nsHtml5ElementName* ELT_TITLE; + static nsHtml5ElementName* ELT_TIME; + static nsHtml5ElementName* ELT_TRANSPOSE; + static nsHtml5ElementName* ELT_TEMPLATE; + static nsHtml5ElementName* ELT_TRUE; + static nsHtml5ElementName* ELT_VARIANCE; + static nsHtml5ElementName* ELT_ALTGLYPHDEF; + static nsHtml5ElementName* ELT_DIFF; + static nsHtml5ElementName* ELT_FACTOROF; + static nsHtml5ElementName* ELT_GLYPHREF; + static nsHtml5ElementName* ELT_PARTIALDIFF; + static nsHtml5ElementName* ELT_SETDIFF; + static nsHtml5ElementName* ELT_TREF; + static nsHtml5ElementName* ELT_CEILING; + 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_ARCSECH; static nsHtml5ElementName* ELT_ARCCSCH; static nsHtml5ElementName* ELT_ARCTANH; static nsHtml5ElementName* ELT_ARCSINH; + static nsHtml5ElementName* ELT_ALTGLYPH; static nsHtml5ElementName* ELT_ARCCOSH; static nsHtml5ElementName* ELT_ARCCOTH; - static nsHtml5ElementName* ELT_ACRONYM; - static nsHtml5ElementName* ELT_ADDRESS; - static nsHtml5ElementName* ELT_BGSOUND; - static nsHtml5ElementName* ELT_COMPOSE; - static nsHtml5ElementName* ELT_CEILING; + static nsHtml5ElementName* ELT_CSCH; + static nsHtml5ElementName* ELT_COSH; + static nsHtml5ElementName* ELT_CLIPPATH; + static nsHtml5ElementName* ELT_COTH; + static nsHtml5ElementName* ELT_GLYPH; + static nsHtml5ElementName* ELT_MGLYPH; + static nsHtml5ElementName* ELT_MISSING_GLYPH; + static nsHtml5ElementName* ELT_MATH; + static nsHtml5ElementName* ELT_MPATH; + static nsHtml5ElementName* ELT_PREFETCH; + static nsHtml5ElementName* ELT_PATH; + static nsHtml5ElementName* ELT_TH; + static nsHtml5ElementName* ELT_SECH; + static nsHtml5ElementName* ELT_SWITCH; + static nsHtml5ElementName* ELT_SINH; + static nsHtml5ElementName* ELT_TANH; + static nsHtml5ElementName* ELT_TEXTPATH; + static nsHtml5ElementName* ELT_CI; + static nsHtml5ElementName* ELT_FONT_FACE_URI; + static nsHtml5ElementName* ELT_LI; + static nsHtml5ElementName* ELT_IMAGINARYI; + static nsHtml5ElementName* ELT_MI; + static nsHtml5ElementName* ELT_PI; + static nsHtml5ElementName* ELT_LINK; + static nsHtml5ElementName* ELT_MARK; + static nsHtml5ElementName* ELT_MALIGNMARK; + static nsHtml5ElementName* ELT_MASK; + static nsHtml5ElementName* ELT_TBREAK; + static nsHtml5ElementName* ELT_TRACK; + static nsHtml5ElementName* ELT_DL; + static nsHtml5ElementName* ELT_ANNOTATION_XML; static nsHtml5ElementName* ELT_CSYMBOL; + static nsHtml5ElementName* ELT_CURL; + static nsHtml5ElementName* ELT_FACTORIAL; + static nsHtml5ElementName* ELT_FORALL; + static nsHtml5ElementName* ELT_HTML; + static nsHtml5ElementName* ELT_INTERVAL; + static nsHtml5ElementName* ELT_OL; + static nsHtml5ElementName* ELT_LABEL; + static nsHtml5ElementName* ELT_UL; + static nsHtml5ElementName* ELT_REAL; + 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_MPHANTOM; + static nsHtml5ElementName* ELT_PARAM; + static nsHtml5ElementName* ELT_CN; + static nsHtml5ElementName* ELT_ARCTAN; + static nsHtml5ElementName* ELT_ARCSIN; + static nsHtml5ElementName* ELT_ANIMATION; + static nsHtml5ElementName* ELT_ANNOTATION; + static nsHtml5ElementName* ELT_ANIMATEMOTION; + static nsHtml5ElementName* ELT_BUTTON; + static nsHtml5ElementName* ELT_FN; + static nsHtml5ElementName* ELT_CODOMAIN; static nsHtml5ElementName* ELT_CAPTION; - static nsHtml5ElementName* ELT_DISCARD; - static nsHtml5ElementName* ELT_DECLARE; - static nsHtml5ElementName* ELT_DETAILS; - static nsHtml5ElementName* ELT_ELLIPSE; - static nsHtml5ElementName* ELT_FEFUNCA; - static nsHtml5ElementName* ELT_FEFUNCB; - static nsHtml5ElementName* ELT_FEBLEND; - static nsHtml5ElementName* ELT_FEFLOOD; - static nsHtml5ElementName* ELT_FEIMAGE; - static nsHtml5ElementName* ELT_FEMERGE; - static nsHtml5ElementName* ELT_FEFUNCG; - static nsHtml5ElementName* ELT_FEFUNCR; - static nsHtml5ElementName* ELT_HANDLER; - static nsHtml5ElementName* ELT_INVERSE; - static nsHtml5ElementName* ELT_IMPLIES; - static nsHtml5ElementName* ELT_ISINDEX; - static nsHtml5ElementName* ELT_LOGBASE; - static nsHtml5ElementName* ELT_LISTING; - static nsHtml5ElementName* ELT_MFENCED; - static nsHtml5ElementName* ELT_MPADDED; - static nsHtml5ElementName* ELT_MARQUEE; + static nsHtml5ElementName* ELT_CONDITION; + static nsHtml5ElementName* ELT_DOMAIN; + static nsHtml5ElementName* ELT_DOMAINOFAPPLICATION; + static nsHtml5ElementName* ELT_IN; + static nsHtml5ElementName* ELT_FIGCAPTION; + static nsHtml5ElementName* ELT_HKERN; + static nsHtml5ElementName* ELT_LN; + static nsHtml5ElementName* ELT_MN; + static nsHtml5ElementName* ELT_KEYGEN; + static nsHtml5ElementName* ELT_LAPLACIAN; + static nsHtml5ElementName* ELT_MEAN; + static nsHtml5ElementName* ELT_MEDIAN; + static nsHtml5ElementName* ELT_MAIN; static nsHtml5ElementName* ELT_MACTION; - static nsHtml5ElementName* ELT_MSUBSUP; - static nsHtml5ElementName* ELT_NOEMBED; - static nsHtml5ElementName* ELT_PICTURE; + static nsHtml5ElementName* ELT_NOTIN; + static nsHtml5ElementName* ELT_OPTION; static nsHtml5ElementName* ELT_POLYGON; static nsHtml5ElementName* ELT_PATTERN; - static nsHtml5ElementName* ELT_PRODUCT; - static nsHtml5ElementName* ELT_SETDIFF; + static nsHtml5ElementName* ELT_RELN; + static nsHtml5ElementName* ELT_SPAN; static nsHtml5ElementName* ELT_SECTION; - static nsHtml5ElementName* ELT_SUMMARY; + static nsHtml5ElementName* ELT_TSPAN; + static nsHtml5ElementName* ELT_UNION; + static nsHtml5ElementName* ELT_VKERN; + static nsHtml5ElementName* ELT_AUDIO; + static nsHtml5ElementName* ELT_MO; static nsHtml5ElementName* ELT_TENDSTO; - static nsHtml5ElementName* ELT_UPLIMIT; - static nsHtml5ElementName* ELT_ALTGLYPH; - static nsHtml5ElementName* ELT_BASEFONT; - static nsHtml5ElementName* ELT_CLIPPATH; - static nsHtml5ElementName* ELT_CODOMAIN; + static nsHtml5ElementName* ELT_VIDEO; static nsHtml5ElementName* ELT_COLGROUP; - static nsHtml5ElementName* ELT_EMPTYSET; - static nsHtml5ElementName* ELT_FACTOROF; - static nsHtml5ElementName* ELT_FIELDSET; - static nsHtml5ElementName* ELT_FRAMESET; - static nsHtml5ElementName* ELT_FEOFFSET; - static nsHtml5ElementName* ELT_GLYPHREF; - static nsHtml5ElementName* ELT_INTERVAL; - static nsHtml5ElementName* ELT_INTEGERS; - static nsHtml5ElementName* ELT_INFINITY; - static nsHtml5ElementName* ELT_LISTENER; - static nsHtml5ElementName* ELT_LOWLIMIT; - static nsHtml5ElementName* ELT_METADATA; - static nsHtml5ElementName* ELT_MENCLOSE; - static nsHtml5ElementName* ELT_MENUITEM; - static nsHtml5ElementName* ELT_MPHANTOM; - static nsHtml5ElementName* ELT_NOFRAMES; - static nsHtml5ElementName* ELT_NOSCRIPT; + static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP; + static nsHtml5ElementName* ELT_HGROUP; + static nsHtml5ElementName* ELT_MALIGNGROUP; + static nsHtml5ElementName* ELT_MSUBSUP; + static nsHtml5ElementName* ELT_MSUP; + static nsHtml5ElementName* ELT_RP; static nsHtml5ElementName* ELT_OPTGROUP; - static nsHtml5ElementName* ELT_POLYLINE; - static nsHtml5ElementName* ELT_PREFETCH; - static nsHtml5ElementName* ELT_PROGRESS; - static nsHtml5ElementName* ELT_PRSUBSET; - static nsHtml5ElementName* ELT_QUOTIENT; - static nsHtml5ElementName* ELT_SELECTOR; - static nsHtml5ElementName* ELT_TEXTAREA; - static nsHtml5ElementName* ELT_TEMPLATE; - static nsHtml5ElementName* ELT_TEXTPATH; - static nsHtml5ElementName* ELT_VARIANCE; - static nsHtml5ElementName* ELT_ANIMATION; - static nsHtml5ElementName* ELT_CONJUGATE; - static nsHtml5ElementName* ELT_CONDITION; - static nsHtml5ElementName* ELT_COMPLEXES; - static nsHtml5ElementName* ELT_FONT_FACE; - static nsHtml5ElementName* ELT_FACTORIAL; - static nsHtml5ElementName* ELT_INTERSECT; - static nsHtml5ElementName* ELT_IMAGINARY; - static nsHtml5ElementName* ELT_LAPLACIAN; - static nsHtml5ElementName* ELT_MATRIXROW; - static nsHtml5ElementName* ELT_NOTSUBSET; - static nsHtml5ElementName* ELT_OTHERWISE; - static nsHtml5ElementName* ELT_PIECEWISE; - static nsHtml5ElementName* ELT_PLAINTEXT; - static nsHtml5ElementName* ELT_RATIONALS; - static nsHtml5ElementName* ELT_SEMANTICS; - static nsHtml5ElementName* ELT_TRANSPOSE; - static nsHtml5ElementName* ELT_ANNOTATION; - static nsHtml5ElementName* ELT_BLOCKQUOTE; - static nsHtml5ElementName* ELT_DIVERGENCE; - static nsHtml5ElementName* ELT_EULERGAMMA; - static nsHtml5ElementName* ELT_EQUIVALENT; - static nsHtml5ElementName* ELT_FIGCAPTION; - static nsHtml5ElementName* ELT_IMAGINARYI; - static nsHtml5ElementName* ELT_MALIGNMARK; + static nsHtml5ElementName* ELT_SAMP; + static nsHtml5ElementName* ELT_STOP; + static nsHtml5ElementName* ELT_EQ; + static nsHtml5ElementName* ELT_BR; + static nsHtml5ElementName* ELT_ABBR; + static nsHtml5ElementName* ELT_ANIMATECOLOR; + static nsHtml5ElementName* ELT_BVAR; + static nsHtml5ElementName* ELT_CENTER; + static nsHtml5ElementName* ELT_CURSOR; + static nsHtml5ElementName* ELT_HR; + static nsHtml5ElementName* ELT_FEFUNCR; + static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER; + static nsHtml5ElementName* ELT_FILTER; + static nsHtml5ElementName* ELT_FOOTER; + static nsHtml5ElementName* ELT_FLOOR; + static nsHtml5ElementName* ELT_FEGAUSSIANBLUR; + static nsHtml5ElementName* ELT_HEADER; + static nsHtml5ElementName* ELT_HANDLER; + static nsHtml5ElementName* ELT_OR; + static nsHtml5ElementName* ELT_LISTENER; + static nsHtml5ElementName* ELT_MUNDER; + static nsHtml5ElementName* ELT_MARKER; + static nsHtml5ElementName* ELT_METER; + static nsHtml5ElementName* ELT_MOVER; static nsHtml5ElementName* ELT_MUNDEROVER; + static nsHtml5ElementName* ELT_MERROR; static nsHtml5ElementName* ELT_MLABELEDTR; + static nsHtml5ElementName* ELT_NOBR; static nsHtml5ElementName* ELT_NOTANUMBER; + static nsHtml5ElementName* ELT_POWER; + static nsHtml5ElementName* ELT_TR; static nsHtml5ElementName* ELT_SOLIDCOLOR; - static nsHtml5ElementName* ELT_ALTGLYPHDEF; + static nsHtml5ElementName* ELT_SELECTOR; + static nsHtml5ElementName* ELT_VECTOR; + static nsHtml5ElementName* ELT_ARCCOS; + static nsHtml5ElementName* ELT_ADDRESS; + static nsHtml5ElementName* ELT_CANVAS; + static nsHtml5ElementName* ELT_COMPLEXES; + static nsHtml5ElementName* ELT_DEFS; + static nsHtml5ElementName* ELT_DETAILS; + static nsHtml5ElementName* ELT_EXISTS; + static nsHtml5ElementName* ELT_IMPLIES; + static nsHtml5ElementName* ELT_INTEGERS; + static nsHtml5ElementName* ELT_MS; + static nsHtml5ElementName* ELT_MPRESCRIPTS; + static nsHtml5ElementName* ELT_MMULTISCRIPTS; + static nsHtml5ElementName* ELT_MINUS; + static nsHtml5ElementName* ELT_NOFRAMES; + static nsHtml5ElementName* ELT_NATURALNUMBERS; + static nsHtml5ElementName* ELT_PRIMES; + static nsHtml5ElementName* ELT_PROGRESS; + static nsHtml5ElementName* ELT_PLUS; + static nsHtml5ElementName* ELT_REALS; + static nsHtml5ElementName* ELT_RATIONALS; + static nsHtml5ElementName* ELT_SEMANTICS; + static nsHtml5ElementName* ELT_TIMES; + static nsHtml5ElementName* ELT_DT; + static nsHtml5ElementName* ELT_APPLET; + static nsHtml5ElementName* ELT_ARCCOT; + static nsHtml5ElementName* ELT_BASEFONT; + static nsHtml5ElementName* ELT_CARTESIANPRODUCT; + static nsHtml5ElementName* ELT_GT; static nsHtml5ElementName* ELT_DETERMINANT; - static nsHtml5ElementName* ELT_FEMERGENODE; - static nsHtml5ElementName* ELT_FECOMPOSITE; + static nsHtml5ElementName* ELT_EMPTYSET; + static nsHtml5ElementName* ELT_EQUIVALENT; + static nsHtml5ElementName* ELT_FONT_FACE_FORMAT; + static nsHtml5ElementName* ELT_FOREIGNOBJECT; + static nsHtml5ElementName* ELT_FIELDSET; + static nsHtml5ElementName* ELT_FRAMESET; + static nsHtml5ElementName* ELT_FEOFFSET; static nsHtml5ElementName* ELT_FESPOTLIGHT; - static nsHtml5ElementName* ELT_MALIGNGROUP; - static nsHtml5ElementName* ELT_MPRESCRIPTS; + static nsHtml5ElementName* ELT_FEPOINTLIGHT; + static nsHtml5ElementName* ELT_FEDISTANTLIGHT; + static nsHtml5ElementName* ELT_FONT; + static nsHtml5ElementName* ELT_LT; + static nsHtml5ElementName* ELT_INTERSECT; + static nsHtml5ElementName* ELT_IDENT; + static nsHtml5ElementName* ELT_INPUT; + static nsHtml5ElementName* ELT_LIMIT; + static nsHtml5ElementName* ELT_LOWLIMIT; + static nsHtml5ElementName* ELT_LINEARGRADIENT; + static nsHtml5ElementName* ELT_LIST; + static nsHtml5ElementName* ELT_MOMENT; + static nsHtml5ElementName* ELT_MROOT; + static nsHtml5ElementName* ELT_MSQRT; static nsHtml5ElementName* ELT_MOMENTABOUT; + static nsHtml5ElementName* ELT_MTEXT; + static nsHtml5ElementName* ELT_NOTSUBSET; static nsHtml5ElementName* ELT_NOTPRSUBSET; - static nsHtml5ElementName* ELT_PARTIALDIFF; - static nsHtml5ElementName* ELT_ALTGLYPHITEM; - static nsHtml5ElementName* ELT_ANIMATECOLOR; - static nsHtml5ElementName* ELT_DATATEMPLATE; - static nsHtml5ElementName* ELT_EXPONENTIALE; - static nsHtml5ElementName* ELT_FETURBULENCE; - static nsHtml5ElementName* ELT_FEPOINTLIGHT; - static nsHtml5ElementName* ELT_FEDROPSHADOW; - static nsHtml5ElementName* ELT_FEMORPHOLOGY; + static nsHtml5ElementName* ELT_NOSCRIPT; + static nsHtml5ElementName* ELT_NEST; + static nsHtml5ElementName* ELT_RT; + static nsHtml5ElementName* ELT_OBJECT; static nsHtml5ElementName* ELT_OUTERPRODUCT; - static nsHtml5ElementName* ELT_ANIMATEMOTION; - static nsHtml5ElementName* ELT_COLOR_PROFILE; - static nsHtml5ElementName* ELT_FONT_FACE_SRC; - static nsHtml5ElementName* ELT_FONT_FACE_URI; - static nsHtml5ElementName* ELT_FOREIGNOBJECT; - static nsHtml5ElementName* ELT_FECOLORMATRIX; - static nsHtml5ElementName* ELT_MISSING_GLYPH; - static nsHtml5ElementName* ELT_MMULTISCRIPTS; + static nsHtml5ElementName* ELT_OUTPUT; + static nsHtml5ElementName* ELT_PRODUCT; + static nsHtml5ElementName* ELT_PRSUBSET; + static nsHtml5ElementName* ELT_PLAINTEXT; + static nsHtml5ElementName* ELT_TT; + static nsHtml5ElementName* ELT_QUOTIENT; + static nsHtml5ElementName* ELT_RECT; + static nsHtml5ElementName* ELT_RADIALGRADIENT; + static nsHtml5ElementName* ELT_ROOT; + static nsHtml5ElementName* ELT_SELECT; static nsHtml5ElementName* ELT_SCALARPRODUCT; + static nsHtml5ElementName* ELT_SUBSET; + static nsHtml5ElementName* ELT_SCRIPT; + static nsHtml5ElementName* ELT_TFOOT; + static nsHtml5ElementName* ELT_TEXT; + static nsHtml5ElementName* ELT_UPLIMIT; static nsHtml5ElementName* ELT_VECTORPRODUCT; - static nsHtml5ElementName* ELT_ANNOTATION_XML; - static nsHtml5ElementName* ELT_DEFINITION_SRC; - static nsHtml5ElementName* ELT_FONT_FACE_NAME; - static nsHtml5ElementName* ELT_FEGAUSSIANBLUR; - static nsHtml5ElementName* ELT_FEDISTANTLIGHT; - static nsHtml5ElementName* ELT_LINEARGRADIENT; - static nsHtml5ElementName* ELT_NATURALNUMBERS; - static nsHtml5ElementName* ELT_RADIALGRADIENT; - static nsHtml5ElementName* ELT_ANIMATETRANSFORM; - static nsHtml5ElementName* ELT_CARTESIANPRODUCT; - static nsHtml5ElementName* ELT_FONT_FACE_FORMAT; + static nsHtml5ElementName* ELT_MENU; + static nsHtml5ElementName* ELT_SDEV; + static nsHtml5ElementName* ELT_FEDROPSHADOW; + static nsHtml5ElementName* ELT_MROW; + static nsHtml5ElementName* ELT_MATRIXROW; + static nsHtml5ElementName* ELT_VIEW; + static nsHtml5ElementName* ELT_APPROX; + static nsHtml5ElementName* ELT_FECOLORMATRIX; static nsHtml5ElementName* ELT_FECONVOLVEMATRIX; - static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING; - static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP; - static nsHtml5ElementName* ELT_FESPECULARLIGHTING; - static nsHtml5ElementName* ELT_DOMAINOFAPPLICATION; - static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER; + static nsHtml5ElementName* ELT_ISINDEX; + static nsHtml5ElementName* ELT_MATRIX; + static nsHtml5ElementName* ELT_APPLY; + static nsHtml5ElementName* ELT_BODY; + static nsHtml5ElementName* ELT_FEMORPHOLOGY; + static nsHtml5ElementName* ELT_IMAGINARY; + static nsHtml5ElementName* ELT_INFINITY; + static nsHtml5ElementName* ELT_RUBY; + static nsHtml5ElementName* ELT_SUMMARY; + static nsHtml5ElementName* ELT_TBODY; private: static nsHtml5ElementName** ELEMENT_NAMES; static staticJArray ELEMENT_HASHES; -- cgit v1.2.3 From 016a21c414f35e0d1af6ee2ffcc17224aab77637 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 13:20:59 -0500 Subject: Bug 1355769 - Avoid malloc for nsHtml5ElementName when processing a non-interned element name. HTML Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 3bf2ed92b..50415225a 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -59,18 +59,28 @@ class nsHtml5Portability; class nsHtml5ElementName { - public: - static nsHtml5ElementName* ELT_NULL_ELEMENT_NAME; + private: nsIAtom* name; nsIAtom* camelCaseName; + public: int32_t flags; + inline nsIAtom* getName() + { + return name; + } + + inline nsIAtom* getCamelCaseName() + { + return camelCaseName; + } + inline int32_t getFlags() { return flags; } int32_t getGroup(); - bool isCustom(); + bool isInterned(); static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); private: inline static uint32_t bufToHash(char16_t* buf, int32_t length) @@ -104,12 +114,10 @@ class nsHtml5ElementName } nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); - protected: - explicit nsHtml5ElementName(nsIAtom* name); public: - virtual void release(); - virtual ~nsHtml5ElementName(); - virtual nsHtml5ElementName* cloneElementName(nsHtml5AtomTable* interner); + nsHtml5ElementName(); + ~nsHtml5ElementName(); + void setNameForNonInterned(nsIAtom* name); static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_ARG; static nsHtml5ElementName* ELT_ABS; @@ -517,7 +525,7 @@ class nsHtml5ElementName }; #define NS_HTML5ELEMENT_NAME_GROUP_MASK 127 -#define NS_HTML5ELEMENT_NAME_CUSTOM (1 << 30) +#define NS_HTML5ELEMENT_NAME_NOT_INTERNED (1 << 30) #define NS_HTML5ELEMENT_NAME_SPECIAL (1 << 29) #define NS_HTML5ELEMENT_NAME_FOSTER_PARENTING (1 << 28) #define NS_HTML5ELEMENT_NAME_SCOPING (1 << 27) -- cgit v1.2.3 From e5557d43d6934918c018a527f3bae1f7049b9ef1 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 16:08:45 -0500 Subject: Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc. HTML Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 50415225a..57e80679d 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -51,7 +51,6 @@ class nsHtml5Tokenizer; class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; @@ -118,6 +117,7 @@ class nsHtml5ElementName nsHtml5ElementName(); ~nsHtml5ElementName(); void setNameForNonInterned(nsIAtom* name); + static nsHtml5ElementName* ELT_ISINDEX; static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_ARG; static nsHtml5ElementName* ELT_ABS; @@ -506,7 +506,6 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_APPROX; static nsHtml5ElementName* ELT_FECOLORMATRIX; static nsHtml5ElementName* ELT_FECONVOLVEMATRIX; - static nsHtml5ElementName* ELT_ISINDEX; static nsHtml5ElementName* ELT_MATRIX; static nsHtml5ElementName* ELT_APPLY; static nsHtml5ElementName* ELT_BODY; -- cgit v1.2.3 From 76a4af34064296177e11a0d3887a5763a6c3a572 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 17:17:17 -0500 Subject: Bug 1358037 - Inline the methods of nsHtml5ElementName and nsHtml5AttributeName. HTML Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 70 +++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 16 deletions(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 57e80679d..6bf31a0ad 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -44,13 +44,14 @@ #include "nsIUnicodeDecoder.h" #include "nsHtml5Macros.h" #include "nsIContentHandle.h" +#include "nsHtml5Portability.h" class nsHtml5StreamParser; +class nsHtml5AttributeName; class nsHtml5Tokenizer; class nsHtml5TreeBuilder; class nsHtml5MetaScanner; -class nsHtml5AttributeName; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; @@ -58,6 +59,25 @@ class nsHtml5Portability; class nsHtml5ElementName { + public: + static const int32_t GROUP_MASK = 127; + + static const int32_t NOT_INTERNED = (1 << 30); + + static const int32_t SPECIAL = (1 << 29); + + static const int32_t FOSTER_PARENTING = (1 << 28); + + static const int32_t SCOPING = (1 << 27); + + static const int32_t SCOPING_AS_SVG = (1 << 26); + + static const int32_t SCOPING_AS_MATHML = (1 << 25); + + static const int32_t HTML_INTEGRATION_POINT = (1 << 24); + + static const int32_t OPTIONAL_END_TAG = (1 << 23); + private: nsIAtom* name; nsIAtom* camelCaseName; @@ -78,9 +98,32 @@ class nsHtml5ElementName return flags; } - int32_t getGroup(); - bool isInterned(); - static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner); + inline int32_t getGroup() + { + return flags & nsHtml5ElementName::GROUP_MASK; + } + + inline bool isInterned() + { + return !(flags & nsHtml5ElementName::NOT_INTERNED); + } + + inline static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) + { + uint32_t hash = nsHtml5ElementName::bufToHash(buf, length); + int32_t index = nsHtml5ElementName::ELEMENT_HASHES.binarySearch(hash); + if (index < 0) { + return nullptr; + } else { + nsHtml5ElementName* elementName = nsHtml5ElementName::ELEMENT_NAMES[index]; + nsIAtom* name = elementName->name; + if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) { + return nullptr; + } + return elementName; + } + } + private: inline static uint32_t bufToHash(char16_t* buf, int32_t length) { @@ -116,7 +159,13 @@ class nsHtml5ElementName public: nsHtml5ElementName(); ~nsHtml5ElementName(); - void setNameForNonInterned(nsIAtom* name); + inline void setNameForNonInterned(nsIAtom* name) + { + this->name = name; + this->camelCaseName = name; + MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED); + } + static nsHtml5ElementName* ELT_ISINDEX; static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_ARG; @@ -523,16 +572,5 @@ class nsHtml5ElementName static void releaseStatics(); }; -#define NS_HTML5ELEMENT_NAME_GROUP_MASK 127 -#define NS_HTML5ELEMENT_NAME_NOT_INTERNED (1 << 30) -#define NS_HTML5ELEMENT_NAME_SPECIAL (1 << 29) -#define NS_HTML5ELEMENT_NAME_FOSTER_PARENTING (1 << 28) -#define NS_HTML5ELEMENT_NAME_SCOPING (1 << 27) -#define NS_HTML5ELEMENT_NAME_SCOPING_AS_SVG (1 << 26) -#define NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML (1 << 25) -#define NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT (1 << 24) -#define NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG (1 << 23) - - #endif -- cgit v1.2.3 From fce396323da02695c266579d229f11bf0959280b Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 17:35:09 -0500 Subject: Bug 1366241 - Change memory layout of element name and attribute name hashes in HTML parser from sorted to level order BST in order to take advantage of cache during lookup. HTML Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 6bf31a0ad..737ac6b18 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -108,10 +108,29 @@ class nsHtml5ElementName return !(flags & nsHtml5ElementName::NOT_INTERNED); } + inline static int32_t levelOrderBinarySearch(jArray data, int32_t key) + { + int32_t n = data.length; + int32_t i = 0; + while (i < n) { + int32_t val = data[i]; + if (val < key) { + i = 2 * i + 2; + } else if (val > key) { + i = 2 * i + 1; + } else { + return i; + } + } + return -1; + } + inline static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner) { uint32_t hash = nsHtml5ElementName::bufToHash(buf, length); - int32_t index = nsHtml5ElementName::ELEMENT_HASHES.binarySearch(hash); + jArray hashes; + hashes = nsHtml5ElementName::ELEMENT_HASHES; + int32_t index = levelOrderBinarySearch(hashes, hash); if (index < 0) { return nullptr; } else { -- cgit v1.2.3 From bec4d0ecdc2576e09b02baaf24961e70dceec605 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 22:51:56 -0500 Subject: Bug 1355779 - Skip interned ElementName lookup for Custom Elements (ones with hyphen). Regen. Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 737ac6b18..89ca549c5 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -186,6 +186,7 @@ class nsHtml5ElementName } static nsHtml5ElementName* ELT_ISINDEX; + static nsHtml5ElementName* ELT_ANNOTATION_XML; static nsHtml5ElementName* ELT_AND; static nsHtml5ElementName* ELT_ARG; static nsHtml5ElementName* ELT_ABS; @@ -387,7 +388,6 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_TBREAK; static nsHtml5ElementName* ELT_TRACK; static nsHtml5ElementName* ELT_DL; - static nsHtml5ElementName* ELT_ANNOTATION_XML; static nsHtml5ElementName* ELT_CSYMBOL; static nsHtml5ElementName* ELT_CURL; static nsHtml5ElementName* ELT_FACTORIAL; -- cgit v1.2.3 From dd6749f7ddd4db014fb7d76a9b698d07f2b859f5 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 19 Jan 2020 19:56:45 -0500 Subject: Regenerate Parser for 483155 Tag UXP Issue #1344 --- parser/html/nsHtml5ElementName.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'parser/html/nsHtml5ElementName.h') diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 89ca549c5..5236d1887 100644 --- a/parser/html/nsHtml5ElementName.h +++ b/parser/html/nsHtml5ElementName.h @@ -45,6 +45,7 @@ #include "nsHtml5Macros.h" #include "nsIContentHandle.h" #include "nsHtml5Portability.h" +#include "nsHtml5ContentCreatorFunction.h" class nsHtml5StreamParser; @@ -81,6 +82,8 @@ class nsHtml5ElementName private: nsIAtom* name; nsIAtom* camelCaseName; + mozilla::dom::HTMLContentCreatorFunction htmlCreator; + mozilla::dom::SVGContentCreatorFunction svgCreator; public: int32_t flags; inline nsIAtom* getName() @@ -93,6 +96,16 @@ class nsHtml5ElementName return camelCaseName; } + inline mozilla::dom::HTMLContentCreatorFunction getHtmlCreator() + { + return htmlCreator; + } + + inline mozilla::dom::SVGContentCreatorFunction getSvgCreator() + { + return svgCreator; + } + inline int32_t getFlags() { return flags; @@ -174,17 +187,27 @@ class nsHtml5ElementName return len + first + second + third + fourth + fifth; } - nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags); + nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, mozilla::dom::HTMLContentCreatorFunction htmlCreator, mozilla::dom::SVGContentCreatorFunction svgCreator, int32_t flags); public: nsHtml5ElementName(); ~nsHtml5ElementName(); - inline void setNameForNonInterned(nsIAtom* name) + inline void setNameForNonInterned(nsIAtom* 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); } + inline bool isCustom() + { + return this->htmlCreator == NS_NewCustomElement; + } + static nsHtml5ElementName* ELT_ISINDEX; static nsHtml5ElementName* ELT_ANNOTATION_XML; static nsHtml5ElementName* ELT_AND; @@ -250,6 +273,7 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_H5; static nsHtml5ElementName* ELT_H6; static nsHtml5ElementName* ELT_AREA; + static nsHtml5ElementName* ELT_DATA; static nsHtml5ElementName* ELT_EULERGAMMA; static nsHtml5ElementName* ELT_FEFUNCA; static nsHtml5ElementName* ELT_LAMBDA; @@ -515,8 +539,10 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_ARCCOT; static nsHtml5ElementName* ELT_BASEFONT; static nsHtml5ElementName* ELT_CARTESIANPRODUCT; + static nsHtml5ElementName* ELT_CONTENT; static nsHtml5ElementName* ELT_GT; static nsHtml5ElementName* ELT_DETERMINANT; + static nsHtml5ElementName* ELT_DATALIST; static nsHtml5ElementName* ELT_EMPTYSET; static nsHtml5ElementName* ELT_EQUIVALENT; static nsHtml5ElementName* ELT_FONT_FACE_FORMAT; @@ -570,6 +596,7 @@ class nsHtml5ElementName static nsHtml5ElementName* ELT_FEDROPSHADOW; static nsHtml5ElementName* ELT_MROW; static nsHtml5ElementName* ELT_MATRIXROW; + static nsHtml5ElementName* ELT_SHADOW; static nsHtml5ElementName* ELT_VIEW; static nsHtml5ElementName* ELT_APPROX; static nsHtml5ElementName* ELT_FECOLORMATRIX; -- cgit v1.2.3