Bold text";
+
+ var document = ParseDocument(sourceCode);
+ var element = document.QuerySelector("span");
+ var styleNormal = element.ComputeStyle();
+ Assert.IsNotNull(styleNormal);
+ Assert.AreEqual("uppercase", styleNormal.GetTextTransform());
+ }
+
[Test]
public async Task NullSelectorStillWorks_Issue52()
{
var sheet = ParseStyleSheet("a {}");
var document = await sheet.Context.OpenAsync(res => res.Content(""));
- sheet.Add(new CssStyleRule(sheet));
var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
var decl = sc.ComputeCascadedStyle(document.Body);
Assert.IsNotNull(decl);
}
+
+ [Test]
+ public async Task PriorityInMultiSelectorIsEvaluatedPerMatch()
+ {
+ var sheet = ParseStyleSheet(@"#target {color: blue} h3, #nottarget { color: purple; } ");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"Test "));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeCascadedStyle(document.QuerySelector("h3"));
+ Assert.AreEqual("rgba(0, 0, 255, 1)", style.GetColor());
+ }
+
+ [Test]
+ public async Task ComputesAbsoluteValuesFromRelative_Issue136()
+ {
+ var sheet = ParseStyleSheet(@"p { font-size: 1.5em }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is only a test.
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("span"));
+ Assert.AreEqual("24px", style.GetFontSize());
+ }
+
+ [Test]
+ public async Task ResolvesCssVariables_Issue62()
+ {
+ var sheet = ParseStyleSheet(@"
+ :root {
+ --color: #FFFFFF;
+ }
+
+ p {
+ color: var(--color);
+ }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is a test
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("p"));
+ Assert.AreEqual("rgba(255, 255, 255, 1)", style.GetColor());
+ }
+
+ [Test]
+ public async Task ResolvesCssVariablesWithUnusedFallback_Issue62()
+ {
+ var sheet = ParseStyleSheet(@"
+ :root {
+ --color: #FFFFFF;
+ }
+
+ p {
+ color: var(--color, green);
+ }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is a test
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("p"));
+ Assert.AreEqual("rgba(255, 255, 255, 1)", style.GetColor());
+ }
+
+ [Test]
+ public async Task ResolvesCssVariablesWithUsedFallback_Issue62()
+ {
+ var sheet = ParseStyleSheet(@"
+ :root {}
+
+ p {
+ color: var(--color, green);
+ }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is a test
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("p"));
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
+
+ [Test]
+ public async Task ResolvesCssVariablesWithUsedFallbackVarReference_Issue62()
+ {
+ var sheet = ParseStyleSheet(@"
+ :root {
+ --defaultColor: green;
+ }
+
+ p {
+ color: var(--color, var(--defaultColor));
+ }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is a test
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("p"));
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
+
+ [Test]
+ public async Task ResolvesCssVariablesWithCascade_Issue62()
+ {
+ var sheet = ParseStyleSheet(@"
+ :root {
+ --color: blue;
+ --defaultColor: red;
+ }
+
+ body {
+ --color: green;
+ }
+
+ p {
+ color: var(--color, var(--defaultColor));
+ }");
+ var document = await sheet.Context.OpenAsync(res => res.Content(@"This is a test
"));
+ var sc = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
+ var style = sc.ComputeDeclarations(document.QuerySelector("p"));
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Extensions/Elements.cs b/src/AngleSharp.Css.Tests/Extensions/Elements.cs
index 0134dc61..c5dff0e6 100644
--- a/src/AngleSharp.Css.Tests/Extensions/Elements.cs
+++ b/src/AngleSharp.Css.Tests/Extensions/Elements.cs
@@ -39,6 +39,7 @@ public async Task DownloadResources()
};
var config = Configuration.Default
.WithDefaultLoader(loaderOptions)
+ .WithRenderDevice()
.WithCss();
var document = "
".ToHtmlDocument(config);
var tree = document.DefaultView.Render();
diff --git a/src/AngleSharp.Css.Tests/Extensions/InnerText.cs b/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
index ab55c6c9..f12fb385 100644
--- a/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
+++ b/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
@@ -37,6 +37,9 @@ public void SetInnerText(String fixture, String expectedInnerText, String expect
// paragraph
[TestCase("test
", "test")]
[TestCase("test1
test2
", "test1\n\ntest2")]
+ [TestCase("test1
\ntest2
", "test1\n\ntest2")]
+ [TestCase("test1
\n \n test2
", "test1\n\ntest2")]
+ [TestCase("test1
a\n \n btest2
", "test1\n\na b\n\ntest2")]
// block-level
[TestCase("test1
test2
test3
", "test1\ntest2\ntest3")]
[TestCase(@"test1test2 test3", "test1\ntest2\ntest3")]
diff --git a/src/AngleSharp.Css.Tests/Extensions/Nesting.cs b/src/AngleSharp.Css.Tests/Extensions/Nesting.cs
new file mode 100644
index 00000000..577f386d
--- /dev/null
+++ b/src/AngleSharp.Css.Tests/Extensions/Nesting.cs
@@ -0,0 +1,118 @@
+namespace AngleSharp.Css.Tests.Extensions
+{
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Dom;
+ using NUnit.Framework;
+ using static CssConstructionFunctions;
+
+ [TestFixture]
+ public class NestingTests
+ {
+ [Test]
+ public void SimpleSelectorNestingImplicit()
+ {
+ var source = @"Larger and green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector(".bar");
+ var style = window.GetComputedStyle(element);
+
+ Assert.AreEqual("22.4px", style.GetFontSize());
+ }
+
+ [Test]
+ public void SimpleSelectorNestingImplicitDeclarations()
+ {
+ var source = @"
Larger and green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector(".bar");
+ var styleCollection = window.GetStyleCollection();
+ var style = styleCollection.GetDeclarations(element);
+
+ Assert.AreEqual("1.4rem", style.GetFontSize());
+ }
+
+ [Test]
+ public void SimpleSelectorNestingExplicit()
+ {
+ var source = @"
Larger and green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector(".bar");
+ var style = window.GetComputedStyle(element);
+
+ Assert.AreEqual("22.4px", style.GetFontSize());
+ }
+
+ [Test]
+ public void SimpleSelectorNestingOverwritten()
+ {
+ var source = @"
Larger and green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector(".bar");
+ var style = window.GetComputedStyle(element);
+
+ Assert.AreEqual("22.4px", style.GetFontSize());
+ }
+
+ [Test]
+ public void CombinedSelectorNesting()
+ {
+ var source = @"
green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector(".bar");
+ var style = window.GetComputedStyle(element);
+
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
+
+ [Test]
+ public void ReversedSelectorNesting()
+ {
+ var source = @"
green";
+ var document = ParseDocument(source);
+ var window = document.DefaultView;
+ var element = document.QuerySelector("li");
+ var style = window.GetComputedStyle(element);
+
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
+ }
+}
diff --git a/src/AngleSharp.Css.Tests/Functions/CssColorFunction.cs b/src/AngleSharp.Css.Tests/Functions/CssColorFunction.cs
index 7396400c..cf36e11b 100644
--- a/src/AngleSharp.Css.Tests/Functions/CssColorFunction.cs
+++ b/src/AngleSharp.Css.Tests/Functions/CssColorFunction.cs
@@ -19,6 +19,171 @@ public void ColorNotParsedCorrectly_Issue109()
var color = s.GetColor();
Assert.AreEqual("rgba(0, 17, 0, 1)", color);
}
+
+ [Test]
+ public void ParseRgbWithSpacesL4_Issue131()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(255, 122, 127, 0.8)", color);
+ }
+
+ [Test]
+ public void ParseRgbWithSpacesInPercentL4_Issue131()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(255, 26, 128, 0.7)", color);
+ }
+
+ [Test]
+ public void ParseRgbWithSpacesAndNoneL4_Issue131()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(255, 0, 128, 0.35)", color);
+ }
+
+ [Test]
+ public void ParseOklabToRgb_First()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(125, 35, 40, 1)", color);
+ }
+
+ [Test]
+ public void ParseOklabToRgb_Second()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 7, 1)", color);
+ }
+
+ [Test]
+ public void ParseOklabToRgb_Alpha()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 7, 0.5)", color);
+ }
+
+ [Test]
+ public void ParseOklchToRgb_First()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(125, 35, 40, 1)", color);
+ }
+
+ [Test]
+ public void ParseOklchToRgb_Second()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 7, 1)", color);
+ }
+
+ [Test]
+ public void ParseOklchToRgb_Alpha()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 7, 0.5)", color);
+ }
+
+ [Test]
+ public void ParseLabToRgb_First()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(125, 35, 40, 1)", color);
+ }
+
+ [Test]
+ public void ParseLabToRgb_Second()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 6, 1)", color);
+ }
+
+ [Test]
+ public void ParseLabToRgb_Alpha()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 6, 0.5)", color);
+ }
+
+ [Test]
+ public void ParseLchToRgb_First()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(125, 35, 40, 1)", color);
+ }
+
+ [Test]
+ public void ParseLchToRgb_Second()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 6, 1)", color);
+ }
+
+ [Test]
+ public void ParseLchToRgb_Alpha()
+ {
+ var html = @"Text
";
+ var dom = ParseDocument(html);
+ var p = dom.QuerySelector("p");
+ var s = p.GetStyle();
+ var color = s.GetColor();
+ Assert.AreEqual("rgba(198, 93, 6, 0.5)", color);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Library/ComputedStyle.cs b/src/AngleSharp.Css.Tests/Library/ComputedStyle.cs
new file mode 100644
index 00000000..6ee3f880
--- /dev/null
+++ b/src/AngleSharp.Css.Tests/Library/ComputedStyle.cs
@@ -0,0 +1,29 @@
+namespace AngleSharp.Css.Tests.Library
+{
+ using AngleSharp.Dom;
+ using AngleSharp.Html.Dom;
+ using NUnit.Framework;
+ using System.Threading.Tasks;
+
+ [TestFixture]
+ public class ComputedStyleTests
+ {
+ [Test]
+ public async Task TransformEmToPx_Issue136()
+ {
+ // .With()
+ var config = Configuration.Default.WithCss();
+ var context = BrowsingContext.New(config);
+ var source = "This is only a test.
";
+ var cssSheet = "p { font-size: 1.5em }";
+ var document = await context.OpenAsync(req => req.Content(source));
+ var style = document.CreateElement();
+ style.TextContent = cssSheet;
+ document.Head.AppendChild(style);
+ var span = document.QuerySelector("span");
+ var fontSize = span.ComputeCurrentStyle().GetProperty("font-size");
+
+ Assert.AreEqual("24px", fontSize.Value);
+ }
+ }
+}
diff --git a/src/AngleSharp.Css.Tests/Library/ExtractInfos.cs b/src/AngleSharp.Css.Tests/Library/ExtractInfos.cs
new file mode 100644
index 00000000..86ecf548
--- /dev/null
+++ b/src/AngleSharp.Css.Tests/Library/ExtractInfos.cs
@@ -0,0 +1,31 @@
+namespace AngleSharp.Css.Tests.Library
+{
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
+ using AngleSharp.Dom;
+ using AngleSharp.Html.Dom;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class ExtractInfosTests
+ {
+ [Test]
+ public void GetFontUrl_Issue126()
+ {
+ var css = @"@font-face {
+ font-family: 'Inter';
+ font-style: normal;
+ font-weight: 400;
+ src: url(https://example.org/some-font.ttf) format('truetype');
+}";
+ var html = $"";
+ var document = html.ToHtmlDocument(Configuration.Default.WithCss());
+ var style = document.QuerySelector("style");
+ var sheet = style.Sheet as ICssStyleSheet;
+ var fontFace = sheet.Rules[0] as ICssFontFaceRule;
+ var src = fontFace.GetProperty("src").RawValue;
+ var url = ((src as ICssMultipleValue)[0] as ICssMultipleValue)[0] as CssUrlValue;
+ Assert.AreEqual("https://example.org/some-font.ttf", url.Path);
+ }
+ }
+}
diff --git a/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs b/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs
index 8aae59f3..f2628c5a 100644
--- a/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs
+++ b/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs
@@ -2,9 +2,14 @@ namespace AngleSharp.Css.Tests.Library
{
using AngleSharp.Css.Dom;
using AngleSharp.Css.Parser;
+ using AngleSharp.Css.RenderTree;
+ using AngleSharp.Css.Tests.Mocks;
using AngleSharp.Css.Values;
+ using AngleSharp.Dom;
+ using AngleSharp.Html.Dom;
using NUnit.Framework;
using System.IO;
+ using System.Threading.Tasks;
using static CssConstructionFunctions;
[TestFixture]
@@ -27,21 +32,21 @@ public void PrettyStyleFormatterStringifyShouldWork_Issue41()
[Test]
public void SimpleColorWorksWithHexOutput_Issue96()
{
- var color = new Color(65, 12, 48);
- Color.UseHex = true;
+ var color = new CssColorValue(65, 12, 48);
+ CssColorValue.UseHex = true;
var text = color.CssText;
- Color.UseHex = false;
+ CssColorValue.UseHex = false;
Assert.AreEqual("#410C30", text);
}
[Test]
- public void TransparentColorDoesNotWorkWithHexOutput_Issue96()
+ public void TransparentColorWorksWithHexOutput_Issue132()
{
- var color = new Color(65, 12, 48, 10);
- Color.UseHex = true;
+ var color = new CssColorValue(65, 12, 48, 10);
+ CssColorValue.UseHex = true;
var text = color.CssText;
- Color.UseHex = false;
- Assert.AreEqual("rgba(65, 12, 48, 0.04)", text);
+ CssColorValue.UseHex = false;
+ Assert.AreEqual("#410C300A", text);
}
[Test]
@@ -105,5 +110,111 @@ public void EscapePropertyNames_UnknownDeclaration_Issue120()
Assert.AreEqual(css, generatedCss);
}
+
+ [Test]
+ public void CssTextShouldNotAddReplacementCharacter_Issue123()
+ {
+ var html = @"Ipsum ";
+ var dom = html.ToHtmlDocument(Configuration.Default.WithCss(new CssParserOptions
+ {
+ IsIncludingUnknownDeclarations = true,
+ IsIncludingUnknownRules = true,
+ IsToleratingInvalidSelectors = true,
+ }));
+ var div = dom.Body?.FirstElementChild;
+ var style = div.GetStyle();
+ var css = style.ToCss();
+
+ Assert.AreEqual("background-image: var(--urlSpellingErrorV2,url(\"https://www.example.com/))", css);
+ }
+
+ [Test]
+ public void CssTextShouldNotTrailingSemicolonCharacter_Issue123()
+ {
+ var html = @"Ipsum ";
+ var dom = html.ToHtmlDocument(Configuration.Default.WithCss(new CssParserOptions
+ {
+ IsIncludingUnknownDeclarations = true,
+ IsIncludingUnknownRules = true,
+ IsToleratingInvalidSelectors = true,
+ }));
+ var div = dom.Body?.FirstElementChild;
+ var style = div.GetStyle();
+ var css = style.ToCss();
+
+ Assert.AreEqual("color: rgba(255, 0, 0, 1)", css);
+ }
+
+ [Test]
+ public void BorderWithEmptyPx_Issue129()
+ {
+ var html = "
";
+ var dom = html.ToHtmlDocument(Configuration.Default.WithCss());
+ var div = dom.Body?.FirstElementChild;
+ var style = div.GetStyle();
+ var css = style.ToCss();
+
+ Assert.AreEqual("border-width: 1px", css);
+ }
+
+ [Test]
+ public async Task MediaListForLinkedStyleSheet_Issue133()
+ {
+ var html = " ";
+ var mockRequester = new MockRequester();
+ mockRequester.BuildResponse(request =>
+ {
+ if (request.Address.Path.EndsWith("style.css"))
+ {
+ return "div#A { color: blue; }";
+ }
+
+ return null;
+ });
+ var config = Configuration.Default.WithCss().WithMockRequester(mockRequester);
+ var context = BrowsingContext.New(config);
+ var document = await context.OpenAsync((res) => res.Content(html));
+ var link = document.QuerySelector("link");
+ Assert.AreEqual("", link.Sheet.Media.MediaText);
+ Assert.IsTrue(link.Sheet.Media.Validate(new DefaultRenderDevice()));
+ }
+
+ [Test]
+ public async Task ExternalCssNotConsidered_Issue140()
+ {
+ var html = @"
+
+ HI
+ ";
+ var mockRequester = new MockRequester();
+ mockRequester.BuildResponse(request =>
+ {
+ if (request.Address.Path.EndsWith("url.css"))
+ {
+ return @"label, .test {
+ min-width: 50px;
+ border: 1px solid green;
+}";
+ }
+
+ return null;
+ });
+ var config = Configuration.Default
+ .WithRenderDevice(new DefaultRenderDevice
+ {
+ DeviceWidth = 1920,
+ DeviceHeight = 1080,
+ })
+ .WithCss()
+ .WithMockRequester(mockRequester);
+ var context = BrowsingContext.New(config);
+ var document = await context.OpenAsync((res) => res.Content(html));
+ var window = document.DefaultView;
+ var tree = window.Render();
+ var label = tree.Find(document.QuerySelector("label"));
+ var minWidth = window.GetComputedStyle(label.Ref as IHtmlElement).GetMinWidth();
+
+ Assert.AreEqual("50px", minWidth);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Parsing/StyleSheet.cs b/src/AngleSharp.Css.Tests/Parsing/StyleSheet.cs
index 7f3b42af..f7ccf797 100644
--- a/src/AngleSharp.Css.Tests/Parsing/StyleSheet.cs
+++ b/src/AngleSharp.Css.Tests/Parsing/StyleSheet.cs
@@ -150,5 +150,15 @@ public async Task CastingException_Issue83()
var newCss = ss.ToCss(formatter);
Assert.IsNotNull(newCss);
}
+
+ [Test]
+ public void OneLetterTagWithCarriageReturnDoesNotWorkAsSelector_Issue190()
+ {
+ var css = "a\r\n{\r\nheight: 100vh;\r\n}";
+ var parser = new CssParser();
+ var ss = parser.ParseStyleSheet(css);
+ Assert.AreEqual(1, ss.Rules.Length);
+ Assert.AreEqual("a", ((AngleSharp.Css.Dom.ICssStyleRule)ss.Rules[0]).SelectorText);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Rules/CssKeyframeRule.cs b/src/AngleSharp.Css.Tests/Rules/CssKeyframeRule.cs
index d2b63469..efcc9a55 100644
--- a/src/AngleSharp.Css.Tests/Rules/CssKeyframeRule.cs
+++ b/src/AngleSharp.Css.Tests/Rules/CssKeyframeRule.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Tests.Rules
+namespace AngleSharp.Css.Tests.Rules
{
using NUnit.Framework;
using System.Linq;
@@ -74,5 +74,15 @@ public void KeyframeRuleWith0AndNoDeclarations()
Assert.AreEqual(1, rule.Key.Stops.Count());
Assert.AreEqual(0, rule.Style.Length);
}
+
+ [Test]
+ public void KeyframeRuleWithPercentage_Issue128()
+ {
+ var rule = ParseKeyframeRule(@" 0.52%, 50.0%,92.82% { }");
+ Assert.IsNotNull(rule);
+ Assert.AreEqual("0.52%, 50%, 92.82%", rule.KeyText);
+ Assert.AreEqual(3, rule.Key.Stops.Count());
+ Assert.AreEqual(0, rule.Style.Length);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Rules/CssMediaList.cs b/src/AngleSharp.Css.Tests/Rules/CssMediaList.cs
index b8cd8cf4..b6acf22f 100644
--- a/src/AngleSharp.Css.Tests/Rules/CssMediaList.cs
+++ b/src/AngleSharp.Css.Tests/Rules/CssMediaList.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Tests.Rules
+namespace AngleSharp.Css.Tests.Rules
{
using AngleSharp.Css.Dom;
using NUnit.Framework;
@@ -132,7 +132,7 @@ public void FeatureMinWidthMediaList()
}
[Test]
- public void OnlyFeatureWidthMediaList()
+ public void OnlyFeatureWidthMediaListInvalid()
{
var source = @"@media only (width: 640px) {
h1 { color: green }
@@ -141,7 +141,23 @@ public void OnlyFeatureWidthMediaList()
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var media = (CssMediaRule)sheet.Rules[0];
- Assert.AreEqual("only (width: 640px)", media.Media.MediaText);
+ Assert.AreEqual("not all", media.Media.MediaText);
+ var list = media.Media;
+ Assert.AreEqual(1, list.Length);
+ Assert.AreEqual(1, media.Rules.Length);
+ }
+
+ [Test]
+ public void OnlyFeatureWidthScreenAndMediaList()
+ {
+ var source = @"@media only screen and (width: 640px) {
+ h1 { color: green }
+}";
+ var sheet = ParseStyleSheet(source);
+ Assert.AreEqual(1, sheet.Rules.Length);
+ Assert.IsInstanceOf(sheet.Rules[0]);
+ var media = (CssMediaRule)sheet.Rules[0];
+ Assert.AreEqual("only screen and (width: 640px)", media.Media.MediaText);
var list = media.Media;
Assert.AreEqual(1, list.Length);
Assert.AreEqual(1, media.Rules.Length);
@@ -187,7 +203,7 @@ public void NoMediaQueryGivenSkip()
Assert.AreEqual(1, sheet.Rules.Length);
Assert.AreEqual(CssRuleType.Media, sheet.Rules[0].Type);
var media = sheet.Rules[0] as ICssMediaRule;
- Assert.AreEqual("not all", media.ConditionText);
+ Assert.AreEqual("", media.ConditionText);
Assert.AreEqual(1, media.Rules.Length);
}
@@ -393,5 +409,53 @@ public void CssMediaListApiWithAppendDeleteAndTextShouldWork()
Assert.AreEqual(media[2], list[1]);
Assert.AreEqual(String.Concat(media[0], ", ", media[2]), list.MediaText);
}
+
+ [Test]
+ public void ReplacesInvalidPartsCommaWithNotAll()
+ {
+ var source = @"@media (example, all,), speech {
+ h1 { color: green }
+}";
+ var sheet = ParseStyleSheet(source);
+ Assert.AreEqual(1, sheet.Rules.Length);
+ Assert.IsInstanceOf(sheet.Rules[0]);
+ var media = (CssMediaRule)sheet.Rules[0];
+ Assert.AreEqual("not all, speech", media.Media.MediaText);
+ var list = media.Media;
+ Assert.AreEqual(2, list.Length);
+ Assert.AreEqual(1, media.Rules.Length);
+ }
+
+ [Test]
+ public void ReplacesInvalidPartsAmpersandWithNotAll()
+ {
+ var source = @"@media test&, speech {
+ h1 { color: green }
+}";
+ var sheet = ParseStyleSheet(source);
+ Assert.AreEqual(1, sheet.Rules.Length);
+ Assert.IsInstanceOf(sheet.Rules[0]);
+ var media = (CssMediaRule)sheet.Rules[0];
+ Assert.AreEqual("not all, speech", media.Media.MediaText);
+ var list = media.Media;
+ Assert.AreEqual(2, list.Length);
+ Assert.AreEqual(1, media.Rules.Length);
+ }
+
+ [Test]
+ public void ReplacesUnclosedParansWithNotAll()
+ {
+ var source = @"@media (example, speech {
+ h1 { color: green }
+}";
+ var sheet = ParseStyleSheet(source);
+ Assert.AreEqual(1, sheet.Rules.Length);
+ Assert.IsInstanceOf(sheet.Rules[0]);
+ var media = (CssMediaRule)sheet.Rules[0];
+ Assert.AreEqual("not all", media.Media.MediaText);
+ var list = media.Media;
+ Assert.AreEqual(1, list.Length);
+ Assert.AreEqual(1, media.Rules.Length);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Rules/CssPageRule.cs b/src/AngleSharp.Css.Tests/Rules/CssPageRule.cs
new file mode 100644
index 00000000..29ef1f69
--- /dev/null
+++ b/src/AngleSharp.Css.Tests/Rules/CssPageRule.cs
@@ -0,0 +1,32 @@
+namespace AngleSharp.Css.Tests.Rules
+{
+ using AngleSharp.Css.Dom;
+ using NUnit.Framework;
+ using System.Linq;
+
+ [TestFixture]
+ public class CssPageRuleTests
+ {
+ [Test]
+ public void SemiColonsShouldNotMissInPageRule_Issue135()
+ {
+ var html = "";
+ var document = html.ToHtmlDocument(Configuration.Default.WithCss());
+ var styleSheet = document.StyleSheets.OfType().First();
+ var css = styleSheet.ToCss();
+
+ Assert.AreEqual("@page { margin-top: 25mm; margin-right: 25mm }", css);
+ }
+
+ [Test]
+ public void PageRuleShouldRecombineShorthandDeclaration_Issue135()
+ {
+ var html = "";
+ var document = html.ToHtmlDocument(Configuration.Default.WithCss());
+ var styleSheet = document.StyleSheets.OfType().First();
+ var css = styleSheet.ToCss();
+
+ Assert.AreEqual("@page { margin: 25mm }", css);
+ }
+ }
+}
diff --git a/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs b/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
index 9af111fd..1133852f 100644
--- a/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
+++ b/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
@@ -210,5 +210,13 @@ public void MinifyWithMultipleDeclarations()
var result = sheet.ToCss(new MinifyStyleFormatter());
Assert.AreEqual("h1{top:0;left:2px;border:none}h2{border:1px solid rgba(255, 0, 0, 1)}", result);
}
+
+ [Test]
+ public void MinifyMinimizesProperties_Issue89()
+ {
+ var sheet = ParseStyleSheet("a { grid-area: aa / aa / aa / aa }");
+ var result = sheet.ToCss(new MinifyStyleFormatter());
+ Assert.AreEqual("a{grid-area:aa}", result);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Styling/CssCases.cs b/src/AngleSharp.Css.Tests/Styling/CssCases.cs
index cf46959b..fb1e6593 100644
--- a/src/AngleSharp.Css.Tests/Styling/CssCases.cs
+++ b/src/AngleSharp.Css.Tests/Styling/CssCases.cs
@@ -15,6 +15,7 @@ private static ICssStyleSheet ParseSheet(String text)
{
IsIncludingUnknownDeclarations = true,
IsIncludingUnknownRules = true,
+ IsExcludingNesting = true,
IsToleratingInvalidSelectors = false,
});
}
@@ -319,9 +320,9 @@ public void StyleSheetEscapes()
/*#\{\}{background:lime;}*/");
Assert.AreEqual(42, sheet.Rules.Length);
- Assert.AreEqual(@".:`(", ((ICssStyleRule)sheet.Rules[0]).SelectorText);
- Assert.AreEqual(@".1a2b3c", ((ICssStyleRule)sheet.Rules[1]).SelectorText);
- Assert.AreEqual(@"##fake-id", ((ICssStyleRule)sheet.Rules[2]).SelectorText);
+ Assert.AreEqual(@".\:\`\(", ((ICssStyleRule)sheet.Rules[0]).SelectorText);
+ Assert.AreEqual(@".\31 a2b3c", ((ICssStyleRule)sheet.Rules[1]).SelectorText);
+ Assert.AreEqual(@"#\#fake-id", ((ICssStyleRule)sheet.Rules[2]).SelectorText);
Assert.AreEqual(@"#---", ((ICssStyleRule)sheet.Rules[3]).SelectorText);
Assert.AreEqual(@"#-a-b-c-", ((ICssStyleRule)sheet.Rules[4]).SelectorText);
Assert.AreEqual(@"#©", ((ICssStyleRule)sheet.Rules[5]).SelectorText);
@@ -346,57 +347,57 @@ public void StyleSheetEscapes()
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[14]).Style["background"]);
Assert.AreEqual(@"#𝄞♪♩♫♬", ((ICssStyleRule)sheet.Rules[15]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[15]).Style["background"]);
- Assert.AreEqual(@"#?", ((ICssStyleRule)sheet.Rules[16]).SelectorText);
+ Assert.AreEqual(@"#\?", ((ICssStyleRule)sheet.Rules[16]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[16]).Style["background"]);
- Assert.AreEqual(@"#@", ((ICssStyleRule)sheet.Rules[17]).SelectorText);
+ Assert.AreEqual(@"#\@", ((ICssStyleRule)sheet.Rules[17]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[17]).Style["background"]);
- Assert.AreEqual(@"#.", ((ICssStyleRule)sheet.Rules[18]).SelectorText);
+ Assert.AreEqual(@"#\.", ((ICssStyleRule)sheet.Rules[18]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[18]).Style["background"]);
- Assert.AreEqual(@"#:)", ((ICssStyleRule)sheet.Rules[19]).SelectorText);
+ Assert.AreEqual(@"#\:\)", ((ICssStyleRule)sheet.Rules[19]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[19]).Style["background"]);
- Assert.AreEqual(@"#:`(", ((ICssStyleRule)sheet.Rules[20]).SelectorText);
+ Assert.AreEqual(@"#\:\`\(", ((ICssStyleRule)sheet.Rules[20]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[20]).Style["background"]);
- Assert.AreEqual(@"#123", ((ICssStyleRule)sheet.Rules[21]).SelectorText);
+ Assert.AreEqual(@"#\31 23", ((ICssStyleRule)sheet.Rules[21]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[21]).Style["background"]);
- Assert.AreEqual(@"#1a2b3c", ((ICssStyleRule)sheet.Rules[22]).SelectorText);
+ Assert.AreEqual(@"#\31 a2b3c", ((ICssStyleRule)sheet.Rules[22]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[22]).Style["background"]);
- Assert.AreEqual(@"#", ((ICssStyleRule)sheet.Rules[23]).SelectorText);
+ Assert.AreEqual(@"#\
", ((ICssStyleRule)sheet.Rules[23]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[23]).Style["background"]);
- Assert.AreEqual(@"#<><<<>><>", ((ICssStyleRule)sheet.Rules[24]).SelectorText);
+ Assert.AreEqual(@"#\<\>\<\<\<\>\>\<\>", ((ICssStyleRule)sheet.Rules[24]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[24]).Style["background"]);
- Assert.AreEqual(@"#++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.", ((ICssStyleRule)sheet.Rules[25]).SelectorText);
+ Assert.AreEqual("#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.------\\.--------\\.\\>\\+\\.\\>\\.", ((ICssStyleRule)sheet.Rules[25]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[25]).Style["background"]);
- Assert.AreEqual(@"##", ((ICssStyleRule)sheet.Rules[26]).SelectorText);
+ Assert.AreEqual(@"#\#", ((ICssStyleRule)sheet.Rules[26]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[26]).Style["background"]);
- Assert.AreEqual(@"###", ((ICssStyleRule)sheet.Rules[27]).SelectorText);
+ Assert.AreEqual(@"#\#\#", ((ICssStyleRule)sheet.Rules[27]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[27]).Style["background"]);
- Assert.AreEqual(@"##.#.#", ((ICssStyleRule)sheet.Rules[28]).SelectorText);
+ Assert.AreEqual(@"#\#\.\#\.\#", ((ICssStyleRule)sheet.Rules[28]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[28]).Style["background"]);
Assert.AreEqual(@"#_", ((ICssStyleRule)sheet.Rules[29]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[29]).Style["background"]);
- Assert.AreEqual(@"#.fake-class", ((ICssStyleRule)sheet.Rules[30]).SelectorText);
+ Assert.AreEqual(@"#\.fake-class", ((ICssStyleRule)sheet.Rules[30]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[30]).Style["background"]);
- Assert.AreEqual(@"#foo.bar", ((ICssStyleRule)sheet.Rules[31]).SelectorText);
+ Assert.AreEqual(@"#foo\.bar", ((ICssStyleRule)sheet.Rules[31]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[31]).Style["background"]);
- Assert.AreEqual(@"#:hover", ((ICssStyleRule)sheet.Rules[32]).SelectorText);
+ Assert.AreEqual(@"#\:hover", ((ICssStyleRule)sheet.Rules[32]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[32]).Style["background"]);
- Assert.AreEqual(@"#:hover:focus:active", ((ICssStyleRule)sheet.Rules[33]).SelectorText);
+ Assert.AreEqual(@"#\:hover\:focus\:active", ((ICssStyleRule)sheet.Rules[33]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[33]).Style["background"]);
- Assert.AreEqual(@"#[attr=value]", ((ICssStyleRule)sheet.Rules[34]).SelectorText);
+ Assert.AreEqual(@"#\[attr\=value\]", ((ICssStyleRule)sheet.Rules[34]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[34]).Style["background"]);
- Assert.AreEqual(@"#f/o/o", ((ICssStyleRule)sheet.Rules[35]).SelectorText);
+ Assert.AreEqual(@"#f\/o\/o", ((ICssStyleRule)sheet.Rules[35]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[35]).Style["background"]);
- Assert.AreEqual(@"#f\o\o", ((ICssStyleRule)sheet.Rules[36]).SelectorText);
+ Assert.AreEqual(@"#f\\o\\o", ((ICssStyleRule)sheet.Rules[36]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[36]).Style["background"]);
- Assert.AreEqual(@"#f*o*o", ((ICssStyleRule)sheet.Rules[37]).SelectorText);
+ Assert.AreEqual(@"#f\*o\*o", ((ICssStyleRule)sheet.Rules[37]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[37]).Style["background"]);
- Assert.AreEqual(@"#f!o!o", ((ICssStyleRule)sheet.Rules[38]).SelectorText);
+ Assert.AreEqual(@"#f\!o\!o", ((ICssStyleRule)sheet.Rules[38]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[38]).Style["background"]);
- Assert.AreEqual(@"#f'o'o", ((ICssStyleRule)sheet.Rules[39]).SelectorText);
+ Assert.AreEqual(@"#f\'o\'o", ((ICssStyleRule)sheet.Rules[39]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[39]).Style["background"]);
- Assert.AreEqual(@"#f~o~o", ((ICssStyleRule)sheet.Rules[40]).SelectorText);
+ Assert.AreEqual(@"#f\~o\~o", ((ICssStyleRule)sheet.Rules[40]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[40]).Style["background"]);
- Assert.AreEqual(@"#f+o+o", ((ICssStyleRule)sheet.Rules[41]).SelectorText);
+ Assert.AreEqual(@"#f\+o\+o", ((ICssStyleRule)sheet.Rules[41]).SelectorText);
Assert.AreEqual(@"rgba(0, 255, 0, 1)", ((ICssStyleRule)sheet.Rules[41]).Style["background"]);
}
diff --git a/src/AngleSharp.Css.Tests/Values/Color.cs b/src/AngleSharp.Css.Tests/Values/Color.cs
index 2e252070..9ef1a0a8 100644
--- a/src/AngleSharp.Css.Tests/Values/Color.cs
+++ b/src/AngleSharp.Css.Tests/Values/Color.cs
@@ -4,331 +4,326 @@ namespace AngleSharp.Css.Tests.Values
using NUnit.Framework;
[TestFixture]
- public class ColorTests
+ public class CssColorValueTests
{
[Test]
- public void ColorInvalidHexDigitString()
+ public void CssColorValueInvalidHexDigitString()
{
- Color hc;
var color = "BCDEFG";
- var result = Color.TryFromHex(color, out hc);
+ var result = CssColorValue.TryFromHex(color, out var hc);
Assert.IsFalse(result);
}
[Test]
- public void ColorValidFourLetterString()
+ public void CssColorValueValidFourLetterString()
{
- Color hc;
var color = "abcd";
- var result = Color.TryFromHex(color, out hc);
- Assert.AreEqual(new Color(170, 187, 204, 221), hc);
+ var result = CssColorValue.TryFromHex(color, out var hc);
+ Assert.AreEqual(new CssColorValue(170, 187, 204, 221), hc);
Assert.IsTrue(result);
}
[Test]
- public void ColorInvalidLengthString()
+ public void CssColorValueInvalidLengthString()
{
- Color hc;
var color = "abcde";
- var result = Color.TryFromHex(color, out hc);
+ var result = CssColorValue.TryFromHex(color, out var hc);
Assert.IsFalse(result);
}
[Test]
- public void ColorValidLengthShortString()
+ public void CssColorValueValidLengthShortString()
{
- Color hc;
var color = "fff";
- var result = Color.TryFromHex(color, out hc);
+ var result = CssColorValue.TryFromHex(color, out var hc);
Assert.IsTrue(result);
}
[Test]
- public void ColorValidLengthLongString()
+ public void CssColorValueValidLengthLongString()
{
- Color hc;
var color = "fffabc";
- var result = Color.TryFromHex(color, out hc);
+ var result = CssColorValue.TryFromHex(color, out var hc);
Assert.IsTrue(result);
}
[Test]
- public void ColorWhiteShortString()
+ public void CssColorValueWhiteShortString()
{
var color = "fff";
- var result = Color.FromHex(color);
- Assert.AreEqual(Color.FromRgb(255, 255, 255), result);
+ var result = CssColorValue.FromHex(color);
+ Assert.AreEqual(CssColorValue.FromRgb(255, 255, 255), result);
}
[Test]
- public void ColorRedShortString()
+ public void CssColorValueRedShortString()
{
var color = "f00";
- var result = Color.FromHex(color);
- Assert.AreEqual(Color.FromRgb(255, 0, 0), result);
+ var result = CssColorValue.FromHex(color);
+ Assert.AreEqual(CssColorValue.FromRgb(255, 0, 0), result);
}
[Test]
- public void ColorFromRedName()
+ public void CssColorValueFromRedName()
{
var color = "red";
- var result = Color.FromName(color);
+ var result = CssColorValue.FromName(color);
Assert.IsTrue(result.HasValue);
- Assert.AreEqual(Color.Red, result);
+ Assert.AreEqual(CssColorValue.Red, result);
}
[Test]
- public void ColorFromWhiteName()
+ public void CssColorValueFromWhiteName()
{
var color = "white";
- var result = Color.FromName(color);
+ var result = CssColorValue.FromName(color);
Assert.IsTrue(result.HasValue);
- Assert.AreEqual(Color.White, result);
+ Assert.AreEqual(CssColorValue.White, result);
}
[Test]
- public void ColorFromUnknownName()
+ public void CssColorValueFromUnknownName()
{
var color = "bla";
- var result = Color.FromName(color);
+ var result = CssColorValue.FromName(color);
Assert.IsFalse(result.HasValue);
}
[Test]
- public void ColorMixedLongString()
+ public void CssColorValueMixedLongString()
{
var color = "facc36";
- var result = Color.FromHex(color);
- Assert.AreEqual(Color.FromRgb(250, 204, 54), result);
+ var result = CssColorValue.FromHex(color);
+ Assert.AreEqual(CssColorValue.FromRgb(250, 204, 54), result);
}
[Test]
- public void ColorMixedEightDigitLongStringTransparent()
+ public void CssColorValueMixedEightDigitLongStringTransparent()
{
var color = "facc3600";
- var result = Color.FromHex(color);
- Assert.AreEqual(Color.FromRgba(250, 204, 54, 0), result);
+ var result = CssColorValue.FromHex(color);
+ Assert.AreEqual(CssColorValue.FromRgba(250, 204, 54, 0), result);
}
[Test]
- public void ColorMixedEightDigitLongStringOpaque()
+ public void CssColorValueMixedEightDigitLongStringOpaque()
{
var color = "facc36ff";
- var result = Color.FromHex(color);
- Assert.AreEqual(Color.FromRgba(250, 204, 54, 1), result);
+ var result = CssColorValue.FromHex(color);
+ Assert.AreEqual(CssColorValue.FromRgba(250, 204, 54, 1), result);
}
[Test]
- public void ColorMixBlackOnWhite50Percent()
+ public void CssColorValueMixBlackOnWhite50Percent()
{
- var color1 = Color.Black;
- var color2 = Color.White;
- var mix = Color.Mix(0.5, color1, color2);
- Assert.AreEqual(Color.FromRgb(127, 127, 127), mix);
+ var color1 = CssColorValue.Black;
+ var color2 = CssColorValue.White;
+ var mix = CssColorValue.Mix(0.5, color1, color2);
+ Assert.AreEqual(CssColorValue.FromRgb(127, 127, 127), mix);
}
[Test]
- public void ColorMixRedOnWhite75Percent()
+ public void CssColorValueMixRedOnWhite75Percent()
{
- var color1 = Color.Red;
- var color2 = Color.White;
- var mix = Color.Mix(0.75, color1, color2);
- Assert.AreEqual(Color.FromRgb(255, 63, 63), mix);
+ var color1 = CssColorValue.Red;
+ var color2 = CssColorValue.White;
+ var mix = CssColorValue.Mix(0.75, color1, color2);
+ Assert.AreEqual(CssColorValue.FromRgb(255, 63, 63), mix);
}
[Test]
- public void ColorMixBlueOnWhite10Percent()
+ public void CssColorValueMixBlueOnWhite10Percent()
{
- var color1 = Color.Blue;
- var color2 = Color.White;
- var mix = Color.Mix(0.1, color1, color2);
- Assert.AreEqual(Color.FromRgb(229, 229, 255), mix);
+ var color1 = CssColorValue.Blue;
+ var color2 = CssColorValue.White;
+ var mix = CssColorValue.Mix(0.1, color1, color2);
+ Assert.AreEqual(CssColorValue.FromRgb(229, 229, 255), mix);
}
[Test]
- public void ColorMixGreenOnRed30Percent()
+ public void CssColorValueMixGreenOnRed30Percent()
{
- var color1 = Color.PureGreen;
- var color2 = Color.Red;
- var mix = Color.Mix(0.3, color1, color2);
- Assert.AreEqual(Color.FromRgb(178, 76, 0), mix);
+ var color1 = CssColorValue.PureGreen;
+ var color2 = CssColorValue.Red;
+ var mix = CssColorValue.Mix(0.3, color1, color2);
+ Assert.AreEqual(CssColorValue.FromRgb(178, 76, 0), mix);
}
[Test]
- public void ColorMixWhiteOnBlack20Percent()
+ public void CssColorValueMixWhiteOnBlack20Percent()
{
- var color1 = Color.White;
- var color2 = Color.Black;
- var mix = Color.Mix(0.2, color1, color2);
- Assert.AreEqual(Color.FromRgb(51, 51, 51), mix);
+ var color1 = CssColorValue.White;
+ var color2 = CssColorValue.Black;
+ var mix = CssColorValue.Mix(0.2, color1, color2);
+ Assert.AreEqual(CssColorValue.FromRgb(51, 51, 51), mix);
}
[Test]
- public void ColorHslBlackMixed()
+ public void CssColorValueHslBlackMixed()
{
- var color = Color.FromHsl(0, 1, 0);
- Assert.AreEqual(Color.Black, color);
+ var color = CssColorValue.FromHsl(0, 1, 0);
+ Assert.AreEqual(CssColorValue.Black, color);
}
[Test]
- public void ColorHslBlackMixed1()
+ public void CssColorValueHslBlackMixed1()
{
- var color = Color.FromHsl(0, 1, 0);
- Assert.AreEqual(Color.Black, color);
+ var color = CssColorValue.FromHsl(0, 1, 0);
+ Assert.AreEqual(CssColorValue.Black, color);
}
[Test]
- public void ColorHslBlackMixed2()
+ public void CssColorValueHslBlackMixed2()
{
- var color = Color.FromHsl(0.5f, 1, 0);
- Assert.AreEqual(Color.Black, color);
+ var color = CssColorValue.FromHsl(0.5f, 1, 0);
+ Assert.AreEqual(CssColorValue.Black, color);
}
[Test]
- public void ColorHslRedPure()
+ public void CssColorValueHslRedPure()
{
- var color = Color.FromHsl(0, 1, 0.5f);
- Assert.AreEqual(Color.Red, color);
+ var color = CssColorValue.FromHsl(0, 1, 0.5f);
+ Assert.AreEqual(CssColorValue.Red, color);
}
[Test]
- public void ColorHslGreenPure()
+ public void CssColorValueHslGreenPure()
{
- var color = Color.FromHsl(1f / 3f, 1, 0.5f);
- Assert.AreEqual(Color.PureGreen, color);
+ var color = CssColorValue.FromHsl(1f / 3f, 1, 0.5f);
+ Assert.AreEqual(CssColorValue.PureGreen, color);
}
[Test]
- public void ColorHslBluePure()
+ public void CssColorValueHslBluePure()
{
- var color = Color.FromHsl(2f / 3f, 1, 0.5f);
- Assert.AreEqual(Color.Blue, color);
+ var color = CssColorValue.FromHsl(2f / 3f, 1, 0.5f);
+ Assert.AreEqual(CssColorValue.Blue, color);
}
[Test]
- public void ColorHslBlackPure()
+ public void CssColorValueHslBlackPure()
{
- var color = Color.FromHsl(0, 0, 0);
- Assert.AreEqual(Color.Black, color);
+ var color = CssColorValue.FromHsl(0, 0, 0);
+ Assert.AreEqual(CssColorValue.Black, color);
}
[Test]
- public void ColorHslMagentaPure()
+ public void CssColorValueHslMagentaPure()
{
- var color = Color.FromHsl(300f / 360f, 1, 0.5f);
- Assert.AreEqual(Color.Magenta, color);
+ var color = CssColorValue.FromHsl(300f / 360f, 1, 0.5f);
+ Assert.AreEqual(CssColorValue.Magenta, color);
}
[Test]
- public void ColorHslYellowGreenMixed()
+ public void CssColorValueHslYellowGreenMixed()
{
- var color = Color.FromHsl(1f / 4f, 0.75f, 0.63f);
- Assert.AreEqual(Color.FromRgb(161, 232, 90), color);
+ var color = CssColorValue.FromHsl(1f / 4f, 0.75f, 0.63f);
+ Assert.AreEqual(CssColorValue.FromRgb(161, 232, 90), color);
}
[Test]
- public void ColorHslGrayBlueMixed()
+ public void CssColorValueHslGrayBlueMixed()
{
- var color = Color.FromHsl(210f / 360f, 0.25f, 0.25f);
- Assert.AreEqual(Color.FromRgb(48, 64, 80), color);
+ var color = CssColorValue.FromHsl(210f / 360f, 0.25f, 0.25f);
+ Assert.AreEqual(CssColorValue.FromRgb(48, 64, 80), color);
}
[Test]
- public void ColorFlexHexOneLetter()
+ public void CssColorValueFlexHexOneLetter()
{
- var color = Color.FromFlexHex("F");
- Assert.AreEqual(Color.FromRgb(0xf, 0x0, 0x0), color);
+ var color = CssColorValue.FromFlexHex("F");
+ Assert.AreEqual(CssColorValue.FromRgb(0xf, 0x0, 0x0), color);
}
[Test]
- public void ColorFlexHexTwoLetters()
+ public void CssColorValueFlexHexTwoLetters()
{
- var color = Color.FromFlexHex("0F");
- Assert.AreEqual(Color.FromRgb(0x0, 0xf, 0x0), color);
+ var color = CssColorValue.FromFlexHex("0F");
+ Assert.AreEqual(CssColorValue.FromRgb(0x0, 0xf, 0x0), color);
}
[Test]
- public void ColorFlexHexFourLetters()
+ public void CssColorValueFlexHexFourLetters()
{
- var color = Color.FromFlexHex("0F0F");
- Assert.AreEqual(Color.FromRgb(0xf, 0xf, 0x0), color);
+ var color = CssColorValue.FromFlexHex("0F0F");
+ Assert.AreEqual(CssColorValue.FromRgb(0xf, 0xf, 0x0), color);
}
[Test]
- public void ColorFlexHexSevenLetters()
+ public void CssColorValueFlexHexSevenLetters()
{
- var color = Color.FromFlexHex("0F0F0F0");
- Assert.AreEqual(Color.FromRgb(0xf, 0xf0, 0x0), color);
+ var color = CssColorValue.FromFlexHex("0F0F0F0");
+ Assert.AreEqual(CssColorValue.FromRgb(0xf, 0xf0, 0x0), color);
}
[Test]
- public void ColorFlexHexFifteenLetters()
+ public void CssColorValueFlexHexFifteenLetters()
{
- var color = Color.FromFlexHex("1234567890ABCDE");
- Assert.AreEqual(Color.FromRgb(0x12, 0x67, 0xab), color);
+ var color = CssColorValue.FromFlexHex("1234567890ABCDE");
+ Assert.AreEqual(CssColorValue.FromRgb(0x12, 0x67, 0xab), color);
}
[Test]
- public void ColorFlexHexExtremelyLong()
+ public void CssColorValueFlexHexExtremelyLong()
{
- var color = Color.FromFlexHex("1234567890ABCDE1234567890ABCDE");
- Assert.AreEqual(Color.FromRgb(0x34, 0xcd, 0x89), color);
+ var color = CssColorValue.FromFlexHex("1234567890ABCDE1234567890ABCDE");
+ Assert.AreEqual(CssColorValue.FromRgb(0x34, 0xcd, 0x89), color);
}
[Test]
- public void ColorFlexHexRandomString()
+ public void CssColorValueFlexHexRandomString()
{
- var color = Color.FromFlexHex("6db6ec49efd278cd0bc92d1e5e072d68");
- Assert.AreEqual(Color.FromRgb(0x6e, 0xcd, 0xe0), color);
+ var color = CssColorValue.FromFlexHex("6db6ec49efd278cd0bc92d1e5e072d68");
+ Assert.AreEqual(CssColorValue.FromRgb(0x6e, 0xcd, 0xe0), color);
}
[Test]
- public void ColorFlexHexSixLettersInvalid()
+ public void CssColorValueFlexHexSixLettersInvalid()
{
- var color = Color.FromFlexHex("zqbttv");
- Assert.AreEqual(Color.FromRgb(0x0, 0xb0, 0x0), color);
+ var color = CssColorValue.FromFlexHex("zqbttv");
+ Assert.AreEqual(CssColorValue.FromRgb(0x0, 0xb0, 0x0), color);
}
[Test]
- public void ColorFromGraySimple()
+ public void CssColorValueFromGraySimple()
{
- var color = Color.FromGray(25);
- Assert.AreEqual(Color.FromRgb(25, 25, 25), color);
+ var color = CssColorValue.FromGray(25);
+ Assert.AreEqual(CssColorValue.FromRgb(25, 25, 25), color);
}
[Test]
- public void ColorFromGrayWithAlpha()
+ public void CssColorValueFromGrayWithAlpha()
{
- var color = Color.FromGray(25, 0.5f);
- Assert.AreEqual(Color.FromRgba(25, 25, 25, 0.5f), color);
+ var color = CssColorValue.FromGray(25, 0.5f);
+ Assert.AreEqual(CssColorValue.FromRgba(25, 25, 25, 0.5f), color);
}
[Test]
- public void ColorFromGrayPercent()
+ public void CssColorValueFromGrayPercent()
{
- var color = Color.FromGray(0.5f, 0.5f);
- Assert.AreEqual(Color.FromRgba(128, 128, 128, 0.5f), color);
+ var color = CssColorValue.FromGray(0.5f, 0.5f);
+ Assert.AreEqual(CssColorValue.FromRgba(128, 128, 128, 0.5f), color);
}
[Test]
- public void ColorFromHwbRed()
+ public void CssColorValueFromHwbRed()
{
- var color = Color.FromHwb(0f, 0.2f, 0.2f);
- Assert.AreEqual(Color.FromRgb(204, 51, 51), color);
+ var color = CssColorValue.FromHwb(0f, 0.2f, 0.2f);
+ Assert.AreEqual(CssColorValue.FromRgb(204, 51, 51), color);
}
[Test]
- public void ColorFromHwbGreen()
+ public void CssColorValueFromHwbGreen()
{
- var color = Color.FromHwb(1f / 3f, 0.2f, 0.6f);
- Assert.AreEqual(Color.FromRgb(51, 102, 51), color);
+ var color = CssColorValue.FromHwb(1f / 3f, 0.2f, 0.6f);
+ Assert.AreEqual(CssColorValue.FromRgb(51, 102, 51), color);
}
[Test]
- public void ColorFromHwbMagentaTransparent()
+ public void CssColorValueFromHwbMagentaTransparent()
{
- var color = Color.FromHwba(5f / 6f, 0.4f, 0.2f, 0.5f);
- Assert.AreEqual(Color.FromRgba(204, 102, 204, 0.5f), color);
+ var color = CssColorValue.FromHwba(5f / 6f, 0.4f, 0.2f, 0.5f);
+ Assert.AreEqual(CssColorValue.FromRgba(204, 102, 204, 0.5f), color);
}
}
}
diff --git a/src/AngleSharp.Css.Tests/Values/Gradient.cs b/src/AngleSharp.Css.Tests/Values/Gradient.cs
index 3c3644f5..017e8481 100644
--- a/src/AngleSharp.Css.Tests/Values/Gradient.cs
+++ b/src/AngleSharp.Css.Tests/Values/Gradient.cs
@@ -29,8 +29,8 @@ public void InRadialGradient()
[Test]
public void BackgroundImageLinearGradientWithAngle()
{
- var red = Color.Red;
- var blue = Color.Blue;
+ var red = CssColorValue.Red;
+ var blue = CssColorValue.Blue;
var source = $"background-image: linear-gradient(135deg, {red.CssText}, {blue.CssText})";
var property = ParseDeclaration(source);
Assert.IsTrue(property.HasValue);
@@ -41,10 +41,10 @@ public void BackgroundImageLinearGradientWithAngle()
var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsNotNull(gradient);
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Angle.TripleHalfQuarter, gradient.Angle);
+ Assert.AreEqual(CssAngleValue.TripleHalfQuarter, gradient.Angle);
Assert.AreEqual(2, gradient.Stops.Length);
- Assert.AreEqual(red, gradient.Stops.First().Color);
- Assert.AreEqual(blue, gradient.Stops.Last().Color);
+ Assert.AreEqual(red, gradient.Stops.OfType().First().Color);
+ Assert.AreEqual(blue, gradient.Stops.OfType().Last().Color);
Assert.AreEqual(source, property.CssText);
}
@@ -61,16 +61,16 @@ public void BackgroundImageLinearGradientWithSide()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Angle.Quarter, gradient.Angle);
+ Assert.AreEqual(CssAngleValue.Quarter, gradient.Angle);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(7, stops.Length);
- Assert.AreEqual(CssColors.GetColor("red").Value, stops[0].Color);
- Assert.AreEqual(CssColors.GetColor("orange").Value, stops[1].Color);
- Assert.AreEqual(CssColors.GetColor("yellow").Value, stops[2].Color);
- Assert.AreEqual(CssColors.GetColor("green").Value, stops[3].Color);
- Assert.AreEqual(CssColors.GetColor("blue").Value, stops[4].Color);
- Assert.AreEqual(CssColors.GetColor("indigo").Value, stops[5].Color);
- Assert.AreEqual(CssColors.GetColor("violet").Value, stops[6].Color);
+ Assert.AreEqual(CssColors.GetColor("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColors.GetColor("orange").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColors.GetColor("yellow").Value, ((CssGradientStopValue)stops[2]).Color);
+ Assert.AreEqual(CssColors.GetColor("green").Value, ((CssGradientStopValue)stops[3]).Color);
+ Assert.AreEqual(CssColors.GetColor("blue").Value, ((CssGradientStopValue)stops[4]).Color);
+ Assert.AreEqual(CssColors.GetColor("indigo").Value, ((CssGradientStopValue)stops[5]).Color);
+ Assert.AreEqual(CssColors.GetColor("violet").Value, ((CssGradientStopValue)stops[6]).Color);
}
[Test]
@@ -85,10 +85,10 @@ public void BackgroundImageLinearGradientWithCornerAndRgba()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Angle.TripleHalfQuarter, gradient.Angle);
+ Assert.AreEqual(CssAngleValue.TripleHalfQuarter, gradient.Angle);
Assert.AreEqual(2, gradient.Stops.Count());
- Assert.AreEqual(Color.Red, gradient.Stops.First().Color);
- Assert.AreEqual(Color.FromRgba(255, 0, 0, 0), gradient.Stops.Last().Color);
+ Assert.AreEqual(CssColorValue.Red, gradient.Stops.OfType().First().Color);
+ Assert.AreEqual(CssColorValue.FromRgba(255, 0, 0, 0), gradient.Stops.OfType().Last().Color);
}
[Test]
@@ -103,10 +103,10 @@ public void BackgroundImageLinearGradientWithSideAndHsl()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Angle.Half, gradient.Angle);
+ Assert.AreEqual(CssAngleValue.Half, gradient.Angle);
Assert.AreEqual(2, gradient.Stops.Count());
- Assert.AreEqual(Color.FromHsl(0f, 0.8f, 0.7f), gradient.Stops.First().Color);
- Assert.AreEqual(Color.FromHex("bada55"), gradient.Stops.Last().Color);
+ Assert.AreEqual(CssColorValue.FromHsl(0f, 0.8f, 0.7f), gradient.Stops.OfType().First().Color);
+ Assert.AreEqual(CssColorValue.FromHex("bada55"), gradient.Stops.OfType().Last().Color);
}
[Test]
@@ -121,11 +121,11 @@ public void BackgroundImageLinearGradientNoAngle()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Angle.Half, gradient.Angle);
+ Assert.AreEqual(CssAngleValue.Half, gradient.Angle);
Assert.AreEqual(3, gradient.Stops.Count());
- Assert.AreEqual(CssColors.GetColor("yellow").Value, gradient.Stops.First().Color);
- Assert.AreEqual(CssColors.GetColor("blue").Value, gradient.Stops.Skip(1).First().Color);
- Assert.AreEqual(Color.FromRgb(0, 255, 0), gradient.Stops.Skip(2).First().Color);
+ Assert.AreEqual(CssColors.GetColor("yellow").Value, gradient.Stops.OfType().First().Color);
+ Assert.AreEqual(CssColors.GetColor("blue").Value, gradient.Stops.OfType().Skip(1).First().Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 255, 0), gradient.Stops.OfType().Skip(2).First().Color);
}
[Test]
@@ -140,15 +140,15 @@ public void BackgroundImageRadialGradientCircleFarthestCorner()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(45, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(45, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(45, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(45, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(true, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.FarthestCorner, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromRgb(0, 255, 255), stops[0].Color);
- Assert.AreEqual(Color.FromRgba(0, 0, 255, 0), stops[1].Color);
- Assert.AreEqual(Color.FromRgb(0, 0, 255), stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 255, 255), ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromRgba(0, 0, 255, 0), ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 0, 255), ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -163,15 +163,15 @@ public void BackgroundImageRadialGradientEllipseFarthestCorner()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(470, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(47, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(470, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(47, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.FarthestCorner, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromRgb(0xFF, 0xFF, 0x80), stops[0].Color);
- Assert.AreEqual(Color.FromRgba(204, 153, 153, 0.4f), stops[1].Color);
- Assert.AreEqual(Color.FromRgb(0xE6, 0xE6, 0xFF), stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0xFF, 0xFF, 0x80), ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromRgba(204, 153, 153, 0.4f), ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0xE6, 0xE6, 0xFF), ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -186,14 +186,14 @@ public void BackgroundImageRadialGradientFarthestCornerWithPoint()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(45, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(45, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(45, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(45, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.FarthestCorner, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(2, stops.Length);
- Assert.AreEqual(Color.FromRgb(255, 0, 0), stops[0].Color);
- Assert.AreEqual(Color.FromRgb(0, 0, 255), stops[1].Color);
+ Assert.AreEqual(CssColorValue.FromRgb(255, 0, 0), ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 0, 255), ((CssGradientStopValue)stops[1]).Color);
}
[Test]
@@ -208,18 +208,18 @@ public void BackgroundImageRadialGradientSingleSize()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(60f, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(60f, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(true, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
- Assert.AreEqual(new Length(16f, Length.Unit.Px), gradient.MajorRadius);
- Assert.AreEqual(Length.Full, gradient.MinorRadius);
+ Assert.AreEqual(new CssLengthValue(16f, CssLengthValue.Unit.Px), gradient.MajorRadius);
+ Assert.AreEqual(CssLengthValue.Full, gradient.MinorRadius);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(4, stops.Length);
- Assert.AreEqual(Color.FromRgb(0, 0, 0), stops[0].Color);
- Assert.AreEqual(Color.FromRgb(0, 0, 0), stops[1].Color);
- Assert.AreEqual(Color.FromRgba(0, 0, 0, 0.3), stops[2].Color);
- Assert.AreEqual(Color.Transparent, stops[3].Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 0, 0), ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromRgb(0, 0, 0), ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromRgba(0, 0, 0, 0.3), ((CssGradientStopValue)stops[2]).Color);
+ Assert.AreEqual(CssColorValue.Transparent, ((CssGradientStopValue)stops[3]).Color);
}
[Test]
@@ -234,14 +234,14 @@ public void BackgroundImageRadialGradientCircle()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Length.Half, gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(true, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(2, stops.Length);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[1].Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[1]).Color);
}
[Test]
@@ -256,14 +256,14 @@ public void BackgroundImageRadialGradientOnlyGradientStops()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Length.Half, gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(2, stops.Length);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[1].Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[1]).Color);
}
[Test]
@@ -278,14 +278,14 @@ public void BackgroundImageRadialGradientEllipseAtCenter()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Length.Half, gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(2, stops.Length);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[1].Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[1]).Color);
}
[Test]
@@ -300,14 +300,14 @@ public void BackgroundImageRadialGradientFarthestCornerWithoutPoint()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Length.Half, gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.FarthestCorner, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(2, stops.Length);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[1].Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[1]).Color);
}
[Test]
@@ -322,15 +322,15 @@ public void BackgroundImageRadialGradientClosestSideWithPoint()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(20f, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(30f, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(20f, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(30f, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.ClosestSide, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -345,17 +345,17 @@ public void BackgroundImageRadialGradientSizeAndPoint()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(20f, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(30f, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(20f, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(30f, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
- Assert.AreEqual(new Length(20f, Length.Unit.Px), gradient.MajorRadius);
- Assert.AreEqual(new Length(30f, Length.Unit.Px), gradient.MinorRadius);
+ Assert.AreEqual(new CssLengthValue(20f, CssLengthValue.Unit.Px), gradient.MajorRadius);
+ Assert.AreEqual(new CssLengthValue(30f, CssLengthValue.Unit.Px), gradient.MinorRadius);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -370,15 +370,15 @@ public void BackgroundImageRadialGradientClosestSideCircleShuffledWithPoint()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(new Length(20f, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(30f, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(20f, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(30f, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(true, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.ClosestSide, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -393,15 +393,15 @@ public void BackgroundImageRadialGradientFarthestSideLeftBottom()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsFalse(gradient.IsRepeating);
- Assert.AreEqual(Length.Zero, gradient.Position.X);
- Assert.AreEqual(Length.Full, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Zero, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Full, gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.FarthestSide, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -418,9 +418,9 @@ public void BackgroundImageRepeatingLinearGradientRedBlue()
Assert.IsTrue(gradient.IsRepeating);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("blue").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("red").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("blue").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -435,15 +435,15 @@ public void BackgroundImageRepeatingRadialGradientRedBlue()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsTrue(gradient.IsRepeating);
- Assert.AreEqual(Length.Half, gradient.Position.X);
- Assert.AreEqual(Length.Half, gradient.Position.Y);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.X);
+ Assert.AreEqual(CssLengthValue.Half, gradient.Position.Y);
Assert.AreEqual(false, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("blue").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("red").Value, stops[2].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("blue").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[2]).Color);
}
[Test]
@@ -458,17 +458,17 @@ public void BackgroundImageRepeatingRadialGradientFunky()
Assert.AreEqual(1, value.Items.Length);
var gradient = value.Items[0] as CssRadialGradientValue;
Assert.IsTrue(gradient.IsRepeating);
- Assert.AreEqual(new Length(20f, Length.Unit.Px), gradient.Position.X);
- Assert.AreEqual(new Length(30f, Length.Unit.Px), gradient.Position.Y);
+ Assert.AreEqual(new CssLengthValue(20f, CssLengthValue.Unit.Px), gradient.Position.X);
+ Assert.AreEqual(new CssLengthValue(30f, CssLengthValue.Unit.Px), gradient.Position.Y);
Assert.AreEqual(true, gradient.IsCircle);
Assert.AreEqual(CssRadialGradientValue.SizeMode.ClosestSide, gradient.Mode);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(5, stops.Length);
- Assert.AreEqual(Color.FromName("red").Value, stops[0].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[1].Color);
- Assert.AreEqual(Color.FromName("green").Value, stops[2].Color);
- Assert.AreEqual(Color.FromName("yellow").Value, stops[3].Color);
- Assert.AreEqual(Color.FromName("red").Value, stops[4].Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[0]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[1]).Color);
+ Assert.AreEqual(CssColorValue.FromName("green").Value, ((CssGradientStopValue)stops[2]).Color);
+ Assert.AreEqual(CssColorValue.FromName("yellow").Value, ((CssGradientStopValue)stops[3]).Color);
+ Assert.AreEqual(CssColorValue.FromName("red").Value, ((CssGradientStopValue)stops[4]).Color);
}
}
}
diff --git a/src/AngleSharp.Css.Tests/Values/UnitConversion.cs b/src/AngleSharp.Css.Tests/Values/UnitConversion.cs
index b4db576a..59eeeccd 100644
--- a/src/AngleSharp.Css.Tests/Values/UnitConversion.cs
+++ b/src/AngleSharp.Css.Tests/Values/UnitConversion.cs
@@ -11,19 +11,19 @@ public class UnitConversionTests
public void LengthParseCorrectPxValue()
{
var s = "12px";
- var v = default(Length);
- var r = Length.TryParse(s, out v);
+ var v = default(CssLengthValue);
+ var r = CssLengthValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(12f, v.Value);
- Assert.AreEqual(Length.Unit.Px, v.Type);
+ Assert.AreEqual(CssLengthValue.Unit.Px, v.Type);
}
[Test]
public void LengthParseIncorrectValue()
{
var s = "123.5";
- var v = default(Length);
- var r = Length.TryParse(s, out v);
+ var v = default(CssLengthValue);
+ var r = CssLengthValue.TryParse(s, out v);
Assert.IsFalse(r);
}
@@ -31,17 +31,17 @@ public void LengthParseIncorrectValue()
public void LengthParseCorrectVwValue()
{
var s = "12.2vw";
- var v = default(Length);
- var r = Length.TryParse(s, out v);
+ var v = default(CssLengthValue);
+ var r = CssLengthValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(12.2, v.Value);
- Assert.AreEqual(Length.Unit.Vw, v.Type);
+ Assert.AreEqual(CssLengthValue.Unit.Vw, v.Type);
}
[Test]
public void LengthToPixelsPercentThrowsOnInvalidRenderDimensions()
{
- var l = new Length(50, Length.Unit.Percent);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Percent);
var renderDevice = new DefaultRenderDevice();
Assert.Throws(() => l.ToPixel(renderDevice, RenderMode.Undefined));
Assert.Throws(() => l.ToPixel(null, RenderMode.Undefined));
@@ -50,7 +50,7 @@ public void LengthToPixelsPercentThrowsOnInvalidRenderDimensions()
[Test]
public void LengthToPixelsEmThrowsOnInvalidRenderDimensions()
{
- var l = new Length(50, Length.Unit.Em);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Em);
var renderDevice = new DefaultRenderDevice { FontSize = 0 };
Assert.Throws(() => l.ToPixel(renderDevice, RenderMode.Undefined));
Assert.Throws(() => l.ToPixel(null, RenderMode.Undefined));
@@ -59,7 +59,7 @@ public void LengthToPixelsEmThrowsOnInvalidRenderDimensions()
[Test]
public void LengthToPixelsCorrectPercentWidth()
{
- var l = new Length(50, Length.Unit.Percent);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Percent);
var renderDevice = new DefaultRenderDevice {ViewPortWidth = 500};
Assert.AreEqual(250, l.ToPixel(renderDevice, RenderMode.Horizontal));
}
@@ -67,7 +67,7 @@ public void LengthToPixelsCorrectPercentWidth()
[Test]
public void LengthToPixelsCorrectPercentHeight()
{
- var l = new Length(25, Length.Unit.Percent);
+ var l = new CssLengthValue(25, CssLengthValue.Unit.Percent);
var renderDevice = new DefaultRenderDevice {ViewPortHeight = 600};
Assert.AreEqual(150, l.ToPixel(renderDevice, RenderMode.Vertical));
}
@@ -75,7 +75,7 @@ public void LengthToPixelsCorrectPercentHeight()
[Test]
public void LengthToPixelsCorrectRem()
{
- var l = new Length(25, Length.Unit.Rem);
+ var l = new CssLengthValue(25, CssLengthValue.Unit.Rem);
var renderDevice = new DefaultRenderDevice {FontSize = 10};
Assert.AreEqual(250, l.ToPixel(renderDevice, RenderMode.Undefined));
}
@@ -83,7 +83,7 @@ public void LengthToPixelsCorrectRem()
[Test]
public void LengthToPixelsCorrectEm()
{
- var l = new Length(10, Length.Unit.Em);
+ var l = new CssLengthValue(10, CssLengthValue.Unit.Em);
var renderDevice = new DefaultRenderDevice {FontSize = 10};
Assert.AreEqual(100, l.ToPixel(renderDevice, RenderMode.Undefined));
}
@@ -91,7 +91,7 @@ public void LengthToPixelsCorrectEm()
[Test]
public void LengthToPixelsCorrectVh()
{
- var l = new Length(10, Length.Unit.Vh);
+ var l = new CssLengthValue(10, CssLengthValue.Unit.Vh);
var renderDevice = new DefaultRenderDevice {ViewPortHeight = 1000};
Assert.AreEqual(100, l.ToPixel(renderDevice, RenderMode.Undefined));
}
@@ -99,7 +99,7 @@ public void LengthToPixelsCorrectVh()
[Test]
public void LengthToPixelsCorrectVw()
{
- var l = new Length(20, Length.Unit.Vw);
+ var l = new CssLengthValue(20, CssLengthValue.Unit.Vw);
var renderDevice = new DefaultRenderDevice {ViewPortWidth = 1000};
Assert.AreEqual(200, l.ToPixel(renderDevice, RenderMode.Undefined));
}
@@ -107,7 +107,7 @@ public void LengthToPixelsCorrectVw()
[Test]
public void LengthToPixelsCorrectVmax()
{
- var l = new Length(20, Length.Unit.Vmax);
+ var l = new CssLengthValue(20, CssLengthValue.Unit.Vmax);
var renderDevice = new DefaultRenderDevice
{
ViewPortHeight = 1000,
@@ -119,7 +119,7 @@ public void LengthToPixelsCorrectVmax()
[Test]
public void LengthToPixelsCorrectVmin()
{
- var l = new Length(20, Length.Unit.Vmin);
+ var l = new CssLengthValue(20, CssLengthValue.Unit.Vmin);
var renderDevice = new DefaultRenderDevice
{
ViewPortHeight = 1000,
@@ -131,125 +131,125 @@ public void LengthToPixelsCorrectVmin()
[Test]
public void LengthToPercentCorrectWidth()
{
- var l = new Length(100, Length.Unit.Px);
+ var l = new CssLengthValue(100, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {ViewPortWidth = 500};
- Assert.AreEqual(20, l.To(Length.Unit.Percent, renderDevice, RenderMode.Horizontal));
+ Assert.AreEqual(20, l.To(CssLengthValue.Unit.Percent, renderDevice, RenderMode.Horizontal));
}
[Test]
public void LengthToPercentCorrectHeight()
{
- var l = new Length(100, Length.Unit.Px);
+ var l = new CssLengthValue(100, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {ViewPortHeight = 1000};
- Assert.AreEqual(10, l.To(Length.Unit.Percent, renderDevice, RenderMode.Vertical));
+ Assert.AreEqual(10, l.To(CssLengthValue.Unit.Percent, renderDevice, RenderMode.Vertical));
}
[Test]
public void LengthToRemCorrectValue()
{
- var l = new Length(100, Length.Unit.Px);
+ var l = new CssLengthValue(100, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {FontSize = 16};
- Assert.AreEqual(6.25d, l.To(Length.Unit.Rem, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(6.25d, l.To(CssLengthValue.Unit.Rem, renderDevice, RenderMode.Undefined));
}
[Test]
public void LengthToEmCorrectValue()
{
- var l = new Length(1600, Length.Unit.Px);
+ var l = new CssLengthValue(1600, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {FontSize = 16};
- Assert.AreEqual(100, l.To(Length.Unit.Em, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(100, l.To(CssLengthValue.Unit.Em, renderDevice, RenderMode.Undefined));
}
[Test]
public void LengthToVhCorrectValue()
{
- var l = new Length(100, Length.Unit.Px);
+ var l = new CssLengthValue(100, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {ViewPortHeight = 1000};
- Assert.AreEqual(10, l.To(Length.Unit.Vh, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(10, l.To(CssLengthValue.Unit.Vh, renderDevice, RenderMode.Undefined));
}
[Test]
public void LengthToVwCorrectValue()
{
- var l = new Length(50, Length.Unit.Px);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice {ViewPortWidth = 1000};
- Assert.AreEqual(5, l.To(Length.Unit.Vw, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(5, l.To(CssLengthValue.Unit.Vw, renderDevice, RenderMode.Undefined));
}
[Test]
public void LengthToVmaxCorrectValue()
{
- var l = new Length(50, Length.Unit.Px);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice
{
ViewPortWidth = 1000,
ViewPortHeight = 500
};
- Assert.AreEqual(5, l.To(Length.Unit.Vmax, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(5, l.To(CssLengthValue.Unit.Vmax, renderDevice, RenderMode.Undefined));
}
[Test]
public void LengthToVminCorrectValue()
{
- var l = new Length(50, Length.Unit.Px);
+ var l = new CssLengthValue(50, CssLengthValue.Unit.Px);
var renderDevice = new DefaultRenderDevice
{
ViewPortWidth = 1000,
ViewPortHeight = 500
};
- Assert.AreEqual(10, l.To(Length.Unit.Vmin, renderDevice, RenderMode.Undefined));
+ Assert.AreEqual(10, l.To(CssLengthValue.Unit.Vmin, renderDevice, RenderMode.Undefined));
}
[Test]
public void AngleParseCorrectDegValue()
{
var s = "1.35e2deg";
- var v = default(Angle);
- var r = Angle.TryParse(s, out v);
+ var v = default(CssAngleValue);
+ var r = CssAngleValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(135f, v.Value);
- Assert.AreEqual(Angle.Unit.Deg, v.Type);
+ Assert.AreEqual(CssAngleValue.Unit.Deg, v.Type);
}
[Test]
public void ResolutionParseCorrectDpiValue()
{
var s = "-24.0dpi";
- var v = default(Resolution);
- var r = Resolution.TryParse(s, out v);
+ var v = default(CssResolutionValue);
+ var r = CssResolutionValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(-24f, v.Value);
- Assert.AreEqual(Resolution.Unit.Dpi, v.Type);
+ Assert.AreEqual(CssResolutionValue.Unit.Dpi, v.Type);
}
[Test]
public void FrequencyParseCorrectKhzValue()
{
var s = "17.123khz";
- var v = default(Frequency);
- var r = Frequency.TryParse(s, out v);
+ var v = default(CssFrequencyValue);
+ var r = CssFrequencyValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(17.123, v.Value);
- Assert.AreEqual(Frequency.Unit.Khz, v.Type);
+ Assert.AreEqual(CssFrequencyValue.Unit.Khz, v.Type);
}
[Test]
public void TimeParseCorrectSecondsValue()
{
var s = "0s";
- var v = default(Time);
- var r = Time.TryParse(s, out v);
+ var v = default(CssTimeValue);
+ var r = CssTimeValue.TryParse(s, out v);
Assert.IsTrue(r);
Assert.AreEqual(0f, v.Value);
- Assert.AreEqual(Time.Unit.S, v.Type);
+ Assert.AreEqual(CssTimeValue.Unit.S, v.Type);
}
[Test]
public void AngleParseIncorrectValue()
{
var s = "123.deg";
- var v = default(Angle);
- var r = Angle.TryParse(s, out v);
+ var v = default(CssAngleValue);
+ var r = CssAngleValue.TryParse(s, out v);
Assert.IsFalse(r);
}
}
diff --git a/src/AngleSharp.Css.nuspec b/src/AngleSharp.Css.nuspec
index ae1d28b0..78a98a3e 100644
--- a/src/AngleSharp.Css.nuspec
+++ b/src/AngleSharp.Css.nuspec
@@ -6,16 +6,17 @@
AngleSharp
Florian Rappl
MIT
+
https://anglesharp.github.io
logo.png
README.md
false
Extends the CSSOM from the core AngleSharp library.
https://github.com/AngleSharp/AngleSharp.Css/blob/main/CHANGELOG.md
- Copyright 2016-2023, AngleSharp
+ Copyright 2016-2025, AngleSharp
html html5 css css3 dom styling library anglesharp angle
-
+
diff --git a/src/AngleSharp.Css.sln b/src/AngleSharp.Css.sln
index ce2248b2..a46c8c7c 100644
--- a/src/AngleSharp.Css.sln
+++ b/src/AngleSharp.Css.sln
@@ -16,10 +16,11 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{988B2C40-782B-4128-9551-7AE65B60F903}"
ProjectSection(SolutionItems) = preProject
AngleSharp.Css.nuspec = AngleSharp.Css.nuspec
- ..\build.cake = ..\build.cake
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "..\nuke\_build.csproj", "{B82798E2-2766-4C1E-860C-136F4B3B1185}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -46,6 +47,8 @@ Global
{37F366DB-78D6-485F-9D8C-7C65A4B0186D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37F366DB-78D6-485F-9D8C-7C65A4B0186D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37F366DB-78D6-485F-9D8C-7C65A4B0186D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B82798E2-2766-4C1E-860C-136F4B3B1185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B82798E2-2766-4C1E-860C-136F4B3B1185}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/AngleSharp.Css/AngleSharp.Css.csproj b/src/AngleSharp.Css/AngleSharp.Css.csproj
index 5422d00f..b71d6bc0 100644
--- a/src/AngleSharp.Css/AngleSharp.Css.csproj
+++ b/src/AngleSharp.Css/AngleSharp.Css.csproj
@@ -1,9 +1,9 @@
-
+
AngleSharp.Css
AngleSharp.Css
- netstandard2.0;net6.0;net7.0
- netstandard2.0;net461;net472;net6.0;net7.0
+ netstandard2.0;net6.0;net7.0;net8.0
+ netstandard2.0;net461;net472;net6.0;net7.0;net8.0
true
Key.snk
true
@@ -21,7 +21,7 @@
-
+
diff --git a/src/AngleSharp.Css/Constants/CssKeywords.cs b/src/AngleSharp.Css/Constants/CssKeywords.cs
index b2087620..775680b3 100644
--- a/src/AngleSharp.Css/Constants/CssKeywords.cs
+++ b/src/AngleSharp.Css/Constants/CssKeywords.cs
@@ -27,6 +27,26 @@ public static class CssKeywords
///
public static readonly String Clip = "clip";
+ ///
+ /// The cyclic keyword.
+ ///
+ public static readonly String Cyclic = "cyclic";
+
+ ///
+ /// The numeric keyword.
+ ///
+ public static readonly String Numeric = "numeric";
+
+ ///
+ /// The alphabetic keyword.
+ ///
+ public static readonly String Alphabetic = "alphabetic";
+
+ ///
+ /// The symbolic keyword.
+ ///
+ public static readonly String Symbolic = "symbolic";
+
///
/// The legacy keyword.
///
@@ -37,6 +57,11 @@ public static class CssKeywords
///
public static readonly String Normal = "normal";
+ ///
+ /// The arabic-indic keyword.
+ ///
+ public static readonly String ArabicIndic = "arabic-indic";
+
///
/// The pre keyword.
///
@@ -97,6 +122,16 @@ public static class CssKeywords
///
public static readonly String InterCharacter = "inter-character";
+ ///
+ /// The katakana keyword.
+ ///
+ public static readonly String Katakana = "katakana";
+
+ ///
+ /// The katakana-iroha keyword.
+ ///
+ public static readonly String KatakanaIroha = "katakana-iroha";
+
///
/// The kashida keyword.
///
@@ -667,6 +702,11 @@ public static class CssKeywords
///
public static readonly String Justify = "justify";
+ ///
+ /// The justify-all keyword.
+ ///
+ public static readonly String JustifyAll = "justify-all";
+
///
/// The underline keyword.
///
@@ -1127,16 +1167,101 @@ public static class CssKeywords
///
public static readonly String UpperLatin = "upper-latin";
+ ///
+ /// The malayalam keyword.
+ ///
+ public static readonly String Malayalam = "malayalam";
+
+ ///
+ /// The myanmar keyword.
+ ///
+ public static readonly String Myanmar = "myanmar";
+
+ ///
+ /// The mongolian keyword.
+ ///
+ public static readonly String Mongolian = "mongolian";
+
+ ///
+ /// The oriya keyword.
+ ///
+ public static readonly String Oriya = "oriya";
+
+ ///
+ /// The persian keyword.
+ ///
+ public static readonly String Persian = "persian";
+
+ ///
+ /// The tamil keyword.
+ ///
+ public static readonly String Tamil = "tamil";
+
+ ///
+ /// The thai keyword.
+ ///
+ public static readonly String Thai = "thai";
+
+ ///
+ /// The telugu keyword.
+ ///
+ public static readonly String Telugu = "telugu";
+
+ ///
+ /// The lao keyword.
+ ///
+ public static readonly String Lao = "lao";
+
+ ///
+ /// The tibetan keyword.
+ ///
+ public static readonly String Tibetan = "tibetan";
+
+ ///
+ /// The trad-chinese-formal keyword.
+ ///
+ public static readonly String TradChineseFormal = "trad-chinese-formal";
+
+ ///
+ /// The trad-chinese-informal keyword.
+ ///
+ public static readonly String TradChineseInformal = "trad-chinese-informal";
+
///
/// The armenian keyword.
///
public static readonly String Armenian = "armenian";
+ ///
+ /// The lower-armenian keyword.
+ ///
+ public static readonly String LowerArmenian = "lower-armenian";
+
+ ///
+ /// The upper-armenian keyword.
+ ///
+ public static readonly String UpperArmenian = "upper-armenian";
+
///
/// The georgian keyword.
///
public static readonly String Georgian = "georgian";
+ ///
+ /// The kannada keyword.
+ ///
+ public static readonly String Kannada = "kannada";
+
+ ///
+ /// The disclosure-open keyword.
+ ///
+ public static readonly String DisclosureOpen = "disclosure-open";
+
+ ///
+ /// The disclosure-closed keyword.
+ ///
+ public static readonly String DisclosureClosed = "disclosure-closed";
+
///
/// The lower-alpha keyword.
///
@@ -1302,6 +1427,11 @@ public static class CssKeywords
///
public static readonly String Separate = "separate";
+ ///
+ /// The match-parent keyword.
+ ///
+ public static readonly String MatchParent = "match-parent";
+
///
/// The start keyword.
///
@@ -1317,6 +1447,106 @@ public static class CssKeywords
///
public static readonly String Fill = "fill";
+ ///
+ /// The cjk-decimal keyword.
+ ///
+ public static readonly String CjkDecimal = "cjk-decimal";
+
+ ///
+ /// The cjk-earthly-branch keyword.
+ ///
+ public static readonly String CjkEarthlyBranch = "cjk-earthly-branch";
+
+ ///
+ /// The cjk-heavenly-stem keyword.
+ ///
+ public static readonly String CjkHeavenlyStem = "cjk-heavenly-stem";
+
+ ///
+ /// The cjk-ideographic keyword.
+ ///
+ public static readonly String CjkIdeographic = "cjk-ideographic";
+
+ ///
+ /// The bengali keyword.
+ ///
+ public static readonly String Bengali = "bengali";
+
+ ///
+ /// The cambodian keyword.
+ ///
+ public static readonly String Cambodian = "cambodian";
+
+ ///
+ /// The devanagari keyword.
+ ///
+ public static readonly String Devanagari = "devanagari";
+
+ ///
+ /// The ethiopic-numeric keyword.
+ ///
+ public static readonly String EthiopicNumeric = "ethiopic-numeric";
+
+ ///
+ /// The gurmukhi keyword.
+ ///
+ public static readonly String Gurmukhi = "gurmukhi";
+
+ ///
+ /// The gujarati keyword.
+ ///
+ public static readonly String Gujarati = "gujarati";
+
+ ///
+ /// The hebrew keyword.
+ ///
+ public static readonly String Hebrew = "hebrew";
+
+ ///
+ /// The hiragana keyword.
+ ///
+ public static readonly String Hiragana = "hiragana";
+
+ ///
+ /// The hiragana-iroha keyword.
+ ///
+ public static readonly String HiraganaIroha = "hiragana-iroha";
+
+ ///
+ /// The japanese-formal keyword.
+ ///
+ public static readonly String JapaneseFormal = "japanese-formal";
+
+ ///
+ /// The japanese-informal keyword.
+ ///
+ public static readonly String JapaneseInformal = "japanese-informal";
+
+ ///
+ /// The simp-chinese-informal keyword.
+ ///
+ public static readonly String SimpChineseInformal = "simp-chinese-informal";
+
+ ///
+ /// The simp-chinese-formal keyword.
+ ///
+ public static readonly String SimpChineseFormal = "simp-chinese-formal";
+
+ ///
+ /// The korean-hangul-formal keyword.
+ ///
+ public static readonly String KoreanHangulFormal = "korean-hangul-formal";
+
+ ///
+ /// The korean-hanja-formal keyword.
+ ///
+ public static readonly String KoreanHanjaFormal = "korean-hanja-formal";
+
+ ///
+ /// The korean-hanja-informal keyword.
+ ///
+ public static readonly String KoreanHanjaInformal = "korean-hanja-informal";
+
///
/// The screen keyword.
///
diff --git a/src/AngleSharp.Css/Constants/FunctionNames.cs b/src/AngleSharp.Css/Constants/FunctionNames.cs
index dc0a98c5..207fd2df 100644
--- a/src/AngleSharp.Css/Constants/FunctionNames.cs
+++ b/src/AngleSharp.Css/Constants/FunctionNames.cs
@@ -57,6 +57,11 @@ public static class FunctionNames
///
public static readonly String Attr = "attr";
+ ///
+ /// The symbols function.
+ ///
+ public static readonly String Symbols = "symbols";
+
///
/// The fit-content function.
///
@@ -262,6 +267,26 @@ public static class FunctionNames
///
public static readonly String Hwba = "hwba";
+ ///
+ /// The LAB (Lightness, A-axis, B-axis) function.
+ ///
+ public static readonly String Lab = "lab";
+
+ ///
+ /// The LCH (Lightness, Chroma, Hue) function.
+ ///
+ public static readonly String Lch = "lch";
+
+ ///
+ /// The Oklab (Lightness, A-axis, B-axis) function.
+ ///
+ public static readonly String Oklab = "oklab";
+
+ ///
+ /// The Oklch (Lightness, Chroma, Hue) function.
+ ///
+ public static readonly String Oklch = "oklch";
+
///
/// The content function.
///
diff --git a/src/AngleSharp.Css/Constants/InitialValues.cs b/src/AngleSharp.Css/Constants/InitialValues.cs
index 6fa6a640..029691e5 100644
--- a/src/AngleSharp.Css/Constants/InitialValues.cs
+++ b/src/AngleSharp.Css/Constants/InitialValues.cs
@@ -10,204 +10,212 @@ namespace AngleSharp.Css
///
static class InitialValues
{
- public static readonly ICssValue ColorDecl = Color.Black;
- public static readonly ICssValue BackgroundColorDecl = Color.Transparent;
- public static readonly ICssValue BackgroundImageDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue BackgroundRepeatHorizontalDecl = new Identifier(CssKeywords.Repeat);
- public static readonly ICssValue BackgroundRepeatVerticalDecl = new Identifier(CssKeywords.Repeat);
+ public static readonly ICssValue ColorDecl = CssColorValue.Black;
+ public static readonly ICssValue BackgroundColorDecl = CssColorValue.Transparent;
+ public static readonly ICssValue BackgroundImageDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue BackgroundRepeatHorizontalDecl = new CssIdentifierValue(CssKeywords.Repeat);
+ public static readonly ICssValue BackgroundRepeatVerticalDecl = new CssIdentifierValue(CssKeywords.Repeat);
public static readonly ICssValue BackgroundRepeatDecl = new CssImageRepeatsValue(BackgroundRepeatHorizontalDecl, BackgroundRepeatVerticalDecl);
- public static readonly ICssValue BackgroundPositionXDecl = new Length(0, Length.Unit.Percent);
- public static readonly ICssValue BackgroundPositionYDecl = new Length(0, Length.Unit.Percent);
+ public static readonly ICssValue BackgroundPositionXDecl = new CssLengthValue(0, CssLengthValue.Unit.Percent);
+ public static readonly ICssValue BackgroundPositionYDecl = new CssLengthValue(0, CssLengthValue.Unit.Percent);
public static readonly ICssValue BackgroundPositionDecl = new CssTupleValue(new [] { BackgroundPositionXDecl, BackgroundPositionYDecl });
- public static readonly ICssValue BackgroundSizeDecl = new CssBackgroundSizeValue(new Constant(CssKeywords.Auto, Length.Auto), new Constant(CssKeywords.Auto, Length.Auto));
- public static readonly ICssValue BackgroundOriginDecl = new Constant(CssKeywords.BorderBox, BoxModel.PaddingBox);
- public static readonly ICssValue BackgroundClipDecl = new Constant(CssKeywords.BorderBox, BoxModel.BorderBox);
- public static readonly ICssValue BackgroundAttachmentDecl = new Constant(CssKeywords.Scroll, BackgroundAttachment.Scroll);
- public static readonly ICssValue BookmarkStateDecl = new Constant(CssKeywords.Open, BookmarkState.Open);
- public static readonly ICssValue BookmarkLabelDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue BookmarkLevelDecl = new Constant(CssKeywords.None, 0);
- public static readonly ICssValue FootnotePolicyDecl = new Constant(CssKeywords.Auto, FootnotePolicy.Auto);
- public static readonly ICssValue FootnoteDisplayDecl = new Constant(CssKeywords.Block, FootnoteDisplay.Block);
- public static readonly ICssValue RunningDecl = new Identifier(CssKeywords.None);
- public static readonly ICssValue StringSetDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue FontStyleDecl = new Constant(CssKeywords.Normal, FontStyle.Normal);
- public static readonly ICssValue FontVariantDecl = new Constant(CssKeywords.Normal, FontVariant.Normal);
- public static readonly ICssValue FontWeightDecl = new Constant(CssKeywords.Normal, FontWeight.Normal);
- public static readonly ICssValue FontStretchDecl = new Constant(CssKeywords.Normal, FontStretch.Normal);
- public static readonly ICssValue FontSizeDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue FontFamilyDecl = new Label("Times New Roman");
- public static readonly ICssValue BorderWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue BorderStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue BorderColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue LineHeightDecl = new Constant(CssKeywords.Normal, Length.Normal);
- public static readonly ICssValue BorderTopWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue BorderRightWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue BorderBottomWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue BorderLeftWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue BorderTopStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue BorderRightStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue BorderBottomStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue BorderLeftStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue BorderTopColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue BorderRightColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue BorderBottomColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue BorderLeftColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue ColumnWidthDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue ColumnCountDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue ColumnRuleWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue ColumnRuleStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue ColumnRuleColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue AnimationNameDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue AnimationDurationDecl = Time.Zero;
+ public static readonly ICssValue BackgroundSizeDecl = new CssBackgroundSizeValue(new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto), new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto));
+ public static readonly ICssValue BackgroundOriginDecl = new CssConstantValue(CssKeywords.BorderBox, BoxModel.PaddingBox);
+ public static readonly ICssValue BackgroundClipDecl = new CssConstantValue(CssKeywords.BorderBox, BoxModel.BorderBox);
+ public static readonly ICssValue BackgroundAttachmentDecl = new CssConstantValue(CssKeywords.Scroll, BackgroundAttachment.Scroll);
+ public static readonly ICssValue BookmarkStateDecl = new CssConstantValue(CssKeywords.Open, BookmarkState.Open);
+ public static readonly ICssValue BookmarkLabelDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue BookmarkLevelDecl = new CssConstantValue(CssKeywords.None, 0);
+ public static readonly ICssValue FootnotePolicyDecl = new CssConstantValue(CssKeywords.Auto, FootnotePolicy.Auto);
+ public static readonly ICssValue FootnoteDisplayDecl = new CssConstantValue(CssKeywords.Block, FootnoteDisplay.Block);
+ public static readonly ICssValue RunningDecl = new CssIdentifierValue(CssKeywords.None);
+ public static readonly ICssValue StringSetDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue FontStyleDecl = new CssConstantValue(CssKeywords.Normal, FontStyle.Normal);
+ public static readonly ICssValue FontVariantDecl = new CssConstantValue(CssKeywords.Normal, FontVariant.Normal);
+ public static readonly ICssValue FontWeightDecl = new CssConstantValue(CssKeywords.Normal, FontWeight.Normal);
+ public static readonly ICssValue FontStretchDecl = new CssConstantValue(CssKeywords.Normal, FontStretch.Normal);
+ public static readonly ICssValue FontSizeDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue FontFamilyDecl = new CssStringValue("Times New Roman");
+ public static readonly ICssValue BorderWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue BorderStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue BorderColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue LineHeightDecl = new CssConstantValue(CssKeywords.Normal, CssLengthValue.Normal);
+ public static readonly ICssValue BorderTopWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue BorderRightWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue BorderBottomWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue BorderLeftWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue BorderTopStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue BorderRightStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue BorderBottomStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue BorderLeftStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue BorderTopColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue BorderRightColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue BorderBottomColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue BorderLeftColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue ColumnWidthDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue ColumnCountDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue ColumnRuleWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue ColumnRuleStyleDecl = new CssConstantValue(CssKeywords.None, LineStyle.None);
+ public static readonly ICssValue ColumnRuleColorDecl = new CssConstantValue(CssKeywords.CurrentColor, CssColorValue.CurrentColor);
+ public static readonly ICssValue AnimationNameDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue AnimationDurationDecl = CssTimeValue.Zero;
public static readonly ICssValue AnimationTimingFunctionDecl = CssCubicBezierValue.Ease;
- public static readonly ICssValue AnimationDelayDecl = Time.Zero;
- public static readonly ICssValue AnimationIterationCountDecl = new Length(1, Length.Unit.None);
- public static readonly ICssValue AnimationDirectionDecl = new Constant(CssKeywords.Normal, AnimationDirection.Normal);
- public static readonly ICssValue AnimationFillModeDecl = new Constant(CssKeywords.None, AnimationFillStyle.None);
- public static readonly ICssValue AnimationPlayStateDecl = new Constant(CssKeywords.Running, PlayState.Running);
- public static readonly ICssValue TransitionDelayDecl = Time.Zero;
- public static readonly ICssValue TransitionDurationDecl = Time.Zero;
- public static readonly ICssValue TransitionPropertyDecl = new Identifier(CssKeywords.All);
+ public static readonly ICssValue AnimationDelayDecl = CssTimeValue.Zero;
+ public static readonly ICssValue AnimationIterationCountDecl = new CssLengthValue(1, CssLengthValue.Unit.None);
+ public static readonly ICssValue AnimationDirectionDecl = new CssConstantValue(CssKeywords.Normal, AnimationDirection.Normal);
+ public static readonly ICssValue AnimationFillModeDecl = new CssConstantValue(CssKeywords.None, AnimationFillStyle.None);
+ public static readonly ICssValue AnimationPlayStateDecl = new CssConstantValue(CssKeywords.Running, PlayState.Running);
+ public static readonly ICssValue TransitionDelayDecl = CssTimeValue.Zero;
+ public static readonly ICssValue TransitionDurationDecl = CssTimeValue.Zero;
+ public static readonly ICssValue TransitionPropertyDecl = new CssIdentifierValue(CssKeywords.All);
public static readonly ICssValue TransitionTimingFunctionDecl = CssCubicBezierValue.Ease;
- public static readonly ICssValue DirectionDecl = new Constant(CssKeywords.Ltr, DirectionMode.Ltr);
- public static readonly ICssValue EmptyCellsDecl = new Constant(CssKeywords.Show, true);
- public static readonly ICssValue FlexGrowDecl = new Length(0, Length.Unit.None);
- public static readonly ICssValue FlexShrinkDecl = new Length(1, Length.Unit.None);
- public static readonly ICssValue FlexBasisDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue FlexWrapDecl = new Constant(CssKeywords.Nowrap, FlexWrapMode.NoWrap);
- public static readonly ICssValue FlexDirectionDecl = new Constant(CssKeywords.Row, FlexDirection.Row);
- public static readonly ICssValue FloatDecl = new Constant(CssKeywords.None, Floating.None);
- public static readonly ICssValue BorderSpacingDecl = Length.Zero;
- public static readonly ICssValue BoxDecorationBreakDecl = new Constant(CssKeywords.Slice, false);
- public static readonly ICssValue BoxShadowDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue BoxSizingDecl = new Constant(CssKeywords.ContentBox, BoxModel.ContentBox);
- public static readonly ICssValue BreakAfterDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue BreakBeforeDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue BreakInsideDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue PageBreakInsideDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue PageBreakBeforeDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue PageBreakAfterDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue BottomDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue TopDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue LeftDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue RightDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue MinHeightDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue MinWidthDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue MaxHeightDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue MaxWidthDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue MarginLeftDecl = Length.Zero;
- public static readonly ICssValue MarginBottomDecl = Length.Zero;
- public static readonly ICssValue MarginRightDecl = Length.Zero;
- public static readonly ICssValue MarginTopDecl = Length.Zero;
- public static readonly ICssValue PaddingLeftDecl = Length.Zero;
- public static readonly ICssValue PaddingBottomDecl = Length.Zero;
- public static readonly ICssValue PaddingRightDecl = Length.Zero;
- public static readonly ICssValue PaddingTopDecl = Length.Zero;
- public static readonly ICssValue CaptionSideDecl = new Constant(CssKeywords.Top, true);
- public static readonly ICssValue CursorDecl = new Constant(CssKeywords.Auto, SystemCursor.Auto);
- public static readonly ICssValue OverflowWrapDecl = new Constant(CssKeywords.Normal, OverflowWrap.Normal);
- public static readonly ICssValue WordSpacingDecl = new Constant(CssKeywords.Normal, Length.Normal);
- public static readonly ICssValue WordBreakDecl = new Constant(CssKeywords.Normal, WordBreak.Normal);
- public static readonly ICssValue VisibilityDecl = new Constant(CssKeywords.Visible, Visibility.Visible);
- public static readonly ICssValue VerticalAlignDecl = new Constant(CssKeywords.Baseline, VerticalAlignment.Baseline);
- public static readonly ICssValue OpacityDecl = new Length(1.0, Length.Unit.None);
- public static readonly ICssValue OverflowDecl = new Constant(CssKeywords.Visible, OverflowMode.Visible);
- public static readonly ICssValue OutlineWidthDecl = new Constant(CssKeywords.Medium, Length.Medium);
- public static readonly ICssValue OutlineStyleDecl = new Constant(CssKeywords.None, LineStyle.None);
- public static readonly ICssValue OutlineColorDecl = new Constant(CssKeywords.Invert, Color.InvertedColor);
- public static readonly ICssValue TextTransformDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue TextShadowDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue TextRenderingDecl = new Constant(CssKeywords.Auto, null);
- public static readonly ICssValue TextOverflowDecl = new Constant(CssKeywords.Auto, OverflowMode.Clip);
- public static readonly ICssValue TextOrientationDecl = new Constant(CssKeywords.Mixed, null);
- public static readonly ICssValue TextJustifyDecl = new Constant(CssKeywords.Auto, TextJustify.Auto);
- public static readonly ICssValue TextIndentDecl = Length.Zero;
- public static readonly ICssValue TextAlignDecl = new Constant(CssKeywords.Left, HorizontalAlignment.Left);
- public static readonly ICssValue TextAlignLastDecl = new Constant(CssKeywords.Auto, TextAlignLast.Auto);
- public static readonly ICssValue TextDecorationLineDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue TextDecorationStyleDecl = new Constant(CssKeywords.Solid, LineStyle.Solid);
- public static readonly ICssValue TextDecorationColorDecl = new Constant(CssKeywords.CurrentColor, Color.CurrentColor);
- public static readonly ICssValue TextAnchorDecl = new Constant(CssKeywords.Start, TextAnchor.Start);
- public static readonly ICssValue ListStyleTypeDecl = new Constant(CssKeywords.Disc, ListStyle.Disc);
- public static readonly ICssValue ListStylePositionDecl = new Constant(CssKeywords.Outside, ListPosition.Outside);
- public static readonly ICssValue ListStyleImageDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue LineBreakDecl = new Constant(CssKeywords.Auto, BreakMode.Auto);
- public static readonly ICssValue GridTemplateRowsDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue GridTemplateColumnsDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue GridTemplateAreasDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue GridAutoRowsDecl = new Constant(CssKeywords.Auto, null);
- public static readonly ICssValue GridAutoColumnsDecl = new Constant(CssKeywords.Auto, null);
- public static readonly ICssValue GridAutoFlowDecl = new Constant(CssKeywords.Row, false);
- public static readonly ICssValue GridColumnGapDecl = Length.Zero;
- public static readonly ICssValue GridRowGapDecl = Length.Zero;
- public static readonly ICssValue ColumnGapDecl = new Constant(CssKeywords.Normal, Length.Normal);
- public static readonly ICssValue RowGapDecl = new Constant(CssKeywords.Normal, Length.Normal);
- public static readonly ICssValue PerspectiveDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue PerspectiveOriginDecl = Point.Center;
- public static readonly ICssValue PositionDecl = new Constant(CssKeywords.Inline, PositionMode.Static);
- public static readonly ICssValue TransformDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue TransformStyleDecl = new Constant(CssKeywords.Flat, true);
- public static readonly ICssValue TransformOriginDecl = Point.Center;
- public static readonly ICssValue TableLayoutDecl = new Constant(CssKeywords.Auto, false);
- public static readonly ICssValue ClearDecl = new Constant(CssKeywords.None, ClearMode.None);
- public static readonly ICssValue ClipDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue StrokeOpacityDecl = new Length(1.0, Length.Unit.None);
- public static readonly ICssValue StrokeLinecapDecl = new Constant(CssKeywords.Butt, StrokeLinecap.Butt);
- public static readonly ICssValue StrokeLinejoinDecl = new Constant(CssKeywords.Miter, StrokeLinejoin.Miter);
- public static readonly ICssValue StrokeDashoffsetDecl = Length.Zero;
- public static readonly ICssValue StrokeDasharrayDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue StrokeWidthDecl = new Length(1.0, Length.Unit.Px);
- public static readonly ICssValue StrokeMiterlimitDecl = new Length(1.0, Length.Unit.None);
- public static readonly ICssValue RubyPositionDecl = new Constant(CssKeywords.Over, RubyPosition.Over);
- public static readonly ICssValue RubyOverhangDecl = new Constant(CssKeywords.None, RubyOverhangMode.None);
- public static readonly ICssValue RubyAlignDecl = new Constant(CssKeywords.SpaceAround, RubyAlignment.SpaceAround);
- public static readonly ICssValue ResizeDecl = new Constant(CssKeywords.None, ResizeMode.None);
- public static readonly ICssValue QuotesDecl = new Quote("«", "»");
- public static readonly ICssValue PointerEventsDecl = new Constant(CssKeywords.Auto, PointerEvent.Auto);
- public static readonly ICssValue ContentDecl = new Constant(CssKeywords.Normal, null);
- public static readonly ICssValue ContentVisibilityDecl = new Constant(CssKeywords.Visible, Visibility.Visible);
- public static readonly ICssValue CounterIncrementDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue CounterResetDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue DisplayDecl = new Constant(CssKeywords.Inline, DisplayMode.Inline);
- public static readonly ICssValue ColumnFillDecl = new Constant(CssKeywords.Balance, true);
- public static readonly ICssValue ColumnSpanDecl = new Constant(CssKeywords.None, false);
- public static readonly ICssValue BackfaceVisibilityDecl = new Constant(CssKeywords.Visible, Visibility.Visible);
- public static readonly ICssValue BorderImageSourceDecl = new Constant(CssKeywords.None, null);
- public static readonly ICssValue BorderImageSliceDecl = Length.Full;
- public static readonly ICssValue BorderImageWidthDecl = new Length(1, Length.Unit.None);
- public static readonly ICssValue BorderImageOutsetDecl = Length.Zero;
- public static readonly ICssValue BorderImageRepeatDecl = new Constant(CssKeywords.Stretch, BorderRepeat.Stretch);
- public static readonly ICssValue BorderCollapseDecl = new Constant(CssKeywords.Separate, true);
- public static readonly ICssValue BorderRadiusDecl = Length.Zero;
- public static readonly ICssValue AlignSelfDecl = new Constant(CssKeywords.Auto, FlexContentMode.Auto);
- public static readonly ICssValue AlignItemsDecl = new Constant(CssKeywords.Normal, FlexContentMode.Stretch);
- public static readonly ICssValue AlignContentDecl = new Constant(CssKeywords.Normal, FlexContentMode.Stretch);
- public static readonly ICssValue JustifyContentDecl = new Constant(CssKeywords.Normal, null);
- public static readonly ICssValue JustifyItemsDecl = new Constant(CssKeywords.Legacy, null);
- public static readonly ICssValue JustifySelfDecl = new Constant(CssKeywords.Auto, FlexContentMode.Auto);
- public static readonly ICssValue UnicodeBidiDecl = new Constant(CssKeywords.Normal, UnicodeMode.Normal);
- public static readonly ICssValue WordWrapDecl = new Constant(CssKeywords.Normal, OverflowWrap.Normal);
- public static readonly ICssValue WidowsDecl = new Length(2, Length.Unit.None);
- public static readonly ICssValue OrphansDecl = new Length(2, Length.Unit.None);
- public static readonly ICssValue OrderDecl = new Length(0, Length.Unit.None);
- public static readonly ICssValue ObjectFitDecl = new Constant(CssKeywords.Fill, ObjectFitting.Fill);
- public static readonly ICssValue ObjectPositionDecl = Point.Center;
- public static readonly ICssValue WhiteSpaceDecl = new Constant(CssKeywords.Normal, Whitespace.Normal);
- public static readonly ICssValue ZIndexDecl = new Constant(CssKeywords.Auto, Length.Auto);
- public static readonly ICssValue WidthDecl = Length.Auto;
- public static readonly ICssValue HeightDecl = Length.Auto;
+ public static readonly ICssValue DirectionDecl = new CssConstantValue(CssKeywords.Ltr, DirectionMode.Ltr);
+ public static readonly ICssValue EmptyCellsDecl = new CssConstantValue(CssKeywords.Show, true);
+ public static readonly ICssValue FlexGrowDecl = new CssLengthValue(0, CssLengthValue.Unit.None);
+ public static readonly ICssValue FlexShrinkDecl = new CssLengthValue(1, CssLengthValue.Unit.None);
+ public static readonly ICssValue FlexBasisDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue FlexWrapDecl = new CssConstantValue(CssKeywords.Nowrap, FlexWrapMode.NoWrap);
+ public static readonly ICssValue FlexDirectionDecl = new CssConstantValue(CssKeywords.Row, FlexDirection.Row);
+ public static readonly ICssValue FloatDecl = new CssConstantValue(CssKeywords.None, Floating.None);
+ public static readonly ICssValue BorderSpacingDecl = CssLengthValue.Zero;
+ public static readonly ICssValue BoxDecorationBreakDecl = new CssConstantValue(CssKeywords.Slice, false);
+ public static readonly ICssValue BoxShadowDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue BoxSizingDecl = new CssConstantValue(CssKeywords.ContentBox, BoxModel.ContentBox);
+ public static readonly ICssValue BreakAfterDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue BreakBeforeDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue BreakInsideDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue PageBreakInsideDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue PageBreakBeforeDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue PageBreakAfterDecl = new CssConstantValue(CssKeywords.Auto, BreakMode.Auto);
+ public static readonly ICssValue BottomDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue TopDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue LeftDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue RightDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue MinHeightDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue MinWidthDecl = new CssConstantValue(CssKeywords.Auto, CssLengthValue.Auto);
+ public static readonly ICssValue MaxHeightDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue MaxWidthDecl = new CssConstantValue(CssKeywords.None, null);
+ public static readonly ICssValue MarginBlockEndDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginBlockStartDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginInlineEndDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginInlineStartDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginLeftDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginBottomDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginRightDecl = CssLengthValue.Zero;
+ public static readonly ICssValue MarginTopDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingBlockEndDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingBlockStartDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingInlineEndDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingInlineStartDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingLeftDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingBottomDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingRightDecl = CssLengthValue.Zero;
+ public static readonly ICssValue PaddingTopDecl = CssLengthValue.Zero;
+ public static readonly ICssValue CaptionSideDecl = new CssConstantValue(CssKeywords.Top, true);
+ public static readonly ICssValue CursorDecl = new CssConstantValue(CssKeywords.Auto, SystemCursor.Auto);
+ public static readonly ICssValue OverflowWrapDecl = new CssConstantValue(CssKeywords.Normal, OverflowWrap.Normal);
+ public static readonly ICssValue WordSpacingDecl = new CssConstantValue(CssKeywords.Normal, CssLengthValue.Normal);
+ public static readonly ICssValue WordBreakDecl = new CssConstantValue(CssKeywords.Normal, WordBreak.Normal);
+ public static readonly ICssValue VisibilityDecl = new CssConstantValue(CssKeywords.Visible, Visibility.Visible);
+ public static readonly ICssValue VerticalAlignDecl = new CssConstantValue(CssKeywords.Baseline, VerticalAlignment.Baseline);
+ public static readonly ICssValue OpacityDecl = new CssLengthValue(1.0, CssLengthValue.Unit.None);
+ public static readonly ICssValue OverflowDecl = new CssConstantValue(CssKeywords.Visible, OverflowMode.Visible);
+ public static readonly ICssValue OutlineWidthDecl = new CssConstantValue(CssKeywords.Medium, CssLengthValue.Medium);
+ public static readonly ICssValue OutlineStyleDecl = new CssConstantValue