mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-21 03:43:16 +09:00
Bug 1355779 - Skip interned ElementName lookup for Custom Elements (ones with hyphen).
Regen. Tag UXP Issue #1344
This commit is contained in:
parent
c7ff832ca7
commit
e846da116e
6 changed files with 280 additions and 262 deletions
|
|
@ -95,6 +95,7 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewin
|
|||
charRefBuf(jArray<char16_t,int32_t>::newJArray(32)),
|
||||
bmpChar(jArray<char16_t,int32_t>::newJArray(1)),
|
||||
astralChar(jArray<char16_t,int32_t>::newJArray(2)),
|
||||
containsHyphen(false),
|
||||
tagName(nullptr),
|
||||
nonInternedTagName(new nsHtml5ElementName()),
|
||||
attributeName(nullptr),
|
||||
|
|
@ -279,11 +280,22 @@ nsHtml5Tokenizer::flushChars(char16_t* buf, int32_t pos)
|
|||
void
|
||||
nsHtml5Tokenizer::strBufToElementNameString()
|
||||
{
|
||||
tagName = nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner);
|
||||
if (!tagName) {
|
||||
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
|
||||
tagName = nonInternedTagName;
|
||||
if (containsHyphen) {
|
||||
nsIAtom* annotationName = nsHtml5ElementName::ELT_ANNOTATION_XML->getName();
|
||||
if (nsHtml5Portability::localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) {
|
||||
tagName = nsHtml5ElementName::ELT_ANNOTATION_XML;
|
||||
} else {
|
||||
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
|
||||
tagName = nonInternedTagName;
|
||||
}
|
||||
} else {
|
||||
tagName = nsHtml5ElementName::elementNameByBuffer(strBuf, 0, strBufLen, interner);
|
||||
if (!tagName) {
|
||||
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
|
||||
tagName = nonInternedTagName;
|
||||
}
|
||||
}
|
||||
containsHyphen = false;
|
||||
clearStrBufAfterUse();
|
||||
}
|
||||
|
||||
|
|
@ -484,12 +496,14 @@ nsHtml5Tokenizer::stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* bu
|
|||
endTag = false;
|
||||
clearStrBufBeforeUse();
|
||||
appendStrBuf((char16_t) (c + 0x20));
|
||||
containsHyphen = false;
|
||||
state = P::transition(mViewSource, nsHtml5Tokenizer::TAG_NAME, reconsume, pos);
|
||||
NS_HTML5_BREAK(tagopenloop);
|
||||
} else if (c >= 'a' && c <= 'z') {
|
||||
endTag = false;
|
||||
clearStrBufBeforeUse();
|
||||
appendStrBuf(c);
|
||||
containsHyphen = false;
|
||||
state = P::transition(mViewSource, nsHtml5Tokenizer::TAG_NAME, reconsume, pos);
|
||||
NS_HTML5_BREAK(tagopenloop);
|
||||
}
|
||||
|
|
@ -580,8 +594,11 @@ nsHtml5Tokenizer::stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* bu
|
|||
default: {
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
c += 0x20;
|
||||
} else if (c == '-') {
|
||||
containsHyphen = true;
|
||||
}
|
||||
appendStrBuf(c);
|
||||
containsHyphen = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -3985,6 +4002,7 @@ nsHtml5Tokenizer::resetToDataState()
|
|||
endTag = false;
|
||||
shouldSuspend = false;
|
||||
initDoctypeFields();
|
||||
containsHyphen = false;
|
||||
tagName = nullptr;
|
||||
attributeName = nullptr;
|
||||
if (newAttributesEachTime) {
|
||||
|
|
@ -4040,6 +4058,7 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other)
|
|||
} else {
|
||||
publicIdentifier = nsHtml5Portability::newStringFromString(other->publicIdentifier);
|
||||
}
|
||||
containsHyphen = other->containsHyphen;
|
||||
if (!other->tagName) {
|
||||
tagName = nullptr;
|
||||
} else if (other->tagName->isInterned()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue