CssBorderTopProperty
More information available at:
https://developer.mozilla.org/en-US/docs/Web/CSS/border-top
using AngleSharp.Css;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AngleSharp.Dom.Css
{
internal sealed class CssBorderTopProperty : CssShorthandProperty
{
internal CssBorderTopProperty(CssStyleDeclaration rule)
: base(PropertyNames.BorderTop, rule, PropertyFlags.Animatable)
{
}
protected override bool IsValid(CssValue value)
{
return CssBorderProperty.Converter.TryConvert(value, delegate(Tuple<CssValue, CssValue, CssValue> m) {
Get<CssBorderTopWidthProperty>().TrySetValue(m.Item1);
Get<CssBorderTopStyleProperty>().TrySetValue(m.Item2);
Get<CssBorderTopColorProperty>().TrySetValue(m.Item3);
});
}
internal override string SerializeValue(IEnumerable<CssProperty> properties)
{
CssBorderTopColorProperty cssBorderTopColorProperty = properties.OfType<CssBorderTopColorProperty>().FirstOrDefault();
CssBorderTopWidthProperty cssBorderTopWidthProperty = properties.OfType<CssBorderTopWidthProperty>().FirstOrDefault();
CssBorderTopStyleProperty cssBorderTopStyleProperty = properties.OfType<CssBorderTopStyleProperty>().FirstOrDefault();
if (cssBorderTopColorProperty == null || cssBorderTopWidthProperty == null || cssBorderTopStyleProperty == null)
return string.Empty;
return CssBorderProperty.SerializeValue(cssBorderTopWidthProperty, cssBorderTopStyleProperty, cssBorderTopColorProperty);
}
}
}