From 650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 14:04:17 -0500 Subject: Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc. - Removes nsHtml5ReleasableAttributeName - Adds nsHtml5AttributeEntry.h - Makes nsHtml5HtmlAttributes no longer gentered. Tag UXP Issue #1344 --- parser/html/nsHtml5HtmlAttributes.h | 54 ++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'parser/html/nsHtml5HtmlAttributes.h') diff --git a/parser/html/nsHtml5HtmlAttributes.h b/parser/html/nsHtml5HtmlAttributes.h index f97e80c8a..8dde05771 100644 --- a/parser/html/nsHtml5HtmlAttributes.h +++ b/parser/html/nsHtml5HtmlAttributes.h @@ -23,11 +23,6 @@ * DEALINGS IN THE SOFTWARE. */ -/* - * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT. - * Please edit HtmlAttributes.java instead and regenerate. - */ - #ifndef nsHtml5HtmlAttributes_h #define nsHtml5HtmlAttributes_h @@ -45,6 +40,8 @@ #include "nsIUnicodeDecoder.h" #include "nsHtml5Macros.h" #include "nsIContentHandle.h" +#include "nsTArray.h" +#include "nsHtml5AttributeEntry.h" class nsHtml5StreamParser; @@ -63,32 +60,39 @@ class nsHtml5HtmlAttributes public: static nsHtml5HtmlAttributes* EMPTY_ATTRIBUTES; private: - int32_t mode; - int32_t length; - autoJArray names; - autoJArray values; - autoJArray lines; + AutoTArray mStorage; + int32_t mMode; + void AddEntry(nsHtml5AttributeEntry&& aEntry); + public: - explicit nsHtml5HtmlAttributes(int32_t mode); + explicit nsHtml5HtmlAttributes(int32_t aMode); ~nsHtml5HtmlAttributes(); - int32_t getIndex(nsHtml5AttributeName* name); - nsHtml5String getValue(nsHtml5AttributeName* name); + + // Remove getIndex when removing isindex support + int32_t getIndex(nsHtml5AttributeName* aName); + + nsHtml5String getValue(nsHtml5AttributeName* aName); int32_t getLength(); - nsIAtom* getLocalNameNoBoundsCheck(int32_t index); - int32_t getURINoBoundsCheck(int32_t index); - nsIAtom* getPrefixNoBoundsCheck(int32_t index); - nsHtml5String getValueNoBoundsCheck(int32_t index); - nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t index); - int32_t getLineNoBoundsCheck(int32_t index); - void addAttribute(nsHtml5AttributeName* name, nsHtml5String value, int32_t line); - void clear(int32_t m); - void releaseValue(int32_t i); + nsIAtom* getLocalNameNoBoundsCheck(int32_t aIndex); + int32_t getURINoBoundsCheck(int32_t aIndex); + nsIAtom* getPrefixNoBoundsCheck(int32_t aIndex); + nsHtml5String getValueNoBoundsCheck(int32_t aIndex); + nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t aIndex); + int32_t getLineNoBoundsCheck(int32_t aIndex); + void addAttribute(nsHtml5AttributeName* aName, + nsHtml5String aValue, + int32_t aLine); + void AddAttributeWithLocal(nsIAtom* aName, + nsHtml5String aValue, + int32_t aLine); + void clear(int32_t aMode); + void releaseValue(int32_t aIndex); void clearWithoutReleasingContents(); - bool contains(nsHtml5AttributeName* name); + bool contains(nsHtml5AttributeName* aName); void adjustForMath(); void adjustForSvg(); - nsHtml5HtmlAttributes* cloneAttributes(nsHtml5AtomTable* interner); - bool equalsAnother(nsHtml5HtmlAttributes* other); + nsHtml5HtmlAttributes* cloneAttributes(nsHtml5AtomTable* aInterner); + bool equalsAnother(nsHtml5HtmlAttributes* aOther); static void initializeStatics(); static void releaseStatics(); }; -- cgit v1.2.3