CssTextAlignProperty
Information can be found on MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
using AngleSharp.Css;
using AngleSharp.Extensions;
namespace AngleSharp.Dom.Css
{
internal sealed class CssTextAlignProperty : CssProperty, ICssTextAlignProperty, ICssProperty
{
internal static readonly HorizontalAlignment Default = HorizontalAlignment.Left;
internal static readonly IValueConverter<HorizontalAlignment> Converter = Map.HorizontalAlignments.ToConverter();
private HorizontalAlignment _mode;
public HorizontalAlignment State => _mode;
internal CssTextAlignProperty(CssStyleDeclaration rule)
: base(PropertyNames.TextAlign, rule, PropertyFlags.Inherited)
{
Reset();
}
public void SetState(HorizontalAlignment mode)
{
_mode = mode;
}
internal override void Reset()
{
_mode = Default;
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, SetState);
}
}
}