Exemplo n.º 1
0
        public IPropertyValue Construct(CssProperty[] properties)
        {
            var result = properties.Guard<MultipleValue>();

            if (result == null)
            {
                var values = new IPropertyValue[properties.Length];

                for (var i = 0; i < properties.Length; i++)
                {
                    var value = _converter.Construct(new[] { properties[i] });

                    if (value == null)
                        return null;

                    values[i] = value;
                }

                result = new MultipleValue(values, Enumerable.Empty<CssToken>());
            }

            return result;
        }
        public IPropertyValue Construct(CssProperty[] properties)
        {
            var result = properties.Guard<OptionsValue>();

            if (result == null)
            {
                var values = new IPropertyValue[_converters.Length];

                for (var i = 0; i < _converters.Length; i++)
                {
                    var value = _converters[i].Construct(properties);

                    if (value == null)
                        return null;

                    values[i] = value;
                }

                result = new OptionsValue(values, Enumerable.Empty<CssToken>());
            }

            return result;
        }
Exemplo n.º 3
0
        public IPropertyValue Construct(CssProperty[] properties)
        {
            var result = properties.Guard<ListValue>();

            if (result == null)
            {
                var valueList = new List<List<CssToken>>[properties.Length];
                var dummies = new CssProperty[properties.Length];
                var max = 0;

                for (var i = 0; i < properties.Length; i++)
                {
                    var value = properties[i].DeclaredValue;
                    valueList[i] = value != null ? value.Original.ToList() : new List<List<CssToken>>();
                    dummies[i] = Factory.Properties.CreateLonghand(properties[i].Name);
                    max = Math.Max(max, valueList[i].Count);
                }

                var values = new IPropertyValue[max];

                for (int i = 0; i < max; i++)
                {
                    for (int j = 0; j < dummies.Length; j++)
                    {
                        var list = valueList[j];
                        var tokens = list.Count > i ? list[i] : Enumerable.Empty<CssToken>();
                        dummies[j].TrySetValue(new CssValue(tokens));
                    }

                    values[i] = _converter.Construct(dummies);
                }

                result = new ListValue(values, Enumerable.Empty<CssToken>());
            }

            return result;
        }
Exemplo n.º 4
0
 public IPropertyValue Construct(CssProperty[] properties)
 {
     return properties.Guard<GradientValue>();
 }
 public IPropertyValue Construct(CssProperty[] properties)
 {
     return properties.Guard<StringsValue>();
 }
 public IPropertyValue Construct(CssProperty[] properties)
 {
     return properties.Guard<ArgumentsValue>();
 }
Exemplo n.º 7
0
 public IPropertyValue Construct(CssProperty[] properties)
 {
     return properties.Guard<FunctionValue>();
 }
 public IPropertyValue Construct(CssProperty[] properties)
 {
     return properties.Guard<IdentifierValue>();
 }