Added support for recent list-type

This commit is contained in:
Florian Rappl 2024-01-16 14:18:08 +01:00
Родитель 240cee3b96
Коммит 7a96a5587f
42 изменённых файлов: 875 добавлений и 181 удалений

Просмотреть файл

@ -15,6 +15,7 @@ Released on tbd.
- Added more CSSOM possibilities and helpers (#6)
- Added parts of recent color spec update such as `rgb` with spaces (#131)
- Added now Color L4 parsing with `hsl`, `hwb`, `lab`, `lch`, `oklab`, and `oklch`
- Added support for recent CSS `list-type` values (#152)
# 0.17.0

Просмотреть файл

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 - 2023 AngleSharp
Copyright (c) 2013 - 2024 AngleSharp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -99,7 +99,7 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org)
The MIT License (MIT)
Copyright (c) 2016 - 2022 AngleSharp
Copyright (c) 2016 - 2024 AngleSharp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Просмотреть файл

@ -1,4 +1,4 @@
namespace AngleSharp.Css.Tests.Declarations
namespace AngleSharp.Css.Tests.Declarations
{
using NUnit.Framework;
using static CssConstructionFunctions;
@ -125,14 +125,15 @@
}
[Test]
public void CssListStyleTypeNumberIllegal()
public void CssListStyleTypeSomeValueLegal()
{
var snippet = "list-style-type: number ";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsFalse(property.IsImportant);
Assert.IsTrue(property.IsInherited);
Assert.IsFalse(property.HasValue);
Assert.IsFalse(property.IsInherited);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("number", property.Value);
}
[Test]
@ -277,5 +278,94 @@
Assert.IsTrue(property.HasValue);
Assert.AreEqual("chapter 1 section 2 page 1", property.Value);
}
[Test]
public void CssListStyleStringValue_Issue152()
{
var snippet = "list-style-type: \"-\"";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("\"-\"", property.Value);
}
[Test]
public void CssListStyleKannada_Issue152()
{
var snippet = "list-style-type: kannada";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("kannada", property.Value);
}
[Test]
public void CssListStyleTradChineseInformal_Issue152()
{
var snippet = "list-style-type: trad-chinese-informal;";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("trad-chinese-informal", property.Value);
}
[Test]
public void CssListStyleGeorgian_Issue152()
{
var snippet = "list-style-type: georgian";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("georgian", property.Value);
}
[Test]
public void CssListStyleDecimal_Issue152()
{
var snippet = "list-style-type: decimal";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("decimal", property.Value);
}
[Test]
public void CssListStyleSquare_Issue152()
{
var snippet = "list-style-type: square";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("square", property.Value);
}
[Test]
public void CssListStyleCircle_Issue152()
{
var snippet = "list-style-type: circle";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("circle", property.Value);
}
[Test]
public void CssListStyleSymbolsFunction_Issue152()
{
var snippet = "list-style-type: symbols(cyclic \"*\" \"†\" \"‡\")";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("symbols(cyclic \"*\" \"†\" \"‡\")", property.Value);
}
[Test]
public void CssListStyleSymbolsFailingForWrongType_Issue152()
{
var snippet = "list-style-type: symbols(foo \"*\" \"†\" \"‡\")";
var property = ParseDeclaration(snippet);
Assert.AreEqual("list-style-type", property.Name);
Assert.IsFalse(property.HasValue);
}
}
}

Просмотреть файл

@ -12,7 +12,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Extends the CSSOM from the core AngleSharp library.</description>
<releaseNotes>https://github.com/AngleSharp/AngleSharp.Css/blob/main/CHANGELOG.md</releaseNotes>
<copyright>Copyright 2016-2023, AngleSharp</copyright>
<copyright>Copyright 2016-2024, AngleSharp</copyright>
<tags>html html5 css css3 dom styling library anglesharp angle</tags>
<dependencies>
<dependency id="AngleSharp" version="[1.0.0,2.0.0)" />

Просмотреть файл

@ -27,6 +27,26 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String Clip = "clip";
/// <summary>
/// The cyclic keyword.
/// </summary>
public static readonly String Cyclic = "cyclic";
/// <summary>
/// The numeric keyword.
/// </summary>
public static readonly String Numeric = "numeric";
/// <summary>
/// The alphabetic keyword.
/// </summary>
public static readonly String Alphabetic = "alphabetic";
/// <summary>
/// The symbolic keyword.
/// </summary>
public static readonly String Symbolic = "symbolic";
/// <summary>
/// The legacy keyword.
/// </summary>
@ -37,6 +57,11 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String Normal = "normal";
/// <summary>
/// The arabic-indic keyword.
/// </summary>
public static readonly String ArabicIndic = "arabic-indic";
/// <summary>
/// The pre keyword.
/// </summary>
@ -97,6 +122,16 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String InterCharacter = "inter-character";
/// <summary>
/// The katakana keyword.
/// </summary>
public static readonly String Katakana = "katakana";
/// <summary>
/// The katakana-iroha keyword.
/// </summary>
public static readonly String KatakanaIroha = "katakana-iroha";
/// <summary>
/// The kashida keyword.
/// </summary>
@ -1127,16 +1162,101 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String UpperLatin = "upper-latin";
/// <summary>
/// The malayalam keyword.
/// </summary>
public static readonly String Malayalam = "malayalam";
/// <summary>
/// The myanmar keyword.
/// </summary>
public static readonly String Myanmar = "myanmar";
/// <summary>
/// The mongolian keyword.
/// </summary>
public static readonly String Mongolian = "mongolian";
/// <summary>
/// The oriya keyword.
/// </summary>
public static readonly String Oriya = "oriya";
/// <summary>
/// The persian keyword.
/// </summary>
public static readonly String Persian = "persian";
/// <summary>
/// The tamil keyword.
/// </summary>
public static readonly String Tamil = "tamil";
/// <summary>
/// The thai keyword.
/// </summary>
public static readonly String Thai = "thai";
/// <summary>
/// The telugu keyword.
/// </summary>
public static readonly String Telugu = "telugu";
/// <summary>
/// The lao keyword.
/// </summary>
public static readonly String Lao = "lao";
/// <summary>
/// The tibetan keyword.
/// </summary>
public static readonly String Tibetan = "tibetan";
/// <summary>
/// The trad-chinese-formal keyword.
/// </summary>
public static readonly String TradChineseFormal = "trad-chinese-formal";
/// <summary>
/// The trad-chinese-informal keyword.
/// </summary>
public static readonly String TradChineseInformal = "trad-chinese-informal";
/// <summary>
/// The armenian keyword.
/// </summary>
public static readonly String Armenian = "armenian";
/// <summary>
/// The lower-armenian keyword.
/// </summary>
public static readonly String LowerArmenian = "lower-armenian";
/// <summary>
/// The upper-armenian keyword.
/// </summary>
public static readonly String UpperArmenian = "upper-armenian";
/// <summary>
/// The georgian keyword.
/// </summary>
public static readonly String Georgian = "georgian";
/// <summary>
/// The kannada keyword.
/// </summary>
public static readonly String Kannada = "kannada";
/// <summary>
/// The disclosure-open keyword.
/// </summary>
public static readonly String DisclosureOpen = "disclosure-open";
/// <summary>
/// The disclosure-closed keyword.
/// </summary>
public static readonly String DisclosureClosed = "disclosure-closed";
/// <summary>
/// The lower-alpha keyword.
/// </summary>
@ -1317,6 +1437,106 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String Fill = "fill";
/// <summary>
/// The cjk-decimal keyword.
/// </summary>
public static readonly String CjkDecimal = "cjk-decimal";
/// <summary>
/// The cjk-earthly-branch keyword.
/// </summary>
public static readonly String CjkEarthlyBranch = "cjk-earthly-branch";
/// <summary>
/// The cjk-heavenly-stem keyword.
/// </summary>
public static readonly String CjkHeavenlyStem = "cjk-heavenly-stem";
/// <summary>
/// The cjk-ideographic keyword.
/// </summary>
public static readonly String CjkIdeographic = "cjk-ideographic";
/// <summary>
/// The bengali keyword.
/// </summary>
public static readonly String Bengali = "bengali";
/// <summary>
/// The cambodian keyword.
/// </summary>
public static readonly String Cambodian = "cambodian";
/// <summary>
/// The devanagari keyword.
/// </summary>
public static readonly String Devanagari = "devanagari";
/// <summary>
/// The ethiopic-numeric keyword.
/// </summary>
public static readonly String EthiopicNumeric = "ethiopic-numeric";
/// <summary>
/// The gurmukhi keyword.
/// </summary>
public static readonly String Gurmukhi = "gurmukhi";
/// <summary>
/// The gujarati keyword.
/// </summary>
public static readonly String Gujarati = "gujarati";
/// <summary>
/// The hebrew keyword.
/// </summary>
public static readonly String Hebrew = "hebrew";
/// <summary>
/// The hiragana keyword.
/// </summary>
public static readonly String Hiragana = "hiragana";
/// <summary>
/// The hiragana-iroha keyword.
/// </summary>
public static readonly String HiraganaIroha = "hiragana-iroha";
/// <summary>
/// The japanese-formal keyword.
/// </summary>
public static readonly String JapaneseFormal = "japanese-formal";
/// <summary>
/// The japanese-informal keyword.
/// </summary>
public static readonly String JapaneseInformal = "japanese-informal";
/// <summary>
/// The simp-chinese-informal keyword.
/// </summary>
public static readonly String SimpChineseInformal = "simp-chinese-informal";
/// <summary>
/// The simp-chinese-formal keyword.
/// </summary>
public static readonly String SimpChineseFormal = "simp-chinese-formal";
/// <summary>
/// The korean-hangul-formal keyword.
/// </summary>
public static readonly String KoreanHangulFormal = "korean-hangul-formal";
/// <summary>
/// The korean-hanja-formal keyword.
/// </summary>
public static readonly String KoreanHanjaFormal = "korean-hanja-formal";
/// <summary>
/// The korean-hanja-informal keyword.
/// </summary>
public static readonly String KoreanHanjaInformal = "korean-hanja-informal";
/// <summary>
/// The screen keyword.
/// </summary>

Просмотреть файл

@ -57,6 +57,11 @@ namespace AngleSharp.Css
/// </summary>
public static readonly String Attr = "attr";
/// <summary>
/// The symbols function.
/// </summary>
public static readonly String Symbols = "symbols";
/// <summary>
/// The fit-content function.
/// </summary>

Просмотреть файл

@ -14,7 +14,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-Whitespace mapping.
/// </summary>
public static readonly Dictionary<String, Whitespace> Whitespaces = new Dictionary<String, Whitespace>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Whitespace> Whitespaces = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, Whitespace.Normal },
{ CssKeywords.Pre, Whitespace.Pre },
@ -26,7 +26,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-Angle mapping for linear-gradients.s
/// </summary>
public static readonly Dictionary<String, Angle> GradientAngles = new Dictionary<String, Angle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Angle> GradientAngles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Left, new Angle(270.0, Angle.Unit.Deg) },
{ CssKeywords.Top, new Angle(0.0, Angle.Unit.Deg) },
@ -41,7 +41,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextTransform mapping.
/// </summary>
public static readonly Dictionary<String, TextTransform> TextTransforms = new Dictionary<String, TextTransform>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextTransform> TextTransforms = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, TextTransform.None },
{ CssKeywords.Capitalize, TextTransform.Capitalize },
@ -53,7 +53,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextAlignLast mapping.
/// </summary>
public static readonly Dictionary<String, TextAlignLast> TextAlignLasts = new Dictionary<String, TextAlignLast>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextAlignLast> TextAlignLasts = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, TextAlignLast.Auto },
{ CssKeywords.Start, TextAlignLast.Start },
@ -67,7 +67,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextAnchor mapping.
/// </summary>
public static readonly Dictionary<String, TextAnchor> TextAnchors = new Dictionary<String, TextAnchor>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextAnchor> TextAnchors = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Start, TextAnchor.Start },
{ CssKeywords.Middle, TextAnchor.Middle },
@ -77,7 +77,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextJustify mapping.
/// </summary>
public static readonly Dictionary<String, TextJustify> TextJustifies = new Dictionary<String, TextJustify>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextJustify> TextJustifies = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, TextJustify.Auto },
{ CssKeywords.Distribute, TextJustify.Distribute },
@ -93,7 +93,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-HorizontalAlignment mapping.
/// </summary>
public static readonly Dictionary<String, HorizontalAlignment> HorizontalAlignments = new Dictionary<String, HorizontalAlignment>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, HorizontalAlignment> HorizontalAlignments = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Left, HorizontalAlignment.Left },
{ CssKeywords.Right, HorizontalAlignment.Right },
@ -104,7 +104,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-VerticalAlignment mapping.
/// </summary>
public static readonly Dictionary<String, VerticalAlignment> VerticalAlignments = new Dictionary<String, VerticalAlignment>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, VerticalAlignment> VerticalAlignments = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Baseline, VerticalAlignment.Baseline },
{ CssKeywords.Sub, VerticalAlignment.Sub },
@ -119,7 +119,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-LineStyle mapping.
/// </summary>
public static readonly Dictionary<String, LineStyle> LineStyles = new Dictionary<String, LineStyle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, LineStyle> LineStyles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, LineStyle.None },
{ CssKeywords.Solid, LineStyle.Solid },
@ -136,7 +136,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BoxModel mapping.
/// </summary>
public static readonly Dictionary<String, BoxModel> BoxModels = new Dictionary<String, BoxModel>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BoxModel> BoxModels = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.BorderBox, BoxModel.BorderBox },
{ CssKeywords.PaddingBox, BoxModel.PaddingBox },
@ -146,7 +146,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TimingFunction mapping.
/// </summary>
public static readonly Dictionary<String, ICssTimingFunctionValue> TimingFunctions = new Dictionary<String, ICssTimingFunctionValue>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ICssTimingFunctionValue> TimingFunctions = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Ease, new CssCubicBezierValue(0.25, 0.1, 0.25, 1.0) },
{ CssKeywords.EaseIn, new CssCubicBezierValue(0.42, 0.0, 1.0, 1.0) },
@ -160,7 +160,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-AnimationFillStyle mapping.
/// </summary>
public static readonly Dictionary<String, AnimationFillStyle> AnimationFillStyles = new Dictionary<String, AnimationFillStyle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, AnimationFillStyle> AnimationFillStyles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, AnimationFillStyle.None },
{ CssKeywords.Forwards, AnimationFillStyle.Forwards },
@ -171,7 +171,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-AnimationDirection mapping.
/// </summary>
public static readonly Dictionary<String, AnimationDirection> AnimationDirections = new Dictionary<String, AnimationDirection>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, AnimationDirection> AnimationDirections = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, AnimationDirection.Normal },
{ CssKeywords.Reverse, AnimationDirection.Reverse },
@ -182,7 +182,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-Visibility mapping.
/// </summary>
public static readonly Dictionary<String, Visibility> Visibilities = new Dictionary<String, Visibility>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Visibility> Visibilities = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Visible, Visibility.Visible },
{ CssKeywords.Hidden, Visibility.Hidden },
@ -192,7 +192,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-PlayState mapping.
/// </summary>
public static readonly Dictionary<String, PlayState> PlayStates = new Dictionary<String, PlayState>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, PlayState> PlayStates = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Running, PlayState.Running },
{ CssKeywords.Paused, PlayState.Paused },
@ -201,7 +201,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FontVariant mapping.
/// </summary>
public static readonly Dictionary<String, FontVariant> FontVariants = new Dictionary<String, FontVariant>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FontVariant> FontVariants = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, FontVariant.Normal },
{ CssKeywords.SmallCaps, FontVariant.SmallCaps },
@ -210,38 +210,90 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-DirectionMode mapping.
/// </summary>
public static readonly Dictionary<String, DirectionMode> DirectionModes = new Dictionary<String, DirectionMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, DirectionMode> DirectionModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Ltr, DirectionMode.Ltr },
{ CssKeywords.Rtl, DirectionMode.Rtl },
};
/// <summary>
/// Contains the string-SymbolsType mapping.
/// </summary>
public static readonly Dictionary<String, SymbolsType> SymbolsTypes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Cyclic, SymbolsType.Cyclic },
{ CssKeywords.Numeric, SymbolsType.Numeric },
{ CssKeywords.Alphabetic, SymbolsType.Alphabetic },
{ CssKeywords.Symbolic, SymbolsType.Symbolic },
{ CssKeywords.Fixed, SymbolsType.Fixed },
};
/// <summary>
/// Contains the string-ListStyle mapping.
/// </summary>
public static readonly Dictionary<String, ListStyle> ListStyles = new Dictionary<String, ListStyle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ListStyle> ListStyles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ListStyle.None },
{ CssKeywords.Disc, ListStyle.Disc },
{ CssKeywords.Circle, ListStyle.Circle },
{ CssKeywords.Square, ListStyle.Square },
{ CssKeywords.Decimal, ListStyle.Decimal },
{ CssKeywords.CjkDecimal, ListStyle.CjkDecimal },
{ CssKeywords.DecimalLeadingZero, ListStyle.DecimalLeadingZero },
{ CssKeywords.LowerRoman, ListStyle.LowerRoman },
{ CssKeywords.UpperRoman, ListStyle.UpperRoman },
{ CssKeywords.LowerGreek, ListStyle.LowerGreek },
{ CssKeywords.LowerLatin, ListStyle.LowerLatin },
{ CssKeywords.UpperLatin, ListStyle.UpperLatin },
{ CssKeywords.Armenian, ListStyle.Armenian },
{ CssKeywords.Georgian, ListStyle.Georgian },
{ CssKeywords.LowerAlpha, ListStyle.LowerLatin },
{ CssKeywords.UpperLatin, ListStyle.UpperLatin },
{ CssKeywords.UpperAlpha, ListStyle.UpperLatin },
{ CssKeywords.None, ListStyle.None },
{ CssKeywords.ArabicIndic, ListStyle.ArabicIndic },
{ CssKeywords.Armenian, ListStyle.Armenian },
{ CssKeywords.Bengali, ListStyle.Bengali },
{ CssKeywords.Cambodian, ListStyle.Cambodian },
{ CssKeywords.CjkEarthlyBranch, ListStyle.CjkEarthlyBranch },
{ CssKeywords.CjkHeavenlyStem, ListStyle.CjkHeavenlyStem },
{ CssKeywords.CjkIdeographic, ListStyle.TradChineseInformal },
{ CssKeywords.Devanagari, ListStyle.Devanagari },
{ CssKeywords.EthiopicNumeric, ListStyle.EthiopicNumeric },
{ CssKeywords.Georgian, ListStyle.Georgian },
{ CssKeywords.Gurmukhi, ListStyle.Gurmukhi },
{ CssKeywords.Hebrew, ListStyle.Hebrew },
{ CssKeywords.Gujarati, ListStyle.Gujarati },
{ CssKeywords.Hiragana, ListStyle.Hiragana },
{ CssKeywords.HiraganaIroha, ListStyle.IrohaHiragana },
{ CssKeywords.JapaneseFormal, ListStyle.JapaneseFormal },
{ CssKeywords.JapaneseInformal, ListStyle.JapaneseInformal },
{ CssKeywords.Kannada, ListStyle.Kannada },
{ CssKeywords.KatakanaIroha, ListStyle.KatakanaIroha },
{ CssKeywords.Katakana, ListStyle.Katakana },
{ CssKeywords.KoreanHangulFormal, ListStyle.KoreanHangulFormal },
{ CssKeywords.KoreanHanjaFormal, ListStyle.KoreanHanjaFormal },
{ CssKeywords.KoreanHanjaInformal, ListStyle.KoreanHanjaInformal },
{ CssKeywords.Lao, ListStyle.Lao },
{ CssKeywords.UpperArmenian, ListStyle.UpperArmenian },
{ CssKeywords.LowerArmenian, ListStyle.LowerArmenian },
{ CssKeywords.Malayalam, ListStyle.Malayalam },
{ CssKeywords.Mongolian, ListStyle.Mongolian },
{ CssKeywords.Myanmar, ListStyle.Myanmar },
{ CssKeywords.Oriya, ListStyle.Oriya },
{ CssKeywords.Persian, ListStyle.Persian },
{ CssKeywords.SimpChineseFormal, ListStyle.SimpChineseFormal },
{ CssKeywords.SimpChineseInformal, ListStyle.SimpChineseInformal },
{ CssKeywords.Tamil, ListStyle.Tamil },
{ CssKeywords.Telugu, ListStyle.Telugu },
{ CssKeywords.Thai, ListStyle.Thai },
{ CssKeywords.Tibetan, ListStyle.Tibetan },
{ CssKeywords.TradChineseFormal, ListStyle.TradChineseFormal },
{ CssKeywords.TradChineseInformal, ListStyle.TradChineseInformal },
{ CssKeywords.DisclosureClosed, ListStyle.DisclosureClosed },
{ CssKeywords.DisclosureOpen, ListStyle.DisclosureOpen },
};
/// <summary>
/// Contains the string-ListPosition mapping.
/// </summary>
public static readonly Dictionary<String, ListPosition> ListPositions = new Dictionary<String, ListPosition>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ListPosition> ListPositions = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Inside, ListPosition.Inside },
{ CssKeywords.Outside, ListPosition.Outside },
@ -250,7 +302,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-length mapping.
/// </summary>
public static readonly Dictionary<String, Length> FontSizes = new Dictionary<String, Length>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Length> FontSizes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.XxSmall, new Length(0.6, Length.Unit.Em) },
{ CssKeywords.XSmall, new Length(0.75, Length.Unit.Em) },
@ -267,7 +319,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextDecorationStyle mapping.
/// </summary>
public static readonly Dictionary<String, TextDecorationStyle> TextDecorationStyles = new Dictionary<String, TextDecorationStyle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextDecorationStyle> TextDecorationStyles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Solid, TextDecorationStyle.Solid },
{ CssKeywords.Double, TextDecorationStyle.Double },
@ -279,7 +331,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-TextDecorationLine mapping.
/// </summary>
public static readonly Dictionary<String, TextDecorationLine> TextDecorationLines = new Dictionary<String, TextDecorationLine>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, TextDecorationLine> TextDecorationLines = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Underline, TextDecorationLine.Underline },
{ CssKeywords.Overline, TextDecorationLine.Overline },
@ -290,7 +342,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BorderRepeat mapping.
/// </summary>
public static readonly Dictionary<String, BorderRepeat> BorderRepeats = new Dictionary<String, BorderRepeat>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BorderRepeat> BorderRepeats = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Stretch, BorderRepeat.Stretch },
{ CssKeywords.Repeat, BorderRepeat.Repeat },
@ -300,7 +352,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-border width mapping.
/// </summary>
public static readonly Dictionary<String, Length> BorderWidths = new Dictionary<String, Length>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Length> BorderWidths = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Thin, Length.Thin },
{ CssKeywords.Medium, Length.Medium },
@ -310,7 +362,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-font family mapping.
/// </summary>
public static readonly Dictionary<String, String> FontFamilies = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, String> FontFamilies = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Serif, "Times New Roman" },
{ CssKeywords.SansSerif, "Arial" },
@ -322,7 +374,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BackgroundAttachment mapping.
/// </summary>
public static readonly Dictionary<String, BackgroundAttachment> BackgroundAttachments = new Dictionary<String, BackgroundAttachment>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BackgroundAttachment> BackgroundAttachments = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Fixed, BackgroundAttachment.Fixed },
{ CssKeywords.Local, BackgroundAttachment.Local },
@ -332,7 +384,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FontStyle mapping.
/// </summary>
public static readonly Dictionary<String, FontStyle> FontStyles = new Dictionary<String, FontStyle>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FontStyle> FontStyles = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, FontStyle.Normal },
{ CssKeywords.Italic, FontStyle.Italic },
@ -342,7 +394,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FontStretch mapping.
/// </summary>
public static readonly Dictionary<String, FontStretch> FontStretches = new Dictionary<String, FontStretch>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FontStretch> FontStretches = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, FontStretch.Normal },
{ CssKeywords.UltraCondensed, FontStretch.UltraCondensed },
@ -358,7 +410,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BreakMode (general) mapping.
/// </summary>
public static readonly Dictionary<String, BreakMode> BreakModes = new Dictionary<String, BreakMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BreakMode> BreakModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, BreakMode.Auto },
{ CssKeywords.Always, BreakMode.Always },
@ -374,7 +426,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BreakMode (page) mapping.
/// </summary>
public static readonly Dictionary<String, BreakMode> PageBreakModes = new Dictionary<String, BreakMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BreakMode> PageBreakModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, BreakMode.Auto },
{ CssKeywords.Always, BreakMode.Always },
@ -386,7 +438,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BreakMode (inside) mapping.
/// </summary>
public static readonly Dictionary<String, BreakMode> BreakInsideModes = new Dictionary<String, BreakMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BreakMode> BreakInsideModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, BreakMode.Auto },
{ CssKeywords.Avoid, BreakMode.Avoid },
@ -398,7 +450,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BreakMode (page/inside) mapping.
/// </summary>
public static readonly Dictionary<String, BreakMode> PageBreakInsideModes = new Dictionary<String, BreakMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BreakMode> PageBreakInsideModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, BreakMode.Auto },
{ CssKeywords.Avoid, BreakMode.Avoid },
@ -407,7 +459,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-horizontal modes mapping.
/// </summary>
public static readonly Dictionary<String, Double> HorizontalModes = new Dictionary<String, Double>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Double> HorizontalModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Left, 0.0 },
{ CssKeywords.Center, 0.5 },
@ -417,7 +469,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-vertical modes mapping.
/// </summary>
public static readonly Dictionary<String, Double> VerticalModes = new Dictionary<String, Double>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Double> VerticalModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Top, 0.0 },
{ CssKeywords.Center, 0.5 },
@ -427,7 +479,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-UnicodeMode mapping.
/// </summary>
public static readonly Dictionary<String, UnicodeMode> UnicodeModes = new Dictionary<String, UnicodeMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, UnicodeMode> UnicodeModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, UnicodeMode.Normal },
{ CssKeywords.Embed, UnicodeMode.Embed },
@ -440,7 +492,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-whitespace mapping.
/// </summary>
public static readonly Dictionary<String, SystemCursor> SystemCursors = new Dictionary<String, SystemCursor>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, SystemCursor> SystemCursors = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, SystemCursor.Auto },
{ CssKeywords.Default, SystemCursor.Default },
@ -483,7 +535,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-PositionMode mapping.
/// </summary>
public static readonly Dictionary<String, PositionMode> PositionModes = new Dictionary<String, PositionMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, PositionMode> PositionModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Static, PositionMode.Static },
{ CssKeywords.Relative, PositionMode.Relative },
@ -495,7 +547,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-OverflowMode mapping.
/// </summary>
public static readonly Dictionary<String, OverflowMode> OverflowModes = new Dictionary<String, OverflowMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, OverflowMode> OverflowModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Visible, OverflowMode.Visible },
{ CssKeywords.Hidden, OverflowMode.Hidden },
@ -506,7 +558,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the extended string-OverflowMode mapping.
/// </summary>
public static readonly Dictionary<String, OverflowMode> OverflowExtendedModes = new Dictionary<String, OverflowMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, OverflowMode> OverflowExtendedModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Visible, OverflowMode.Visible },
{ CssKeywords.Hidden, OverflowMode.Hidden },
@ -518,7 +570,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-Floating mapping.
/// </summary>
public static readonly Dictionary<String, Floating> Floatings = new Dictionary<String, Floating>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Floating> Floatings = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, Floating.None },
{ CssKeywords.Left, Floating.Left },
@ -529,7 +581,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-DisplayMode mapping.
/// </summary>
public static readonly Dictionary<String, DisplayMode> DisplayModes = new Dictionary<String, DisplayMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, DisplayMode> DisplayModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, DisplayMode.None },
{ CssKeywords.Inline, DisplayMode.Inline },
@ -555,7 +607,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-ClearMode mapping.
/// </summary>
public static readonly Dictionary<String, ClearMode> ClearModes = new Dictionary<String, ClearMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ClearMode> ClearModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ClearMode.None },
{ CssKeywords.Left, ClearMode.Left },
@ -566,7 +618,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BackgroundRepeat mapping.
/// </summary>
public static readonly Dictionary<String, BackgroundRepeat> BackgroundRepeats = new Dictionary<String, BackgroundRepeat>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BackgroundRepeat> BackgroundRepeats = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.NoRepeat, BackgroundRepeat.NoRepeat },
{ CssKeywords.Repeat, BackgroundRepeat.Repeat },
@ -577,7 +629,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BlendMode mapping.
/// </summary>
public static readonly Dictionary<String, BlendMode> BlendModes = new Dictionary<String, BlendMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BlendMode> BlendModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Color, BlendMode.Color },
{ CssKeywords.ColorBurn, BlendMode.ColorBurn },
@ -600,7 +652,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-UpdateFrequency mapping.
/// </summary>
public static readonly Dictionary<String, UpdateFrequency> UpdateFrequencies = new Dictionary<String, UpdateFrequency>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, UpdateFrequency> UpdateFrequencies = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, UpdateFrequency.None },
{ CssKeywords.Slow, UpdateFrequency.Slow },
@ -610,7 +662,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-ScriptingState mapping.
/// </summary>
public static readonly Dictionary<String, ScriptingState> ScriptingStates = new Dictionary<String, ScriptingState>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ScriptingState> ScriptingStates = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ScriptingState.None },
{ CssKeywords.InitialOnly, ScriptingState.InitialOnly },
@ -620,7 +672,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-PointerAccuracy mapping.
/// </summary>
public static readonly Dictionary<String, PointerAccuracy> PointerAccuracies = new Dictionary<String, PointerAccuracy>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, PointerAccuracy> PointerAccuracies = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, PointerAccuracy.None },
{ CssKeywords.Coarse, PointerAccuracy.Coarse },
@ -630,7 +682,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-HoverAbility mapping.
/// </summary>
public static readonly Dictionary<String, HoverAbility> HoverAbilities = new Dictionary<String, HoverAbility>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, HoverAbility> HoverAbilities = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, HoverAbility.None },
{ CssKeywords.OnDemand, HoverAbility.OnDemand },
@ -640,7 +692,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-SizeMode mapping.
/// </summary>
public static readonly Dictionary<String, CssRadialGradientValue.SizeMode> RadialGradientSizeModes = new Dictionary<String, CssRadialGradientValue.SizeMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, CssRadialGradientValue.SizeMode> RadialGradientSizeModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.ClosestSide, CssRadialGradientValue.SizeMode.ClosestSide },
{ CssKeywords.FarthestSide, CssRadialGradientValue.SizeMode.FarthestSide },
@ -651,7 +703,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-ObjectFitting mapping.
/// </summary>
public static readonly Dictionary<String, ObjectFitting> ObjectFittings = new Dictionary<String, ObjectFitting>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ObjectFitting> ObjectFittings = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ObjectFitting.None },
{ CssKeywords.Cover, ObjectFitting.Cover },
@ -663,7 +715,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FontWeight mapping.
/// </summary>
public static readonly Dictionary<String, FontWeight> FontWeights = new Dictionary<String, FontWeight>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FontWeight> FontWeights = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, FontWeight.Normal },
{ CssKeywords.Bold, FontWeight.Bold },
@ -674,7 +726,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-SystemFont mapping.
/// </summary>
public static readonly Dictionary<String, SystemFont> SystemFonts = new Dictionary<String, SystemFont>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, SystemFont> SystemFonts = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Caption, SystemFont.Caption },
{ CssKeywords.Icon, SystemFont.Icon },
@ -687,7 +739,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-StrokeLinecap mapping.
/// </summary>
public static readonly Dictionary<String, StrokeLinecap> StrokeLinecaps = new Dictionary<String, StrokeLinecap>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, StrokeLinecap> StrokeLinecaps = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Butt, StrokeLinecap.Butt },
{ CssKeywords.Round, StrokeLinecap.Round },
@ -697,7 +749,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-StrokeLinejoin mapping.
/// </summary>
public static readonly Dictionary<String, StrokeLinejoin> StrokeLinejoins = new Dictionary<String, StrokeLinejoin>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, StrokeLinejoin> StrokeLinejoins = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Miter, StrokeLinejoin.Miter },
{ CssKeywords.Round, StrokeLinejoin.Round },
@ -707,7 +759,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-WordBreak mapping.
/// </summary>
public static readonly Dictionary<String, WordBreak> WordBreaks = new Dictionary<String, WordBreak>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, WordBreak> WordBreaks = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, WordBreak.Normal },
{ CssKeywords.BreakAll, WordBreak.BreakAll },
@ -717,7 +769,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-WordBreak mapping.
/// </summary>
public static readonly Dictionary<String, OverflowWrap> OverflowWraps = new Dictionary<String, OverflowWrap>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, OverflowWrap> OverflowWraps = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Normal, OverflowWrap.Normal },
{ CssKeywords.BreakWord, OverflowWrap.BreakWord },
@ -726,7 +778,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-ResizeMode mapping.
/// </summary>
public static readonly Dictionary<String, ResizeMode> ResizeModes = new Dictionary<String, ResizeMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ResizeMode> ResizeModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ResizeMode.None },
{ CssKeywords.Both, ResizeMode.Both },
@ -739,7 +791,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-RubyAlignment mapping.
/// </summary>
public static readonly Dictionary<String, RubyAlignment> RubyAlignments = new Dictionary<String, RubyAlignment>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, RubyAlignment> RubyAlignments = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Center, RubyAlignment.Center },
{ CssKeywords.Start, RubyAlignment.Start },
@ -750,7 +802,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-RubyPosition mapping.
/// </summary>
public static readonly Dictionary<String, RubyPosition> RubyPositions = new Dictionary<String, RubyPosition>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, RubyPosition> RubyPositions = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.InterCharacter, RubyPosition.InterCharacter },
{ CssKeywords.Over, RubyPosition.Over },
@ -760,7 +812,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-RubyOverhangMode mapping.
/// </summary>
public static readonly Dictionary<String, RubyOverhangMode> RubyOverhangModes = new Dictionary<String, RubyOverhangMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, RubyOverhangMode> RubyOverhangModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, RubyOverhangMode.Auto },
{ CssKeywords.End, RubyOverhangMode.End },
@ -771,7 +823,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-PointerEvent mapping.
/// </summary>
public static readonly Dictionary<String, PointerEvent> PointerEvents = new Dictionary<String, PointerEvent>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, PointerEvent> PointerEvents = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, PointerEvent.None },
{ CssKeywords.Auto, PointerEvent.Auto },
@ -788,7 +840,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexDirection mapping.
/// </summary>
public static readonly Dictionary<String, FlexDirection> FlexDirections = new Dictionary<String, FlexDirection>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexDirection> FlexDirections = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Column, FlexDirection.Column },
{ CssKeywords.ColumnReverse, FlexDirection.ColumnReverse },
@ -799,7 +851,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexWrapMode mapping.
/// </summary>
public static readonly Dictionary<String, FlexWrapMode> FlexWrapModes = new Dictionary<String, FlexWrapMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexWrapMode> FlexWrapModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Nowrap, FlexWrapMode.NoWrap },
{ CssKeywords.Wrap, FlexWrapMode.Wrap },
@ -809,7 +861,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexContentMode mapping.
/// </summary>
public static readonly Dictionary<String, FlexContentMode> JustifyContentModes = new Dictionary<String, FlexContentMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexContentMode> JustifyContentModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.FlexStart, FlexContentMode.Start },
{ CssKeywords.FlexEnd, FlexContentMode.End },
@ -821,7 +873,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexContentMode mapping.
/// </summary>
public static readonly Dictionary<String, FlexContentMode> AlignContentModes = new Dictionary<String, FlexContentMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexContentMode> AlignContentModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.FlexStart, FlexContentMode.Start },
{ CssKeywords.FlexEnd, FlexContentMode.End },
@ -834,7 +886,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexContentMode mapping.
/// </summary>
public static readonly Dictionary<String, FlexContentMode> AlignItemsModes = new Dictionary<String, FlexContentMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexContentMode> AlignItemsModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.FlexStart, FlexContentMode.Start },
{ CssKeywords.FlexEnd, FlexContentMode.End },
@ -846,7 +898,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FlexContentMode mapping.
/// </summary>
public static readonly Dictionary<String, FlexContentMode> AlignSelfModes = new Dictionary<String, FlexContentMode>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FlexContentMode> AlignSelfModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, FlexContentMode.Auto },
{ CssKeywords.FlexStart, FlexContentMode.Start },
@ -859,7 +911,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-BookmarkState mapping.
/// </summary>
public static readonly Dictionary<String, BookmarkState> BookmarkStates = new Dictionary<String, BookmarkState>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, BookmarkState> BookmarkStates = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Open, BookmarkState.Open },
{ CssKeywords.Closed, BookmarkState.Closed },
@ -868,7 +920,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FootnotePolicy mapping.
/// </summary>
public static readonly Dictionary<String, FootnotePolicy> FootnotePolicies = new Dictionary<String, FootnotePolicy>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FootnotePolicy> FootnotePolicies = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Auto, FootnotePolicy.Auto },
{ CssKeywords.Block, FootnotePolicy.Block },
@ -878,7 +930,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-FootnoteDisplay mapping.
/// </summary>
public static readonly Dictionary<String, FootnoteDisplay> FootnoteDisplays = new Dictionary<String, FootnoteDisplay>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, FootnoteDisplay> FootnoteDisplays = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Block, FootnoteDisplay.Block },
{ CssKeywords.Compact, FootnoteDisplay.Compact },
@ -888,7 +940,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-length mapping.
/// </summary>
public static readonly Dictionary<String, Sizing> Sizings = new Dictionary<String, Sizing>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Sizing> Sizings = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.FitContent, Sizing.FitContent },
{ CssKeywords.MinContent, Sizing.MinContent},
@ -898,7 +950,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the string-ContentVisibility mapping.
/// </summary>
public static readonly Dictionary<String, Visibility> ContentVisibilities = new Dictionary<String, Visibility>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, Visibility> ContentVisibilities = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Visible, Visibility.Visible },
{ CssKeywords.Hidden, Visibility.Hidden },
@ -908,7 +960,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the scroll-snap-axis mapping.
/// </summary>
public static readonly Dictionary<String, ScrollSnapAxis> ScrollSnapAxises = new Dictionary<String, ScrollSnapAxis>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ScrollSnapAxis> ScrollSnapAxises = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.X, ScrollSnapAxis.X },
{ CssKeywords.Y, ScrollSnapAxis.Y },
@ -920,7 +972,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the scroll-snap-strictness mapping.
/// </summary>
public static readonly Dictionary<String, ScrollSnapStrictness> ScrollSnapStrictnesses = new Dictionary<String, ScrollSnapStrictness>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ScrollSnapStrictness> ScrollSnapStrictnesses = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.Proximity, ScrollSnapStrictness.Proximity},
{ CssKeywords.Mandatory, ScrollSnapStrictness.Mandatory },
@ -929,7 +981,7 @@ namespace AngleSharp.Css
/// <summary>
/// Contains the scroll-snap-align mapping.
/// </summary>
public static readonly Dictionary<String, ScrollSnapAlign> ScrollSnapAlignments = new Dictionary<String, ScrollSnapAlign>(StringComparer.OrdinalIgnoreCase)
public static readonly Dictionary<String, ScrollSnapAlign> ScrollSnapAlignments = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.None, ScrollSnapAlign.None },
{ CssKeywords.Start, ScrollSnapAlign.Start},

Просмотреть файл

@ -21,7 +21,7 @@ namespace AngleSharp.Css.Declarations
sealed class ContentValueConverter : IValueConverter
{
private static readonly Dictionary<String, IContentMode> ContentModes = new Dictionary<String, IContentMode>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, IContentMode> ContentModes = new(StringComparer.OrdinalIgnoreCase)
{
{ CssKeywords.OpenQuote, new OpenQuoteContentMode() },
{ CssKeywords.NoOpenQuote, new NoOpenQuoteContentMode() },

Просмотреть файл

@ -14,7 +14,7 @@ namespace AngleSharp.Css.Dom
[DomExposed("SVGElement")]
public static class ElementCssInlineStyleExtensions
{
private static readonly ConditionalWeakTable<IElement, ICssStyleDeclaration> _styles = new ConditionalWeakTable<IElement, ICssStyleDeclaration>();
private static readonly ConditionalWeakTable<IElement, ICssStyleDeclaration> _styles = new();
/// <summary>
/// Gets the style declaration of an element.

Просмотреть файл

@ -18,7 +18,7 @@ namespace AngleSharp.Css.Dom
private readonly IBrowsingContext _context;
private readonly List<ICssMedium> _media;
private static readonly CssMedium replacementMedium = new CssMedium(CssKeywords.All, inverse: true, exclusive: false);
private static readonly CssMedium replacementMedium = new(CssKeywords.All, inverse: true, exclusive: false);
#endregion

Просмотреть файл

@ -13,7 +13,7 @@ namespace AngleSharp.Css.Dom
{
#region Fields
private static readonly HashSet<String> ContainedProperties = new HashSet<String>(StringComparer.OrdinalIgnoreCase)
private static readonly HashSet<String> ContainedProperties = new(StringComparer.OrdinalIgnoreCase)
{
PropertyNames.FontFamily,
PropertyNames.Src,

Просмотреть файл

@ -9,7 +9,7 @@ namespace AngleSharp.Css.Dom
/// </summary>
sealed class CssViewportRule : CssDeclarationRule
{
private static readonly HashSet<String> ContainedProperties = new HashSet<String>(StringComparer.OrdinalIgnoreCase)
private static readonly HashSet<String> ContainedProperties = new(StringComparer.OrdinalIgnoreCase)
{
PropertyNames.MinWidth,
PropertyNames.MaxWidth,

Просмотреть файл

@ -1,4 +1,4 @@
namespace AngleSharp.Css.Dom
namespace AngleSharp.Css.Dom
{
/// <summary>
/// An enumeration over possible list styles.
@ -56,6 +56,162 @@
/// <summary>
/// Traditional Georgian numbering, E.g.an, ban, gan, ... he, tan, in…
/// </summary>
Georgian
Georgian,
/// <summary>
/// Kannada numbering.
/// </summary>
Kannada,
/// <summary>
/// Traditional Chinese formal numbering.
/// </summary>
TradChineseFormal,
/// <summary>
/// Traditional Chinese informal numbering.
/// </summary>
TradChineseInformal,
/// <summary>
/// Han decimal numbers.
/// </summary>
CjkDecimal,
/// <summary>
/// Arabic-Indic numbers.
/// </summary>
ArabicIndic,
/// <summary>
/// Bengali numbering.
/// </summary>
Bengali,
/// <summary>
/// Cambodian/Khmer numbering.
/// </summary>
Cambodian,
/// <summary>
/// Han "Earthly Branch" ordinals.
/// </summary>
CjkEarthlyBranch,
/// <summary>
/// Han "Heavenly Stem" ordinals.
/// </summary>
CjkHeavenlyStem,
/// <summary>
/// Devanagari numbering.
/// </summary>
Devanagari,
/// <summary>
/// Ethiopic numbering.
/// </summary>
EthiopicNumeric,
/// <summary>
/// Gurmukhi numbering.
/// </summary>
Gurmukhi,
/// <summary>
/// Traditional Hebrew numbering.
/// </summary>
Hebrew,
/// <summary>
/// Gujarati numbering.
/// </summary>
Gujarati,
/// <summary>
/// Dictionary-order hiragana lettering.
/// </summary>
Hiragana,
/// <summary>
/// Iroha-order hiragana lettering.
/// </summary>
IrohaHiragana,
/// <summary>
/// Japanese informal numbering.
/// </summary>
JapaneseInformal,
/// <summary>
/// Japanese formal numbering to be used in legal or financial documents. The kanjis are designed so that they can't be modified to look like another correct one.
/// </summary>
JapaneseFormal,
/// <summary>
/// Iroha-order katakana lettering.
/// </summary>
KatakanaIroha,
/// <summary>
/// Dictionary-order katakana lettering.
/// </summary>
Katakana,
/// <summary>
/// Korean hangul numbering.
/// </summary>
KoreanHangulFormal,
/// <summary>
/// Formal Korean Han numbering.
/// </summary>
KoreanHanjaFormal,
/// <summary>
/// Korean hanja numbering.
/// </summary>
KoreanHanjaInformal,
/// <summary>
/// Laotian numbering.
/// </summary>
Lao,
/// <summary>
/// Uppercase Armenian numbering.
/// </summary>
UpperArmenian,
/// <summary>
/// Lowercase Armenian numbering.
/// </summary>
LowerArmenian,
/// <summary>
/// Malayalam numbering.
/// </summary>
Malayalam,
/// <summary>
/// Mongolian numbering.
/// </summary>
Mongolian,
/// <summary>
/// Myanmar (Burmese) numbering.
/// </summary>
Myanmar,
/// <summary>
/// Oriya numbering.
/// </summary>
Oriya,
/// <summary>
/// Persian numbering.
/// </summary>
Persian,
/// <summary>
/// Simplified Chinese formal numbering.
/// </summary>
SimpChineseFormal,
/// <summary>
/// Simplified Chinese informal numbering.
/// </summary>
SimpChineseInformal,
/// <summary>
/// Tamil numbering.
/// </summary>
Tamil,
/// <summary>
/// Telugu numbering.
/// </summary>
Telugu,
/// <summary>
/// Thai numbering.
/// </summary>
Thai,
/// <summary>
/// Tibetan numbering.
/// </summary>
Tibetan,
/// <summary>
/// Symbol indicating that a disclosure widget, like &lt;details&gt; is closed.
/// </summary>
DisclosureClosed,
/// <summary>
/// Symbol indicating that a disclosure widget such as &lt;details&gt; is opened.
/// </summary>
DisclosureOpen,
}
}

Просмотреть файл

@ -0,0 +1,29 @@
namespace AngleSharp.Css.Dom
{
/// <summary>
/// An enumeration with all possible symbol types.
/// </summary>
public enum SymbolsType : byte
{
/// <summary>
/// The system cycles through the given values in the order of their definition, and returns to the start when it reaches the end.
/// </summary>
Cyclic,
/// <summary>
/// The system interprets the given values as the successive units of a place-value numbering system.
/// </summary>
Numeric,
/// <summary>
/// The system interprets the given values as the digits of an alphabetic numbering system, like a place-value numbering system but without 0.
/// </summary>
Alphabetic,
/// <summary>
/// The system cycles through the values, printing them an additional time at each cycle (one time for the first cycle, two times for the second, etc.).
/// </summary>
Symbolic,
/// <summary>
/// The system cycles through the given values once, then falls back to Arabic numerals.
/// </summary>
Fixed,
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace AngleSharp.Css.Dom
static class MediaListExtensions
{
private readonly static ConditionalWeakTable<IMediaFeature, IFeatureValidator> AssociatedValidators =
new ConditionalWeakTable<IMediaFeature, IFeatureValidator>();
new();
private readonly static String[] KnownTypes =
{

Просмотреть файл

@ -9,7 +9,7 @@ namespace AngleSharp.Css
/// </summary>
public class DefaultDeclarationFactory : IDeclarationFactory
{
private readonly Dictionary<String, DeclarationInfo> _declarations = new Dictionary<String, DeclarationInfo>(StringComparer.OrdinalIgnoreCase)
private readonly Dictionary<String, DeclarationInfo> _declarations = new(StringComparer.OrdinalIgnoreCase)
{
{
BookmarkLabelDeclaration.Name, new DeclarationInfo(

Просмотреть файл

@ -17,7 +17,7 @@ namespace AngleSharp.Css
/// <returns>The created document function for the given url.</returns>
public delegate IDocumentFunction Creator(String url);
private readonly Dictionary<String, Creator> _creators = new Dictionary<String, Creator>(StringComparer.OrdinalIgnoreCase)
private readonly Dictionary<String, Creator> _creators = new(StringComparer.OrdinalIgnoreCase)
{
{ FunctionNames.Url, str => new UrlFunction(str) },
{ FunctionNames.Domain, str => new DomainFunction(str) },

Просмотреть файл

@ -15,7 +15,7 @@ namespace AngleSharp.Css
/// <returns>The created media feature validator.</returns>
public delegate IFeatureValidator Creator();
private readonly Dictionary<String, Creator> _creators = new Dictionary<String, Creator>(StringComparer.OrdinalIgnoreCase)
private readonly Dictionary<String, Creator> _creators = new(StringComparer.OrdinalIgnoreCase)
{
{ FeatureNames.MinWidth, () => new WidthFeatureValidator() },
{ FeatureNames.MaxWidth, () => new WidthFeatureValidator() },

Просмотреть файл

@ -17,7 +17,7 @@ namespace AngleSharp.Css
/// <returns>The new pseudo element.</returns>
public delegate IPseudoElement Creator(IElement host);
private readonly Dictionary<String, Creator> _creators = new Dictionary<String, Creator>(StringComparer.OrdinalIgnoreCase)
private readonly Dictionary<String, Creator> _creators = new(StringComparer.OrdinalIgnoreCase)
{
{ PseudoElementNames.Before, element => new PseudoElement(element, PseudoElementNames.Before) },
{ PseudoElementNames.After, element => new PseudoElement(element, PseudoElementNames.After) },

Просмотреть файл

@ -2,14 +2,14 @@ namespace AngleSharp.Css
{
static class Factory
{
public static DefaultFeatureValidatorFactory FeatureValidator = new DefaultFeatureValidatorFactory();
public static DefaultFeatureValidatorFactory FeatureValidator = new();
public static DefaultPseudoElementFactory PseudoElement = new DefaultPseudoElementFactory();
public static DefaultPseudoElementFactory PseudoElement = new();
public static DefaultDocumentFunctionFactory DocumentFunction = new DefaultDocumentFunctionFactory();
public static DefaultDocumentFunctionFactory DocumentFunction = new();
public static DefaultDeclarationFactory Declaration = new DefaultDeclarationFactory();
public static DefaultDeclarationFactory Declaration = new();
public static StyleAttributeObserver Observer = new StyleAttributeObserver();
public static StyleAttributeObserver Observer = new();
}
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace AngleSharp.Css.Parser
/// </summary>
static class ColorParser
{
private static readonly Dictionary<String, Func<StringSource, Color?>> ColorFunctions = new Dictionary<String, Func<StringSource, Color?>>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, Func<StringSource, Color?>> ColorFunctions = new(StringComparer.OrdinalIgnoreCase)
{
{ FunctionNames.Rgb, ParseRgba },
{ FunctionNames.Rgba, ParseRgba },

Просмотреть файл

@ -19,23 +19,14 @@ namespace AngleSharp.Css.Parser
{
var current = source.SkipSpacesAndComments();
switch (current)
return current switch
{
case Symbols.DoubleQuote:
return DoubleQuoted(source);
case Symbols.SingleQuote:
return SingleQuoted(source);
case Symbols.RoundBracketClose:
return new CssUrlValue(String.Empty);
case Symbols.EndOfFile:
return new CssUrlValue(String.Empty);
default:
return Unquoted(source);
}
Symbols.DoubleQuote => DoubleQuoted(source),
Symbols.SingleQuote => SingleQuoted(source),
Symbols.RoundBracketClose => new CssUrlValue(String.Empty),
Symbols.EndOfFile => new CssUrlValue(String.Empty),
_ => Unquoted(source),
};
}
return null;

Просмотреть файл

@ -11,7 +11,7 @@ namespace AngleSharp.Css.Parser
/// </summary>
public static class GradientParser
{
private static readonly Dictionary<String, Func<StringSource, ICssGradientFunctionValue>> GradientFunctions = new Dictionary<string, Func<StringSource, ICssGradientFunctionValue>>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, Func<StringSource, ICssGradientFunctionValue>> GradientFunctions = new(StringComparer.OrdinalIgnoreCase)
{
{ FunctionNames.LinearGradient, ParseLinearGradient },
{ FunctionNames.RepeatingLinearGradient, ParseRepeatingLinearGradient },

Просмотреть файл

@ -306,7 +306,7 @@ namespace AngleSharp.Css.Parser
}
}
private static readonly HashSet<String> Animatables = new HashSet<String>(StringComparer.OrdinalIgnoreCase)
private static readonly HashSet<String> Animatables = new(StringComparer.OrdinalIgnoreCase)
{
"backdrop-filter",
"background",

Просмотреть файл

@ -16,13 +16,12 @@ namespace AngleSharp.Css.Parser
{
var current = source.Current;
switch (current)
return current switch
{
case Symbols.DoubleQuote: return DoubleQuoted(source);
case Symbols.SingleQuote: return SingleQuoted(source);
}
return null;
Symbols.DoubleQuote => DoubleQuoted(source),
Symbols.SingleQuote => SingleQuoted(source),
_ => null,
};
}
private static String DoubleQuoted(StringSource source)

Просмотреть файл

@ -0,0 +1,63 @@
namespace AngleSharp.Css.Parser
{
using AngleSharp.Css.Values;
using AngleSharp.Text;
using System;
using System.Collections.Generic;
/// <summary>
/// Represents extensions to for symbols() values.
/// </summary>
public static class SymbolsParser
{
/// <summary>
/// Parse a CSS symbols() value.
/// </summary>
public static CssSymbolsValue ParseSymbols(this StringSource source)
{
var start = source.Index;
if (source.IsFunction(FunctionNames.Symbols))
{
source.SkipSpacesAndComments();
var pos = source.Index;
var type = ValueConverters.SymbolsTypeConverter.Convert(source);
var entries = new List<String>();
if (type is null)
{
source.BackTo(pos);
}
else
{
source.SkipSpacesAndComments();
}
do
{
var entry = StringParser.ParseString(source);
if (entry is null)
{
break;
}
entries.Add(entry);
var c = source.SkipSpacesAndComments();
if (c == Symbols.RoundBracketClose)
{
source.Next();
return new CssSymbolsValue(type, entries);
}
}
while (true);
source.BackTo(start);
}
return null;
}
}
}

Просмотреть файл

@ -10,7 +10,7 @@ namespace AngleSharp.Css.Parser
/// </summary>
public static class TimingFunctionParser
{
private static readonly Dictionary<String, Func<StringSource, ICssTimingFunctionValue>> TimingFunctions = new Dictionary<String, Func<StringSource, ICssTimingFunctionValue>>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, Func<StringSource, ICssTimingFunctionValue>> TimingFunctions = new(StringComparer.OrdinalIgnoreCase)
{
{ FunctionNames.Steps, ParseSteps },
{ FunctionNames.CubicBezier, ParseCubicBezier },

Просмотреть файл

@ -11,7 +11,7 @@ namespace AngleSharp.Css.Parser
/// </summary>
public static class TransformParser
{
private static readonly Dictionary<String, Func<StringSource, ICssTransformFunctionValue>> TransformFunctions = new Dictionary<String, Func<StringSource, ICssTransformFunctionValue>>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, Func<StringSource, ICssTransformFunctionValue>> TransformFunctions = new(StringComparer.OrdinalIgnoreCase)
{
{ FunctionNames.Skew, ParseSkew2d },
{ FunctionNames.SkewX, ParseSkewX },

Просмотреть файл

@ -125,6 +125,12 @@ namespace AngleSharp.Css
/// </summary>
public static readonly IValueConverter IdentifierConverter = new IdentifierValueConverter(IdentParser.ParseNormalizedIdent);
/// <summary>
/// Represents an identifier object.
/// https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
/// </summary>
public static readonly IValueConverter CustomIdentConverter = new IdentifierValueConverter(IdentParser.ParseCustomIdent);
/// <summary>
/// Represents an identifier object that matches the production rules of a single transition property.
/// http://dev.w3.org/csswg/css-transitions/#single-transition-property
@ -227,6 +233,12 @@ namespace AngleSharp.Css
/// </summary>
public static readonly IValueConverter PointYConverter = FromParser(PointParser.ParsePointY);
/// <summary>
/// Represents an symbols object.
/// https://developer.mozilla.org/en-US/docs/Web/CSS/symbols
/// </summary>
public static readonly IValueConverter SymbolsConverter = FromParser(SymbolsParser.ParseSymbols);
#endregion
#region Functions
@ -315,7 +327,12 @@ namespace AngleSharp.Css
/// <summary>
/// Represents a converter for the ListStyle enumeration.
/// </summary>
public static readonly IValueConverter ListStyleConverter = Map.ListStyles.ToConverter();
public static readonly IValueConverter ListStyleConverter = Or(Map.ListStyles.ToConverter(), StringConverter, SymbolsConverter, CustomIdentConverter);
/// <summary>
/// Represents a converter for the SymbolsType enumeration.
/// </summary>
public static readonly IValueConverter SymbolsTypeConverter = Map.SymbolsTypes.ToConverter();
/// <summary>
/// Represents a converter for the BreakMode enumeration.

Просмотреть файл

@ -17,12 +17,12 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Used to declare cover background size.
/// </summary>
public static readonly CssBackgroundSizeValue Cover = new CssBackgroundSizeValue(ValueMode.Cover);
public static readonly CssBackgroundSizeValue Cover = new(ValueMode.Cover);
/// <summary>
/// Used to declare contain background size.
/// </summary>
public static readonly CssBackgroundSizeValue Contain = new CssBackgroundSizeValue(ValueMode.Contain);
public static readonly CssBackgroundSizeValue Contain = new(ValueMode.Contain);
#endregion

Просмотреть файл

@ -12,7 +12,7 @@ namespace AngleSharp.Css.Values
{
#region Fields
private static readonly Dictionary<String, Color> TheColors = new Dictionary<String, Color>(StringComparer.OrdinalIgnoreCase)
private static readonly Dictionary<String, Color> TheColors = new(StringComparer.OrdinalIgnoreCase)
{
// Extended color keywords
{ "aliceblue", new Color(240, 248, 255) },

Просмотреть файл

@ -21,27 +21,27 @@ namespace AngleSharp.Css.Values
/// <summary>
/// The pre-configured ease function.
/// </summary>
public static readonly CssCubicBezierValue Ease = new CssCubicBezierValue(0.25, 0.1, 0.25, 1.0);
public static readonly CssCubicBezierValue Ease = new(0.25, 0.1, 0.25, 1.0);
/// <summary>
/// The pre-configured ease-in function.
/// </summary>
public static readonly CssCubicBezierValue EaseIn = new CssCubicBezierValue(0.42, 0.0, 1.0, 1.0);
public static readonly CssCubicBezierValue EaseIn = new(0.42, 0.0, 1.0, 1.0);
/// <summary>
/// The pre-configured ease-out function.
/// </summary>
public static readonly CssCubicBezierValue EaseOut = new CssCubicBezierValue(0.0, 0.0, 0.58, 1.0);
public static readonly CssCubicBezierValue EaseOut = new(0.0, 0.0, 0.58, 1.0);
/// <summary>
/// The pre-configured ease-in-out function.
/// </summary>
public static readonly CssCubicBezierValue EaseInOut = new CssCubicBezierValue(0.42, 0.0, 0.58, 1.0);
public static readonly CssCubicBezierValue EaseInOut = new(0.42, 0.0, 0.58, 1.0);
/// <summary>
/// The pre-configured linear function.
/// </summary>
public static readonly CssCubicBezierValue Linear = new CssCubicBezierValue(0.0, 0.0, 1.0, 1.0);
public static readonly CssCubicBezierValue Linear = new(0.0, 0.0, 1.0, 1.0);
#endregion

Просмотреть файл

@ -137,7 +137,7 @@ namespace AngleSharp.Css.Values
/// </summary>
/// <returns>The transformation matrix representation.</returns>
public TransformMatrix ComputeMatrix(IRenderDimensions renderDimensions) =>
new TransformMatrix(_sx, 0f, 0f, 0f, _sy, 0f, 0f, 0f, _sz, 0f, 0f, 0f, 0f, 0f, 0f);
new(_sx, 0f, 0f, 0f, _sy, 0f, 0f, 0f, _sz, 0f, 0f, 0f, 0f, 0f, 0f);
#endregion
}

Просмотреть файл

@ -0,0 +1,71 @@
namespace AngleSharp.Css.Values
{
using AngleSharp.Css.Dom;
using AngleSharp.Text;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
/// <summary>
/// Represents a CSS symbols function call.
/// </summary>
public sealed class CssSymbolsValue : ICssFunctionValue
{
#region Fields
private readonly ICssValue _type;
private readonly List<String> _entries;
#endregion
#region ctor
/// <summary>
/// Creates a new sybols function call.
/// </summary>
/// <param name="type">The used type.</param>
/// <param name="entries">The contained entries.</param>
public CssSymbolsValue(ICssValue type, List<String> entries)
{
_type = type;
_entries = entries;
}
#endregion
#region Properties
/// <summary>
/// Gets the used type, if any.
/// </summary>
public ICssValue Type => _type;
/// <summary>
/// Gets the name of the function.
/// </summary>
public String Name => FunctionNames.Symbols;
/// <summary>
/// Gets the arguments.
/// </summary>
public ICssValue[] Arguments => _entries.Select(e => new Label(e) as ICssValue).ToArray();
/// <summary>
/// Gets the CSS text representation.
/// </summary>
public String CssText =>Name.CssFunction(GetArgs());
#endregion
#region Helpers
private String GetArgs()
{
var arg = String.Join(" ", _entries.Select(m => m.CssString()));
return _type is not null ? $"{_type.CssText} {arg}" : arg;
}
#endregion
}
}

Просмотреть файл

@ -13,27 +13,27 @@ namespace AngleSharp.Css.Values
/// <summary>
/// The zero angle.
/// </summary>
public static readonly Angle Zero = new Angle(0.0, Angle.Unit.Rad);
public static readonly Angle Zero = new(0.0, Angle.Unit.Rad);
/// <summary>
/// The 45° angle.
/// </summary>
public static readonly Angle HalfQuarter = new Angle(45.0, Angle.Unit.Deg);
public static readonly Angle HalfQuarter = new(45.0, Angle.Unit.Deg);
/// <summary>
/// The 90° angle.
/// </summary>
public static readonly Angle Quarter = new Angle(90.0, Angle.Unit.Deg);
public static readonly Angle Quarter = new(90.0, Angle.Unit.Deg);
/// <summary>
/// The 135° angle.
/// </summary>
public static readonly Angle TripleHalfQuarter = new Angle(135.0, Angle.Unit.Deg);
public static readonly Angle TripleHalfQuarter = new(135.0, Angle.Unit.Deg);
/// <summary>
/// The 180° angle.
/// </summary>
public static readonly Angle Half = new Angle(180.0, Angle.Unit.Deg);
public static readonly Angle Half = new(180.0, Angle.Unit.Deg);
#endregion

Просмотреть файл

@ -17,52 +17,52 @@ namespace AngleSharp.Css.Values
/// <summary>
/// The color #000000.
/// </summary>
public static readonly Color Black = new Color(0, 0, 0);
public static readonly Color Black = new(0, 0, 0);
/// <summary>
/// The color #FFFFFF.
/// </summary>
public static readonly Color White = new Color(255, 255, 255);
public static readonly Color White = new(255, 255, 255);
/// <summary>
/// The color #FF0000.
/// </summary>
public static readonly Color Red = new Color(255, 0, 0);
public static readonly Color Red = new(255, 0, 0);
/// <summary>
/// The color #FF00FF.
/// </summary>
public static readonly Color Magenta = new Color(255, 0, 255);
public static readonly Color Magenta = new(255, 0, 255);
/// <summary>
/// The color #008000.
/// </summary>
public static readonly Color Green = new Color(0, 128, 0);
public static readonly Color Green = new(0, 128, 0);
/// <summary>
/// The color #00FF00.
/// </summary>
public static readonly Color PureGreen = new Color(0, 255, 0);
public static readonly Color PureGreen = new(0, 255, 0);
/// <summary>
/// The color #0000FF.
/// </summary>
public static readonly Color Blue = new Color(0, 0, 255);
public static readonly Color Blue = new(0, 0, 255);
/// <summary>
/// The color #00000000.
/// </summary>
public static readonly Color Transparent = new Color(0, 0, 0, 0);
public static readonly Color Transparent = new(0, 0, 0, 0);
/// <summary>
/// The color #00010203.
/// </summary>
public static readonly Color CurrentColor = new Color(0, 1, 2, 3);
public static readonly Color CurrentColor = new(0, 1, 2, 3);
/// <summary>
/// The color #30201000.
/// </summary>
public static readonly Color InvertedColor = new Color(48, 32, 16, 0);
public static readonly Color InvertedColor = new(48, 32, 16, 0);
#endregion
@ -127,7 +127,7 @@ namespace AngleSharp.Css.Values
/// <param name="a">The value for alpha [0,1].</param>
/// <returns>The CSS color value.</returns>
public static Color FromRgba(Byte r, Byte g, Byte b, Double a) =>
new Color(r, g, b, Normalize(a));
new(r, g, b, Normalize(a));
/// <summary>
/// Returns the color from the given primitives.
@ -138,7 +138,7 @@ namespace AngleSharp.Css.Values
/// <param name="a">The value for alpha [0,1].</param>
/// <returns>The CSS color value.</returns>
public static Color FromRgba(Double r, Double g, Double b, Double a) =>
new Color(Normalize(r), Normalize(g), Normalize(b), Normalize(a));
new(Normalize(r), Normalize(g), Normalize(b), Normalize(a));
/// <summary>
/// Returns the gray color from the given value.
@ -147,7 +147,7 @@ namespace AngleSharp.Css.Values
/// <param name="alpha">The value for alpha [0,1].</param>
/// <returns>The CSS color value.</returns>
public static Color FromGray(Byte number, Double alpha = 1.0) =>
new Color(number, number, number, Normalize(alpha));
new(number, number, number, Normalize(alpha));
/// <summary>
/// Returns the gray color from the given value.
@ -172,7 +172,7 @@ namespace AngleSharp.Css.Values
/// <param name="g">The value for green [0,255].</param>
/// <param name="b">The value for blue [0,255].</param>
/// <returns>The CSS color value.</returns>
public static Color FromRgb(Byte r, Byte g, Byte b) => new Color(r, g, b);
public static Color FromRgb(Byte r, Byte g, Byte b) => new(r, g, b);
/// <summary>
/// Returns the color that represents the given Lab values.

Просмотреть файл

@ -12,47 +12,47 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Gets a zero pixel length value.
/// </summary>
public static readonly Length Zero = new Length(0.0, Unit.Px);
public static readonly Length Zero = new(0.0, Unit.Px);
/// <summary>
/// Gets the half relative length, i.e. 50%.
/// </summary>
public static readonly Length Half = new Length(50.0, Unit.Percent);
public static readonly Length Half = new(50.0, Unit.Percent);
/// <summary>
/// Gets the full relative length, i.e. 100%.
/// </summary>
public static readonly Length Full = new Length(100.0, Unit.Percent);
public static readonly Length Full = new(100.0, Unit.Percent);
/// <summary>
/// Gets a thin length value.
/// </summary>
public static readonly Length Thin = new Length(1.0, Unit.Px);
public static readonly Length Thin = new(1.0, Unit.Px);
/// <summary>
/// Gets a medium length value.
/// </summary>
public static readonly Length Medium = new Length(3.0, Unit.Px);
public static readonly Length Medium = new(3.0, Unit.Px);
/// <summary>
/// Gets a thick length value.
/// </summary>
public static readonly Length Thick = new Length(5.0, Unit.Px);
public static readonly Length Thick = new(5.0, Unit.Px);
/// <summary>
/// Gets the auto value.
/// </summary>
public static readonly Length Auto = new Length(Double.NaN, Unit.Vmax);
public static readonly Length Auto = new(Double.NaN, Unit.Vmax);
/// <summary>
/// Gets the content value.
/// </summary>
public static readonly Length Content = new Length(Double.NaN, Unit.Percent);
public static readonly Length Content = new(Double.NaN, Unit.Percent);
/// <summary>
/// Gets the normal value.
/// </summary>
public static readonly Length Normal = new Length(Double.NaN, Unit.Em);
public static readonly Length Normal = new(Double.NaN, Unit.Em);
#endregion

Просмотреть файл

@ -13,47 +13,47 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Gets the (50%, 50%) point.
/// </summary>
public static readonly Point Center = new Point(Length.Half, Length.Half);
public static readonly Point Center = new(Length.Half, Length.Half);
/// <summary>
/// Gets the (0, 0) point.
/// </summary>
public static readonly Point LeftTop = new Point(Length.Zero, Length.Zero);
public static readonly Point LeftTop = new(Length.Zero, Length.Zero);
/// <summary>
/// Gets the (100%, 0) point.
/// </summary>
public static readonly Point RightTop = new Point(Length.Full, Length.Zero);
public static readonly Point RightTop = new(Length.Full, Length.Zero);
/// <summary>
/// Gets the (100%, 100%) point.
/// </summary>
public static readonly Point RightBottom = new Point(Length.Full, Length.Full);
public static readonly Point RightBottom = new(Length.Full, Length.Full);
/// <summary>
/// Gets the (0, 100%) point.
/// </summary>
public static readonly Point LeftBottom = new Point(Length.Zero, Length.Full);
public static readonly Point LeftBottom = new(Length.Zero, Length.Full);
/// <summary>
/// Gets the (0, 50%) point.
/// </summary>
public static readonly Point Left = new Point(Length.Zero, Length.Half);
public static readonly Point Left = new(Length.Zero, Length.Half);
/// <summary>
/// Gets the (100%, 50%) point.
/// </summary>
public static readonly Point Right = new Point(Length.Full, Length.Half);
public static readonly Point Right = new(Length.Full, Length.Half);
/// <summary>
/// Gets the (50%, 100%) point.
/// </summary>
public static readonly Point Bottom = new Point(Length.Half, Length.Full);
public static readonly Point Bottom = new(Length.Half, Length.Full);
/// <summary>
/// Gets the (50%, 0) point.
/// </summary>
public static readonly Point Top = new Point(Length.Half, Length.Zero);
public static readonly Point Top = new(Length.Half, Length.Zero);
#endregion

Просмотреть файл

@ -12,7 +12,7 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Gets the zero time.
/// </summary>
public static readonly Time Zero = new Time(0.0, Unit.Ms);
public static readonly Time Zero = new(0.0, Unit.Ms);
#endregion

Просмотреть файл

@ -15,7 +15,7 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Gets the only instance.
/// </summary>
public static readonly CssInheritValue Instance = new CssInheritValue();
public static readonly CssInheritValue Instance = new();
/// <summary>
/// Gets the referring value.

Просмотреть файл

@ -13,12 +13,12 @@ namespace AngleSharp.Css.Values
/// <summary>
/// Gets the zero matrix.
/// </summary>
public static readonly TransformMatrix Zero = new TransformMatrix();
public static readonly TransformMatrix Zero = new();
/// <summary>
/// Gets the unity matrix.
/// </summary>
public static readonly TransformMatrix One = new TransformMatrix(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 0f);
public static readonly TransformMatrix One = new(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 0f);
private readonly Double[,] _matrix;