From e602080115926b6e311ab216e3b0130277fda39b Mon Sep 17 00:00:00 2001 From: EAZYBLACK Date: Thu, 24 Sep 2026 20:42:47 +0300 Subject: [PATCH] fix fatal recursion bug --- layout/style/nsRuleNode.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 7fcb433ac8..0ac5dbd599 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1236,8 +1236,20 @@ static bool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, const mozilla::css::ColorMixValue* colorMix = aValue.GetColorMixValue(); if (colorMix) { nscolor color1, color2; - if (SetColor(colorMix->mColor1, aParentColor, aPresContext, aContext, color1, aConditions) && - SetColor(colorMix->mColor2, aParentColor, aPresContext, aContext, color2, aConditions)) { + // XXX: Avoid fatal recursion when either color resolves to NS_COLOR_CURRENTCOLOR. + if (colorMix->mColor1.GetUnit() == eCSSUnit_EnumColor && + colorMix->mColor1.GetIntValue() == NS_COLOR_CURRENTCOLOR) { + color1 = aParentColor; + } else { + SetColor(colorMix->mColor1, aParentColor, aPresContext, aContext, color1, aConditions); + } + if (colorMix->mColor2.GetUnit() == eCSSUnit_EnumColor && + colorMix->mColor2.GetIntValue() == NS_COLOR_CURRENTCOLOR) { + color2 = aParentColor; + } else { + SetColor(colorMix->mColor2, aParentColor, aPresContext, aContext, color2, aConditions); + } + if (color1 && color2) { // interpolate each RGBA component with proper percentage handling float w1 = colorMix->mWeight1;