public static CssColor AsColor(WebDom.CssCodeValueExpression value) { if (value.EvaluatedAs != WebDom.CssValueEvaluatedAs.Color) { if (value is WebDom.CssCodeColor) { return(((WebDom.CssCodeColor)value).ActualColor); } else { CssColor actualColor = CssValueParser2.GetActualColor(value.GetTranslatedStringValue()); value.SetColorValue(actualColor); return(actualColor); } } return(value.GetCacheColor()); }
//----------------------- static int EvaluateIntPropertyValueFromString <T>(ValueMap <T> map, WebDom.CssValueEvaluatedAs evalAs, T defaultValue, WebDom.CssCodeValueExpression value) where T : struct { if (value.EvaluatedAs != evalAs) { T knownValue = map.GetValueFromString(value.GetTranslatedStringValue(), defaultValue); int result = Convert.ToInt32(knownValue); value.SetIntValue(result, evalAs); return((int)result); } else { return(value.GetCacheIntValue()); } }