AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.8.3" />

.NET API 1,189,376 bytes

 CssBackgroundSizeProperty

More information available at: https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
using AngleSharp.Css; using AngleSharp.Extensions; using System; namespace AngleSharp.Dom.Css { internal sealed class CssBackgroundSizeProperty : CssProperty { internal struct BackgroundSize { public bool IsCovered; public bool IsContained; public Length Width; public Length Height; } internal static readonly BackgroundSize Default = default(BackgroundSize); internal static readonly IValueConverter<BackgroundSize> SingleConverter; internal static readonly IValueConverter<BackgroundSize[]> Converter; internal CssBackgroundSizeProperty(CssStyleDeclaration rule) : base(PropertyNames.BackgroundSize, rule, PropertyFlags.Animatable) { } protected override object GetDefault(IElement element) { return Default; } protected override object Compute(IElement element) { return Converter.Convert(base.Value); } protected override bool IsValid(ICssValue value) { return Converter.Validate(value); } static CssBackgroundSizeProperty() { IValueConverter<BackgroundSize> primary = Converters.AutoLengthOrPercentConverter.To(delegate(Length? m) { BackgroundSize result2 = default(BackgroundSize); result2.Width = (m ?? Length.Full); result2.Height = Length.Full; return result2; }); string cover = Keywords.Cover; BackgroundSize value = new BackgroundSize { IsCovered = true }; IValueConverter<BackgroundSize> primary2 = primary.Or(cover, value); string contain = Keywords.Contain; value = new BackgroundSize { IsContained = true }; SingleConverter = primary2.Or(contain, value).Or(Converters.WithOrder(Converters.AutoLengthOrPercentConverter.Required(), Converters.AutoLengthOrPercentConverter.Required()).To(delegate(Tuple<Length?, Length?> pt) { BackgroundSize result = default(BackgroundSize); result.Width = (pt.Item1 ?? Length.Full); result.Height = (pt.Item2 ?? Length.Full); return result; })); Converter = SingleConverter.FromList(); } } }