From 41eb02d1e1785811fa4219dbe16e45843a6a7e32 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 29 Mar 2024 20:32:33 +0800 Subject: [PATCH 1/3] No issue - Turn worker runnable assertion into something harmless in debug builds It's annoying. --- dom/workers/WorkerRunnable.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 9049878710..9949efa665 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -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; } From 2e3953399a2bb34f62220ff813cc733a79502047 Mon Sep 17 00:00:00 2001 From: Martok Date: Wed, 22 Jan 2025 00:02:37 +0100 Subject: [PATCH 2/3] Issue #1765 - Follow-Up: For parsing calc() in non-hue component of hsl/a(), explicitly expect values --- layout/style/nsCSSParser.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index c467525c29..dd6f0f4a3d 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -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 . 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 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); From 77728935eff053d72de20535c864e63f92e1ccc3 Mon Sep 17 00:00:00 2001 From: Martok Date: Wed, 22 Jan 2025 00:11:03 +0100 Subject: [PATCH 3/3] Issue #2078 - Follow-up: Don't try to resolve ancestor link elements when matching for Has*DependentStyle --- layout/style/nsCSSRuleProcessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 6abfd57574..799e5c5602 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -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; }