mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
a57b7e6ca4
21 changed files with 546 additions and 25 deletions
|
|
@ -68,6 +68,7 @@ static bool sWebkitDevicePixelRatioEnabled;
|
|||
static bool sMozGradientsEnabled;
|
||||
static bool sControlCharVisibility;
|
||||
static bool sLegacyNegationPseudoClassEnabled;
|
||||
static bool sCascadeLayersEnabled;
|
||||
|
||||
const uint32_t
|
||||
nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
|
||||
|
|
@ -705,6 +706,7 @@ protected:
|
|||
bool ParseMediaQueryExpression(nsMediaQuery* aQuery);
|
||||
void ProcessImport(const nsString& aURLSpec,
|
||||
nsMediaList* aMedia,
|
||||
const nsString& aLayerName,
|
||||
RuleAppendFunc aAppendFunc,
|
||||
void* aProcessData,
|
||||
uint32_t aLineNumber,
|
||||
|
|
@ -752,6 +754,8 @@ protected:
|
|||
nsCSSValue& aValue);
|
||||
bool ParseCounterRange(nsCSSValuePair& aPair);
|
||||
|
||||
bool ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData);
|
||||
|
||||
/**
|
||||
* Parses the current input stream for a CSS token stream value and resolves
|
||||
* any variable references using the variables in aVariables.
|
||||
|
|
@ -3452,6 +3456,11 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
|
|||
parseFunc = &CSSParserImpl::ParseSupportsRule;
|
||||
newSection = eCSSSection_General;
|
||||
|
||||
} else if (mToken.mIdent.LowerCaseEqualsLiteral("layer") &&
|
||||
sCascadeLayersEnabled) {
|
||||
parseFunc = &CSSParserImpl::ParseLayerRule;
|
||||
newSection = eCSSSection_General;
|
||||
|
||||
} else if (mToken.mIdent.LowerCaseEqualsLiteral("counter-style")) {
|
||||
parseFunc = &CSSParserImpl::ParseCounterStyleRule;
|
||||
newSection = eCSSSection_General;
|
||||
|
|
@ -3885,19 +3894,24 @@ CSSParserImpl::ParseImportRule(RuleAppendFunc aAppendFunc, void* aData)
|
|||
NS_ASSERTION(media->Length() != 0, "media list must be nonempty");
|
||||
}
|
||||
|
||||
ProcessImport(url, media, aAppendFunc, aData, linenum, colnum);
|
||||
// FIXME: Layer functions inside @import declarations are treated as an error.
|
||||
nsAutoString layerName;
|
||||
|
||||
ProcessImport(url, media, layerName, aAppendFunc, aData, linenum, colnum);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CSSParserImpl::ProcessImport(const nsString& aURLSpec,
|
||||
nsMediaList* aMedia,
|
||||
const nsString& aLayerName,
|
||||
RuleAppendFunc aAppendFunc,
|
||||
void* aData,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber)
|
||||
{
|
||||
RefPtr<css::ImportRule> rule = new css::ImportRule(aMedia, aURLSpec,
|
||||
aLayerName,
|
||||
aLineNumber,
|
||||
aColumnNumber);
|
||||
(*aAppendFunc)(rule, aData);
|
||||
|
|
@ -4929,6 +4943,113 @@ CSSParserImpl::ParseSupportsConditionTermsAfterOperator(
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseLayerRule(RuleAppendFunc aAppendFunc, void* aProcessData)
|
||||
{
|
||||
nsString layerName;
|
||||
nsTArray<nsString>* nameList = new nsTArray<nsString>();
|
||||
|
||||
uint32_t linenum, colnum;
|
||||
if (!GetNextTokenLocation(true, &linenum, &colnum)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCSSToken* tk = &mToken;
|
||||
if (!GetToken(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the layer name or name list if we aren't immediately
|
||||
// followed by a "{", which indicates an anonymous layer.
|
||||
bool isStatement = false;
|
||||
if (tk->mType == eCSSToken_Ident) {
|
||||
nsString* currentName = new nsString();
|
||||
currentName->Assign(tk->mIdent);
|
||||
|
||||
bool parsing = true;
|
||||
bool expectIdent = false;
|
||||
while (parsing) {
|
||||
if (!GetToken(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (tk->mType) {
|
||||
case eCSSToken_Symbol: {
|
||||
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) {
|
||||
if (expectIdent) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
nameList->AppendElement(*currentName);
|
||||
currentName = new nsString();
|
||||
isStatement = true;
|
||||
parsing = false;
|
||||
break;
|
||||
} else if ('{' == tk->mSymbol) {
|
||||
if (expectIdent) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
nameList->AppendElement(*currentName);
|
||||
uint32_t nameListLength = nameList->Length();
|
||||
if (nameListLength == 0 || nameListLength > 1) {
|
||||
return false;
|
||||
}
|
||||
layerName.Assign(nameList->ElementAt(0));
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case eCSSToken_Ident: {
|
||||
expectIdent = false;
|
||||
currentName->Append(tk->mIdent);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expectIdent) {
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
} else if (tk->mType == eCSSToken_Symbol && '{' != tk->mSymbol) {
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isStatement) {
|
||||
RefPtr<CSSLayerStatementRule> rule =
|
||||
new CSSLayerStatementRule(*nameList, linenum, colnum);
|
||||
(*aAppendFunc)(rule, aProcessData);
|
||||
return true;
|
||||
}
|
||||
|
||||
UngetToken();
|
||||
RefPtr<css::GroupRule> rule =
|
||||
new CSSLayerBlockRule(layerName, linenum, colnum);
|
||||
return ParseGroupRule(rule, aAppendFunc, aProcessData);
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseCounterStyleRule(RuleAppendFunc aAppendFunc, void* aData)
|
||||
{
|
||||
|
|
@ -18179,6 +18300,8 @@ nsCSSParser::Startup()
|
|||
"layout.css.control-characters.visible");
|
||||
Preferences::AddBoolVarCache(&sLegacyNegationPseudoClassEnabled,
|
||||
"layout.css.legacy-negation-pseudo.enabled");
|
||||
Preferences::AddBoolVarCache(&sCascadeLayersEnabled,
|
||||
"layout.css.cascade-layers.enabled");
|
||||
}
|
||||
|
||||
nsCSSParser::nsCSSParser(mozilla::css::Loader* aLoader,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue