AngleSharp by Florian Rappl

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

.NET API 1,229,312 bytes

 CssBorderRadiusProperty

Information can be found on MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
using AngleSharp.Css; using AngleSharp.Extensions; using System; using System.Collections.Generic; using System.Linq; namespace AngleSharp.Dom.Css { internal sealed class CssBorderRadiusProperty : CssShorthandProperty { private static readonly IValueConverter<Tuple<CssValue, CssValue>> Converter = Converters.WithOrder(Converters.LengthOrPercentConverter.Periodic().Val().Required(), Converters.LengthOrPercentConverter.Periodic().Val().StartsWithDelimiter() .Option()); internal CssBorderRadiusProperty(CssStyleDeclaration rule) : base(PropertyNames.BorderRadius, rule, PropertyFlags.Animatable) { } protected override bool IsValid(CssValue value) { return Converter.TryConvert(value, delegate(Tuple<CssValue, CssValue> m) { Get<CssBorderTopLeftRadiusProperty>().TrySetValue(Extract(m, 0)); Get<CssBorderTopRightRadiusProperty>().TrySetValue(Extract(m, 1)); Get<CssBorderBottomRightRadiusProperty>().TrySetValue(Extract(m, 2)); Get<CssBorderBottomLeftRadiusProperty>().TrySetValue(Extract(m, 3)); }); } internal override string SerializeValue(IEnumerable<CssProperty> properties) { CssBorderTopLeftRadiusProperty cssBorderTopLeftRadiusProperty = properties.OfType<CssBorderTopLeftRadiusProperty>().FirstOrDefault(); CssBorderTopRightRadiusProperty cssBorderTopRightRadiusProperty = properties.OfType<CssBorderTopRightRadiusProperty>().FirstOrDefault(); CssBorderBottomRightRadiusProperty cssBorderBottomRightRadiusProperty = properties.OfType<CssBorderBottomRightRadiusProperty>().FirstOrDefault(); CssBorderBottomLeftRadiusProperty cssBorderBottomLeftRadiusProperty = properties.OfType<CssBorderBottomLeftRadiusProperty>().FirstOrDefault(); if (cssBorderTopLeftRadiusProperty == null || cssBorderTopRightRadiusProperty == null || cssBorderBottomRightRadiusProperty == null || cssBorderBottomLeftRadiusProperty == null) return string.Empty; if (!cssBorderTopLeftRadiusProperty.HasValue || !cssBorderTopRightRadiusProperty.HasValue || !cssBorderBottomRightRadiusProperty.HasValue || !cssBorderBottomLeftRadiusProperty.HasValue) return string.Empty; return CssShorthandProperty.SerializePeriodic(cssBorderTopLeftRadiusProperty, cssBorderTopRightRadiusProperty, cssBorderBottomRightRadiusProperty, cssBorderBottomLeftRadiusProperty); } private static CssValue Extract(Tuple<CssValue, CssValue> src, int index) { return null; } } }