CssBorderImageWidthProperty
More information available at:
https://developer.mozilla.org/en-US/docs/Web/CSS/border-image-width
using AngleSharp.Css;
using AngleSharp.Extensions;
using System;
namespace AngleSharp.Dom.Css
{
internal sealed class CssBorderImageWidthProperty : CssProperty, ICssBorderImageWidthProperty, ICssProperty
{
internal static readonly Length Default = Length.Full;
internal static readonly IValueConverter<Tuple<Length, Length, Length, Length>> Converter = Converters.ImageBorderWidthConverter.Periodic();
private Length _top;
private Length _right;
private Length _bottom;
private Length _left;
public Length WidthTop => _top;
public Length WidthBottom => _bottom;
public Length WidthLeft => _left;
public Length WidthRight => _right;
internal CssBorderImageWidthProperty(CssStyleDeclaration rule)
: base(PropertyNames.BorderImageWidth, rule, PropertyFlags.None)
{
}
private void SetWidth(Length top, Length right, Length bottom, Length left)
{
_top = top;
_right = right;
_bottom = bottom;
_left = left;
}
internal override void Reset()
{
_top = Default;
_right = Default;
_bottom = Default;
_left = Default;
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, delegate(Tuple<Length, Length, Length, Length> m) {
SetWidth(m.Item1, m.Item2, m.Item3, m.Item4);
});
}
}
}