From 07cf2e643f930f246459c26ccbf84125c85c25a0 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 14 Jul 2025 17:24:44 +0200 Subject: [PATCH] Issue #2720 - Follow-up: Use temp value for duplicate color stop --- layout/style/nsCSSParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index e1b01a4543..2efce10dd9 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -10583,6 +10583,8 @@ CSSParserImpl::ParseColorStop(nsCSSValueGradient* aGradient) stop->mIsInterpolationHint = true; } + nsCSSValue stopColor=stop->mColor; + // Stop positions do not have to fall between the starting-point and // ending-point, so we don't use ParseNonNegativeVariant. result = ParseVariant(stop->mLocation, VARIANT_LP | VARIANT_CALC, nullptr); @@ -10609,7 +10611,7 @@ CSSParserImpl::ParseColorStop(nsCSSValueGradient* aGradient) aGradient->mStops.SetLength(aGradient->mStops.Length()-1); return false; } - stop2->mColor = stop->mColor; // copy color from first stop arg + stop2->mColor = stopColor; // We found a valid location; copy color from first stop arg. } else { // We didn't get a second stop after all, remove the additional stop again. aGradient->mStops.SetLength(aGradient->mStops.Length()-1);