mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
Issue #2486 - Part 5: Fix parsing of nested layer names
This does not handle the merging of same-named layers, however.
This commit is contained in:
parent
2fc2056be7
commit
9ad579bd35
1 changed files with 18 additions and 3 deletions
|
|
@ -4963,7 +4963,8 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
// followed by a "{", which indicates an anonymous layer.
|
||||
bool isStatement = false;
|
||||
if (tk->mType == eCSSToken_Ident) {
|
||||
nameList->AppendElement(tk->mIdent);
|
||||
nsString* currentName = new nsString();
|
||||
currentName->Assign(tk->mIdent);
|
||||
|
||||
bool parsing = true;
|
||||
bool expectIdent = false;
|
||||
|
|
@ -4974,11 +4975,21 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
|
||||
switch (tk->mType) {
|
||||
case eCSSToken_Symbol: {
|
||||
if (',' == tk->mSymbol) {
|
||||
if ('.' == tk->mSymbol) {
|
||||
expectIdent = true;
|
||||
if (!currentName->IsEmpty()) {
|
||||
currentName->Append(tk->mSymbol);
|
||||
continue;
|
||||
}
|
||||
parsing = false;
|
||||
break;
|
||||
} else if (',' == tk->mSymbol) {
|
||||
if (expectIdent) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
nameList->AppendElement(*currentName);
|
||||
currentName = new nsString();
|
||||
expectIdent = true;
|
||||
continue;
|
||||
} else if (';' == tk->mSymbol) {
|
||||
|
|
@ -4986,6 +4997,8 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
parsing = false;
|
||||
break;
|
||||
}
|
||||
nameList->AppendElement(*currentName);
|
||||
currentName = new nsString();
|
||||
isStatement = true;
|
||||
parsing = false;
|
||||
break;
|
||||
|
|
@ -4994,6 +5007,7 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
parsing = false;
|
||||
break;
|
||||
}
|
||||
nameList->AppendElement(*currentName);
|
||||
uint32_t nameListLength = nameList->Length();
|
||||
if (nameListLength == 0 || nameListLength > 1) {
|
||||
return false;
|
||||
|
|
@ -5004,8 +5018,8 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
}
|
||||
}
|
||||
case eCSSToken_Ident: {
|
||||
nameList->AppendElement(tk->mIdent);
|
||||
expectIdent = false;
|
||||
currentName->Append(tk->mIdent);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
@ -5019,6 +5033,7 @@ CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
|||
return false;
|
||||
}
|
||||
} else if (tk->mType == eCSSToken_Symbol && '{' != tk->mSymbol) {
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue