mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-24 21:33:09 +09:00
Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.
HTML Regen. Tag UXP Issue #1344
This commit is contained in:
parent
a330217f3f
commit
84ba7ad062
18 changed files with 66 additions and 71 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue