CssBorderSpacingProperty
Information can be found on MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing
using AngleSharp.Css;
using AngleSharp.Extensions;
namespace AngleSharp.Dom.Css
{
internal sealed class CssBorderSpacingProperty : CssProperty, ICssBorderSpacingProperty, ICssProperty
{
internal static readonly Length Default = Length.Zero;
internal static readonly IValueConverter<Length[]> Converter = Converters.LengthConverter.Many(1, 2);
private Length _h;
private Length _v;
public Length Horizontal => _h;
public Length Vertical => _v;
internal CssBorderSpacingProperty(CssStyleDeclaration rule)
: base(PropertyNames.BorderSpacing, rule, PropertyFlags.Inherited)
{
Reset();
}
public void SetSpacing(Length horizontal, Length vertical)
{
_h = horizontal;
_v = vertical;
}
internal override void Reset()
{
_h = Default;
_v = Default;
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, delegate(Length[] m) {
SetSpacing(m[0], (m.Length == 2) ? m[1] : m[0]);
});
}
}
}