public static ICssProperty[] CreateLonghands(this DeclarationInfo info, ICssValue value, Func <String, ICssValue, ICssProperty> createProperty) { var aggregator = info.Converter as IValueAggregator; var longhands = info.Longhands; if (value is ICssRawValue) { var child = new CssChildValue(value); var values = Enumerable.Repeat(child, longhands.Length).ToArray(); return(CreateProperties(longhands, values, createProperty)); } return(CreateProperties(longhands, aggregator?.Split(value), createProperty)); }
public static ICssValue[] Expand(this DeclarationInfo info, IDeclarationFactory factory, ICssValue value) { var longhands = info.Longhands; if (value is ICssRawValue || value is CssChildValue) { var child = new CssChildValue(value); return(Enumerable .Repeat(child, longhands.Length) .ToArray()); } else if (value is CssInitialValue) { return(longhands .Select(name => new CssInitialValue(factory.Create(name)?.InitialValue)) .OfType <ICssValue>() .ToArray()); } return(info.Aggregator?.Split(value)); }