Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2025-01-23 09:39:37 +08:00
commit 789327be17
3 changed files with 18 additions and 7 deletions

View file

@ -242,9 +242,9 @@ WorkerRunnable::Run()
// underlying WorkerThreadPrimaryRunnable active, which means we should
// find a CycleCollectedJSContext.
if (!CycleCollectedJSContext::Get()) {
MOZ_DIAGNOSTIC_ASSERT(false,
"A WorkerRunnable was executed after "
"WorkerThreadPrimaryRunnable ended.");
NS_ASSERTION(false,
"A WorkerRunnable was executed after "
"WorkerThreadPrimaryRunnable ended.");
return NS_OK;
}

View file

@ -143,8 +143,7 @@ struct ReduceNumberCalcOps : public mozilla::css::BasicFloatCalcOps,
{
result_type ComputeLeafValue(const nsCSSValue& aValue)
{
// FIXME: Restore this assertion once ParseColor no longer uses this class.
//MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit");
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit");
return aValue.GetFloatValue();
}
@ -154,6 +153,17 @@ struct ReduceNumberCalcOps : public mozilla::css::BasicFloatCalcOps,
}
};
// Same as above, but reduces leaves as <percentage>. You normally don't want to use this.
// Only useful in parsing percentage saturation and lightness values by ParseColorComponent.
struct ReducePercentageCalcOps : ReduceNumberCalcOps
{
result_type ComputeLeafValue(const nsCSSValue& aValue)
{
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Percent, "unexpected unit");
return aValue.GetPercentValue();
}
};
static_assert(css::eAuthorSheetFeatures == 0 &&
css::eUserSheetFeatures == 1 &&
css::eAgentSheetFeatures == 2,
@ -7324,7 +7334,7 @@ CSSParserImpl::ParseColorComponent(float& aComponent, Maybe<char> aSeparator)
if (!ParseCalc(aValue, VARIANT_LPN | VARIANT_CALC)) {
return false;
}
ReduceNumberCalcOps ops;
ReducePercentageCalcOps ops;
value = mozilla::css::ComputeCalc(aValue, ops);
} else {
REPORT_UNEXPECTED_TOKEN(PEExpectedPercent);

View file

@ -2772,8 +2772,9 @@ static bool SelectorListMatches(Element* aElement,
nsCSSSelector* next = selector->mNext;
SelectorMatchesTreeFlags selectorTreeFlags = SelectorMatchesTreeFlags(0);
// Try to look for the closest ancestor link element if we're processing
// the selector list argument of a pseudo-class.
// the selector list argument of a pseudo-class, but only if for a new style context (see SelectorMatches).
if (!aNodeMatchContext.mIsRelevantLink &&
aTreeMatchContext.mForStyling &&
(aSelectorFlags & SelectorMatchesFlags::IS_PSEUDO_CLASS_ARGUMENT)) {
selectorTreeFlags = eLookForRelevantLink;
}