From kde-commits Fri May 22 04:43:21 2009 From: Germain Garand Date: Fri, 22 May 2009 04:43:21 +0000 To: kde-commits Subject: KDE/kdelibs/khtml/css Message-Id: <1242967401.900895.28928.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124296740904123 SVN commit 971234 by ggarand: don't allow mix of percents and integers in functional-style colour declarations since it is explicitely disallowed by CSS 2.1 BUG: 193434 M +5 -3 cssparser.cpp --- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #971233:971234 @@ -2259,18 +2259,20 @@ { ValueList* args = value->function->args; Value* v = args->current(); + // Get the first value if (!validUnit(v, FInteger | FPercent, true)) return false; - colorArray[0] = static_cast(v->fValue * (v->unit == CSSPrimitiveValue::CSS_PERCENTAGE ? 256.0 / 100.0 : 1.0)); + bool isPercent = (v->unit == CSSPrimitiveValue::CSS_PERCENTAGE); + colorArray[0] = static_cast(v->fValue * (isPercent ? 256.0 / 100.0 : 1.0)); for (int i = 1; i < 3; i++) { v = args->next(); if (v->unit != Value::Operator && v->iValue != ',') return false; v = args->next(); - if (!validUnit(v, FInteger | FPercent, true)) + if (!validUnit(v, (isPercent ? FPercent : FInteger), true)) return false; - colorArray[i] = static_cast(v->fValue * (v->unit == CSSPrimitiveValue::CSS_PERCENTAGE ? 256.0 / 100.0 : 1.0)); + colorArray[i] = static_cast(v->fValue * (isPercent ? 256.0 / 100.0 : 1.0)); } if (parseAlpha) { v = args->next();