CssFontStyleProperty
Information:
https://developer.mozilla.org/en-US/docs/Web/CSS/font-style
using AngleSharp.Css;
using AngleSharp.Extensions;
namespace AngleSharp.Dom.Css
{
internal sealed class CssFontStyleProperty : CssProperty, ICssFontStyleProperty, ICssProperty
{
internal static readonly FontStyle Default = FontStyle.Normal;
internal static readonly IValueConverter<FontStyle> Converter = Map.FontStyles.ToConverter();
private FontStyle _style;
public FontStyle Style => _style;
internal CssFontStyleProperty(CssStyleDeclaration rule)
: base(PropertyNames.FontStyle, rule, PropertyFlags.Inherited)
{
Reset();
}
private void SetStyle(FontStyle style)
{
_style = style;
}
internal override void Reset()
{
_style = Default;
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, SetStyle);
}
}
}