diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-18 16:08:45 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:36 -0500 |
commit | e5557d43d6934918c018a527f3bae1f7049b9ef1 (patch) | |
tree | ff494bb15bd1031f8c5b3a2d6550f6d9b5304e33 /parser/html | |
parent | 650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa (diff) | |
download | uxp-e5557d43d6934918c018a527f3bae1f7049b9ef1.tar.gz |
Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.
HTML Regen.
Tag UXP Issue #1344
Diffstat (limited to 'parser/html')
-rw-r--r-- | parser/html/nsHtml5AtomList.h | 8 | ||||
-rw-r--r-- | parser/html/nsHtml5AttributeName.cpp | 54 | ||||
-rw-r--r-- | parser/html/nsHtml5AttributeName.h | 13 | ||||
-rw-r--r-- | parser/html/nsHtml5ElementName.cpp | 7 | ||||
-rw-r--r-- | parser/html/nsHtml5ElementName.h | 3 | ||||
-rw-r--r-- | parser/html/nsHtml5MetaScanner.cpp | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5MetaScanner.h | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5Portability.h | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5StackNode.cpp | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5StackNode.h | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5StateSnapshot.cpp | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5StateSnapshot.h | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5Tokenizer.cpp | 31 | ||||
-rw-r--r-- | parser/html/nsHtml5Tokenizer.h | 2 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeBuilder.cpp | 9 | ||||
-rw-r--r-- | parser/html/nsHtml5TreeBuilder.h | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5UTF16Buffer.cpp | 1 | ||||
-rw-r--r-- | parser/html/nsHtml5UTF16Buffer.h | 1 |
18 files changed, 66 insertions, 71 deletions
diff --git a/parser/html/nsHtml5AtomList.h b/parser/html/nsHtml5AtomList.h index 76c3ba6361..1a47273eb8 100644 --- a/parser/html/nsHtml5AtomList.h +++ b/parser/html/nsHtml5AtomList.h @@ -48,6 +48,9 @@ HTML5_ATOM(address, "address") HTML5_ATOM(div, "div") HTML5_ATOM(a, "a") HTML5_ATOM(nobr, "nobr") +HTML5_ATOM(name, "name") +HTML5_ATOM(prompt, "prompt") +HTML5_ATOM(action, "action") HTML5_ATOM(input, "input") HTML5_ATOM(option, "option") HTML5_ATOM(ruby, "ruby") @@ -249,7 +252,6 @@ HTML5_ATOM(linebreak, "linebreak") HTML5_ATOM(label, "label") HTML5_ATOM(linethickness, "linethickness") HTML5_ATOM(mode, "mode") -HTML5_ATOM(name, "name") HTML5_ATOM(noresize, "noresize") HTML5_ATOM(onbeforeunload, "onbeforeunload") HTML5_ATOM(onrepeat, "onrepeat") @@ -355,7 +357,6 @@ HTML5_ATOM(pathLength, "pathLength") HTML5_ATOM(path, "path") HTML5_ATOM(altimg, "altimg") HTML5_ATOM(actiontype, "actiontype") -HTML5_ATOM(action, "action") HTML5_ATOM(active, "active") HTML5_ATOM(additive, "additive") HTML5_ATOM(begin, "begin") @@ -423,7 +424,6 @@ HTML5_ATOM(frameborder, "frameborder") HTML5_ATOM(frame, "frame") HTML5_ATOM(framespacing, "framespacing") HTML5_ATOM(from, "from") -HTML5_ATOM(prompt, "prompt") HTML5_ATOM(primitiveunits, "primitiveunits") HTML5_ATOM(primitiveUnits, "primitiveUnits") HTML5_ATOM(symmetric, "symmetric") @@ -713,6 +713,7 @@ HTML5_ATOM(verythinmathspace, "verythinmathspace") HTML5_ATOM(verythickmathspace, "verythickmathspace") HTML5_ATOM(veryverythinmathspace, "veryverythinmathspace") HTML5_ATOM(veryverythickmathspace, "veryverythickmathspace") +HTML5_ATOM(isindex, "isindex") HTML5_ATOM(and_, "and") HTML5_ATOM(arg, "arg") HTML5_ATOM(abs, "abs") @@ -1066,7 +1067,6 @@ HTML5_ATOM(fecolormatrix, "fecolormatrix") HTML5_ATOM(feColorMatrix, "feColorMatrix") HTML5_ATOM(feconvolvematrix, "feconvolvematrix") HTML5_ATOM(feConvolveMatrix, "feConvolveMatrix") -HTML5_ATOM(isindex, "isindex") HTML5_ATOM(matrix, "matrix") HTML5_ATOM(apply, "apply") HTML5_ATOM(femorphology, "femorphology") diff --git a/parser/html/nsHtml5AttributeName.cpp b/parser/html/nsHtml5AttributeName.cpp index c527767ecd..1947972b84 100644 --- a/parser/html/nsHtml5AttributeName.cpp +++ b/parser/html/nsHtml5AttributeName.cpp @@ -48,14 +48,12 @@ #include "nsHtml5TreeBuilder.h" #include "nsHtml5MetaScanner.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" #include "nsHtml5Portability.h" #include "nsHtml5AttributeName.h" -#include "nsHtml5ReleasableAttributeName.h" int32_t* nsHtml5AttributeName::ALL_NO_NS = 0; int32_t* nsHtml5AttributeName::XMLNS_NS = 0; @@ -111,35 +109,55 @@ nsHtml5AttributeName::nameByBuffer(char16_t* buf, int32_t offset, int32_t length uint32_t hash = nsHtml5AttributeName::bufToHash(buf, length); int32_t index = nsHtml5AttributeName::ATTRIBUTE_HASHES.binarySearch(hash); if (index < 0) { - return nsHtml5AttributeName::createAttributeName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner)); - } else { - nsHtml5AttributeName* attributeName = nsHtml5AttributeName::ATTRIBUTE_NAMES[index]; - nsIAtom* name = attributeName->getLocal(NS_HTML5ATTRIBUTE_NAME_HTML); - if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) { - return nsHtml5AttributeName::createAttributeName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner)); - } - return attributeName; + return nullptr; } + nsHtml5AttributeName* attributeName = nsHtml5AttributeName::ATTRIBUTE_NAMES[index]; + nsIAtom* name = attributeName->getLocal(NS_HTML5ATTRIBUTE_NAME_HTML); + if (!nsHtml5Portability::localEqualsBuffer(name, buf, offset, length)) { + return nullptr; + } + return attributeName; } nsHtml5AttributeName::nsHtml5AttributeName(int32_t* uri, nsIAtom** local, nsIAtom** prefix) : uri(uri), local(local), - prefix(prefix) + prefix(prefix), + custom(false) { MOZ_COUNT_CTOR(nsHtml5AttributeName); } -nsHtml5AttributeName* -nsHtml5AttributeName::createAttributeName(nsIAtom* name) + +nsHtml5AttributeName::nsHtml5AttributeName() + : uri(nsHtml5AttributeName::ALL_NO_NS), + local(nsHtml5AttributeName::SAME_LOCAL(nullptr)), + prefix(ALL_NO_PREFIX), + custom(true) +{ + MOZ_COUNT_CTOR(nsHtml5AttributeName); +} + +bool +nsHtml5AttributeName::isInterned() { - return new nsHtml5ReleasableAttributeName(nsHtml5AttributeName::ALL_NO_NS, nsHtml5AttributeName::SAME_LOCAL(name), ALL_NO_PREFIX); + return !custom; } void -nsHtml5AttributeName::release() +nsHtml5AttributeName::setNameForNonInterned(nsIAtom* name) { + MOZ_ASSERT(custom); + local[0] = name; + local[1] = name; + local[2] = name; +} + +nsHtml5AttributeName* +nsHtml5AttributeName::createAttributeName(nsIAtom* name) +{ + return new nsHtml5AttributeName(nsHtml5AttributeName::ALL_NO_NS, nsHtml5AttributeName::SAME_LOCAL(name), ALL_NO_PREFIX); } @@ -149,12 +167,6 @@ nsHtml5AttributeName::~nsHtml5AttributeName() delete[] local; } -nsHtml5AttributeName* -nsHtml5AttributeName::cloneAttributeName(nsHtml5AtomTable* interner) -{ - return this; -} - int32_t nsHtml5AttributeName::getUri(int32_t mode) { diff --git a/parser/html/nsHtml5AttributeName.h b/parser/html/nsHtml5AttributeName.h index f71a5d87b5..8519f463f3 100644 --- a/parser/html/nsHtml5AttributeName.h +++ b/parser/html/nsHtml5AttributeName.h @@ -51,7 +51,6 @@ class nsHtml5Tokenizer; class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; @@ -114,14 +113,14 @@ class nsHtml5AttributeName int32_t* uri; nsIAtom** local; nsIAtom** prefix; - protected: + bool custom; nsHtml5AttributeName(int32_t* uri, nsIAtom** local, nsIAtom** prefix); - private: - static nsHtml5AttributeName* createAttributeName(nsIAtom* name); public: - virtual void release(); - virtual ~nsHtml5AttributeName(); - virtual nsHtml5AttributeName* cloneAttributeName(nsHtml5AtomTable* interner); + nsHtml5AttributeName(); + bool isInterned(); + void setNameForNonInterned(nsIAtom* name); + static nsHtml5AttributeName* createAttributeName(nsIAtom* name); + ~nsHtml5AttributeName(); int32_t getUri(int32_t mode); nsIAtom* getLocal(int32_t mode); nsIAtom* getPrefix(int32_t mode); diff --git a/parser/html/nsHtml5ElementName.cpp b/parser/html/nsHtml5ElementName.cpp index 6b829dfe33..cc5a73098e 100644 --- a/parser/html/nsHtml5ElementName.cpp +++ b/parser/html/nsHtml5ElementName.cpp @@ -48,7 +48,6 @@ #include "nsHtml5TreeBuilder.h" #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" @@ -117,6 +116,7 @@ nsHtml5ElementName::setNameForNonInterned(nsIAtom* name) MOZ_ASSERT(this->flags == (NS_HTML5TREE_BUILDER_OTHER | NS_HTML5ELEMENT_NAME_NOT_INTERNED)); } +nsHtml5ElementName* nsHtml5ElementName::ELT_ISINDEX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_AND = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_ARG = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_ABS = nullptr; @@ -505,7 +505,6 @@ nsHtml5ElementName* nsHtml5ElementName::ELT_VIEW = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_APPROX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_FECOLORMATRIX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_FECONVOLVEMATRIX = nullptr; -nsHtml5ElementName* nsHtml5ElementName::ELT_ISINDEX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_MATRIX = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_APPLY = nullptr; nsHtml5ElementName* nsHtml5ElementName::ELT_BODY = nullptr; @@ -521,6 +520,7 @@ staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HAS void nsHtml5ElementName::initializeStatics() { + ELT_ISINDEX = new nsHtml5ElementName(nsHtml5Atoms::isindex, nsHtml5Atoms::isindex, NS_HTML5TREE_BUILDER_ISINDEX | NS_HTML5ELEMENT_NAME_SPECIAL); ELT_AND = new nsHtml5ElementName(nsHtml5Atoms::and_, nsHtml5Atoms::and_, NS_HTML5TREE_BUILDER_OTHER); ELT_ARG = new nsHtml5ElementName(nsHtml5Atoms::arg, nsHtml5Atoms::arg, NS_HTML5TREE_BUILDER_OTHER); ELT_ABS = new nsHtml5ElementName(nsHtml5Atoms::abs, nsHtml5Atoms::abs, NS_HTML5TREE_BUILDER_OTHER); @@ -909,7 +909,6 @@ nsHtml5ElementName::initializeStatics() ELT_APPROX = new nsHtml5ElementName(nsHtml5Atoms::approx, nsHtml5Atoms::approx, NS_HTML5TREE_BUILDER_OTHER); ELT_FECOLORMATRIX = new nsHtml5ElementName(nsHtml5Atoms::fecolormatrix, nsHtml5Atoms::feColorMatrix, NS_HTML5TREE_BUILDER_OTHER); ELT_FECONVOLVEMATRIX = new nsHtml5ElementName(nsHtml5Atoms::feconvolvematrix, nsHtml5Atoms::feConvolveMatrix, NS_HTML5TREE_BUILDER_OTHER); - ELT_ISINDEX = new nsHtml5ElementName(nsHtml5Atoms::isindex, nsHtml5Atoms::isindex, NS_HTML5TREE_BUILDER_ISINDEX | NS_HTML5ELEMENT_NAME_SPECIAL); ELT_MATRIX = new nsHtml5ElementName(nsHtml5Atoms::matrix, nsHtml5Atoms::matrix, NS_HTML5TREE_BUILDER_OTHER); ELT_APPLY = new nsHtml5ElementName(nsHtml5Atoms::apply, nsHtml5Atoms::apply, NS_HTML5TREE_BUILDER_OTHER); ELT_BODY = new nsHtml5ElementName(nsHtml5Atoms::body, nsHtml5Atoms::body, NS_HTML5TREE_BUILDER_BODY | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG); @@ -1323,6 +1322,7 @@ nsHtml5ElementName::initializeStatics() void nsHtml5ElementName::releaseStatics() { + delete ELT_ISINDEX; delete ELT_AND; delete ELT_ARG; delete ELT_ABS; @@ -1711,7 +1711,6 @@ nsHtml5ElementName::releaseStatics() delete ELT_APPROX; delete ELT_FECOLORMATRIX; delete ELT_FECONVOLVEMATRIX; - delete ELT_ISINDEX; delete ELT_MATRIX; delete ELT_APPLY; delete ELT_BODY; diff --git a/parser/html/nsHtml5ElementName.h b/parser/html/nsHtml5ElementName.h index 50415225a1..57e80679d1 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; diff --git a/parser/html/nsHtml5MetaScanner.cpp b/parser/html/nsHtml5MetaScanner.cpp index f22b77f0d5..e24b5d353f 100644 --- a/parser/html/nsHtml5MetaScanner.cpp +++ b/parser/html/nsHtml5MetaScanner.cpp @@ -49,7 +49,6 @@ #include "nsHtml5TreeBuilder.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" diff --git a/parser/html/nsHtml5MetaScanner.h b/parser/html/nsHtml5MetaScanner.h index 7fb950d2c7..9d3a50a853 100644 --- a/parser/html/nsHtml5MetaScanner.h +++ b/parser/html/nsHtml5MetaScanner.h @@ -52,7 +52,6 @@ class nsHtml5Tokenizer; class nsHtml5TreeBuilder; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; diff --git a/parser/html/nsHtml5Portability.h b/parser/html/nsHtml5Portability.h index ce94016647..8e384258b0 100644 --- a/parser/html/nsHtml5Portability.h +++ b/parser/html/nsHtml5Portability.h @@ -52,7 +52,6 @@ class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; diff --git a/parser/html/nsHtml5StackNode.cpp b/parser/html/nsHtml5StackNode.cpp index 10b0192c07..95e51fa1af 100644 --- a/parser/html/nsHtml5StackNode.cpp +++ b/parser/html/nsHtml5StackNode.cpp @@ -50,7 +50,6 @@ #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" #include "nsHtml5Portability.h" diff --git a/parser/html/nsHtml5StackNode.h b/parser/html/nsHtml5StackNode.h index cfe6820c67..15922f3bb1 100644 --- a/parser/html/nsHtml5StackNode.h +++ b/parser/html/nsHtml5StackNode.h @@ -53,7 +53,6 @@ class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; diff --git a/parser/html/nsHtml5StateSnapshot.cpp b/parser/html/nsHtml5StateSnapshot.cpp index 33809dc707..c239632601 100644 --- a/parser/html/nsHtml5StateSnapshot.cpp +++ b/parser/html/nsHtml5StateSnapshot.cpp @@ -49,7 +49,6 @@ #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5Portability.h" diff --git a/parser/html/nsHtml5StateSnapshot.h b/parser/html/nsHtml5StateSnapshot.h index 7d60b88c80..b820af9800 100644 --- a/parser/html/nsHtml5StateSnapshot.h +++ b/parser/html/nsHtml5StateSnapshot.h @@ -52,7 +52,6 @@ class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5Portability; diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index aa5b3df282..3b1c34b588 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -52,7 +52,6 @@ #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" @@ -99,6 +98,7 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewin tagName(nullptr), nonInternedTagName(new nsHtml5ElementName()), attributeName(nullptr), + nonInternedAttributeName(new nsHtml5AttributeName()), doctypeName(nullptr), publicIdentifier(nullptr), systemIdentifier(nullptr), @@ -325,13 +325,16 @@ void nsHtml5Tokenizer::attributeNameComplete() { attributeName = nsHtml5AttributeName::nameByBuffer(strBuf, 0, strBufLen, interner); + if (!attributeName) { + nonInternedAttributeName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner)); + attributeName = nonInternedAttributeName; + } clearStrBufAfterUse(); if (!attributes) { attributes = new nsHtml5HtmlAttributes(0); } if (attributes->contains(attributeName)) { errDuplicateAttribute(); - attributeName->release(); attributeName = nullptr; } } @@ -3941,10 +3944,8 @@ nsHtml5Tokenizer::end() } tagName = nullptr; nonInternedTagName->setNameForNonInterned(nullptr); - if (attributeName) { - attributeName->release(); - attributeName = nullptr; - } + attributeName = nullptr; + nonInternedAttributeName->setNameForNonInterned(nullptr); tokenHandler->endTokenization(); if (attributes) { attributes->clear(0); @@ -3984,13 +3985,8 @@ nsHtml5Tokenizer::resetToDataState() endTag = false; shouldSuspend = false; initDoctypeFields(); - if (tagName) { - tagName = nullptr; - } - if (attributeName) { - attributeName->release(); - attributeName = nullptr; - } + tagName = nullptr; + attributeName = nullptr; if (newAttributesEachTime) { if (attributes) { delete attributes; @@ -4052,13 +4048,13 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other) nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner)); tagName = nonInternedTagName; } - if (attributeName) { - attributeName->release(); - } if (!other->attributeName) { attributeName = nullptr; + } else if (other->attributeName->isInterned()) { + attributeName = other->attributeName; } else { - attributeName = other->attributeName->cloneAttributeName(interner); + nonInternedAttributeName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->attributeName->getLocal(NS_HTML5ATTRIBUTE_NAME_HTML), interner)); + attributeName = nonInternedAttributeName; } delete attributes; if (!other->attributes) { @@ -4089,6 +4085,7 @@ nsHtml5Tokenizer::~nsHtml5Tokenizer() { MOZ_COUNT_DTOR(nsHtml5Tokenizer); delete nonInternedTagName; + delete nonInternedAttributeName; nonInternedTagName = nullptr; delete attributes; attributes = nullptr; diff --git a/parser/html/nsHtml5Tokenizer.h b/parser/html/nsHtml5Tokenizer.h index 121d355de3..fedf06e0de 100644 --- a/parser/html/nsHtml5Tokenizer.h +++ b/parser/html/nsHtml5Tokenizer.h @@ -55,7 +55,6 @@ class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; @@ -128,6 +127,7 @@ class nsHtml5Tokenizer protected: nsHtml5AttributeName* attributeName; private: + nsHtml5AttributeName* nonInternedAttributeName; nsIAtom* doctypeName; nsHtml5String publicIdentifier; nsHtml5String systemIdentifier; diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index 23e874d965..d909c223c6 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -62,7 +62,6 @@ #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5UTF16Buffer.h" #include "nsHtml5StateSnapshot.h" @@ -1260,11 +1259,11 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu nsHtml5HtmlAttributes* inputAttributes = new nsHtml5HtmlAttributes(0); inputAttributes->addAttribute(nsHtml5AttributeName::ATTR_NAME, nsHtml5Portability::newStringFromLiteral("isindex"), tokenizer->getLineNumber()); for (int32_t i = 0; i < attributes->getLength(); i++) { - nsHtml5AttributeName* attributeQName = attributes->getAttributeNameNoBoundsCheck(i); - if (nsHtml5AttributeName::ATTR_NAME == attributeQName || nsHtml5AttributeName::ATTR_PROMPT == attributeQName) { + nsIAtom* attributeQName = attributes->getLocalNameNoBoundsCheck(i); + if (nsHtml5Atoms::name == attributeQName || nsHtml5Atoms::prompt == attributeQName) { attributes->releaseValue(i); - } else if (nsHtml5AttributeName::ATTR_ACTION != attributeQName) { - inputAttributes->addAttribute(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i)); + } else if (nsHtml5Atoms::action != attributeQName) { + inputAttributes->AddAttributeWithLocal(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i)); } } attributes->clearWithoutReleasingContents(); diff --git a/parser/html/nsHtml5TreeBuilder.h b/parser/html/nsHtml5TreeBuilder.h index ff6cdd4ae3..5b314a5ce8 100644 --- a/parser/html/nsHtml5TreeBuilder.h +++ b/parser/html/nsHtml5TreeBuilder.h @@ -65,7 +65,6 @@ class nsHtml5Tokenizer; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5UTF16Buffer; class nsHtml5StateSnapshot; class nsHtml5Portability; diff --git a/parser/html/nsHtml5UTF16Buffer.cpp b/parser/html/nsHtml5UTF16Buffer.cpp index 4ba40eab0c..d2f8b98324 100644 --- a/parser/html/nsHtml5UTF16Buffer.cpp +++ b/parser/html/nsHtml5UTF16Buffer.cpp @@ -49,7 +49,6 @@ #include "nsHtml5MetaScanner.h" #include "nsHtml5AttributeName.h" #include "nsHtml5ElementName.h" -#include "nsHtml5HtmlAttributes.h" #include "nsHtml5StackNode.h" #include "nsHtml5StateSnapshot.h" #include "nsHtml5Portability.h" diff --git a/parser/html/nsHtml5UTF16Buffer.h b/parser/html/nsHtml5UTF16Buffer.h index 5413dac870..6214d6d07e 100644 --- a/parser/html/nsHtml5UTF16Buffer.h +++ b/parser/html/nsHtml5UTF16Buffer.h @@ -52,7 +52,6 @@ class nsHtml5TreeBuilder; class nsHtml5MetaScanner; class nsHtml5AttributeName; class nsHtml5ElementName; -class nsHtml5HtmlAttributes; class nsHtml5StateSnapshot; class nsHtml5Portability; |