diff --git a/CHANGELOG.md b/CHANGELOG.md
index 66477500..eb3042da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,28 @@
+# 0.12.0
+
+Released on Sunday, May 12 2019.
+
+- Reference latest AngleSharp
+- Fixed empty value when removing properties (#14)
+- Returns `null` in `GetStyle` if CSS not configured (#15)
+- Added `pointer-events` and fixed border recombination (#16)
+- Fixed `stroke-width` value without unit (#18)
+- Fixed exception when not providing an `IRenderDevice` (#20)
+- Fixed missing `CssStylingService.Default` in cascade (#21)
+- Added extension helper `SetStyle` to modify all styles of many elements (#22)
+- Fixed expansion of shorthand properties to longhand (#23)
+- Opened CSSOM, e.g., declared `ICssFunctionValue` `public` (#24)
+- Introduced special converter for the `src` declaration (#25)
+- Fixed bug regarding CSS grid serialization (#27)
+- Added `DefaultRenderDevice` implementation
+
+# 0.10.1
+
+Released on Monday, January 7 2019.
+
+- Reference latest AngleSharp
+- Updated reference to `System.Encoding.CodePages` (#13)
+
# 0.10.0
Released on Friday, January 4 2019.
diff --git a/README.md b/README.md
index 87e9b723..326c302f 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@
[![GitHub Tag](https://img.shields.io/github/tag/AngleSharp/AngleSharp.Css.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Css/releases)
[![NuGet Count](https://img.shields.io/nuget/dt/AngleSharp.Css.svg?style=flat-square)](https://www.nuget.org/packages/AngleSharp.Css/)
[![Issues Open](https://img.shields.io/github/issues/AngleSharp/AngleSharp.Css.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Css/issues)
+[![Gitter Chat](http://img.shields.io/badge/gitter-AngleSharp/AngleSharp-blue.svg?style=flat-square)](https://gitter.im/AngleSharp/AngleSharp)
[![StackOverflow Questions](https://img.shields.io/stackexchange/stackoverflow/t/anglesharp.svg?style=flat-square)](https://stackoverflow.com/tags/anglesharp)
[![CLA Assistant](https://cla-assistant.io/readme/badge/AngleSharp/AngleSharp.Css?style=flat-square)](https://cla-assistant.io/AngleSharp/AngleSharp.Css)
@@ -28,6 +29,20 @@ This will register a parser for CSS related content. The CSS parsing options and
For an interactive DOM (i.e., to handle `style` attribute changes in the HTML document) an observer needs to be registered as well.
+Furthermore, for some CSSOM features (e.g., media queries) a render device is required.
+
+```cs
+var config = Configuration.Default
+ .WithCss()
+ .WithRenderDevice(new DefaultRenderDevice
+ {
+ DeviceHeight = 768,
+ DeviceWidth = 1024,
+ });
+```
+
+If no specific `IRenderDevice` (e.g., via creating an `DefaultRenderDevice` object) instance is created a default implementation will be set.
+
## Advantages of AngleSharp.Css
The core library already contains the CSS selector parser and the most basic classes and interfaces for dealing with the CSSOM. AngleSharp.Css brings the following advantages and use cases to life:
@@ -60,6 +75,16 @@ Participation in the project is highly welcome. For this project the same rules
If you have any question, concern, or spot an issue then please report it before opening a pull request. An initial discussion is appreciated regardless of the nature of the problem.
+Live discussions can take place in our [Gitter chat](https://gitter.im/AngleSharp/AngleSharp), which supports using GitHub accounts.
+
+This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
+
+For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
+
+## .NET Foundation
+
+This project is supported by the [.NET Foundation](https://dotnetfoundation.org).
+
## License
The MIT License (MIT)
diff --git a/build.cake b/build.cake
index da10a4bc..3de873fe 100644
--- a/build.cake
+++ b/build.cake
@@ -16,7 +16,6 @@ using Octokit;
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
-var isLocal = BuildSystem.IsLocalBuild;
var isRunningOnUnix = IsRunningOnUnix();
var isRunningOnWindows = IsRunningOnWindows();
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
@@ -140,7 +139,7 @@ Task("Create-Package")
Task("Publish-Package")
.IsDependentOn("Create-Package")
- .WithCriteria(() => isLocal)
+ .IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var apiKey = EnvironmentVariable("NUGET_API_KEY");
@@ -161,8 +160,8 @@ Task("Publish-Package")
});
Task("Publish-Release")
- .IsDependentOn("Publish-Package")
- .WithCriteria(() => isLocal)
+ .IsDependentOn("Create-Package")
+ .IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var githubToken = EnvironmentVariable("GITHUB_API_TOKEN");
diff --git a/doc/API.md b/doc/API.md
new file mode 100644
index 00000000..2fb5276b
--- /dev/null
+++ b/doc/API.md
@@ -0,0 +1,44 @@
+# API Documentation
+
+## CSSOM - Basics
+
+The CSS Object Model (CSSOM) consists of multiple parts. On the one hand we have standard Document Object Model (DOM) exposed interfaces, such as the stylesheets, styles, or rules, on the other hand we have special constructs only available in AngleSharp to dig deeper into the provided CSS.
+
+The AngleSharp CSS parser can construct objects of the following high-level types:
+
+- `ICssStyleSheet`, representing a full CSS stylesheet
+- `ICssRule`, representing a rule within a CSS stylesheet
+- `ICssKeyframeRule`, representing a special keyframe rule (only exposed since the DOM directly connects to it)
+- `ICssStyleDeclaration`, representing the keeper of CSS declarations
+
+A CSS declaration is a CSS property, e.g., `color` together with its value (e.g., `red`) and priority ("important" or not). Declarations are rather complicated as they appear not only in primitive fashion as seen earlier (`color`), but also in form of *shorthands* such as `background`. In the latter case the shorthand is expanded into all contained *longhands* (e.g., `background-color`, `background-image`, ...) and stored in this primitive way. Retrieving the shorthand later on is done via a recombination of the *currently* available longhands.
+
+The topic with longhands and shorthands is especially complicated in face of *defered computation*. This is the case once a calculated value is hit, which is necessary for the rule to be validated, but cannot be calculated during sheet evaluation time (i.e., the calculation has to take place with the cascade coming from the DOM). The simplest example is `var`. CSS variables are evaluated only with the cascade in mind. In this case no simple expansion of the shorthand into longhands is possible. Instead, AngleSharp will "fake" a potential expansion with a reference value, which can then be resolved later.
+
+There are multiple types of rules. Depending on the type of rule other rules may be the children of the rule. While a style rule is the most elementary one (essentially just containing an `ICssStyleDeclaration` instance) one example of a container rule is the media rule. This type of rule hosts other rules.
+
+## CSSOM - Values
+
+The most interesting part of a CSS declaration is the value part. This is also the complicated part as values are always given in string form. The parsing is completely dependent on the type of declaration. Some fixed / known types and parsing rules exist, however, the exact setup of a declaration is completely arbitrary.
+
+AngleSharp uses converters to parse a given source to an `ICssValue` instance. The converter follows the `IValueConverter` interface.
+
+The `ICssValue` interface is split in various interfaces with respect to their usage.
+
+![The CSSOM Value Tree](cssom-value-tree.png)
+
+A converter may also implement the `IValueAggregator` interface, which indicates that the declaration behind it is actually a shorthand that can additionally merge values into a shorthand representation or split the shorthand representation into the atoms described by the shorthand.
+
+For convenience some (extension) methods have been introduced to make working with the CSSOM (specifically values) simpler. The shown extension methods are placed in the `AngleSharp.Css.Dom` namespace.
+
+```cs
+// sheet is a stylesheet, e.g., obtained from a document, with content:
+// p > a { border: 1px solid red }
+var rule = sheet.GetStyleRuleWith("p>a");
+var color = rule.GetValueOf("border-right-color").AsRgba();
+// the color is an Int32, e.g., 0xFF_FF - same as rgba(255, 0, 0, 1)
+```
+
+The idea behind `GetStyleRuleWith` is to get the first top-level style rule that matches the given selector exactly. The text of the selector does not have to be equal to the text of the selector in the stylesheet, but it needs to be equal *semantically*, i.e., in the provided example the spaces do not matter as the semantics are not influenced by them.
+
+The `GetValueOf` obtains the `ICssValue` instance behind the property with the given name. The `AsRgba` works (like all the other `As*` extension methods) against the `ICssValue` to get an elementary value out of it. This works in simple cases, but will fail, e.g., when there are multiple values available or when the primitive value is hidden in a composite one.
diff --git a/doc/cssom-value-tree.png b/doc/cssom-value-tree.png
new file mode 100644
index 00000000..2d6573f3
Binary files /dev/null and b/doc/cssom-value-tree.png differ
diff --git a/doc/index.md b/doc/index.md
new file mode 100644
index 00000000..8963f600
--- /dev/null
+++ b/doc/index.md
@@ -0,0 +1,7 @@
+# AngleSharp.Css Documentation
+
+We have more detailed information regarding the following subjects:
+
+- [API Documentation](API.md)
+
+For help on AngleSharp itself, see [the full documentation](https://anglesharp.github.io/docs.html).
diff --git a/src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj b/src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj
index 8ca64439..db2c258c 100644
--- a/src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj
+++ b/src/AngleSharp.Css.Tests/AngleSharp.Css.Tests.csproj
@@ -13,9 +13,10 @@
-
+
+
-
+
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssAnimationProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssAnimationProperty.cs
index fe34b096..e29fcf1a 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssAnimationProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssAnimationProperty.cs
@@ -473,7 +473,7 @@ public void CssAnimationCountDoubleIllegal()
{
var snippet = "animation : 10 20";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssBorderProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssBorderProperty.cs
index 7353af33..d54b931c 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssBorderProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssBorderProperty.cs
@@ -1,3 +1,6 @@
+using AngleSharp.Css.Dom;
+using AngleSharp.Css.Parser;
+
namespace AngleSharp.Css.Tests.Declarations
{
using NUnit.Framework;
@@ -178,7 +181,7 @@ public void CssBorderColorRedBlueGreenBlackTransparentIllegal()
{
var snippet = "border-color: red blue green black transparent";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -246,7 +249,7 @@ public void CssBorderStyleWavyIllegal()
{
var snippet = "border-style: wavy";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -434,7 +437,7 @@ public void CssBorderWidthZerosIllegal()
{
var snippet = "border-width: 0 0 0 0 0";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -554,5 +557,17 @@ public void CssBorderOutSetWithNoColor()
Assert.IsTrue(property.HasValue);
Assert.AreEqual("1px outset", property.Value);
}
+
+ [Test]
+ public void CssBorderAggregation()
+ {
+ var expectedCss = "border: 1px solid rgba(0, 0, 0, 1)";
+ var context = BrowsingContext.New(Configuration.Default.WithCss());
+ var style = new CssStyleDeclaration(context);
+ style.SetBorderWidth("1px");
+ style.SetBorderStyle("solid");
+ style.SetBorderColor("black");
+ Assert.AreEqual(expectedCss, style.CssText);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssBorderRadiusProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssBorderRadiusProperty.cs
index e1b9e38e..be4edf9f 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssBorderRadiusProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssBorderRadiusProperty.cs
@@ -15,7 +15,7 @@ public void CssBorderBottomLeftRadiusPxPxLegal()
Assert.IsFalse(property.IsImportant);
Assert.IsFalse(property.IsInherited);
Assert.IsTrue(property.HasValue);
- Assert.AreEqual("40px 40px", property.Value);
+ Assert.AreEqual("40px", property.Value);
}
[Test]
@@ -155,7 +155,7 @@ public void CssBorderRadiusFiveLengthsIllegal()
{
var snippet = "border-radius: 2px 4px 3px 0 1px";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -199,7 +199,7 @@ public void CssBorderRadiusFiveTailFractionIllegal()
{
var snippet = "border-radius: 4px 3px 6px 1em / 2px 4px 0 20% 0";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -207,7 +207,7 @@ public void CssBorderRadiusFiveHeadFractionIllegal()
{
var snippet = "border-radius: 4px 3px 6px 1em 0 / 2px 4px 0 20%";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssColumnsProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssColumnsProperty.cs
index f445e712..a2d79f0d 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssColumnsProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssColumnsProperty.cs
@@ -178,7 +178,7 @@ public void CssColumsNumberPercenIllegal()
{
var snippet = "columns : 5 25% ";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssGridProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssGridProperty.cs
index 88613609..2dff206c 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssGridProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssGridProperty.cs
@@ -759,5 +759,14 @@ public void CssGridTemplateRowsAndColumnsWithFractionsLegal()
Assert.IsTrue(property.HasValue);
Assert.AreEqual("100px 1fr / 50px 1fr", property.Value);
}
+
+ [Test]
+ public void CssRuleWithOnlyGridTemplateAreasLegal_Issue27()
+ {
+ var snippet = @"div#A { grid-template-areas: ""a b b"" ""a c d"" }";
+ var rule = ParseRule(snippet);
+ var text = rule.CssText;
+ Assert.AreEqual(snippet, text);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssMarginProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssMarginProperty.cs
index 8a963a06..349662fb 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssMarginProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssMarginProperty.cs
@@ -191,7 +191,7 @@ public void CssMarginTooManyValuesIllegal()
{
var snippet = "margin: 10px 5% 8px 2% 3px auto";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssOutlineProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssOutlineProperty.cs
index 207200f2..35f7d94e 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssOutlineProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssOutlineProperty.cs
@@ -176,7 +176,7 @@ public void CssOutlineDoubleColorIllegal()
{
var snippet = "outline : dotted #123456 rgb(255, 255, 255)";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssPaddingProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssPaddingProperty.cs
index 9b177b8e..70d7794d 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssPaddingProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssPaddingProperty.cs
@@ -95,7 +95,7 @@ public void CssPaddingAutoIllegal()
{
var snippet = "padding: auto ";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
@@ -127,7 +127,7 @@ public void CssPaddingTooManyValuesIllegal()
{
var snippet = "padding: 10px 5% 8px 2% 3px";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssStrokeProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssStrokeProperty.cs
index 30b94588..2921d788 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssStrokeProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssStrokeProperty.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Tests.Declarations
+namespace AngleSharp.Css.Tests.Declarations
{
using NUnit.Framework;
using static CssConstructionFunctions;
@@ -370,5 +370,17 @@ public void CssStrokeWidthNoneIllegal()
Assert.IsFalse(property.IsInherited);
Assert.IsFalse(property.HasValue);
}
+
+ [Test]
+ public void CssStrokeWithoutUnit_Issue18()
+ {
+ var snippet = "stroke-width: 3";
+ var property = ParseDeclaration(snippet);
+ Assert.AreEqual("stroke-width", property.Name);
+ Assert.IsFalse(property.IsImportant);
+ Assert.IsFalse(property.IsInherited);
+ Assert.IsTrue(property.HasValue);
+ Assert.AreEqual("3", property.Value);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssTextProperty.cs b/src/AngleSharp.Css.Tests/Declarations/CssTextProperty.cs
index 39c69401..381bb5c3 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssTextProperty.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssTextProperty.cs
@@ -180,7 +180,7 @@ public void CssTextDecorationIllegal()
{
var snippet = "text-decoration: line-pass";
var property = ParseDeclaration(snippet);
- Assert.IsNull(property);
+ Assert.IsFalse(property.HasValue);
}
[Test]
diff --git a/src/AngleSharp.Css.Tests/Declarations/CssVariables.cs b/src/AngleSharp.Css.Tests/Declarations/CssVariables.cs
index 767a442a..f3ba1fed 100644
--- a/src/AngleSharp.Css.Tests/Declarations/CssVariables.cs
+++ b/src/AngleSharp.Css.Tests/Declarations/CssVariables.cs
@@ -42,7 +42,7 @@ public void LegitVariableReferenceWithoutFallback()
var source = @"padding-bottom: var(--foo)";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(1, variable.References.Length);
Assert.AreEqual("--foo", variable.References[0].VariableName);
@@ -55,7 +55,7 @@ public void LegitVariableReferenceWithFallback()
var source = @"padding-bottom: var(--my-bar, 24px)";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(1, variable.References.Length);
Assert.AreEqual("--my-bar", variable.References[0].VariableName);
@@ -68,7 +68,7 @@ public void LegitVariableReferenceWithFallbackContainingComma()
var source = @"border-top-color: var(--color, red, blue)";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(1, variable.References.Length);
Assert.AreEqual("--color", variable.References[0].VariableName);
@@ -81,7 +81,7 @@ public void LegitSingleVariableReferenceInBackgroundShorthand()
var source = @"background: var(--foo)";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(1, variable.References.Length);
Assert.AreEqual("--foo", variable.References[0].VariableName);
@@ -94,7 +94,7 @@ public void LegitMixedVariableReferenceInBackgroundShorthand()
var source = @"background: url('http://bit.ly/2FiPrRA') 0 100%/340px no-repeat, var(--primary-color);";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(1, variable.References.Length);
Assert.AreEqual("--primary-color", variable.References[0].VariableName);
@@ -107,7 +107,7 @@ public void LegitMultipleVariableReferenceInBorderShorthand()
var source = @"border: var(--width) solid var(--color, black)";
var property = ParseDeclaration(source);
Assert.IsNotNull(property);
- var variable = property.RawValue as VarReferences;
+ var variable = property.RawValue as CssReferenceValue;
Assert.IsNotNull(variable);
Assert.AreEqual(2, variable.References.Length);
Assert.AreEqual("--width", variable.References[0].VariableName);
diff --git a/src/AngleSharp.Css.Tests/Extensions/Elements.cs b/src/AngleSharp.Css.Tests/Extensions/Elements.cs
new file mode 100644
index 00000000..fca5730d
--- /dev/null
+++ b/src/AngleSharp.Css.Tests/Extensions/Elements.cs
@@ -0,0 +1,23 @@
+namespace AngleSharp.Css.Tests.Extensions
+{
+ using NUnit.Framework;
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Dom;
+ using System.Linq;
+
+ [TestFixture]
+ public class ElementsTests
+ {
+ [Test]
+ public void SetAllStyles()
+ {
+ var document = "
".ToHtmlDocument(Configuration.Default.WithCss());
+ var divs = document.QuerySelectorAll("div");
+ divs.SetStyle(style => style.SetBackground("red"));
+
+ Assert.AreEqual("rgba(255, 0, 0, 1)", divs.Skip(0).First().GetStyle().GetBackground());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", divs.Skip(1).First().GetStyle().GetBackground());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", divs.Skip(2).First().GetStyle().GetBackground());
+ }
+ }
+}
diff --git a/src/AngleSharp.Css.Tests/Extensions/InnerText.cs b/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
index 9a2dd373..c8fe56b4 100644
--- a/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
+++ b/src/AngleSharp.Css.Tests/Extensions/InnerText.cs
@@ -73,7 +73,9 @@ public void SetInnerText(String fixture, String expectedInnerText, String expect
[TestCase("", "")]
public void GetInnerText(String fixture, String expected)
{
- var config = Configuration.Default.WithCss();
+ var defaultSheet = new CssDefaultStyleSheetProvider();
+ defaultSheet.SetDefault("");
+ var config = Configuration.Default.With(defaultSheet).WithCss();
var doc = fixture.ToHtmlDocument(config);
Assert.AreEqual(expected, doc.Body.GetInnerText());
diff --git a/src/AngleSharp.Css.Tests/Mocks/DelayedStream.cs b/src/AngleSharp.Css.Tests/Mocks/DelayedStream.cs
index 9e5ff20c..38dc13da 100644
--- a/src/AngleSharp.Css.Tests/Mocks/DelayedStream.cs
+++ b/src/AngleSharp.Css.Tests/Mocks/DelayedStream.cs
@@ -20,35 +20,23 @@ public DelayedStream(Byte[] content)
{
}
- public override Boolean CanRead
- {
- get { return _stream.CanRead; }
- }
+ public override Boolean CanRead => _stream.CanRead;
- public override Boolean CanSeek
- {
- get { return _stream.CanSeek; }
- }
+ public override Boolean CanSeek => _stream.CanSeek;
- public override Boolean CanWrite
- {
- get { return _stream.CanWrite; }
- }
+ public override Boolean CanWrite => _stream.CanWrite;
public override void Flush()
{
_stream.Flush();
}
- public override Int64 Length
- {
- get { return _stream.Length; }
- }
+ public override Int64 Length => _stream.Length;
public override Int64 Position
{
- get { return _stream.Position; }
- set { _stream.Position = value; }
+ get => _stream.Position;
+ set => _stream.Position = value;
}
public override async Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
diff --git a/src/AngleSharp.Css.Tests/Mocks/MockRenderDevice.cs b/src/AngleSharp.Css.Tests/Mocks/MockRenderDevice.cs
deleted file mode 100644
index 3c4d1edf..00000000
--- a/src/AngleSharp.Css.Tests/Mocks/MockRenderDevice.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-namespace AngleSharp.Css.Tests.Mocks
-{
- sealed class MockRenderDevice : IRenderDevice
- {
- public DeviceCategory Category
- {
- get;
- set;
- }
-
- public int ColorBits
- {
- get;
- set;
- }
-
- public int DeviceHeight
- {
- get;
- set;
- }
-
- public int DeviceWidth
- {
- get;
- set;
- }
-
- public int Frequency
- {
- get;
- set;
- }
-
- public bool IsGrid
- {
- get;
- set;
- }
-
- public bool IsInterlaced
- {
- get;
- set;
- }
-
- public bool IsScripting
- {
- get;
- set;
- }
-
- public int MonochromeBits
- {
- get;
- set;
- }
-
- public int Resolution
- {
- get;
- set;
- }
-
- public int ViewPortHeight
- {
- get;
- set;
- }
-
- public int ViewPortWidth
- {
- get;
- set;
- }
-
- public IBrowsingContext Context
- {
- get;
- set;
- }
- }
-}
diff --git a/src/AngleSharp.Css.Tests/Mocks/SiteMapping.cs b/src/AngleSharp.Css.Tests/Mocks/SiteMapping.cs
index 1456d526..0f93ab26 100644
--- a/src/AngleSharp.Css.Tests/Mocks/SiteMapping.cs
+++ b/src/AngleSharp.Css.Tests/Mocks/SiteMapping.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Tests.Mocks
+namespace AngleSharp.Css.Tests.Mocks
{
using AngleSharp.Xml;
using AngleSharp.Xml.Dom;
@@ -24,14 +24,11 @@ public String this[String url]
get
{
var element = _xml.QuerySelector("entry[url='" + url + "']");
- return element != null ? element.TextContent : null;
+ return element?.TextContent;
}
}
- public Boolean Contains(String url)
- {
- return this[url] != null;
- }
+ public Boolean Contains(String url) => this[url] != null;
public void Add(String url, String fileName)
{
diff --git a/src/AngleSharp.Css.Tests/Parsing/LargeValues.cs b/src/AngleSharp.Css.Tests/Parsing/LargeValues.cs
index 21ba2b48..36d6e9d0 100644
--- a/src/AngleSharp.Css.Tests/Parsing/LargeValues.cs
+++ b/src/AngleSharp.Css.Tests/Parsing/LargeValues.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Tests.Parsing
{
using AngleSharp.Css.Dom;
+ using AngleSharp.Html.Parser;
using NUnit.Framework;
using static CssConstructionFunctions;
@@ -30,5 +31,15 @@ public void LargeNegativeZIndexShouldNotErrorAndBeCapped()
var style = sheet.Rules[0] as ICssStyleRule;
Assert.AreEqual("-2147483648", style.Style.GetZIndex());
}
+
+ [Test]
+ public void SilentlyIgnoresErrorsWhenInvokedWithoutCss_Issue15()
+ {
+ var p = new HtmlParser();
+ var dom = p.ParseDocument(@"Test
");
+ var div = dom.QuerySelector("div");
+ var style = div.GetStyle();
+ Assert.IsNull(style);
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Rules/CssMediaFeatures.cs b/src/AngleSharp.Css.Tests/Rules/CssMediaFeatures.cs
index 3700d993..6aaee58c 100644
--- a/src/AngleSharp.Css.Tests/Rules/CssMediaFeatures.cs
+++ b/src/AngleSharp.Css.Tests/Rules/CssMediaFeatures.cs
@@ -32,8 +32,8 @@ public void CssMediaFeatureValidatorFactory()
public void CssMediaWidthValidation()
{
var validate = CreateValidator(FeatureNames.Width, "100px");
- var valid = validate(new MockRenderDevice { ViewPortWidth = 100, ViewPortHeight = 0 });
- var invalid = validate(new MockRenderDevice { ViewPortWidth = 0, ViewPortHeight = 0 });
+ var valid = validate(new DefaultRenderDevice { ViewPortWidth = 100, ViewPortHeight = 0 });
+ var invalid = validate(new DefaultRenderDevice { ViewPortWidth = 0, ViewPortHeight = 0 });
Assert.IsTrue(valid);
Assert.IsFalse(invalid);
}
@@ -42,8 +42,8 @@ public void CssMediaWidthValidation()
public void CssMediaMaxHeightValidation()
{
var validate = CreateValidator(FeatureNames.MaxHeight, "100px");
- var valid = validate(new MockRenderDevice { ViewPortWidth = 0, ViewPortHeight = 99 });
- var invalid = validate(new MockRenderDevice { ViewPortWidth = 0, ViewPortHeight = 101 });
+ var valid = validate(new DefaultRenderDevice { ViewPortWidth = 0, ViewPortHeight = 99 });
+ var invalid = validate(new DefaultRenderDevice { ViewPortWidth = 0, ViewPortHeight = 101 });
Assert.IsTrue(valid);
Assert.IsFalse(invalid);
}
@@ -52,8 +52,8 @@ public void CssMediaMaxHeightValidation()
public void CssMediaMinDeviceWidthValidation()
{
var validate = CreateValidator(FeatureNames.MinDeviceWidth, "100px");
- var valid = validate(new MockRenderDevice { DeviceWidth = 100, DeviceHeight = 0 });
- var invalid = validate(new MockRenderDevice { DeviceWidth = 99, DeviceHeight = 0 });
+ var valid = validate(new DefaultRenderDevice { DeviceWidth = 100, DeviceHeight = 0 });
+ var invalid = validate(new DefaultRenderDevice { DeviceWidth = 99, DeviceHeight = 0 });
Assert.IsTrue(valid);
Assert.IsFalse(invalid);
}
@@ -62,8 +62,8 @@ public void CssMediaMinDeviceWidthValidation()
public void CssMediaAspectRatio()
{
var validate = CreateValidator(FeatureNames.AspectRatio, "1/1");
- var valid = validate(new MockRenderDevice { ViewPortWidth = 100, ViewPortHeight = 100 });
- var invalid = validate(new MockRenderDevice { ViewPortWidth = 16, ViewPortHeight = 9 });
+ var valid = validate(new DefaultRenderDevice { ViewPortWidth = 100, ViewPortHeight = 100 });
+ var invalid = validate(new DefaultRenderDevice { ViewPortWidth = 16, ViewPortHeight = 9 });
Assert.IsTrue(valid);
Assert.IsFalse(invalid);
}
diff --git a/src/AngleSharp.Css.Tests/Rules/CssSupports.cs b/src/AngleSharp.Css.Tests/Rules/CssSupports.cs
index 25ee1633..a4b5bd3d 100644
--- a/src/AngleSharp.Css.Tests/Rules/CssSupports.cs
+++ b/src/AngleSharp.Css.Tests/Rules/CssSupports.cs
@@ -1,7 +1,6 @@
-namespace AngleSharp.Css.Tests.Rules
+namespace AngleSharp.Css.Tests.Rules
{
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Tests.Mocks;
using NUnit.Framework;
using static CssConstructionFunctions;
@@ -13,7 +12,7 @@ public void SupportsEmptyRule()
{
var source = @"@supports () { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -26,7 +25,7 @@ public void SupportsBackgroundColorRedRule()
{
var source = @"@supports (background-color: red) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -39,7 +38,7 @@ public void SupportsBackgroundColorRedAndColorBlueRule()
{
var source = @"@supports ((background-color: red) and (color: blue)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -52,7 +51,7 @@ public void SupportsNotUnsupportedDeclarationRule()
{
var source = @"@supports (not (background-transparency: half)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -65,7 +64,7 @@ public void SupportsUnsupportedDeclarationRule()
{
var source = @"@supports ((background-transparency: zero)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -78,7 +77,7 @@ public void SupportsBackgroundRedWithImportantRule()
{
var source = @"@supports (background: red !important) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -91,7 +90,7 @@ public void SupportsPaddingTopOrPaddingLeftRule()
{
var source = @"@supports ((padding-TOP : 0) or (padding-left : 0)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -104,7 +103,7 @@ public void SupportsPaddingTopOrPaddingLeftAndPaddingBottomOrPaddingRightRule()
{
var source = @"@supports (((padding-top: 0) or (padding-left: 0)) and ((padding-bottom: 0) or (padding-right: 0))) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -117,7 +116,7 @@ public void SupportsDisplayFlexWithImportantRule()
{
var source = @"@supports (display: flex !important) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -138,7 +137,7 @@ public void SupportsDisplayFlexMultipleBracketsRule()
{
var source = @"@supports ((display: flex)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -153,7 +152,7 @@ public void SupportsTransitionOrAnimationNameAndTransformFrontBracketRule()
(animation-name: foo)) and
(transform: rotate(10deg)) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -168,7 +167,7 @@ public void SupportsTransitionOrAnimationNameAndTransformBackBracketRule()
((animation-name: foo) and
(transform: rotate(10deg))) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -184,7 +183,7 @@ public void SupportsShadowVendorPrefixesRule()
( -webkit-box-shadow: 0 0 2px black ) or
( -o-box-shadow: 0 0 2px black ) { }";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
@@ -201,7 +200,7 @@ public void SupportsNegatedDisplayFlexRuleWithDeclarations()
#article { width: 75%; }
}";
var sheet = ParseStyleSheet(source);
- var device = new MockRenderDevice { Context = sheet.Context };
+ var device = new DefaultRenderDevice();
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var supports = sheet.Rules[0] as CssSupportsRule;
diff --git a/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs b/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
index 07ae271e..ae52a27e 100644
--- a/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
+++ b/src/AngleSharp.Css.Tests/Styling/BasicStyling.cs
@@ -119,7 +119,7 @@ public void CssStyleDeclarationUnbound()
{
var css = ParseDeclarations(String.Empty);
css.CssText = "background-color: rgb(255, 0, 0); color: rgb(0, 0, 0)";
- Assert.AreEqual("background: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", css.CssText);
+ Assert.AreEqual("background-color: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", css.CssText);
Assert.AreEqual(2, css.Length);
}
@@ -129,7 +129,7 @@ public void CssStyleDeclarationBoundOutboundDirectionIndirect()
var document = ParseDocument(String.Empty);
var element = document.CreateElement();
element.SetAttribute("style", "background-color: rgb(255, 0, 0); color: rgb(0, 0, 0)");
- Assert.AreEqual("background: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", element.GetStyle().CssText);
+ Assert.AreEqual("background-color: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", element.GetStyle().CssText);
Assert.AreEqual(2, element.GetStyle().Length);
}
@@ -141,7 +141,7 @@ public void CssStyleDeclarationBoundOutboundDirectionDirect()
element.SetAttribute("style", String.Empty);
Assert.AreEqual(String.Empty, element.GetStyle().CssText);
element.SetAttribute("style", "background-color: rgb(255, 0, 0); color: rgb(0, 0, 0)");
- Assert.AreEqual("background: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", element.GetStyle().CssText);
+ Assert.AreEqual("background-color: rgba(255, 0, 0, 1); color: rgba(0, 0, 0, 1)", element.GetStyle().CssText);
Assert.AreEqual(2, element.GetStyle().Length);
}
diff --git a/src/AngleSharp.Css.Tests/Styling/Configuration.cs b/src/AngleSharp.Css.Tests/Styling/Configuration.cs
index dec765e3..4d3b2576 100644
--- a/src/AngleSharp.Css.Tests/Styling/Configuration.cs
+++ b/src/AngleSharp.Css.Tests/Styling/Configuration.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Tests.Styling
+namespace AngleSharp.Css.Tests.Styling
{
using AngleSharp.Css.Dom;
using AngleSharp.Io;
@@ -30,10 +30,9 @@ public void ConfigurationWithExtensionLeavesOriginallyUnmodified()
[Test]
public void ObtainDefaultSheet()
{
- var service = new CssStylingService();
+ var service = new CssDefaultStyleSheetProvider();
Assert.IsNotNull(service.Default);
- Assert.IsTrue((service as IStylingService).SupportsType(MimeTypeNames.Css));
- var sheet = service.Default as ICssStyleSheet;
+ var sheet = service.Default;
Assert.IsNotNull(sheet);
Assert.AreEqual(49, sheet.Rules.Length);
}
diff --git a/src/AngleSharp.Css.Tests/Styling/CssSheet.cs b/src/AngleSharp.Css.Tests/Styling/CssSheet.cs
index 3366002a..e7dff851 100644
--- a/src/AngleSharp.Css.Tests/Styling/CssSheet.cs
+++ b/src/AngleSharp.Css.Tests/Styling/CssSheet.cs
@@ -82,7 +82,7 @@ public void CssSheetSerializeBorder1pxOutset()
public void CssSheetSerializeBorder1pxSolidWithColor()
{
var cssSrc = "#rule1 { border: 1px solid #BBCCEB; border-top: none }";
- var expected = "#rule1 { border: 1px solid rgba(187, 204, 235, 1); border-top: none }";
+ var expected = "#rule1 { border-top: none; border-right: 1px solid rgba(187, 204, 235, 1); border-bottom: 1px solid rgba(187, 204, 235, 1); border-left: 1px solid rgba(187, 204, 235, 1) }";
var stylesheet = ParseStyleSheet(cssSrc);
var cssText = stylesheet.ToCss();
Assert.AreEqual(expected, cssText);
@@ -142,12 +142,11 @@ public void CssSheetCloseStringsEndOfLine()
Assert.AreEqual(1, sheet.Rules.Length);
Assert.IsInstanceOf(sheet.Rules[0]);
var p = sheet.Rules[0] as ICssStyleRule;
- Assert.AreEqual(2, p.Style.Length);
+ Assert.AreEqual(1, p.Style.Length);
Assert.AreEqual("p", p.SelectorText);
Assert.AreEqual("color", p.Style[0]);
- Assert.AreEqual("font-family", p.Style[1]);
Assert.AreEqual("rgba(0, 128, 0, 1)", p.Style.GetColor());
- Assert.AreEqual("initial", p.Style.GetFontFamily());
+ Assert.AreEqual("", p.Style.GetFontFamily());
}
[Test]
@@ -304,8 +303,8 @@ public void CssSheetIgnoreInvalidValueFloat()
Assert.IsInstanceOf(sheet.Rules[0]);
var img = sheet.Rules[0] as ICssStyleRule;
Assert.AreEqual("img", img.SelectorText);
- Assert.AreEqual(1, img.Style.Length);
- Assert.AreEqual("initial", img.Style.GetFloat());
+ Assert.AreEqual(0, img.Style.Length);
+ Assert.AreEqual("", img.Style.GetFloat());
}
[Test]
@@ -573,7 +572,7 @@ public void CssFontWithSlashAndContent()
public void CssBackgroundWebkitGradientIsInvalid()
{
var background = ParseDeclaration("background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FFA84C), color-stop(100%, #FF7B0D))");
- Assert.IsNull(background);
+ Assert.IsFalse(background.HasValue);
}
[Test]
@@ -688,7 +687,7 @@ public void CssSheetWithDataUrlAsBackgroundImage()
Assert.AreEqual(1, sheet.Rules.Length);
var rule = sheet.Rules[0] as CssStyleRule;
Assert.IsNotNull(rule);
- Assert.AreEqual(4, rule.Style.Length);
+ Assert.AreEqual(5, rule.Style.Length);
Assert.AreEqual(".App_Header_ .logo", rule.SelectorText);
var decl = rule.Style as ICssStyleDeclaration;
Assert.AreEqual("url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAAcCAMAAAAEJ1IZAAAABGdBTUEAALGPC/xhBQAAVAI/VAI/VAI/VAI/VAI/VAI/VAAAA////AI/VRZ0U8AAAAFJ0Uk5TYNV4S2UbgT/Gk6uQt585w2wGXS0zJO2lhGttJK6j4YqZSobH1AAAAAElFTkSuQmCC\")", decl.GetBackgroundImage());
@@ -926,6 +925,60 @@ public void CssStyleSheetShouldIgnoreHtmlCommentTokens()
Assert.AreEqual("none", div.Style.GetDisplay());
}
+ [Test]
+ public void CssStyleSheetShouldExpandBorderColorCorrectly_Issue23()
+ {
+ var parser = new CssParser();
+ var source = "body { border-color: red }";
+ var sheet = parser.ParseStyleSheet(source);
+
+ Assert.AreEqual(1, sheet.Rules.Length);
+ Assert.AreEqual(CssRuleType.Style, sheet.Rules[0].Type);
+
+ var body = sheet.Rules[0] as ICssStyleRule;
+ Assert.AreEqual("border-color: rgba(255, 0, 0, 1)", body.Style.CssText);
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderLeftColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderRightColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderTopColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderBottomColor());
+ }
+
+ [Test]
+ public void CssStyleSheetShouldCollapseBorderColorCorrectly_Issue23()
+ {
+ var parser = new CssParser();
+ var source = "body { border-color: red }";
+ var sheet = parser.ParseStyleSheet(source);
+
+ var body = sheet.Rules[0] as ICssStyleRule;
+ body.Style.SetBorderLeftColor("blue");
+ body.Style.SetBorderRightColor("blue");
+ Assert.AreEqual("border-color: rgba(255, 0, 0, 1) rgba(0, 0, 255, 1)", body.Style.CssText);
+ Assert.AreEqual("rgba(255, 0, 0, 1) rgba(0, 0, 255, 1)", body.Style.GetBorderColor());
+ Assert.AreEqual("rgba(0, 0, 255, 1)", body.Style.GetBorderLeftColor());
+ Assert.AreEqual("rgba(0, 0, 255, 1)", body.Style.GetBorderRightColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderTopColor());
+ Assert.AreEqual("rgba(255, 0, 0, 1)", body.Style.GetBorderBottomColor());
+ }
+
+ [Test]
+ public void CssStyleSheetShouldCollapseFullBorderCorrectly_Issue23()
+ {
+ var parser = new CssParser();
+ var source = "body { border: 1px solid red }";
+ var sheet = parser.ParseStyleSheet(source);
+
+ var body = sheet.Rules[0] as ICssStyleRule;
+ Assert.AreEqual("border: 1px solid rgba(255, 0, 0, 1)", body.Style.CssText);
+ body.Style.SetBorderLeftColor("blue");
+ body.Style.SetBorderTopWidth("medium");
+ Assert.AreEqual("border-top: 3px solid rgba(255, 0, 0, 1); border-right: 1px solid rgba(255, 0, 0, 1); border-bottom: 1px solid rgba(255, 0, 0, 1); border-left: 1px solid rgba(0, 0, 255, 1)", body.Style.CssText);
+ Assert.AreEqual("rgba(255, 0, 0, 1) rgba(255, 0, 0, 1) rgba(255, 0, 0, 1) rgba(0, 0, 255, 1)", body.Style.GetBorderColor());
+ Assert.AreEqual("3px 1px 1px", body.Style.GetBorderWidth());
+ Assert.AreEqual("solid", body.Style.GetBorderStyle());
+ }
+
[Test]
public void CssStyleSheetInsertShouldSetParentStyleSheetCorrectly()
{
@@ -934,6 +987,24 @@ public void CssStyleSheetInsertShouldSetParentStyleSheetCorrectly()
Assert.AreEqual(s, s.Rules[0].Owner);
}
+ [Test]
+ public void GetImageRefOfACertainDeclarationFromSheet()
+ {
+ var s = ParseStyleSheet("body { background: url(http://example.com/foo.png) no-repeat }");
+ var rule = s.GetStyleRuleWith("body");
+ var url = rule.GetValueOf("background-image").AsUrl();
+ Assert.AreEqual("http://example.com/foo.png", url);
+ }
+
+ [Test]
+ public void GetBorderRightColorOfACertainDeclarationFromSheet()
+ {
+ var s = ParseStyleSheet("p > a { border: 1px solid red }");
+ var rule = s.GetStyleRuleWith("p > a");
+ var color = rule.GetValueOf("border-right-color").AsRgba();
+ Assert.AreEqual(0x00_00_ff_ff, color);
+ }
+
[Test]
public void CssColorFunctionsMixAllShouldWork()
{
diff --git a/src/AngleSharp.Css.Tests/Styling/HtmlCssIntegration.cs b/src/AngleSharp.Css.Tests/Styling/HtmlCssIntegration.cs
index c5c7bdd4..754a36f5 100644
--- a/src/AngleSharp.Css.Tests/Styling/HtmlCssIntegration.cs
+++ b/src/AngleSharp.Css.Tests/Styling/HtmlCssIntegration.cs
@@ -5,6 +5,7 @@ namespace AngleSharp.Css.Tests.Styling
using AngleSharp.Css.Tests.Mocks;
using AngleSharp.Dom;
using AngleSharp.Html.Dom;
+ using AngleSharp.Html.Parser;
using AngleSharp.Io;
using NUnit.Framework;
using System;
@@ -60,8 +61,8 @@ public void ParsedCssCanHaveExtraWhitespace()
IsIncludingUnknownRules = true
});
var div = doc.QuerySelector("div");
- Assert.AreEqual("initial", div.GetStyle()["background-color"]);
- Assert.AreEqual("background-color: initial", div.GetStyle().CssText);
+ Assert.AreEqual("", div.GetStyle()["background-color"]);
+ Assert.AreEqual("", div.GetStyle().CssText);
}
[Test]
@@ -325,7 +326,7 @@ public void SetStyleAttributeAfterPageLoadWithInvalidColor()
// hang occurs only if this line is executed prior to setting the attribute
// hang occurs when executing next line
div.SetAttribute("style", "background-color: http://www.codeplex.com?url=<SCRIPT>a=/XSS/alert(a.source)</SCRIPT>");
- Assert.AreEqual("initial", div.GetStyle().GetBackgroundColor());
+ Assert.AreEqual("", div.GetStyle().GetBackgroundColor());
}
[Test]
@@ -403,5 +404,93 @@ public void ExtensionCssWithMultipleElements()
Assert.AreEqual("color", color);
Assert.AreEqual("rgba(255, 0, 0, 1)", style4.GetPropertyValue(color));
}
+
+ [Test]
+ public void Background0ShouldSerializeCorrectly_Issue14()
+ {
+ var dom = ParseDocument(@"Test
");
+ var div = dom.QuerySelector("div");
+ var style = div.GetStyle();
+
+ Assert.AreEqual("background: left", style.CssText);
+ }
+
+ [Test]
+ public void RemovingPropertiesShouldNotYieldEmptyStyle_Issue14()
+ {
+ var dom = ParseDocument(@"Test
");
+ var div = dom.QuerySelector("div");
+ var style = div.GetStyle();
+
+ style.RemoveProperty("background-position-x");
+ style.RemoveProperty("background-position-y");
+
+ Assert.AreEqual("background-image: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial", style.CssText);
+ }
+
+ [Test]
+ public void RecombinationWorksWithBorder_Issue16()
+ {
+ var expected = " ";
+ var document = ParseDocument("");
+ var element = document.CreateElement("button");
+ element.GetStyle().SetPointerEvents("auto");
+ element.GetStyle().SetBorderWidth("1px");
+ element.GetStyle().SetBorderStyle("solid");
+ element.GetStyle().SetBorderColor("black");
+ Assert.AreEqual(expected, element.ToHtml());
+ }
+
+ [Test]
+ public void DefaultStyleSheetTest_Issue21()
+ {
+ var browsingContext = BrowsingContext.New(Configuration.Default.WithCss());
+ var htmlParser = browsingContext.GetService();
+ var document = htmlParser.ParseDocument("Hello, World! ");
+ var boldStyle = document.Body.FirstElementChild.ComputeCurrentStyle();
+ Assert.AreEqual("bolder", boldStyle.GetFontWeight());
+ }
+
+ [Test]
+ public void MediaRuleCssCausesException_Issue20()
+ {
+ var browsingContext = BrowsingContext.New(Configuration.Default.WithCss());
+ var htmlParser = browsingContext.GetService();
+ var document = htmlParser.ParseDocument("");
+ var style = document.Body.ComputeCurrentStyle();
+ Assert.IsNotNull(style);
+ }
+
+ [Test]
+ public void MediaRuleIsCalculatedIfScreenIsOkay()
+ {
+ var config = Configuration.Default
+ .WithCss()
+ .WithRenderDevice(new DefaultRenderDevice
+ {
+ ViewPortWidth = 1000,
+ });
+ var browsingContext = BrowsingContext.New(config);
+ var htmlParser = browsingContext.GetService();
+ var document = htmlParser.ParseDocument("");
+ var style = document.Body.ComputeCurrentStyle();
+ Assert.AreEqual("rgba(0, 128, 0, 1)", style.GetColor());
+ }
+
+ [Test]
+ public void MediaRuleIsNotCalculatedIfScreenIsNotWideEnough()
+ {
+ var config = Configuration.Default
+ .WithCss()
+ .WithRenderDevice(new DefaultRenderDevice
+ {
+ ViewPortWidth = 599,
+ });
+ var browsingContext = BrowsingContext.New(config);
+ var htmlParser = browsingContext.GetService();
+ var document = htmlParser.ParseDocument("");
+ var style = document.Body.ComputeCurrentStyle();
+ Assert.AreEqual("rgba(255, 0, 0, 1)", style.GetColor());
+ }
}
}
diff --git a/src/AngleSharp.Css.Tests/Values/Gradient.cs b/src/AngleSharp.Css.Tests/Values/Gradient.cs
index a2ac21b9..808375eb 100644
--- a/src/AngleSharp.Css.Tests/Values/Gradient.cs
+++ b/src/AngleSharp.Css.Tests/Values/Gradient.cs
@@ -36,7 +36,7 @@ public void BackgroundImageLinearGradientWithAngle()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsNotNull(gradient);
Assert.IsFalse(gradient.IsRepeating);
Assert.AreEqual(Angle.TripleHalfQuarter, gradient.Angle);
@@ -55,18 +55,18 @@ public void BackgroundImageLinearGradientWithSide()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
Assert.AreEqual(Angle.Quarter, gradient.Angle);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(7, stops.Length);
- Assert.AreEqual(Colors.GetColor("red").Value, stops[0].Color);
- Assert.AreEqual(Colors.GetColor("orange").Value, stops[1].Color);
- Assert.AreEqual(Colors.GetColor("yellow").Value, stops[2].Color);
- Assert.AreEqual(Colors.GetColor("green").Value, stops[3].Color);
- Assert.AreEqual(Colors.GetColor("blue").Value, stops[4].Color);
- Assert.AreEqual(Colors.GetColor("indigo").Value, stops[5].Color);
- Assert.AreEqual(Colors.GetColor("violet").Value, stops[6].Color);
+ 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);
}
[Test]
@@ -79,7 +79,7 @@ public void BackgroundImageLinearGradientWithCornerAndRgba()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
Assert.AreEqual(Angle.TripleHalfQuarter, gradient.Angle);
Assert.AreEqual(2, gradient.Stops.Count());
@@ -97,7 +97,7 @@ public void BackgroundImageLinearGradientWithSideAndHsl()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
Assert.AreEqual(Angle.Half, gradient.Angle);
Assert.AreEqual(2, gradient.Stops.Count());
@@ -115,12 +115,12 @@ public void BackgroundImageLinearGradientNoAngle()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsFalse(gradient.IsRepeating);
Assert.AreEqual(Angle.Half, gradient.Angle);
Assert.AreEqual(3, gradient.Stops.Count());
- Assert.AreEqual(Colors.GetColor("yellow").Value, gradient.Stops.First().Color);
- Assert.AreEqual(Colors.GetColor("blue").Value, gradient.Stops.Skip(1).First().Color);
+ 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);
}
@@ -134,12 +134,12 @@ public void BackgroundImageRadialGradientCircleFarthestCorner()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(true, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.FarthestCorner, gradient.Mode);
+ 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);
@@ -157,12 +157,12 @@ public void BackgroundImageRadialGradientEllipseFarthestCorner()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.FarthestCorner, gradient.Mode);
+ 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);
@@ -180,12 +180,12 @@ public void BackgroundImageRadialGradientFarthestCornerWithPoint()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.FarthestCorner, gradient.Mode);
+ 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);
@@ -202,12 +202,12 @@ public void BackgroundImageRadialGradientSingleSize()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(true, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ Assert.AreEqual(CssRadialGradientValue.SizeMode.None, gradient.Mode);
Assert.AreEqual(new Length(16f, Length.Unit.Px), gradient.MajorRadius);
Assert.AreEqual(Length.Full, gradient.MinorRadius);
var stops = gradient.Stops.ToArray();
@@ -228,12 +228,12 @@ public void BackgroundImageRadialGradientCircle()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(true, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ 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);
@@ -250,12 +250,12 @@ public void BackgroundImageRadialGradientOnlyGradientStops()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ 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);
@@ -272,12 +272,12 @@ public void BackgroundImageRadialGradientEllipseAtCenter()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ 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);
@@ -294,12 +294,12 @@ public void BackgroundImageRadialGradientFarthestCornerWithoutPoint()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.FarthestCorner, gradient.Mode);
+ 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);
@@ -316,12 +316,12 @@ public void BackgroundImageRadialGradientClosestSideWithPoint()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.ClosestSide, gradient.Mode);
+ 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);
@@ -339,12 +339,12 @@ public void BackgroundImageRadialGradientSizeAndPoint()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ 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);
var stops = gradient.Stops.ToArray();
@@ -364,12 +364,12 @@ public void BackgroundImageRadialGradientClosestSideCircleShuffledWithPoint()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(true, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.ClosestSide, gradient.Mode);
+ 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);
@@ -387,12 +387,12 @@ public void BackgroundImageRadialGradientFarthestSideLeftBottom()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.FarthestSide, gradient.Mode);
+ 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);
@@ -410,7 +410,7 @@ public void BackgroundImageRepeatingLinearGradientRedBlue()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as LinearGradient;
+ var gradient = value.Items[0] as CssLinearGradientValue;
Assert.IsTrue(gradient.IsRepeating);
var stops = gradient.Stops.ToArray();
Assert.AreEqual(3, stops.Length);
@@ -429,12 +429,12 @@ public void BackgroundImageRepeatingRadialGradientRedBlue()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(false, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.None, gradient.Mode);
+ 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);
@@ -452,12 +452,12 @@ public void BackgroundImageRepeatingRadialGradientFunky()
var value = property.RawValue as CssListValue;
Assert.IsNotNull(value);
Assert.AreEqual(1, value.Items.Length);
- var gradient = value.Items[0] as RadialGradient;
+ 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(true, gradient.IsCircle);
- Assert.AreEqual(RadialGradient.SizeMode.ClosestSide, gradient.Mode);
+ 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);
diff --git a/src/AngleSharp.Css.nuspec b/src/AngleSharp.Css.nuspec
index 02a01122..1d8fac72 100644
--- a/src/AngleSharp.Css.nuspec
+++ b/src/AngleSharp.Css.nuspec
@@ -14,7 +14,7 @@
Copyright 2016-2019, AngleSharp
html html5 css css3 dom styling library anglesharp angle
-
+
diff --git a/src/AngleSharp.Css/AngleSharp.Css.csproj b/src/AngleSharp.Css/AngleSharp.Css.csproj
index 5a4624fa..70533018 100644
--- a/src/AngleSharp.Css/AngleSharp.Css.csproj
+++ b/src/AngleSharp.Css/AngleSharp.Css.csproj
@@ -10,8 +10,7 @@
-
-
+
diff --git a/src/AngleSharp.Css/AngleSharp.Css.nuget.targets b/src/AngleSharp.Css/AngleSharp.Css.nuget.targets
deleted file mode 100644
index e69ce0e6..00000000
--- a/src/AngleSharp.Css/AngleSharp.Css.nuget.targets
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AngleSharp.Css/BrowsingContextExtensions.cs b/src/AngleSharp.Css/BrowsingContextExtensions.cs
index 77702d6f..29e502cd 100644
--- a/src/AngleSharp.Css/BrowsingContextExtensions.cs
+++ b/src/AngleSharp.Css/BrowsingContextExtensions.cs
@@ -20,10 +20,8 @@ public static class BrowsingContextExtensions
/// The address of the resource.
/// The hosting element.
/// The async task.
- public static Task OpenStyleSheetAsync(this IBrowsingContext context, Url address, IElement element)
- {
- return context.OpenStyleSheetAsync(address, element, CancellationToken.None);
- }
+ public static Task OpenStyleSheetAsync(this IBrowsingContext context, Url address, IElement element) =>
+ context.OpenStyleSheetAsync(address, element, CancellationToken.None);
///
/// Loads a stylesheet resource via its URL.
@@ -59,12 +57,33 @@ internal static DeclarationInfo GetDeclarationInfo(this IBrowsingContext context
return factory.Create(propertyName);
}
+ internal static ICssProperty CreateShorthand(this IBrowsingContext context, String name, ICssValue[] longhands, Boolean important)
+ {
+ var factory = context.GetFactory();
+ var info = factory.Create(name);
+ var value = info.Collapse(factory, longhands);
+
+ if (context.AllowsDeclaration(info))
+ {
+ return new CssProperty(name, info.Converter, info.Flags, value, important);
+ }
+
+ return null;
+ }
+
+ internal static ICssProperty[] CreateLonghands(this IBrowsingContext context, ICssProperty shorthand)
+ {
+ var factory = context.GetFactory();
+ var info = factory.Create(shorthand.Name);
+ var values = info.Expand(factory, shorthand.RawValue);
+ return factory.CreateProperties(info.Longhands, values, shorthand.IsImportant);
+ }
+
internal static CssProperty CreateProperty(this IBrowsingContext context, String propertyName)
{
var info = context.GetDeclarationInfo(propertyName);
- var provider = context.GetProvider();
- if (info.Flags != PropertyFlags.Unknown || context.IsAllowingUnknownDeclarations())
+ if (context.AllowsDeclaration(info))
{
return new CssProperty(propertyName, info.Converter, info.Flags);
}
@@ -72,10 +91,31 @@ internal static CssProperty CreateProperty(this IBrowsingContext context, String
return null;
}
+ private static Boolean AllowsDeclaration(this IBrowsingContext context, DeclarationInfo info) =>
+ info.Flags != PropertyFlags.Unknown || context.IsAllowingUnknownDeclarations();
+
private static Boolean IsAllowingUnknownDeclarations(this IBrowsingContext context)
{
var parser = context.GetProvider();
- return parser != null ? parser.Options.IsIncludingUnknownDeclarations : true;
+ return parser?.Options.IsIncludingUnknownDeclarations ?? true;
+ }
+
+ private static ICssProperty[] CreateProperties(this IDeclarationFactory factory, String[] names, ICssValue[] values, Boolean important)
+ {
+ if (values != null && values.Length == names.Length)
+ {
+ var properties = new ICssProperty[names.Length];
+
+ for (var i = 0; i < names.Length; i++)
+ {
+ var info = factory.Create(names[i]);
+ properties[i] = new CssProperty(names[i], info.Converter, info.Flags, values[i], important);
+ }
+
+ return properties;
+ }
+
+ return null;
}
}
}
diff --git a/src/AngleSharp.Css/Constants/CssKeywords.cs b/src/AngleSharp.Css/Constants/CssKeywords.cs
index 06a3c952..404b0488 100644
--- a/src/AngleSharp.Css/Constants/CssKeywords.cs
+++ b/src/AngleSharp.Css/Constants/CssKeywords.cs
@@ -17,6 +17,11 @@ public static class CssKeywords
///
public static readonly String Clip = "clip";
+ ///
+ /// The legacy keyword.
+ ///
+ public static readonly String Legacy = "legacy";
+
///
/// The normal keyword.
///
@@ -121,11 +126,17 @@ public static class CssKeywords
/// The break-all keyword.
///
public static readonly String BreakWord = "break-word";
+
///
/// The important keyword.
///
public static readonly String Important = "important";
+ ///
+ /// The !important keyword.
+ ///
+ public static readonly String BangImportant = "!important";
+
///
/// The inherit keyword.
///
@@ -151,6 +162,11 @@ public static class CssKeywords
///
public static readonly String Auto = "auto";
+ ///
+ /// The mixed keyword.
+ ///
+ public static readonly String Mixed = "mixed";
+
///
/// The auto-fill keyword.
///
@@ -181,6 +197,11 @@ public static class CssKeywords
///
public static readonly String MaxContent = "max-content";
+ ///
+ /// The format keyword.
+ ///
+ public static readonly String Format = "format";
+
///
/// The from keyword.
///
@@ -1485,5 +1506,30 @@ public static class CssKeywords
/// The right bottom keyword.
///
public static readonly String RightBottom = "right bottom";
+
+ ///
+ /// The stroke keyword.
+ ///
+ public static readonly String Stroke = "stroke";
+
+ ///
+ /// The painted keyword.
+ ///
+ public static readonly String Painted = "painted";
+
+ ///
+ /// The visibleStroke keyword.
+ ///
+ public static readonly String VisibleStroke = "visibleStroke";
+
+ ///
+ /// The visibleFill keyword.
+ ///
+ public static readonly String VisibleFill = "visibleFill";
+
+ ///
+ /// The visiblePainted keyword.
+ ///
+ public static readonly String VisiblePainted = "visiblePainted";
}
}
diff --git a/src/AngleSharp.Css/Constants/InitialValues.cs b/src/AngleSharp.Css/Constants/InitialValues.cs
new file mode 100644
index 00000000..48aaf51f
--- /dev/null
+++ b/src/AngleSharp.Css/Constants/InitialValues.cs
@@ -0,0 +1,201 @@
+namespace AngleSharp.Css
+{
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
+ using AngleSharp.Dom;
+ using System;
+
+ ///
+ /// A collection of initial values for the respective CSS declarations.
+ ///
+ 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 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 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 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 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 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 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 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 ScrollbarTrackColorDecl = CssColors.GetColor("scrollbar");
+ public static readonly ICssValue ScrollbarShadowColorDecl = CssColors.GetColor("threeddarkshadow");
+ public static readonly ICssValue ScrollbarHighlightColorDecl = CssColors.GetColor("threedhighlight");
+ public static readonly ICssValue ScrollbarFaceColorDecl = CssColors.GetColor("threedface");
+ public static readonly ICssValue ScrollbarDarkshadowColorDecl = CssColors.GetColor("threeddarkshadow");
+ public static readonly ICssValue ScrollbarBaseColorDecl = Color.Transparent;
+ public static readonly ICssValue ScrollbarArrowColorDecl = CssColors.GetColor("buttontext");
+ public static readonly ICssValue Scrollbar3dLightColorDecl = Color.White;
+ public static readonly ICssValue LetterSpacingDecl = Length.Normal;
+ public static readonly ICssValue FontSizeAdjustDecl = new Length(1.0, Length.Unit.Em);
+ }
+}
diff --git a/src/AngleSharp.Css/Map.cs b/src/AngleSharp.Css/Constants/Map.cs
similarity index 94%
rename from src/AngleSharp.Css/Map.cs
rename to src/AngleSharp.Css/Constants/Map.cs
index 55e488ce..e9b625e4 100644
--- a/src/AngleSharp.Css/Map.cs
+++ b/src/AngleSharp.Css/Constants/Map.cs
@@ -146,15 +146,15 @@ static class Map
///
/// Contains the string-TimingFunction mapping.
///
- public static readonly Dictionary TimingFunctions = new Dictionary(StringComparer.OrdinalIgnoreCase)
+ public static readonly Dictionary TimingFunctions = new Dictionary(StringComparer.OrdinalIgnoreCase)
{
- { CssKeywords.Ease, new CubicBezierTimingFunction(0.25, 0.1, 0.25, 1.0) },
- { CssKeywords.EaseIn, new CubicBezierTimingFunction(0.42, 0.0, 1.0, 1.0) },
- { CssKeywords.EaseOut, new CubicBezierTimingFunction(0.0, 0.0, 0.58, 1.0) },
- { CssKeywords.EaseInOut, new CubicBezierTimingFunction(0.42, 0.0, 0.58, 1.0) },
- { CssKeywords.Linear, new CubicBezierTimingFunction(0.0, 0.0, 1.0, 1.0) },
- { CssKeywords.StepStart, new StepsTimingFunction(1, true) },
- { CssKeywords.StepEnd, new StepsTimingFunction(1, false) },
+ { CssKeywords.Ease, new CssCubicBezierValue(0.25, 0.1, 0.25, 1.0) },
+ { CssKeywords.EaseIn, new CssCubicBezierValue(0.42, 0.0, 1.0, 1.0) },
+ { CssKeywords.EaseOut, new CssCubicBezierValue(0.0, 0.0, 0.58, 1.0) },
+ { CssKeywords.EaseInOut, new CssCubicBezierValue(0.42, 0.0, 0.58, 1.0) },
+ { CssKeywords.Linear, new CssCubicBezierValue(0.0, 0.0, 1.0, 1.0) },
+ { CssKeywords.StepStart, new CssStepsValue(1, true) },
+ { CssKeywords.StepEnd, new CssStepsValue(1, false) },
};
///
@@ -638,12 +638,12 @@ static class Map
///
/// Contains the string-SizeMode mapping.
///
- public static readonly Dictionary RadialGradientSizeModes = new Dictionary(StringComparer.OrdinalIgnoreCase)
+ public static readonly Dictionary RadialGradientSizeModes = new Dictionary(StringComparer.OrdinalIgnoreCase)
{
- { CssKeywords.ClosestSide, RadialGradient.SizeMode.ClosestSide },
- { CssKeywords.FarthestSide, RadialGradient.SizeMode.FarthestSide },
- { CssKeywords.ClosestCorner, RadialGradient.SizeMode.ClosestCorner },
- { CssKeywords.FarthestCorner, RadialGradient.SizeMode.FarthestCorner },
+ { CssKeywords.ClosestSide, CssRadialGradientValue.SizeMode.ClosestSide },
+ { CssKeywords.FarthestSide, CssRadialGradientValue.SizeMode.FarthestSide },
+ { CssKeywords.ClosestCorner, CssRadialGradientValue.SizeMode.ClosestCorner },
+ { CssKeywords.FarthestCorner, CssRadialGradientValue.SizeMode.FarthestCorner },
};
///
@@ -753,6 +753,23 @@ static class Map
{ CssKeywords.Start, RubyOverhangMode.Start },
};
+ ///
+ /// Contains the string-PointerEvent mapping.
+ ///
+ public static readonly Dictionary PointerEvents = new Dictionary(StringComparer.OrdinalIgnoreCase)
+ {
+ { CssKeywords.None, PointerEvent.None },
+ { CssKeywords.Auto, PointerEvent.Auto },
+ { CssKeywords.Visible, PointerEvent.Visible },
+ { CssKeywords.VisibleFill, PointerEvent.VisibleFill },
+ { CssKeywords.VisiblePainted, PointerEvent.VisiblePainted },
+ { CssKeywords.VisibleStroke, PointerEvent.VisibleStroke },
+ { CssKeywords.Painted, PointerEvent.Painted },
+ { CssKeywords.Fill, PointerEvent.Fill },
+ { CssKeywords.Stroke, PointerEvent.Stroke },
+ { CssKeywords.All, PointerEvent.All },
+ };
+
///
/// Contains the string-FlexDirection mapping.
///
diff --git a/src/AngleSharp.Css/Converters/CounterValueConverter.cs b/src/AngleSharp.Css/Converters/CounterValueConverter.cs
index 42e90f9c..90a98646 100644
--- a/src/AngleSharp.Css/Converters/CounterValueConverter.cs
+++ b/src/AngleSharp.Css/Converters/CounterValueConverter.cs
@@ -9,6 +9,8 @@ namespace AngleSharp.Css.Converters
sealed class CounterValueConverter : IValueConverter
{
+ private static readonly CounterValue[] NoneValue = Array.Empty();
+
private readonly Int32 _defaultValue;
public CounterValueConverter(Int32 defaultValue)
@@ -18,7 +20,7 @@ public CounterValueConverter(Int32 defaultValue)
public ICssValue Convert(StringSource source)
{
- var counters = new List();
+ var counters = new List();
if (!source.IsIdentifier(CssKeywords.None))
{
@@ -37,10 +39,10 @@ public ICssValue Convert(StringSource source)
counters.Add(new CounterValue(name, value));
}
- return new Counters(counters.ToArray());
+ return new CssTupleValue(counters.ToArray());
}
- return new Counters();
+ return new Constant(CssKeywords.None, NoneValue);
}
}
}
diff --git a/src/AngleSharp.Css/Converters/IdentifierValueConverter.cs b/src/AngleSharp.Css/Converters/IdentifierValueConverter.cs
index b6b087a9..72b3f537 100644
--- a/src/AngleSharp.Css/Converters/IdentifierValueConverter.cs
+++ b/src/AngleSharp.Css/Converters/IdentifierValueConverter.cs
@@ -41,7 +41,12 @@ public IdentifierValueConverter(String identifier, T result)
public ICssValue Convert(StringSource source)
{
- return source.IsIdentifier(_identifier) ? new Constant(_identifier, _result) : null;
+ if (source.IsIdentifier(_identifier))
+ {
+ return new Constant(_identifier, _result);
+ }
+
+ return null;
}
}
}
diff --git a/src/AngleSharp.Css/Converters/OptionValueConverter.cs b/src/AngleSharp.Css/Converters/OptionValueConverter.cs
index 8bee1373..3505ed39 100644
--- a/src/AngleSharp.Css/Converters/OptionValueConverter.cs
+++ b/src/AngleSharp.Css/Converters/OptionValueConverter.cs
@@ -4,12 +4,12 @@ namespace AngleSharp.Css.Converters
using AngleSharp.Css.Values;
using AngleSharp.Text;
- sealed class OptionValueConverter : IValueConverter
+ sealed class OptionValueConverter : IValueConverter
{
private readonly IValueConverter _converter;
- private readonly T _defaultValue;
+ private readonly ICssValue _defaultValue;
- public OptionValueConverter(IValueConverter converter, T defaultValue)
+ public OptionValueConverter(IValueConverter converter, ICssValue defaultValue)
{
_converter = converter;
_defaultValue = defaultValue;
@@ -19,7 +19,7 @@ public ICssValue Convert(StringSource source)
{
if (source.IsDone || source.Current == Symbols.Comma)
{
- return new Default(_defaultValue);
+ return new CssInitialValue(_defaultValue);
}
return _converter.Convert(source);
diff --git a/src/AngleSharp.Css/Converters/PeriodicValueConverter.cs b/src/AngleSharp.Css/Converters/PeriodicValueConverter.cs
index 6cf4ec84..3d718eb1 100644
--- a/src/AngleSharp.Css/Converters/PeriodicValueConverter.cs
+++ b/src/AngleSharp.Css/Converters/PeriodicValueConverter.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Converters
+namespace AngleSharp.Css.Converters
{
using AngleSharp.Css.Dom;
using AngleSharp.Css.Parser;
@@ -35,7 +35,7 @@ public ICssValue Convert(StringSource source)
{
var values = new ICssValue[length];
Array.Copy(options, values, length);
- return new Periodic(values);
+ return new CssPeriodicValue(values);
}
return null;
diff --git a/src/AngleSharp.Css/Converters/RadiusValueConverter.cs b/src/AngleSharp.Css/Converters/RadiusValueConverter.cs
new file mode 100644
index 00000000..985229e7
--- /dev/null
+++ b/src/AngleSharp.Css/Converters/RadiusValueConverter.cs
@@ -0,0 +1,44 @@
+namespace AngleSharp.Css.Converters
+{
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Parser;
+ using AngleSharp.Css.Values;
+ using AngleSharp.Text;
+ using System;
+
+ sealed class RadiusValueConverter : IValueConverter
+ {
+ private readonly IValueConverter _converter;
+
+ public RadiusValueConverter(IValueConverter converter)
+ {
+ _converter = converter;
+ }
+
+ public ICssValue Convert(StringSource source)
+ {
+ var options = new ICssValue[2];
+ var length = 0;
+
+ for (var i = 0; i < options.Length; i++)
+ {
+ options[i] = _converter.Convert(source);
+ source.SkipSpacesAndComments();
+
+ if (options[length] != null)
+ {
+ length++;
+ }
+ }
+
+ if (length > 0)
+ {
+ var values = new ICssValue[length];
+ Array.Copy(options, values, length);
+ return new CssRadiusValue(values);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/src/AngleSharp.Css/Converters/StandardValueConverter.cs b/src/AngleSharp.Css/Converters/StandardValueConverter.cs
index 5ea8054d..79021014 100644
--- a/src/AngleSharp.Css/Converters/StandardValueConverter.cs
+++ b/src/AngleSharp.Css/Converters/StandardValueConverter.cs
@@ -5,11 +5,11 @@ namespace AngleSharp.Css.Converters
using AngleSharp.Css.Values;
using AngleSharp.Text;
- sealed class StandardValueConverter : IValueConverter
+ sealed class StandardValueConverter : IValueConverter
{
- private readonly T _defaultValue;
+ private readonly ICssValue _defaultValue;
- public StandardValueConverter(T defaultValue)
+ public StandardValueConverter(ICssValue defaultValue)
{
_defaultValue = defaultValue;
}
@@ -20,15 +20,15 @@ public ICssValue Convert(StringSource source)
if (ident.Isi(CssKeywords.Initial))
{
- return new Initial(_defaultValue);
+ return new CssInitialValue(_defaultValue);
}
else if (ident.Isi(CssKeywords.Inherit))
{
- return Inherit.Instance;
+ return CssInheritValue.Instance;
}
else if (ident.Isi(CssKeywords.Unset))
{
- return new Unset(_defaultValue);
+ return new CssUnsetValue(_defaultValue);
}
else if (ident.Isi(FunctionNames.Var) && source.Current == Symbols.RoundBracketOpen)
{
diff --git a/src/AngleSharp.Css/CssConfigurationExtensions.cs b/src/AngleSharp.Css/CssConfigurationExtensions.cs
index 2afeb17f..d0795928 100644
--- a/src/AngleSharp.Css/CssConfigurationExtensions.cs
+++ b/src/AngleSharp.Css/CssConfigurationExtensions.cs
@@ -15,15 +15,16 @@ public static class CssConfigurationExtensions
///
/// The configuration to extend.
/// Optional options for the parser.
- /// Optional setup for the style engine.
/// The new instance with the service.
- public static IConfiguration WithCss(this IConfiguration configuration, CssParserOptions options = default(CssParserOptions), Action setup = null)
+ public static IConfiguration WithCss(this IConfiguration configuration, CssParserOptions options = default(CssParserOptions))
{
- if (configuration == null)
- throw new ArgumentNullException(nameof(configuration));
-
+ configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
var service = new CssStylingService();
- setup?.Invoke(service);
+
+ if (!configuration.Has())
+ {
+ configuration = configuration.With(new CssDefaultStyleSheetProvider());
+ }
if (!configuration.Has())
{
@@ -50,7 +51,18 @@ public static class CssConfigurationExtensions
configuration = configuration.With(context => new CssParser(options, context));
}
- return configuration.WithOnly(Factory.Observer).With(service);
+ return configuration
+ .WithOnly(Factory.Observer)
+ .WithOnly(service);
}
+
+ ///
+ /// Registers the render device for the given configuration.
+ ///
+ /// The configuration to extend.
+ /// The custom device to register, if any.
+ /// The new instance with the render device.
+ public static IConfiguration WithRenderDevice(this IConfiguration configuration, IRenderDevice renderDevice = null) =>
+ configuration.WithOnly(renderDevice ?? new DefaultRenderDevice());
}
}
diff --git a/src/AngleSharp.Css/CssDefaultStyleSheetProvider.cs b/src/AngleSharp.Css/CssDefaultStyleSheetProvider.cs
new file mode 100644
index 00000000..1afae9b4
--- /dev/null
+++ b/src/AngleSharp.Css/CssDefaultStyleSheetProvider.cs
@@ -0,0 +1,125 @@
+namespace AngleSharp.Css
+{
+ using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Parser;
+ using System;
+
+ sealed class CssDefaultStyleSheetProvider : ICssDefaultStyleSheetProvider
+ {
+ #region Fields
+
+ private ICssStyleSheet _default;
+
+ #endregion
+
+ #region Properties
+
+ public ICssStyleSheet Default => _default ?? (_default = Parse(DefaultSource));
+
+ #endregion
+
+ #region Methods
+
+ public void SetDefault(ICssStyleSheet sheet) => _default = sheet;
+
+ public void SetDefault(String source) => SetDefault(Parse(source));
+
+ public void AppendDefault(String source) => SetDefault(Parse($"{DefaultSource}\r\n{source}"));
+
+ #endregion
+
+ #region Default Stylesheet
+
+ private static ICssStyleSheet Parse(String source)
+ {
+ var parser = new CssParser();
+ return parser.ParseStyleSheet(source);
+ }
+
+ ///
+ /// Gets the source code for the by default used base stylesheet.
+ /// Taken from https://www.w3.org/TR/CSS22/sample.html.
+ ///
+ public static readonly String DefaultSource = @"
+html, address,
+blockquote,
+body, dd, div,
+dl, dt, fieldset, form,
+frame, frameset,
+h1, h2, h3, h4,
+h5, h6, noframes,
+ol, p, ul, center,
+dir, hr, menu, pre { display: block; unicode-bidi: embed }
+li { display: list-item }
+head { display: none }
+table { display: table }
+tr { display: table-row }
+thead { display: table-header-group }
+tbody { display: table-row-group }
+tfoot { display: table-footer-group }
+col { display: table-column }
+colgroup { display: table-column-group }
+td, th { display: table-cell }
+caption { display: table-caption }
+th { font-weight: bolder; text-align: center }
+caption { text-align: center }
+body { margin: 8px }
+h1 { font-size: 2em; margin: .67em 0 }
+h2 { font-size: 1.5em; margin: .75em 0 }
+h3 { font-size: 1.17em; margin: .83em 0 }
+h4, p,
+blockquote, ul,
+fieldset, form,
+ol, dl, dir,
+menu { margin: 1.12em 0 }
+h5 { font-size: .83em; margin: 1.5em 0 }
+h6 { font-size: .75em; margin: 1.67em 0 }
+h1, h2, h3, h4,
+h5, h6, b,
+strong { font-weight: bolder }
+blockquote { margin-left: 40px; margin-right: 40px }
+i, cite, em,
+var, address { font-style: italic }
+pre, tt, code,
+kbd, samp { font-family: monospace }
+pre { white-space: pre }
+button, textarea,
+input, select { display: inline-block }
+big { font-size: 1.17em }
+small, sub, sup { font-size: .83em }
+sub { vertical-align: sub }
+sup { vertical-align: super }
+table { border-spacing: 2px; }
+thead, tbody,
+tfoot { vertical-align: middle }
+td, th, tr { vertical-align: inherit }
+s, strike, del { text-decoration: line-through }
+hr { border: 1px inset }
+ol, ul, dir,
+menu, dd { margin-left: 40px }
+ol { list-style-type: decimal }
+ol ul, ul ol,
+ul ul, ol ol { margin-top: 0; margin-bottom: 0 }
+u, ins { text-decoration: underline }
+br:before { content: '\A'; white-space: pre-line }
+center { text-align: center }
+:link, :visited { text-decoration: underline }
+:focus { outline: thin dotted invert }
+
+/* Begin bidirectionality settings (do not change) */
+BDO[DIR='ltr'] { direction: ltr; unicode-bidi: bidi-override }
+BDO[DIR='rtl'] { direction: rtl; unicode-bidi: bidi-override }
+
+*[DIR='ltr'] { direction: ltr; unicode-bidi: embed }
+*[DIR='rtl'] { direction: rtl; unicode-bidi: embed }
+
+@media print {
+ h1 { page-break-before: always }
+ h1, h2, h3,
+ h4, h5, h6 { page-break-after: avoid }
+ ul, ol, dl { page-break-before: avoid }
+}";
+
+ #endregion
+ }
+}
diff --git a/src/AngleSharp.Css/CssStylingService.cs b/src/AngleSharp.Css/CssStylingService.cs
index 5165e6dd..f685d223 100644
--- a/src/AngleSharp.Css/CssStylingService.cs
+++ b/src/AngleSharp.Css/CssStylingService.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css
+namespace AngleSharp.Css
{
using AngleSharp.Css.Dom;
using AngleSharp.Css.Parser;
@@ -14,40 +14,9 @@
///
public class CssStylingService : IStylingService
{
- #region Fields
-
- private ICssStyleSheet _default;
-
- #endregion
-
- #region Properties
-
- ///
- /// Gets the default stylesheet as specified by the W3C:
- /// http://www.w3.org/TR/CSS21/sample.html
- ///
- public ICssStyleSheet Default
- {
- get { return _default ?? (_default = ParseDefault()); }
- }
-
- #endregion
-
#region Methods
- Boolean IStylingService.SupportsType(String mimeType)
- {
- return mimeType.Isi(MimeTypeNames.Css);
- }
-
- ///
- /// Sets a new default stylesheet to use.
- ///
- /// The default stylesheet to use.
- public void SetDefault(ICssStyleSheet sheet)
- {
- _default = sheet;
- }
+ Boolean IStylingService.SupportsType(String mimeType) => mimeType.Isi(MimeTypeNames.Css);
///
/// Creates a style sheet for the given response asynchronously.
@@ -77,98 +46,5 @@ public async Task ParseStylesheetAsync(IResponse response, StyleOpt
}
#endregion
-
- #region Default Stylesheet
-
- private ICssStyleSheet ParseDefault()
- {
- var parser = new CssParser();
- return parser.ParseStyleSheet(DefaultSource);
- }
-
- ///
- /// Gets the source code for the by default used base stylesheet.
- ///
- public static readonly String DefaultSource = @"
-html, address,
-blockquote,
-body, dd, div,
-dl, dt, fieldset, form,
-frame, frameset,
-h1, h2, h3, h4,
-h5, h6, noframes,
-ol, p, ul, center,
-dir, hr, menu, pre { display: block; unicode-bidi: embed }
-li { display: list-item }
-head { display: none }
-table { display: table }
-tr { display: table-row }
-thead { display: table-header-group }
-tbody { display: table-row-group }
-tfoot { display: table-footer-group }
-col { display: table-column }
-colgroup { display: table-column-group }
-td, th { display: table-cell }
-caption { display: table-caption }
-th { font-weight: bolder; text-align: center }
-caption { text-align: center }
-body { margin: 8px }
-h1 { font-size: 2em; margin: .67em 0 }
-h2 { font-size: 1.5em; margin: .75em 0 }
-h3 { font-size: 1.17em; margin: .83em 0 }
-h4, p,
-blockquote, ul,
-fieldset, form,
-ol, dl, dir,
-menu { margin: 1.12em 0 }
-h5 { font-size: .83em; margin: 1.5em 0 }
-h6 { font-size: .75em; margin: 1.67em 0 }
-h1, h2, h3, h4,
-h5, h6, b,
-strong { font-weight: bolder }
-blockquote { margin-left: 40px; margin-right: 40px }
-i, cite, em,
-var, address { font-style: italic }
-pre, tt, code,
-kbd, samp { font-family: monospace }
-pre { white-space: pre }
-button, textarea,
-input, select { display: inline-block }
-big { font-size: 1.17em }
-small, sub, sup { font-size: .83em }
-sub { vertical-align: sub }
-sup { vertical-align: super }
-table { border-spacing: 2px; }
-thead, tbody,
-tfoot { vertical-align: middle }
-td, th, tr { vertical-align: inherit }
-s, strike, del { text-decoration: line-through }
-hr { border: 1px inset }
-ol, ul, dir,
-menu, dd { margin-left: 40px }
-ol { list-style-type: decimal }
-ol ul, ul ol,
-ul ul, ol ol { margin-top: 0; margin-bottom: 0 }
-u, ins { text-decoration: underline }
-br:before { content: '\A'; white-space: pre-line }
-center { text-align: center }
-:link, :visited { text-decoration: underline }
-:focus { outline: thin dotted invert }
-
-/* Begin bidirectionality settings (do not change) */
-BDO[DIR='ltr'] { direction: ltr; unicode-bidi: bidi-override }
-BDO[DIR='rtl'] { direction: rtl; unicode-bidi: bidi-override }
-
-*[DIR='ltr'] { direction: ltr; unicode-bidi: embed }
-*[DIR='rtl'] { direction: rtl; unicode-bidi: embed }
-
-@media print {
- h1 { page-break-before: always }
- h1, h2, h3,
- h4, h5, h6 { page-break-after: avoid }
- ul, ol, dl { page-break-before: avoid }
-}";
-
- #endregion
}
}
diff --git a/src/AngleSharp.Css/CssValueExtensions.cs b/src/AngleSharp.Css/CssValueExtensions.cs
deleted file mode 100644
index b4169945..00000000
--- a/src/AngleSharp.Css/CssValueExtensions.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-namespace AngleSharp.Css
-{
- using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using System;
-
- static class CssValueExtensions
- {
- public static Double AsNumber(this ICssValue value)
- {
- var length = value as Length?;
-
- if (length.HasValue && length.Value.Type == Length.Unit.None)
- {
- return length.Value.Value;
- }
-
- return 0.0;
- }
-
- public static Double AsPixel(this ICssValue value)
- {
- var length = value as Length?;
-
- if (length.HasValue && length.Value.Type != Length.Unit.None)
- {
- return length.Value.ToPixel();
- }
-
- return 0.0;
- }
-
- public static Int32 AsInteger(this ICssValue value)
- {
- return (Int32)value.AsNumber();
- }
-
- public static Boolean AsBoolean(this ICssValue value)
- {
- return false;
- }
-
- public static T AsEnum(this ICssValue value)
- where T : struct, IComparable
- {
- return default(T);
- }
-
- public static Boolean Is(this ICssValue value, String keyword)
- {
- return false;
- }
- }
-}
diff --git a/src/AngleSharp.Css/DeclarationInfo.cs b/src/AngleSharp.Css/DeclarationInfo.cs
index 4d688b83..9391ac78 100644
--- a/src/AngleSharp.Css/DeclarationInfo.cs
+++ b/src/AngleSharp.Css/DeclarationInfo.cs
@@ -1,6 +1,8 @@
namespace AngleSharp.Css
{
+ using AngleSharp.Css.Dom;
using System;
+ using static ValueConverters;
///
/// A collection of useful information regarding a CSS declaration.
@@ -13,15 +15,18 @@ public class DeclarationInfo
/// The name of the declaration.
/// The value converter.
/// The property flags.
+ /// The initial value, if any.
/// The names of the associated shorthand declarations, if any.
/// The names of the associated longhand declarations, if any.
- public DeclarationInfo(String name, IValueConverter converter, PropertyFlags flags = PropertyFlags.None, String[] shorthands = null, String[] longhands = null)
+ public DeclarationInfo(String name, IValueConverter converter, PropertyFlags flags = PropertyFlags.None, ICssValue initialValue = null, String[] shorthands = null, String[] longhands = null)
{
Name = name;
- Converter = converter;
+ Converter = initialValue != null ? Or(converter, AssignInitial(initialValue)) : converter;
+ Aggregator = converter as IValueAggregator;
Flags = flags;
- Shorthands = shorthands ?? new String[0];
- Longhands = longhands ?? new String[0];
+ InitialValue = initialValue;
+ Shorthands = shorthands ?? Array.Empty();
+ Longhands = longhands ?? Array.Empty();
}
///
@@ -29,11 +34,21 @@ public DeclarationInfo(String name, IValueConverter converter, PropertyFlags fla
///
public String Name { get; }
+ ///
+ /// Gets the initial value of the declaration, if any.
+ ///
+ public ICssValue InitialValue { get; }
+
///
/// Gets the associated value converter.
///
public IValueConverter Converter { get; }
+ ///
+ /// Gets the value aggregator, if any.
+ ///
+ public IValueAggregator Aggregator { get; }
+
///
/// Gets the flags of the declaration.
///
diff --git a/src/AngleSharp.Css/Declarations/AlignContentDeclaration.cs b/src/AngleSharp.Css/Declarations/AlignContentDeclaration.cs
index e496160a..8d4b25f8 100644
--- a/src/AngleSharp.Css/Declarations/AlignContentDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AlignContentDeclaration.cs
@@ -8,7 +8,9 @@ static class AlignContentDeclaration
{
public static String Name = PropertyNames.AlignContent;
- public static IValueConverter Converter = Or(AlignContentConverter, AssignInitial(FlexContentMode.Stretch));
+ public static IValueConverter Converter = AlignContentConverter;
+
+ public static ICssValue InitialValue = InitialValues.AlignContentDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AlignItemsDeclaration.cs b/src/AngleSharp.Css/Declarations/AlignItemsDeclaration.cs
index 3ec9f5d5..0ad72479 100644
--- a/src/AngleSharp.Css/Declarations/AlignItemsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AlignItemsDeclaration.cs
@@ -8,7 +8,9 @@ static class AlignItemsDeclaration
{
public static String Name = PropertyNames.AlignItems;
- public static IValueConverter Converter = Or(AlignItemsConverter, AssignInitial(FlexContentMode.Stretch));
+ public static IValueConverter Converter = AlignItemsConverter;
+
+ public static ICssValue InitialValue = InitialValues.AlignItemsDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AlignSelfDeclaration.cs b/src/AngleSharp.Css/Declarations/AlignSelfDeclaration.cs
index 9dbec392..02406c7a 100644
--- a/src/AngleSharp.Css/Declarations/AlignSelfDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AlignSelfDeclaration.cs
@@ -8,7 +8,9 @@ static class AlignSelfDeclaration
{
public static String Name = PropertyNames.AlignSelf;
- public static IValueConverter Converter = Or(AlignSelfConverter, AssignInitial(FlexContentMode.Auto));
+ public static IValueConverter Converter = AlignSelfConverter;
+
+ public static ICssValue InitialValue = InitialValues.AlignSelfDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationDeclaration.cs
index bfb64753..c103c634 100644
--- a/src/AngleSharp.Css/Declarations/AnimationDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationDeclaration.cs
@@ -5,7 +5,6 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Css.Values;
using AngleSharp.Text;
using System;
- using System.Collections.Generic;
using System.Linq;
using static ValueConverters;
@@ -15,6 +14,8 @@ static class AnimationDeclaration
public static IValueConverter Converter = new AnimationAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -29,32 +30,19 @@ static class AnimationDeclaration
PropertyNames.AnimationName,
};
- sealed class AnimationConverter : IValueConverter
- {
- private static readonly IValueConverter ListConverter = WithAny(
- TimeConverter.Option(),
- TransitionConverter.Option(),
- TimeConverter.Option(),
- PositiveOrInfiniteNumberConverter.Option(),
- AnimationDirectionConverter.Option(),
- AnimationFillStyleConverter.Option(),
- PlayStateConverter.Option(),
- IdentifierConverter.Option()).FromList();
-
- public ICssValue Convert(StringSource source)
- {
- return ListConverter.Convert(source);
- }
- }
-
sealed class AnimationAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new AnimationConverter(), AssignInitial());
+ private static readonly IValueConverter ListConverter = WithAny(
+ TimeConverter.Option(InitialValues.AnimationDurationDecl),
+ TransitionConverter.Option(InitialValues.AnimationTimingFunctionDecl),
+ TimeConverter.Option(InitialValues.AnimationDelayDecl),
+ PositiveOrInfiniteNumberConverter.Option(InitialValues.AnimationIterationCountDecl),
+ AnimationDirectionConverter.Option(InitialValues.AnimationDirectionDecl),
+ AnimationFillStyleConverter.Option(InitialValues.AnimationFillModeDecl),
+ PlayStateConverter.Option(InitialValues.AnimationPlayStateDecl),
+ IdentifierConverter.Option(InitialValues.AnimationNameDecl)).FromList();
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => ListConverter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -77,9 +65,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var list = value as CssListValue;
-
- if (list != null)
+ if (value is CssListValue list)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/AnimationDelayDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationDelayDeclaration.cs
index e26fa2d1..3ea7e79d 100644
--- a/src/AngleSharp.Css/Declarations/AnimationDelayDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationDelayDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class AnimationDelayDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(TimeConverter.FromList(), AssignInitial(Time.Zero));
+ public static IValueConverter Converter = TimeConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationDelayDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationDirectionDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationDirectionDeclaration.cs
index c741da16..54f77f0b 100644
--- a/src/AngleSharp.Css/Declarations/AnimationDirectionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationDirectionDeclaration.cs
@@ -14,7 +14,9 @@ static class AnimationDirectionDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(AnimationDirectionConverter.FromList(), AssignInitial(AnimationDirection.Normal));
+ public static IValueConverter Converter = AnimationDirectionConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationDirectionDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationDurationDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationDurationDeclaration.cs
index e3686dc1..0e09f8cb 100644
--- a/src/AngleSharp.Css/Declarations/AnimationDurationDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationDurationDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class AnimationDurationDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(TimeConverter.FromList(), AssignInitial(Time.Zero));
+ public static IValueConverter Converter = TimeConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationDurationDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationFillModeDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationFillModeDeclaration.cs
index 0d14f77d..6afb6874 100644
--- a/src/AngleSharp.Css/Declarations/AnimationFillModeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationFillModeDeclaration.cs
@@ -14,7 +14,9 @@ static class AnimationFillModeDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(AnimationFillStyleConverter.FromList(), AssignInitial(AnimationFillStyle.None));
+ public static IValueConverter Converter = AnimationFillStyleConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationFillModeDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationIterationCountDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationIterationCountDeclaration.cs
index 9cfe2766..7dde584d 100644
--- a/src/AngleSharp.Css/Declarations/AnimationIterationCountDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationIterationCountDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +14,9 @@ static class AnimationIterationCountDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(PositiveOrInfiniteNumberConverter.FromList(), AssignInitial(1f));
+ public static IValueConverter Converter = PositiveOrInfiniteNumberConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationIterationCountDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationNameDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationNameDeclaration.cs
index 91597c04..21ba494f 100644
--- a/src/AngleSharp.Css/Declarations/AnimationNameDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationNameDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +14,9 @@ static class AnimationNameDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(IdentifierConverter.FromList(), None, AssignInitial());
+ public static IValueConverter Converter = Or(IdentifierConverter.FromList(), None);
+
+ public static ICssValue InitialValue = InitialValues.AnimationNameDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationPlayStateDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationPlayStateDeclaration.cs
index 1e38a245..f8460ad7 100644
--- a/src/AngleSharp.Css/Declarations/AnimationPlayStateDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationPlayStateDeclaration.cs
@@ -14,7 +14,9 @@ static class AnimationPlayStateDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(PlayStateConverter.FromList(), AssignInitial(PlayState.Running));
+ public static IValueConverter Converter = PlayStateConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationPlayStateDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/AnimationTimingFunctionDeclaration.cs b/src/AngleSharp.Css/Declarations/AnimationTimingFunctionDeclaration.cs
index 514ce8ce..fedfd1ce 100644
--- a/src/AngleSharp.Css/Declarations/AnimationTimingFunctionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/AnimationTimingFunctionDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class AnimationTimingFunctionDeclaration
PropertyNames.Animation,
};
- public static IValueConverter Converter = Or(TransitionConverter.FromList(), AssignInitial(CubicBezierTimingFunction.Ease));
+ public static IValueConverter Converter = TransitionConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.AnimationTimingFunctionDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackfaceVisibilityDeclaration.cs b/src/AngleSharp.Css/Declarations/BackfaceVisibilityDeclaration.cs
index 6e06cdc0..142641bd 100644
--- a/src/AngleSharp.Css/Declarations/BackfaceVisibilityDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackfaceVisibilityDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class BackfaceVisibilityDeclaration
{
public static String Name = PropertyNames.BackfaceVisibility;
- public static IValueConverter Converter = Or(BackfaceVisibilityConverter, AssignInitial(true));
+ public static IValueConverter Converter = BackfaceVisibilityConverter;
+
+ public static ICssValue InitialValue = InitialValues.BackfaceVisibilityDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundAttachmentDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundAttachmentDeclaration.cs
index 6d38f8fd..6acaf6aa 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundAttachmentDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundAttachmentDeclaration.cs
@@ -14,7 +14,9 @@ static class BackgroundAttachmentDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(BackgroundAttachmentConverter.FromList(), AssignInitial(BackgroundAttachment.Scroll));
+ public static IValueConverter Converter = BackgroundAttachmentConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundAttachmentDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundClipDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundClipDeclaration.cs
index bfa8a48b..6a818dc6 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundClipDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundClipDeclaration.cs
@@ -14,7 +14,9 @@ static class BackgroundClipDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(BoxModelConverter.FromList(), AssignInitial(BoxModel.BorderBox));
+ public static IValueConverter Converter = BoxModelConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundClipDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundColorDeclaration.cs
index cfd83152..dd03e67c 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundColorDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class BackgroundColorDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(CurrentColorConverter, AssignInitial());
+ public static IValueConverter Converter = CurrentColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.BackgroundColorDecl;
public static PropertyFlags Flags = PropertyFlags.Hashless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundDeclaration.cs
index ed6cbf00..93fd41ed 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundDeclaration.cs
@@ -7,7 +7,6 @@ namespace AngleSharp.Css.Declarations
using System;
using System.Collections.Generic;
using System.Linq;
- using static ValueConverters;
static class BackgroundDeclaration
{
@@ -15,35 +14,33 @@ static class BackgroundDeclaration
public static IValueConverter Converter = new BackgroundAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
{
- PropertyNames.BackgroundColor,
PropertyNames.BackgroundImage,
+ PropertyNames.BackgroundPosition,
+ PropertyNames.BackgroundSize,
+ PropertyNames.BackgroundRepeat,
PropertyNames.BackgroundAttachment,
- PropertyNames.BackgroundClip,
- PropertyNames.BackgroundPositionX,
- PropertyNames.BackgroundPositionY,
PropertyNames.BackgroundOrigin,
- PropertyNames.BackgroundRepeatX,
- PropertyNames.BackgroundRepeatY,
- PropertyNames.BackgroundSize,
+ PropertyNames.BackgroundClip,
+ PropertyNames.BackgroundColor,
};
- sealed class BackgroundValueConverter : IValueConverter
+ sealed class BackgroundAggregator : IValueAggregator, IValueConverter
{
public ICssValue Convert(StringSource source)
{
- var layers = new List();
+ var layers = new List();
var color = default(ICssValue);
var pos = 0;
var c = source.SkipSpacesAndComments();
while (!source.IsDone && color == null)
{
- var layer = new BackgroundLayer();
-
if (layers.Count > 0)
{
if (c != Symbols.Comma)
@@ -54,50 +51,58 @@ public ICssValue Convert(StringSource source)
c = source.SkipCurrentAndSpaces();
}
+ var image = default(ICssImageValue);
+ var position = default(Point?);
+ var size = default(CssBackgroundSizeValue);
+ var repeat = default(CssImageRepeatsValue);
+ var attachment = default(ICssValue);
+ var origin = default(ICssValue);
+ var clip = default(ICssValue);
+
do
{
pos = source.Index;
- if (layer.Source == null)
+ if (image == null)
{
- layer.Source = source.ParseImageSource();
+ image = source.ParseImageSource();
c = source.SkipSpacesAndComments();
}
- if (layer.Position == null)
+ if (position == null)
{
- layer.Position = source.ParsePoint();
+ position = source.ParsePoint();
c = source.SkipSpacesAndComments();
- if (c == Symbols.Solidus && layer.Size == null)
+ if (c == Symbols.Solidus && size == null)
{
c = source.SkipSpacesAndComments();
- layer.Size = source.ParseSize();
+ size = source.ParseSize();
c = source.SkipSpacesAndComments();
}
}
- if (layer.Repeat == null)
+ if (repeat == null)
{
- layer.Repeat = source.ParseBackgroundRepeat();
+ repeat = source.ParseBackgroundRepeat();
c = source.SkipSpacesAndComments();
}
- if (layer.Attachment == null)
+ if (attachment == null)
{
- layer.Attachment = source.ParseConstant(Map.BackgroundAttachments);
+ attachment = source.ParseConstant(Map.BackgroundAttachments);
c = source.SkipSpacesAndComments();
}
- if (layer.Origin == null)
+ if (origin == null)
{
- layer.Origin = source.ParseConstant(Map.BoxModels);
+ origin = source.ParseConstant(Map.BoxModels);
c = source.SkipSpacesAndComments();
}
- if (layer.Clip == null)
+ if (clip == null)
{
- layer.Clip = source.ParseConstant(Map.BoxModels);
+ clip = source.ParseConstant(Map.BoxModels);
c = source.SkipSpacesAndComments();
}
@@ -109,41 +114,48 @@ public ICssValue Convert(StringSource source)
}
while (pos != source.Index);
- layers.Add(layer);
+ layers.Add(new CssBackgroundLayerValue(
+ image,
+ position,
+ size,
+ repeat,
+ attachment,
+ origin,
+ clip));
}
- return new Background(new CssListValue(layers.OfType().ToArray()), color);
+ return new CssBackgroundValue(new CssListValue(layers.OfType().ToArray()), color ?? new CssInitialValue(InitialValues.BackgroundColorDecl));
}
- }
+ public ICssValue Merge(ICssValue[] values)
+ {
+ var image = GetList(values[0]);
+ var position = GetList(values[1]);
+ var size = GetList(values[2]);
+ var repeat = GetList(values[3]);
+ var attachment = GetList(values[4]);
+ var origin = GetList(values[5]);
+ var clip = GetList(values[6]);
+ var color = values[7];
+ var layers = CreateLayers(image, attachment, clip, position, origin, repeat, size);
- sealed class BackgroundAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(new BackgroundValueConverter(), AssignInitial());
+ if (color != null || layers != null)
+ {
+ return new CssBackgroundValue(layers, color);
+ }
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
+ return null;
}
- public ICssValue Merge(ICssValue[] values)
+ private static CssListValue GetList(ICssValue value)
{
- var color = values[0];
- var image = values[1];
- var attachment = values[2];
- var clip = values[3];
- var positionX = values[4];
- var positionY = values[5];
- var origin = values[6];
- var repeatX = values[7];
- var repeatY = values[8];
- var size = values[9];
-
- var layers = CreateLayers(image as CssListValue, attachment as CssListValue, clip as CssListValue, positionX as CssListValue, positionY as CssListValue, origin as CssListValue, repeatX as CssListValue, repeatY as CssListValue, size as CssListValue);
-
- if (color != null || layers != null)
+ if (value is CssListValue list)
{
- return new Background(layers, color);
+ return list;
+ }
+ else if (value is CssInitialValue)
+ {
+ return new CssListValue();
}
return null;
@@ -151,50 +163,42 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var background = value as Background;
-
- if (background != null)
+ if (value is CssBackgroundValue background)
{
return new[]
{
+ CreateMultiple(background, m => m.Image, InitialValues.BackgroundImageDecl),
+ CreateMultiple(background, m => m.Position, InitialValues.BackgroundPositionDecl),
+ CreateMultiple(background, m => m.Size, InitialValues.BackgroundSizeDecl),
+ CreateMultiple(background, m => m.Repeat, InitialValues.BackgroundRepeatDecl),
+ CreateMultiple(background, m => m.Attachment, InitialValues.BackgroundAttachmentDecl),
+ CreateMultiple(background, m => m.Origin, InitialValues.BackgroundOriginDecl),
+ CreateMultiple(background, m => m.Clip, InitialValues.BackgroundClipDecl),
background.Color,
- CreateMultiple(background, m => m.Source),
- CreateMultiple(background, m => m.Attachment),
- CreateMultiple(background, m => m.Clip),
- CreateMultiple(background, m => m.Position.HasValue ? m.Position.Value.X : new Nullable()),
- CreateMultiple(background, m => m.Position.HasValue ? m.Position.Value.Y : new Nullable()),
- CreateMultiple(background, m => m.Origin),
- CreateMultiple(background, m => m.Repeat.HasValue ? m.Repeat.Value.Horizontal : null),
- CreateMultiple(background, m => m.Repeat.HasValue ? m.Repeat.Value.Vertical : null),
- CreateMultiple(background, m => m.Size),
};
}
return null;
}
- private static ICssValue CreateLayers(CssListValue image, CssListValue attachment, CssListValue clip, CssListValue positionX, CssListValue positionY, CssListValue origin, CssListValue repeatX, CssListValue repeatY, CssListValue size)
+ private static ICssValue CreateLayers(CssListValue image, CssListValue attachment, CssListValue clip, CssListValue position, CssListValue origin, CssListValue repeat, CssListValue size)
{
- if (image != null)
+ var count = GetCount(image, attachment, clip, position, size, repeat, origin);
+
+ if (count > 0)
{
- var layers = new ICssValue[image.Items.Length];
+ var layers = new ICssValue[count];
- for (var i = 0; i < image.Items.Length; i++)
+ for (var i = 0; i < count; i++)
{
- var px = GetValue(positionX, i);
- var py = GetValue(positionY, i);
- var rx = GetValue(repeatX, i);
- var ry = GetValue(repeatY, i);
- layers[i] = new BackgroundLayer
- {
- Attachment = GetValue(attachment, i),
- Clip = GetValue(clip, i),
- Origin = GetValue(origin, i),
- Position = px == null && py == null ? new Nullable() : new Point(px as Length? ?? Length.Zero, py as Length? ?? Length.Zero),
- Repeat = rx == null && ry == null ? new Nullable() : new ImageRepeats(rx, ry),
- Size = GetValue(size, i),
- Source = image.Items[i],
- };
+ layers[i] = new CssBackgroundLayerValue(
+ GetValue(image, i),
+ GetValue(position, i),
+ GetValue(size, i),
+ GetValue(repeat, i),
+ GetValue(attachment, i),
+ GetValue(origin, i),
+ GetValue(clip, i));
}
return new CssListValue(layers);
@@ -203,6 +207,18 @@ private static ICssValue CreateLayers(CssListValue image, CssListValue attachmen
return null;
}
+ private static Int32 GetCount(params CssListValue[] lists)
+ {
+ var count = 0;
+
+ foreach (var list in lists)
+ {
+ count = Math.Max(count, list?.Count ?? 0);
+ }
+
+ return count;
+ }
+
private static ICssValue GetValue(CssListValue container, Int32 index)
{
if (container != null && index < container.Items.Length)
@@ -213,21 +229,19 @@ private static ICssValue GetValue(CssListValue container, Int32 index)
return null;
}
- private static ICssValue CreateMultiple(Background background, Func getValue)
+ private static ICssValue CreateMultiple(CssBackgroundValue background, Func getValue, ICssValue initialValue)
{
- var layers = background.Layers as CssListValue;
-
- if (layers != null)
+ if (background.Layers is CssListValue layers)
{
- var values = layers.Items.OfType().Select(getValue);
+ var values = layers.Items.OfType().Select(getValue);
- if (values.Any())
+ if (values.Any(m => m != null))
{
return new CssListValue(values.ToArray());
}
}
- return null;
+ return new CssInitialValue(initialValue);
}
}
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundImageDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundImageDeclaration.cs
index 5f4c4114..14557832 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundImageDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundImageDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class BackgroundImageDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(MultipleImageSourceConverter, AssignInitial());
+ public static IValueConverter Converter = MultipleImageSourceConverter;
+
+ public static ICssValue InitialValue = InitialValues.BackgroundImageDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundOriginDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundOriginDeclaration.cs
index 8d38ef4c..38a5254c 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundOriginDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundOriginDeclaration.cs
@@ -14,7 +14,9 @@ static class BackgroundOriginDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(BoxModelConverter.FromList(), AssignInitial(BoxModel.PaddingBox));
+ public static IValueConverter Converter = BoxModelConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundOriginDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundPositionDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundPositionDeclaration.cs
index aeb9ee24..3f344d29 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundPositionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundPositionDeclaration.cs
@@ -1,8 +1,11 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using AngleSharp.Css.Values;
+ using AngleSharp.Text;
using System;
+ using System.Linq;
using static ValueConverters;
static class BackgroundPositionDeclaration
@@ -20,8 +23,55 @@ static class BackgroundPositionDeclaration
PropertyNames.BackgroundPositionY,
};
- public static IValueConverter Converter = Or(PointConverter.FromList(), AssignInitial(Point.Center));
+ public static IValueConverter Converter = new BackgroundPositionAggregator();
- public static PropertyFlags Flags = PropertyFlags.Animatable;
+ public static ICssValue InitialValue = InitialValues.BackgroundPositionDecl;
+
+ public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
+
+ sealed class BackgroundPositionAggregator : IValueConverter, IValueAggregator
+ {
+ private static readonly IValueConverter converter = Or(PointConverter.FromList(), AssignInitial(InitialValues.BackgroundPositionDecl));
+
+ public ICssValue Convert(StringSource source) =>
+ converter.Convert(source);
+
+ public ICssValue Merge(ICssValue[] values)
+ {
+ var x = values[0] as CssListValue;
+ var y = values[1] as CssListValue;
+
+ if (x != null && y != null && x.Items.Length == y.Items.Length)
+ {
+ var points = new ICssValue[x.Items.Length];
+
+ for (var i = 0; i < points.Length; i++)
+ {
+ points[i] = new Point(x.Items[i], y.Items[i]);
+ }
+
+ return new CssListValue(points);
+ }
+
+ return null;
+ }
+
+ public ICssValue[] Split(ICssValue value)
+ {
+ if (value is CssListValue list)
+ {
+ var points = list.Items.OfType();
+ var x = points.Select(m => m.X).ToArray();
+ var y = points.Select(m => m.Y).ToArray();
+ return new ICssValue[]
+ {
+ new CssListValue(x),
+ new CssListValue(y),
+ };
+ }
+
+ return null;
+ }
+ }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundPositionXDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundPositionXDeclaration.cs
index 990cc951..3c68ba0e 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundPositionXDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundPositionXDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class BackgroundPositionXDeclaration
PropertyNames.BackgroundPosition,
};
- public static IValueConverter Converter = Or(PointXConverter.FromList(), AssignInitial(Length.Zero));
+ public static IValueConverter Converter = PointXConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundPositionXDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundPositionYDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundPositionYDeclaration.cs
index ac3f0b79..1c6aa99d 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundPositionYDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundPositionYDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class BackgroundPositionYDeclaration
PropertyNames.BackgroundPosition,
};
- public static IValueConverter Converter = Or(PointYConverter.FromList(), AssignInitial(Length.Zero));
+ public static IValueConverter Converter = PointYConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundPositionYDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundRepeatDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundRepeatDeclaration.cs
index fd4166b2..ab6ba7ef 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundRepeatDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundRepeatDeclaration.cs
@@ -2,7 +2,10 @@ namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
+ using AngleSharp.Text;
using System;
+ using System.Linq;
using static ValueConverters;
static class BackgroundRepeatDeclaration
@@ -20,8 +23,55 @@ static class BackgroundRepeatDeclaration
PropertyNames.BackgroundRepeatY,
};
- public static IValueConverter Converter = Or(BackgroundRepeatsConverter.FromList(), AssignInitial(BackgroundRepeat.Repeat));
+ public static IValueConverter Converter = new BackgroundRepeatAggregator();
- public static PropertyFlags Flags = PropertyFlags.None;
+ public static ICssValue InitialValue = InitialValues.BackgroundRepeatDecl;
+
+ public static PropertyFlags Flags = PropertyFlags.Shorthand;
+
+ sealed class BackgroundRepeatAggregator : IValueConverter, IValueAggregator
+ {
+ private static readonly IValueConverter converter = Or(BackgroundRepeatsConverter.FromList(), AssignInitial(InitialValues.BackgroundRepeatDecl));
+
+ public ICssValue Convert(StringSource source) =>
+ converter.Convert(source);
+
+ public ICssValue Merge(ICssValue[] values)
+ {
+ var h = values[0] as CssListValue;
+ var v = values[1] as CssListValue;
+
+ if (h != null && v != null && h.Items.Length == v.Items.Length)
+ {
+ var repeats = new ICssValue[h.Items.Length];
+
+ for (var i = 0; i < repeats.Length; i++)
+ {
+ repeats[i] = new CssImageRepeatsValue(h.Items[i], v.Items[i]);
+ }
+
+ return new CssListValue(repeats);
+ }
+
+ return null;
+ }
+
+ public ICssValue[] Split(ICssValue value)
+ {
+ if (value is CssListValue list)
+ {
+ var repeats = list.Items.OfType();
+ var h = repeats.Select(m => m.Horizontal).ToArray();
+ var v = repeats.Select(m => m.Vertical).ToArray();
+ return new ICssValue[]
+ {
+ new CssListValue(h),
+ new CssListValue(v),
+ };
+ }
+
+ return null;
+ }
+ }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundRepeatXDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundRepeatXDeclaration.cs
index 9145f04d..2b36e6b2 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundRepeatXDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundRepeatXDeclaration.cs
@@ -14,7 +14,9 @@ static class BackgroundRepeatXDeclaration
PropertyNames.BackgroundRepeat,
};
- public static IValueConverter Converter = Or(BackgroundRepeatConverter.FromList(), AssignInitial(BackgroundRepeat.Repeat));
+ public static IValueConverter Converter = BackgroundRepeatConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundRepeatHorizontalDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundRepeatYDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundRepeatYDeclaration.cs
index f563ee36..8ac1a3c8 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundRepeatYDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundRepeatYDeclaration.cs
@@ -14,7 +14,9 @@ static class BackgroundRepeatYDeclaration
PropertyNames.BackgroundRepeat,
};
- public static IValueConverter Converter = Or(BackgroundRepeatConverter.FromList(), AssignInitial(BackgroundRepeat.Repeat));
+ public static IValueConverter Converter = BackgroundRepeatConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundRepeatVerticalDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BackgroundSizeDeclaration.cs b/src/AngleSharp.Css/Declarations/BackgroundSizeDeclaration.cs
index dc94ae44..14387475 100644
--- a/src/AngleSharp.Css/Declarations/BackgroundSizeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BackgroundSizeDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +14,9 @@ static class BackgroundSizeDeclaration
PropertyNames.Background,
};
- public static IValueConverter Converter = Or(BackgroundSizeConverter.FromList(), AssignInitial());
+ public static IValueConverter Converter = BackgroundSizeConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.BackgroundSizeDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomColorDeclaration.cs
index 8c0ae77d..09941dbf 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderBottomColorDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderColor,
+ PropertyNames.Border,
PropertyNames.BorderBottom,
+ PropertyNames.BorderColor,
};
- public static IValueConverter Converter = Or(CurrentColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = CurrentColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderBottomColorDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomDeclaration.cs
index f7fc4520..b67d754d 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomDeclaration.cs
@@ -1,8 +1,6 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -10,59 +8,25 @@ static class BorderBottomDeclaration
{
public static String Name = PropertyNames.BorderBottom;
- public static IValueConverter Converter = new BorderBottomAggregator();
-
- public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
-
public static String[] Shorthands = new[]
{
PropertyNames.Border,
};
+ public static IValueConverter Converter = WithBorderSide(
+ InitialValues.BorderBottomWidthDecl,
+ InitialValues.BorderBottomStyleDecl,
+ InitialValues.BorderBottomColorDecl);
+
+ public static ICssValue InitialValue = null;
+
+ public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
+
public static String[] Longhands = new[]
{
PropertyNames.BorderBottomWidth,
PropertyNames.BorderBottomStyle,
PropertyNames.BorderBottomColor,
};
-
- sealed class BorderBottomAggregator : IValueAggregator, IValueConverter
- {
- public ICssValue Convert(StringSource source)
- {
- return BorderSideConverter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null || style != null || color != null)
- {
- return new CssTupleValue(new[] { width, style, color });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomLeftRadiusDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomLeftRadiusDeclaration.cs
index 545d0187..ffa1d3ea 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomLeftRadiusDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomLeftRadiusDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderBottomLeftRadiusDeclaration
PropertyNames.BorderRadius,
};
- public static IValueConverter Converter = Or(BorderRadiusLonghandConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = BorderRadiusLonghandConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRadiusDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomRightRadiusDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomRightRadiusDeclaration.cs
index ce02860d..f7438b55 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomRightRadiusDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomRightRadiusDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderBottomRightRadiusDeclaration
PropertyNames.BorderRadius,
};
- public static IValueConverter Converter = Or(BorderRadiusLonghandConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = BorderRadiusLonghandConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRadiusDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomStyleDeclaration.cs
index abb70281..04c54327 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomStyleDeclaration.cs
@@ -10,11 +10,14 @@ static class BorderBottomStyleDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderStyle,
+ PropertyNames.Border,
PropertyNames.BorderBottom,
+ PropertyNames.BorderStyle,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderBottomStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderBottomWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderBottomWidthDeclaration.cs
index 05d49acd..c4fe8145 100644
--- a/src/AngleSharp.Css/Declarations/BorderBottomWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderBottomWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderBottomWidthDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderWidth,
+ PropertyNames.Border,
PropertyNames.BorderBottom,
+ PropertyNames.BorderWidth,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderBottomWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderCollapseDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderCollapseDeclaration.cs
index 848f7d5f..422011b0 100644
--- a/src/AngleSharp.Css/Declarations/BorderCollapseDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderCollapseDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class BorderCollapseDeclaration
{
public static String Name = PropertyNames.BorderCollapse;
- public static IValueConverter Converter = Or(BorderCollapseConverter, AssignInitial(true));
+ public static IValueConverter Converter = BorderCollapseConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderCollapseDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderColorDeclaration.cs
index e2340797..c32160fc 100644
--- a/src/AngleSharp.Css/Declarations/BorderColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderColorDeclaration.cs
@@ -1,9 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -16,7 +13,9 @@ static class BorderColorDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderColorAggregator();
+ public static IValueConverter Converter = AggregatePeriodic(CurrentColorConverter);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Hashless | PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -27,48 +26,5 @@ static class BorderColorDeclaration
PropertyNames.BorderBottomColor,
PropertyNames.BorderLeftColor,
};
-
- sealed class BorderColorAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(CurrentColorConverter.Periodic(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var top = values[0];
- var right = values[1];
- var bottom = values[2];
- var left = values[3];
-
- if (top != null && right != null && bottom != null && left != null)
- {
- return new Periodic(new[] { top, right, bottom, left });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var periodic = value as Periodic;
-
- if (periodic != null)
- {
- return new[]
- {
- periodic.Top,
- periodic.Right,
- periodic.Bottom,
- periodic.Left,
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderDeclaration.cs
index 4573220e..6acc9163 100644
--- a/src/AngleSharp.Css/Declarations/BorderDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderDeclaration.cs
@@ -5,6 +5,7 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Css.Values;
using AngleSharp.Text;
using System;
+ using System.Linq;
using static ValueConverters;
static class BorderDeclaration
@@ -13,6 +14,8 @@ static class BorderDeclaration
public static IValueConverter Converter = new BorderAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -22,37 +25,20 @@ static class BorderDeclaration
PropertyNames.BorderColor,
};
- sealed class BorderValueConverter : IValueConverter
- {
- private static readonly IValueConverter converter = WithAny(
- LineWidthConverter.Option(),
- LineStyleConverter.Option(),
- CurrentColorConverter.Option());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
- }
-
sealed class BorderAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new BorderValueConverter(), AssignInitial());
+ private static readonly IValueConverter converter = WithAny(
+ LineWidthConverter.Option(InitialValues.BorderWidthDecl),
+ LineStyleConverter.Option(InitialValues.BorderStyleDecl),
+ CurrentColorConverter.Option(InitialValues.BorderColorDecl));
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null && style != null && color != null)
+ if (!values.OfType().Any())
{
- return new CssTupleValue(new[] { width, style, color });
+ return new CssTupleValue(values);
}
return null;
@@ -60,11 +46,9 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var options = value as CssTupleValue;
-
- if (options != null)
+ if (value is CssTupleValue options)
{
- return new[] { options.Items[0], options.Items[1], options.Items[2] };
+ return options.ToArray();
}
return null;
diff --git a/src/AngleSharp.Css/Declarations/BorderImageDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageDeclaration.cs
index fb2a1312..750be019 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageDeclaration.cs
@@ -13,6 +13,8 @@ static class BorderImageDeclaration
public static IValueConverter Converter = new BorderImageAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -86,7 +88,7 @@ public ICssValue Convert(StringSource source)
}
while (pos != source.Index);
- return new BorderImage(image, slice, widths, outsets, CreateRepeat(repeatX, repeatY));
+ return new CssBorderImageValue(image, slice, widths, outsets, CreateRepeat(repeatX, repeatY));
}
private static ICssValue CreateRepeat(ICssValue repeatX, ICssValue repeatY)
@@ -108,7 +110,7 @@ private static ICssValue CreateRepeat(ICssValue repeatX, ICssValue repeatY)
sealed class BorderImageAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(None, new BorderImageValueConverter(), AssignInitial());
+ private static readonly IValueConverter converter = Or(None, new BorderImageValueConverter());
public ICssValue Convert(StringSource source)
{
@@ -125,7 +127,7 @@ public ICssValue Merge(ICssValue[] values)
if (outset != null || repeat != null || slice != null || source != null || width != null)
{
- return new BorderImage(source, slice, width, outset, repeat);
+ return new CssBorderImageValue(source, slice, width, outset, repeat);
}
return null;
@@ -133,34 +135,27 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var img = value as BorderImage?;
-
- if (img.HasValue)
+ if (value is CssBorderImageValue img)
{
- return new[]
+ return new ICssValue[]
{
- img.Value.Outsets,
- img.Value.Repeat,
- img.Value.Slice,
- img.Value.Image,
- img.Value.Widths,
+ img.Outsets,
+ img.Repeat,
+ img.Slice,
+ img.Image,
+ img.Widths,
};
}
- else
+ else if (value is Constant constant)
{
- var constant = value as Constant;
-
- if (constant != null)
+ return new ICssValue[]
{
- return new[]
- {
- null,
- null,
- null,
- constant,
- null,
- };
- }
+ null,
+ null,
+ null,
+ constant,
+ null,
+ };
}
return null;
diff --git a/src/AngleSharp.Css/Declarations/BorderImageOutsetDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageOutsetDeclaration.cs
index b1f45182..18cf281a 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageOutsetDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageOutsetDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class BorderImageOutsetDeclaration
PropertyNames.BorderImage,
};
- public static IValueConverter Converter = Or(LengthOrPercentConverter.Periodic(), AssignInitial(Length.Zero));
+ public static IValueConverter Converter = LengthOrPercentConverter.Periodic();
+
+ public static ICssValue InitialValue = InitialValues.BorderImageOutsetDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderImageRepeatDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageRepeatDeclaration.cs
index 68ee21d9..265130d6 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageRepeatDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageRepeatDeclaration.cs
@@ -13,7 +13,9 @@ static class BorderImageRepeatDeclaration
PropertyNames.BorderImage,
};
- public static IValueConverter Converter = Or(BorderImageRepeatConverter, AssignInitial(BorderRepeat.Stretch));
+ public static IValueConverter Converter = BorderImageRepeatConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderImageRepeatDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderImageSliceDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageSliceDeclaration.cs
index 0143f357..23d9393c 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageSliceDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageSliceDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderImageSliceDeclaration
PropertyNames.BorderImage,
};
- public static IValueConverter Converter = Or(BorderImageSliceConverter, AssignInitial(Length.Full));
+ public static IValueConverter Converter = BorderImageSliceConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderImageSliceDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderImageSourceDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageSourceDeclaration.cs
index e2cae48a..1ba17515 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageSourceDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageSourceDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class BorderImageSourceDeclaration
PropertyNames.BorderImage,
};
- public static IValueConverter Converter = Or(OptionalImageSourceConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalImageSourceConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderImageSourceDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderImageWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderImageWidthDeclaration.cs
index 7b23b129..6721f784 100644
--- a/src/AngleSharp.Css/Declarations/BorderImageWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderImageWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderImageWidthDeclaration
PropertyNames.BorderImage,
};
- public static IValueConverter Converter = Or(BorderImageWidthConverter, AssignInitial(Length.Full));
+ public static IValueConverter Converter = BorderImageWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderImageWidthDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderLeftColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderLeftColorDeclaration.cs
index 75a7fb01..3a61754c 100644
--- a/src/AngleSharp.Css/Declarations/BorderLeftColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderLeftColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderLeftColorDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderColor,
+ PropertyNames.Border,
PropertyNames.BorderLeft,
+ PropertyNames.BorderColor,
};
- public static IValueConverter Converter = Or(CurrentColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = CurrentColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderLeftColorDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderLeftDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderLeftDeclaration.cs
index 0b19be16..f23d3fa0 100644
--- a/src/AngleSharp.Css/Declarations/BorderLeftDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderLeftDeclaration.cs
@@ -1,8 +1,6 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -15,7 +13,12 @@ static class BorderLeftDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderLeftAggregator();
+ public static IValueConverter Converter = WithBorderSide(
+ InitialValues.BorderLeftWidthDecl,
+ InitialValues.BorderLeftStyleDecl,
+ InitialValues.BorderLeftColorDecl);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -25,44 +28,5 @@ static class BorderLeftDeclaration
PropertyNames.BorderLeftStyle,
PropertyNames.BorderLeftColor,
};
-
- sealed class BorderLeftAggregator : IValueAggregator, IValueConverter
- {
- public ICssValue Convert(StringSource source)
- {
- return BorderSideConverter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null || style != null || color != null)
- {
- return new CssTupleValue(new[] { width, style, color });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderLeftStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderLeftStyleDeclaration.cs
index fd240ea7..faf7b5eb 100644
--- a/src/AngleSharp.Css/Declarations/BorderLeftStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderLeftStyleDeclaration.cs
@@ -10,11 +10,14 @@ static class BorderLeftStyleDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderStyle,
+ PropertyNames.Border,
PropertyNames.BorderLeft,
+ PropertyNames.BorderStyle,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderLeftStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderLeftWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderLeftWidthDeclaration.cs
index 663db754..655ac8ef 100644
--- a/src/AngleSharp.Css/Declarations/BorderLeftWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderLeftWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderLeftWidthDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderWidth,
+ PropertyNames.Border,
PropertyNames.BorderLeft,
+ PropertyNames.BorderWidth,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderLeftWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderRadiusDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderRadiusDeclaration.cs
index d0961f90..55f47a4b 100644
--- a/src/AngleSharp.Css/Declarations/BorderRadiusDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderRadiusDeclaration.cs
@@ -14,6 +14,8 @@ static class BorderRadiusDeclaration
public static IValueConverter Converter = new BorderRadiusAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -24,53 +26,40 @@ static class BorderRadiusDeclaration
PropertyNames.BorderBottomLeftRadius,
};
- sealed class BorderRadiusValueConverter : IValueConverter
+ sealed class BorderRadiusAggregator : IValueAggregator, IValueConverter
{
private readonly IValueConverter _converter = LengthOrPercentConverter.Periodic();
public ICssValue Convert(StringSource source)
{
var start = source.Index;
- var horizontal = _converter.Convert(source) as Periodic;
+ var horizontal = _converter.Convert(source) as CssPeriodicValue;
var vertical = horizontal;
var c = source.SkipSpacesAndComments();
if (c == Symbols.Solidus)
{
source.SkipCurrentAndSpaces();
- vertical = _converter.Convert(source) as Periodic;
+ vertical = _converter.Convert(source) as CssPeriodicValue;
}
- return vertical != null ? new BorderRadius(horizontal, vertical) : null;
+ return vertical != null ? new CssBorderRadiusValue(horizontal, vertical) : null;
}
- }
- sealed class BorderRadiusAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(new BorderRadiusValueConverter(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- private static ICssValue Both(ICssValue horizontal, ICssValue vertical)
- {
- return new CssTupleValue(new[] { horizontal, vertical });
- }
+ private static ICssValue Both(params ICssValue[] values) => new CssRadiusValue(values);
public ICssValue Merge(ICssValue[] values)
{
- var topLeft = values[0] as CssTupleValue;
- var topRight = values[1] as CssTupleValue;
- var bottomRight = values[2] as CssTupleValue;
- var bottomLeft = values[3] as CssTupleValue;
+ var topLeft = values[0] as CssRadiusValue;
+ var topRight = values[1] as CssRadiusValue;
+ var bottomRight = values[2] as CssRadiusValue;
+ var bottomLeft = values[3] as CssRadiusValue;
if (topLeft != null && topRight != null && bottomRight != null && bottomLeft != null)
{
- var horizontal = new Periodic(new[] { topLeft.Items[0], topRight.Items[0], bottomRight.Items[0], bottomLeft.Items[0] });
- var vertical = new Periodic(new[] { topLeft.Items[1], topRight.Items[1], bottomRight.Items[1], bottomLeft.Items[1] });
- return new BorderRadius(horizontal, vertical);
+ var horizontal = new CssPeriodicValue(new[] { topLeft.Width, topRight.Width, bottomRight.Width, bottomLeft.Width });
+ var vertical = new CssPeriodicValue(new[] { topLeft.Height, topRight.Height, bottomRight.Height, bottomLeft.Height });
+ return new CssBorderRadiusValue(horizontal, vertical);
}
return null;
@@ -78,9 +67,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var radius = value as BorderRadius;
-
- if (radius != null)
+ if (value is CssBorderRadiusValue radius)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/BorderRightColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderRightColorDeclaration.cs
index 94b0ea2a..dbae07f3 100644
--- a/src/AngleSharp.Css/Declarations/BorderRightColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderRightColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderRightColorDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderColor,
+ PropertyNames.Border,
PropertyNames.BorderRight,
+ PropertyNames.BorderColor,
};
- public static IValueConverter Converter = Or(CurrentColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = CurrentColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRightColorDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderRightDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderRightDeclaration.cs
index 3befdb93..427ebe3a 100644
--- a/src/AngleSharp.Css/Declarations/BorderRightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderRightDeclaration.cs
@@ -1,8 +1,6 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -15,7 +13,12 @@ static class BorderRightDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderRightAggregator();
+ public static IValueConverter Converter = WithBorderSide(
+ InitialValues.BorderRightWidthDecl,
+ InitialValues.BorderRightStyleDecl,
+ InitialValues.BorderRightColorDecl);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -25,44 +28,5 @@ static class BorderRightDeclaration
PropertyNames.BorderRightStyle,
PropertyNames.BorderRightColor,
};
-
- sealed class BorderRightAggregator : IValueAggregator, IValueConverter
- {
- public ICssValue Convert(StringSource source)
- {
- return BorderSideConverter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null || style != null || color != null)
- {
- return new CssTupleValue(new[] { width, style, color });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderRightStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderRightStyleDeclaration.cs
index abca5af8..04e5c218 100644
--- a/src/AngleSharp.Css/Declarations/BorderRightStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderRightStyleDeclaration.cs
@@ -10,11 +10,14 @@ static class BorderRightStyleDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderStyle,
+ PropertyNames.Border,
PropertyNames.BorderRight,
+ PropertyNames.BorderStyle,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRightStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderRightWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderRightWidthDeclaration.cs
index a7ccd570..5ad9e6eb 100644
--- a/src/AngleSharp.Css/Declarations/BorderRightWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderRightWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderRightWidthDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderWidth,
+ PropertyNames.Border,
PropertyNames.BorderRight,
+ PropertyNames.BorderWidth,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRightWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderSpacingDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderSpacingDeclaration.cs
index 8d9dc42c..7df35a04 100644
--- a/src/AngleSharp.Css/Declarations/BorderSpacingDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderSpacingDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,7 +9,9 @@ static class BorderSpacingDeclaration
{
public static String Name = PropertyNames.BorderSpacing;
- public static IValueConverter Converter = Or(LengthConverter.Many(1, 2), AssignInitial(Length.Zero));
+ public static IValueConverter Converter = LengthConverter.Many(1, 2);
+
+ public static ICssValue InitialValue = InitialValues.BorderSpacingDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderStyleDeclaration.cs
index 4ef07f97..a43a1619 100644
--- a/src/AngleSharp.Css/Declarations/BorderStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderStyleDeclaration.cs
@@ -1,9 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -16,7 +13,9 @@ static class BorderStyleDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderStyleAggregator();
+ public static IValueConverter Converter = AggregatePeriodic(LineStyleConverter);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Shorthand;
@@ -27,48 +26,5 @@ static class BorderStyleDeclaration
PropertyNames.BorderBottomStyle,
PropertyNames.BorderLeftStyle,
};
-
- sealed class BorderStyleAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(LineStyleConverter.Periodic(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var top = values[0];
- var right = values[1];
- var bottom = values[2];
- var left = values[3];
-
- if (top != null && right != null && bottom != null && left != null)
- {
- return new Periodic(new[] { top, right, bottom, left });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var periodic = value as Periodic;
-
- if (periodic != null)
- {
- return new[]
- {
- periodic.Top,
- periodic.Right,
- periodic.Bottom,
- periodic.Left,
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopColorDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopColorDeclaration.cs
index 56d8eafb..e2c3a998 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderTopColorDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderColor,
+ PropertyNames.Border,
PropertyNames.BorderTop,
+ PropertyNames.BorderColor,
};
- public static IValueConverter Converter = Or(CurrentColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = CurrentColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderTopColorDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopDeclaration.cs
index 412e2281..76c5bb3f 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopDeclaration.cs
@@ -1,8 +1,6 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -15,7 +13,12 @@ static class BorderTopDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderTopAggregator();
+ public static IValueConverter Converter = WithBorderSide(
+ InitialValues.BorderTopWidthDecl,
+ InitialValues.BorderTopStyleDecl,
+ InitialValues.BorderTopColorDecl);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -25,44 +28,5 @@ static class BorderTopDeclaration
PropertyNames.BorderTopStyle,
PropertyNames.BorderTopColor,
};
-
- sealed class BorderTopAggregator : IValueAggregator, IValueConverter
- {
- public ICssValue Convert(StringSource source)
- {
- return BorderSideConverter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null || style != null || color != null)
- {
- return new CssTupleValue(new[] { width, style, color });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopLeftRadiusDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopLeftRadiusDeclaration.cs
index a6a11e45..0aa6b5b2 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopLeftRadiusDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopLeftRadiusDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderTopLeftRadiusDeclaration
PropertyNames.BorderRadius,
};
- public static IValueConverter Converter = Or(BorderRadiusLonghandConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = BorderRadiusLonghandConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRadiusDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopRightRadiusDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopRightRadiusDeclaration.cs
index 1287719f..b44f1fe1 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopRightRadiusDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopRightRadiusDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class BorderTopRightRadiusDeclaration
PropertyNames.BorderRadius,
};
- public static IValueConverter Converter = Or(BorderRadiusLonghandConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = BorderRadiusLonghandConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderRadiusDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopStyleDeclaration.cs
index b1f1f08d..8e517c83 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopStyleDeclaration.cs
@@ -10,11 +10,14 @@ static class BorderTopStyleDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderStyle,
+ PropertyNames.Border,
PropertyNames.BorderTop,
+ PropertyNames.BorderStyle,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderTopStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderTopWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderTopWidthDeclaration.cs
index 17a474fc..c7b78122 100644
--- a/src/AngleSharp.Css/Declarations/BorderTopWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderTopWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -10,11 +10,14 @@ static class BorderTopWidthDeclaration
public static String[] Shorthands = new[]
{
- PropertyNames.BorderWidth,
+ PropertyNames.Border,
PropertyNames.BorderTop,
+ PropertyNames.BorderWidth,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.BorderTopWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BorderWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/BorderWidthDeclaration.cs
index 9f1a70df..7d8cf6b6 100644
--- a/src/AngleSharp.Css/Declarations/BorderWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BorderWidthDeclaration.cs
@@ -1,9 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -16,7 +13,9 @@ static class BorderWidthDeclaration
PropertyNames.Border,
};
- public static IValueConverter Converter = new BorderWidthAggregator();
+ public static IValueConverter Converter = AggregatePeriodic(LineWidthConverter);
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -27,48 +26,5 @@ static class BorderWidthDeclaration
PropertyNames.BorderBottomWidth,
PropertyNames.BorderLeftWidth,
};
-
- sealed class BorderWidthAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(LineWidthConverter.Periodic(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var top = values[0];
- var right = values[1];
- var bottom = values[2];
- var left = values[3];
-
- if (top != null && right != null && bottom != null && left != null)
- {
- return new Periodic(new[] { top, right, bottom, left });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var periodic = value as Periodic;
-
- if (periodic != null)
- {
- return new[]
- {
- periodic.Top,
- periodic.Right,
- periodic.Bottom,
- periodic.Left,
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/BottomDeclaration.cs b/src/AngleSharp.Css/Declarations/BottomDeclaration.cs
index 4a5c28ba..8b646879 100644
--- a/src/AngleSharp.Css/Declarations/BottomDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BottomDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class BottomDeclaration
{
public static String Name = PropertyNames.Bottom;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.BottomDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BoxDecorationBreakDeclaration.cs b/src/AngleSharp.Css/Declarations/BoxDecorationBreakDeclaration.cs
index db132ec9..797c5551 100644
--- a/src/AngleSharp.Css/Declarations/BoxDecorationBreakDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BoxDecorationBreakDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class BoxDecorationBreakDeclaration
{
public static String Name = PropertyNames.BoxDecorationBreak;
- public static IValueConverter Converter = Or(BoxDecorationConverter, AssignInitial(false));
+ public static IValueConverter Converter = BoxDecorationConverter;
+
+ public static ICssValue InitialValue = InitialValues.BoxDecorationBreakDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BoxShadowDeclaration.cs b/src/AngleSharp.Css/Declarations/BoxShadowDeclaration.cs
index 5685b946..2306f17b 100644
--- a/src/AngleSharp.Css/Declarations/BoxShadowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BoxShadowDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class BoxShadowDeclaration
{
public static String Name = PropertyNames.BoxShadow;
- public static IValueConverter Converter = Or(MultipleShadowConverter, AssignInitial());
+ public static IValueConverter Converter = MultipleShadowConverter;
+
+ public static ICssValue InitialValue = InitialValues.BoxShadowDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/BreakAfterDeclaration.cs b/src/AngleSharp.Css/Declarations/BreakAfterDeclaration.cs
index d0beb554..31128244 100644
--- a/src/AngleSharp.Css/Declarations/BreakAfterDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BreakAfterDeclaration.cs
@@ -8,7 +8,9 @@ static class BreakAfterDeclaration
{
public static String Name = PropertyNames.BreakAfter;
- public static IValueConverter Converter = Or(BreakModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = BreakModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.BreakAfterDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BreakBeforeDeclaration.cs b/src/AngleSharp.Css/Declarations/BreakBeforeDeclaration.cs
index e8a3f9bd..2dc2ace9 100644
--- a/src/AngleSharp.Css/Declarations/BreakBeforeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BreakBeforeDeclaration.cs
@@ -8,7 +8,9 @@ static class BreakBeforeDeclaration
{
public static String Name = PropertyNames.BreakBefore;
- public static IValueConverter Converter = Or(BreakModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = BreakModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.BreakBeforeDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/BreakInsideDeclaration.cs b/src/AngleSharp.Css/Declarations/BreakInsideDeclaration.cs
index 9008b7b6..c2c53674 100644
--- a/src/AngleSharp.Css/Declarations/BreakInsideDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/BreakInsideDeclaration.cs
@@ -8,7 +8,9 @@ static class BreakInsideDeclaration
{
public static String Name = PropertyNames.BreakInside;
- public static IValueConverter Converter = Or(BreakInsideModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = BreakInsideModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.BreakInsideDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/CaptionSideDeclaration.cs b/src/AngleSharp.Css/Declarations/CaptionSideDeclaration.cs
index 5dbee010..7d26c1d4 100644
--- a/src/AngleSharp.Css/Declarations/CaptionSideDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/CaptionSideDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class CaptionSideDeclaration
{
public static String Name = PropertyNames.CaptionSide;
- public static IValueConverter Converter = Or(CaptionSideConverter, AssignInitial(true));
+ public static IValueConverter Converter = CaptionSideConverter;
+
+ public static ICssValue InitialValue = InitialValues.CaptionSideDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ClearDeclaration.cs b/src/AngleSharp.Css/Declarations/ClearDeclaration.cs
index dfbc4e3a..78e1026d 100644
--- a/src/AngleSharp.Css/Declarations/ClearDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ClearDeclaration.cs
@@ -8,7 +8,9 @@ static class ClearDeclaration
{
public static String Name = PropertyNames.Clear;
- public static IValueConverter Converter = Or(ClearModeConverter, AssignInitial(ClearMode.None));
+ public static IValueConverter Converter = ClearModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.ClearDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ClipDeclaration.cs b/src/AngleSharp.Css/Declarations/ClipDeclaration.cs
index d5eb41c1..81cbb61e 100644
--- a/src/AngleSharp.Css/Declarations/ClipDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ClipDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class ClipDeclaration
{
public static String Name = PropertyNames.Clip;
- public static IValueConverter Converter = Or(ShapeConverter, Auto, AssignInitial());
+ public static IValueConverter Converter = Or(ShapeConverter, Auto);
+
+ public static ICssValue InitialValue = InitialValues.ClipDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ColorDeclaration.cs
index 5e332cbb..6c39446d 100644
--- a/src/AngleSharp.Css/Declarations/ColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ColorDeclaration
{
public static String Name = PropertyNames.Color;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Color.Black));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Hashless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnCountDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnCountDeclaration.cs
index c604fa4f..f3ab1977 100644
--- a/src/AngleSharp.Css/Declarations/ColumnCountDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnCountDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class ColumnCountDeclaration
PropertyNames.Columns,
};
- public static IValueConverter Converter = Or(OptionalIntegerConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalIntegerConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnCountDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnFillDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnFillDeclaration.cs
index d38a654c..dadec2ef 100644
--- a/src/AngleSharp.Css/Declarations/ColumnFillDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnFillDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class ColumnFillDeclaration
{
public static String Name = PropertyNames.ColumnFill;
- public static IValueConverter Converter = Or(ColumnFillConverter, AssignInitial(true));
+ public static IValueConverter Converter = ColumnFillConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnFillDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnGapDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnGapDeclaration.cs
index 7e0cc8b5..030f444a 100644
--- a/src/AngleSharp.Css/Declarations/ColumnGapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnGapDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class ColumnGapDeclaration
PropertyNames.Gap,
};
- public static IValueConverter Converter = Or(GapConverter, AssignInitial(Length.Normal));
+ public static IValueConverter Converter = GapConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnGapDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnRuleColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnRuleColorDeclaration.cs
index ae4932b9..c97604a7 100644
--- a/src/AngleSharp.Css/Declarations/ColumnRuleColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnRuleColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class ColumnRuleColorDeclaration
PropertyNames.ColumnRule,
};
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnRuleColorDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnRuleDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnRuleDeclaration.cs
index 65f524d7..9d240f26 100644
--- a/src/AngleSharp.Css/Declarations/ColumnRuleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnRuleDeclaration.cs
@@ -5,7 +5,6 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Css.Values;
using AngleSharp.Text;
using System;
- using static ValueConverters;
static class ColumnRuleDeclaration
{
@@ -13,6 +12,8 @@ static class ColumnRuleDeclaration
public static IValueConverter Converter = new ColumnRuleAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -61,7 +62,7 @@ public ICssValue Convert(StringSource source)
sealed class ColumnRuleAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new ColumnRuleValueConverter(), AssignInitial());
+ private static readonly IValueConverter converter = new ColumnRuleValueConverter();
public ICssValue Convert(StringSource source)
{
@@ -84,9 +85,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var options = value as CssTupleValue;
-
- if (options != null)
+ if (value is CssTupleValue options)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/ColumnRuleStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnRuleStyleDeclaration.cs
index 8c756eff..8561995b 100644
--- a/src/AngleSharp.Css/Declarations/ColumnRuleStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnRuleStyleDeclaration.cs
@@ -13,7 +13,9 @@ static class ColumnRuleStyleDeclaration
PropertyNames.ColumnRule,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnRuleStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnRuleWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnRuleWidthDeclaration.cs
index 06811896..d4c1f0fb 100644
--- a/src/AngleSharp.Css/Declarations/ColumnRuleWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnRuleWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class ColumnRuleWidthDeclaration
PropertyNames.ColumnRule,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnRuleWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnSpanDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnSpanDeclaration.cs
index 9895dc43..78604822 100644
--- a/src/AngleSharp.Css/Declarations/ColumnSpanDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnSpanDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class ColumnSpanDeclaration
{
public static String Name = PropertyNames.ColumnSpan;
- public static IValueConverter Converter = Or(ColumnSpanConverter, AssignInitial(false));
+ public static IValueConverter Converter = ColumnSpanConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnSpanDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnWidthDeclaration.cs
index d7faf30c..cce2a705 100644
--- a/src/AngleSharp.Css/Declarations/ColumnWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class ColumnWidthDeclaration
PropertyNames.Columns,
};
- public static IValueConverter Converter = Or(AutoLengthConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthConverter;
+
+ public static ICssValue InitialValue = InitialValues.ColumnWidthDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ColumnsDeclaration.cs b/src/AngleSharp.Css/Declarations/ColumnsDeclaration.cs
index 0919d634..100efc54 100644
--- a/src/AngleSharp.Css/Declarations/ColumnsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ColumnsDeclaration.cs
@@ -12,6 +12,8 @@ static class ColumnsDeclaration
public static IValueConverter Converter = new ColumnsAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -34,12 +36,9 @@ public ICssValue Convert(StringSource source)
sealed class ColumnsAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new ColumnsValueConverter(), AssignInitial());
+ private static readonly IValueConverter converter = new ColumnsValueConverter();
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -56,9 +55,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var options = value as CssTupleValue;
-
- if (options != null)
+ if (value is CssTupleValue options)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/ContentDeclaration.cs b/src/AngleSharp.Css/Declarations/ContentDeclaration.cs
index c2b1821c..5e4b3e91 100644
--- a/src/AngleSharp.Css/Declarations/ContentDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ContentDeclaration.cs
@@ -8,13 +8,14 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Text;
using System;
using System.Collections.Generic;
- using static ValueConverters;
static class ContentDeclaration
{
public static String Name = PropertyNames.Content;
- public static IValueConverter Converter = Or(new ContentValueConverter(), AssignInitial());
+ public static IValueConverter Converter = new ContentValueConverter();
+
+ public static ICssValue InitialValue = InitialValues.ContentDecl;
public static PropertyFlags Flags = PropertyFlags.None;
@@ -84,9 +85,9 @@ public ICssValue Convert(StringSource source)
var m = source.ParseStatic(ContentModes);
- if (m != null)
+ if (m.HasValue)
{
- ms.Add(m);
+ ms.Add(m.Value);
source.SkipSpacesAndComments();
continue;
}
@@ -115,10 +116,7 @@ public ContentValue(ICssValue[] modes)
_modes = modes;
}
- public String CssText
- {
- get { return _modes.Length == 0 ? CssKeywords.None : _modes.Join(" "); }
- }
+ public String CssText => _modes.Length == 0 ? CssKeywords.None : _modes.Join(" ");
}
private interface IContentMode : ICssValue
@@ -131,10 +129,7 @@ private interface IContentMode : ICssValue
///
private sealed class NormalContentMode : IContentMode
{
- public String CssText
- {
- get { return CssKeywords.Normal; }
- }
+ public String CssText => CssKeywords.Normal;
public String Stringify(IElement element)
{
@@ -148,10 +143,7 @@ public String Stringify(IElement element)
///
private sealed class OpenQuoteContentMode : IContentMode
{
- public String CssText
- {
- get { return CssKeywords.OpenQuote; }
- }
+ public String CssText => CssKeywords.OpenQuote;
public String Stringify(IElement element)
{
@@ -165,10 +157,7 @@ public String Stringify(IElement element)
///
private sealed class CloseQuoteContentMode : IContentMode
{
- public String CssText
- {
- get { return CssKeywords.CloseQuote; }
- }
+ public String CssText => CssKeywords.CloseQuote;
public String Stringify(IElement element)
{
@@ -182,10 +171,7 @@ public String Stringify(IElement element)
///
private sealed class NoOpenQuoteContentMode : IContentMode
{
- public String CssText
- {
- get { return CssKeywords.NoOpenQuote; }
- }
+ public String CssText => CssKeywords.NoOpenQuote;
public String Stringify(IElement element)
{
@@ -199,10 +185,7 @@ public String Stringify(IElement element)
///
private sealed class NoCloseQuoteContentMode : IContentMode
{
- public String CssText
- {
- get { return CssKeywords.NoCloseQuote; }
- }
+ public String CssText => CssKeywords.NoCloseQuote;
public String Stringify(IElement element)
{
@@ -222,10 +205,7 @@ public TextContentMode(String text)
_text = text;
}
- public String CssText
- {
- get { return _text.CssString(); }
- }
+ public String CssText => _text.CssString();
public String Stringify(IElement element)
{
@@ -247,10 +227,7 @@ public CounterContentMode(CounterDefinition counter)
_counter = counter;
}
- public String CssText
- {
- get { return _counter.CssText; }
- }
+ public String CssText => _counter.CssText;
public String Stringify(IElement element)
{
@@ -271,10 +248,7 @@ public AttributeContentMode(String attribute)
_attribute = attribute;
}
- public String CssText
- {
- get { return FunctionNames.Attr.CssFunction(_attribute); }
- }
+ public String CssText => FunctionNames.Attr.CssFunction(_attribute);
public String Stringify(IElement element)
{
@@ -289,17 +263,14 @@ public String Stringify(IElement element)
///
private sealed class UrlContentMode : IContentMode
{
- private readonly UrlReference _url;
+ private readonly CssUrlValue _url;
- public UrlContentMode(UrlReference url)
+ public UrlContentMode(CssUrlValue url)
{
_url = url;
}
- public String CssText
- {
- get { return _url.CssText; }
- }
+ public String CssText => _url.CssText;
public String Stringify(IElement element)
{
diff --git a/src/AngleSharp.Css/Declarations/CounterIncrementDeclaration.cs b/src/AngleSharp.Css/Declarations/CounterIncrementDeclaration.cs
index 2a0cb0bf..500db09d 100644
--- a/src/AngleSharp.Css/Declarations/CounterIncrementDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/CounterIncrementDeclaration.cs
@@ -1,14 +1,16 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
- using static ValueConverters;
static class CounterIncrementDeclaration
{
public static String Name = PropertyNames.CounterIncrement;
- public static IValueConverter Converter = Or(new CounterValueConverter(1), AssignInitial());
+ public static IValueConverter Converter = new CounterValueConverter(1);
+
+ public static ICssValue InitialValue = InitialValues.CounterIncrementDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/CounterResetDeclaration.cs b/src/AngleSharp.Css/Declarations/CounterResetDeclaration.cs
index b1c65b03..6dc518bb 100644
--- a/src/AngleSharp.Css/Declarations/CounterResetDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/CounterResetDeclaration.cs
@@ -1,14 +1,16 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
- using static ValueConverters;
static class CounterResetDeclaration
{
public static String Name = PropertyNames.CounterReset;
- public static IValueConverter Converter = Or(new CounterValueConverter(0), AssignInitial());
+ public static IValueConverter Converter = new CounterValueConverter(0);
+
+ public static ICssValue InitialValue = InitialValues.CounterResetDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/CursorDeclaration.cs b/src/AngleSharp.Css/Declarations/CursorDeclaration.cs
index 0528e967..d16867cc 100644
--- a/src/AngleSharp.Css/Declarations/CursorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/CursorDeclaration.cs
@@ -6,13 +6,14 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Text;
using System;
using System.Collections.Generic;
- using static ValueConverters;
static class CursorDeclaration
{
public static String Name = PropertyNames.Cursor;
- public static IValueConverter Converter = Or(new CursorValueConverter(), AssignInitial(SystemCursor.Auto));
+ public static IValueConverter Converter = new CursorValueConverter();
+
+ public static ICssValue InitialValue = InitialValues.CursorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
@@ -25,11 +26,10 @@ public ICssValue Convert(StringSource source)
while (!source.IsDone)
{
- var definition = new CursorDefinition();
- definition.Source = source.ParseImageSource();
+ var imageSource = source.ParseImageSource();
var c = source.SkipSpacesAndComments();
- if (definition.Source != null)
+ if (imageSource != null)
{
var x = source.ParseNumber();
c = source.SkipSpacesAndComments();
@@ -40,15 +40,16 @@ public ICssValue Convert(StringSource source)
break;
source.SkipCurrentAndSpaces();
+ var position = default(Point?);
if (x.HasValue)
{
var xp = new Length(x.Value, Length.Unit.None);
var yp = new Length(y.Value, Length.Unit.None);
- definition.Position = new Point(xp, yp);
+ position = new Point(xp, yp);
}
- definitions.Add(definition);
+ definitions.Add(new CssCustomCursorValue(imageSource, position));
}
else
{
@@ -56,7 +57,7 @@ public ICssValue Convert(StringSource source)
if (cursor != null)
{
- return new Cursor(definitions.ToArray(), cursor);
+ return new CssCursorValue(definitions.ToArray(), cursor);
}
break;
diff --git a/src/AngleSharp.Css/Declarations/DirectionDeclaration.cs b/src/AngleSharp.Css/Declarations/DirectionDeclaration.cs
index 31aa6fed..af2c92db 100644
--- a/src/AngleSharp.Css/Declarations/DirectionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/DirectionDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Dom;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class DirectionDeclaration
{
public static String Name = PropertyNames.Direction;
- public static IValueConverter Converter = Or(DirectionModeConverter, AssignInitial(DirectionMode.Ltr));
+ public static IValueConverter Converter = DirectionModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.DirectionDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/DisplayDeclaration.cs b/src/AngleSharp.Css/Declarations/DisplayDeclaration.cs
index ac779a3f..efab49cb 100644
--- a/src/AngleSharp.Css/Declarations/DisplayDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/DisplayDeclaration.cs
@@ -8,7 +8,9 @@ static class DisplayDeclaration
{
public static String Name = PropertyNames.Display;
- public static IValueConverter Converter = Or(DisplayModeConverter, AssignInitial(DisplayMode.Inline));
+ public static IValueConverter Converter = DisplayModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.DisplayDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/EmptyCellsDeclaration.cs b/src/AngleSharp.Css/Declarations/EmptyCellsDeclaration.cs
index 8bfcba2d..f9072b60 100644
--- a/src/AngleSharp.Css/Declarations/EmptyCellsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/EmptyCellsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class EmptyCellsDeclaration
{
public static String Name = PropertyNames.EmptyCells;
- public static IValueConverter Converter = Or(EmptyCellsConverter, AssignInitial(true));
+ public static IValueConverter Converter = EmptyCellsConverter;
+
+ public static ICssValue InitialValue = InitialValues.EmptyCellsDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/FlexBasisDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexBasisDeclaration.cs
index be8892b0..91ebb57c 100644
--- a/src/AngleSharp.Css/Declarations/FlexBasisDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexBasisDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class FlexBasisDeclaration
PropertyNames.Flex,
};
- public static IValueConverter Converter = Or(Content, AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = Or(Content, AutoLengthOrPercentConverter);
+
+ public static ICssValue InitialValue = InitialValues.FlexBasisDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FlexDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexDeclaration.cs
index d765acfb..01ee6cbe 100644
--- a/src/AngleSharp.Css/Declarations/FlexDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexDeclaration.cs
@@ -19,6 +19,8 @@ static class FlexDeclaration
public static IValueConverter Converter = new FlexAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class FlexAggregator : IValueAggregator, IValueConverter
diff --git a/src/AngleSharp.Css/Declarations/FlexDirectionDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexDirectionDeclaration.cs
index 36113be2..56fc6546 100644
--- a/src/AngleSharp.Css/Declarations/FlexDirectionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexDirectionDeclaration.cs
@@ -13,7 +13,9 @@ static class FlexDirectionDeclaration
PropertyNames.FlexFlow,
};
- public static IValueConverter Converter = Or(FlexDirectionConverter, AssignInitial(FlexDirection.Row));
+ public static IValueConverter Converter = FlexDirectionConverter;
+
+ public static ICssValue InitialValue = InitialValues.FlexDirectionDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FlexFlowDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexFlowDeclaration.cs
index a5b08a0a..a9e56bdf 100644
--- a/src/AngleSharp.Css/Declarations/FlexFlowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexFlowDeclaration.cs
@@ -18,6 +18,8 @@ static class FlexFlowDeclaration
public static IValueConverter Converter = new FlexFlowAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class FlexFlowAggregator : IValueAggregator, IValueConverter
diff --git a/src/AngleSharp.Css/Declarations/FlexGrowDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexGrowDeclaration.cs
index e0c73761..a6b73812 100644
--- a/src/AngleSharp.Css/Declarations/FlexGrowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexGrowDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class FlexGrowDeclaration
PropertyNames.Flex,
};
- public static IValueConverter Converter = Or(NumberConverter, AssignInitial(0));
+ public static IValueConverter Converter = NumberConverter;
+
+ public static ICssValue InitialValue = InitialValues.FlexGrowDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FlexShrinkDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexShrinkDeclaration.cs
index f8c68d14..c9d11e78 100644
--- a/src/AngleSharp.Css/Declarations/FlexShrinkDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexShrinkDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class FlexShrinkDeclaration
PropertyNames.Flex,
};
- public static IValueConverter Converter = Or(NumberConverter, AssignInitial(1));
+ public static IValueConverter Converter = NumberConverter;
+
+ public static ICssValue InitialValue = InitialValues.FlexShrinkDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FlexWrapDeclaration.cs b/src/AngleSharp.Css/Declarations/FlexWrapDeclaration.cs
index 859cc3fc..8b23da19 100644
--- a/src/AngleSharp.Css/Declarations/FlexWrapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FlexWrapDeclaration.cs
@@ -13,7 +13,9 @@ static class FlexWrapDeclaration
PropertyNames.FlexFlow,
};
- public static IValueConverter Converter = Or(FlexWrapConverter, AssignInitial(FlexWrapMode.NoWrap));
+ public static IValueConverter Converter = FlexWrapConverter;
+
+ public static ICssValue InitialValue = InitialValues.FlexWrapDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FloatDeclaration.cs b/src/AngleSharp.Css/Declarations/FloatDeclaration.cs
index 8f4ab930..de152831 100644
--- a/src/AngleSharp.Css/Declarations/FloatDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FloatDeclaration.cs
@@ -8,7 +8,9 @@ static class FloatDeclaration
{
public static String Name = PropertyNames.Float;
- public static IValueConverter Converter = Or(FloatingConverter, AssignInitial(Floating.None));
+ public static IValueConverter Converter = FloatingConverter;
+
+ public static ICssValue InitialValue = InitialValues.FloatDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/FontDeclaration.cs b/src/AngleSharp.Css/Declarations/FontDeclaration.cs
index f1cef230..6350ab22 100644
--- a/src/AngleSharp.Css/Declarations/FontDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontDeclaration.cs
@@ -13,6 +13,8 @@ static class FontDeclaration
public static IValueConverter Converter = new FontAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable | PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -92,7 +94,7 @@ public ICssValue Convert(StringSource source)
if (fontFamilies != null)
{
- return new FontInfo(style, variant, weight, stretch, size, lineHeight, new CssListValue(fontFamilies));
+ return new CssFontValue(style, variant, weight, stretch, size, lineHeight, new CssListValue(fontFamilies));
}
}
@@ -102,7 +104,7 @@ public ICssValue Convert(StringSource source)
sealed class FontAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new FontValueConverter(), SystemFontConverter, AssignInitial());
+ private static readonly IValueConverter converter = Or(new FontValueConverter(), SystemFontConverter);
public ICssValue Convert(StringSource source)
{
@@ -121,7 +123,7 @@ public ICssValue Merge(ICssValue[] values)
if (families != null && size != null || families is Constant)
{
- return new FontInfo(style, variant, weight, stretch, size, height, families);
+ return new CssFontValue(style, variant, weight, stretch, size, height, families);
}
return null;
@@ -129,21 +131,18 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var font = value as FontInfo;
-
- if (font == null)
+ if (!(value is CssFontValue font))
{
- var systemFont = value as Constant;
- if (systemFont == null)
+ if (!(value is Constant systemFont))
{
return null;
}
- return new[] { systemFont, null, null, null, null, null, null };
+ return new ICssValue[] { systemFont, null, null, null, null, null, null };
}
- return new[] { font.FontFamilies, font.Size, font.Variant, font.Weight, font.Stretch, font.Style, font.LineHeight };
+ return new ICssValue[] { font.FontFamilies, font.Size, font.Variant, font.Weight, font.Stretch, font.Style, font.LineHeight };
}
}
}
diff --git a/src/AngleSharp.Css/Declarations/FontFamilyDeclaration.cs b/src/AngleSharp.Css/Declarations/FontFamilyDeclaration.cs
index 1574d6a5..e08c31b1 100644
--- a/src/AngleSharp.Css/Declarations/FontFamilyDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontFamilyDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class FontFamilyDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(FontFamiliesConverter, AssignInitial("Times New Roman"));
+ public static IValueConverter Converter = FontFamiliesConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontFamilyDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/FontSizeAdjustDeclaration.cs b/src/AngleSharp.Css/Declarations/FontSizeAdjustDeclaration.cs
index 2bc860ef..ae7db1d5 100644
--- a/src/AngleSharp.Css/Declarations/FontSizeAdjustDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontSizeAdjustDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class FontSizeAdjustDeclaration
{
public static String Name = PropertyNames.FontSizeAdjust;
- public static IValueConverter Converter = Or(OptionalNumberConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalNumberConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontSizeAdjustDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/FontSizeDeclaration.cs b/src/AngleSharp.Css/Declarations/FontSizeDeclaration.cs
index 5675635f..168baead 100644
--- a/src/AngleSharp.Css/Declarations/FontSizeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontSizeDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class FontSizeDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(FontSizeConverter, AssignInitial(new Length(1f, Length.Unit.Em)));
+ public static IValueConverter Converter = FontSizeConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontSizeDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/FontStretchDeclaration.cs b/src/AngleSharp.Css/Declarations/FontStretchDeclaration.cs
index e2256f04..8cb3cdcd 100644
--- a/src/AngleSharp.Css/Declarations/FontStretchDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontStretchDeclaration.cs
@@ -8,7 +8,9 @@ static class FontStretchDeclaration
{
public static String Name = PropertyNames.FontStretch;
- public static IValueConverter Converter = Or(FontStretchConverter, AssignInitial(FontStretch.Normal));
+ public static IValueConverter Converter = FontStretchConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontStretchDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/FontStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/FontStyleDeclaration.cs
index fd3614cf..0ac37084 100644
--- a/src/AngleSharp.Css/Declarations/FontStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontStyleDeclaration.cs
@@ -13,7 +13,9 @@ static class FontStyleDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(FontStyleConverter, AssignInitial(FontStyle.Normal));
+ public static IValueConverter Converter = FontStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontStyleDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/FontVariantDeclaration.cs b/src/AngleSharp.Css/Declarations/FontVariantDeclaration.cs
index 078f54a7..a18367c9 100644
--- a/src/AngleSharp.Css/Declarations/FontVariantDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontVariantDeclaration.cs
@@ -13,7 +13,9 @@ static class FontVariantDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(FontVariantConverter, AssignInitial(FontVariant.Normal));
+ public static IValueConverter Converter = FontVariantConverter;
+
+ public static ICssValue InitialValue = InitialValues.FontVariantDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/FontWeightDeclaration.cs b/src/AngleSharp.Css/Declarations/FontWeightDeclaration.cs
index b2c15de6..869b5923 100644
--- a/src/AngleSharp.Css/Declarations/FontWeightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/FontWeightDeclaration.cs
@@ -13,7 +13,9 @@ static class FontWeightDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(FontWeightConverter, WeightIntegerConverter, AssignInitial(FontWeight.Normal));
+ public static IValueConverter Converter = Or(FontWeightConverter, WeightIntegerConverter);
+
+ public static ICssValue InitialValue = InitialValues.FontWeightDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/GapDeclaration.cs b/src/AngleSharp.Css/Declarations/GapDeclaration.cs
index 31ede2c5..1512f71c 100644
--- a/src/AngleSharp.Css/Declarations/GapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GapDeclaration.cs
@@ -18,16 +18,15 @@ static class GapDeclaration
public static readonly IValueConverter Converter = new GapAggregagtor();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
sealed class GapAggregagtor : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(WithOrder(GapConverter, GapConverter), AssignInitial());
+ private static readonly IValueConverter converter = WithOrder(GapConverter, GapConverter);
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -44,9 +43,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var list = value as CssTupleValue;
-
- if (list != null)
+ if (value is CssTupleValue list)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridAreaDeclaration.cs b/src/AngleSharp.Css/Declarations/GridAreaDeclaration.cs
index 7d0a5079..eca5c752 100644
--- a/src/AngleSharp.Css/Declarations/GridAreaDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridAreaDeclaration.cs
@@ -21,32 +21,24 @@ static class GridAreaDeclaration
public static readonly IValueConverter Converter = new GridAreaAggregator();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class GridAreaAggregator : IValueAggregator, IValueConverter
{
private static readonly String seperator = " / ";
- private static readonly IValueConverter converter = Or(
- SlashSeparated(Or(
- Assign(CssKeywords.Auto, null),
- WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 4, seperator),
- AssignInitial());
+ private static readonly IValueConverter converter = SlashSeparated(Or(
+ Assign(CssKeywords.Auto, null),
+ WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 4, seperator);
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
- public ICssValue Merge(ICssValue[] values)
- {
- return new CssTupleValue(values, seperator);
- }
+ public ICssValue Merge(ICssValue[] values) => new CssTupleValue(values, seperator);
public ICssValue[] Split(ICssValue value)
{
- var tuple = value as CssTupleValue;
-
- if (tuple != null)
+ if (value is CssTupleValue tuple)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridAutoColumnsDeclaration.cs b/src/AngleSharp.Css/Declarations/GridAutoColumnsDeclaration.cs
index d926f53e..69e4ee1e 100644
--- a/src/AngleSharp.Css/Declarations/GridAutoColumnsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridAutoColumnsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class GridAutoColumnsDeclaration
public static readonly IValueConverter Converter = GridAutoConverter;
+ public static readonly ICssValue InitialValue = InitialValues.GridAutoColumnsDecl;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridAutoFlowDeclaration.cs b/src/AngleSharp.Css/Declarations/GridAutoFlowDeclaration.cs
index df49fbb8..2da4dab7 100644
--- a/src/AngleSharp.Css/Declarations/GridAutoFlowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridAutoFlowDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,11 @@ static class GridAutoFlowDeclaration
{
public static readonly String Name = PropertyNames.GridAutoFlow;
- public static readonly IValueConverter Converter = Or(WithAny(Toggle(CssKeywords.Column, CssKeywords.Row), Assign(CssKeywords.Dense, true)), AssignInitial());
+ public static readonly IValueConverter Converter = WithAny(
+ Toggle(CssKeywords.Column, CssKeywords.Row),
+ Assign(CssKeywords.Dense, true));
+
+ public static readonly ICssValue InitialValue = InitialValues.GridAutoFlowDecl;
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/GridAutoRowsDeclaration.cs b/src/AngleSharp.Css/Declarations/GridAutoRowsDeclaration.cs
index 37607d2f..fce5675d 100644
--- a/src/AngleSharp.Css/Declarations/GridAutoRowsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridAutoRowsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class GridAutoRowsDeclaration
public static readonly IValueConverter Converter = GridAutoConverter;
+ public static readonly ICssValue InitialValue = InitialValues.GridAutoRowsDecl;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridColumnDeclaration.cs b/src/AngleSharp.Css/Declarations/GridColumnDeclaration.cs
index 5dfed867..e531bd32 100644
--- a/src/AngleSharp.Css/Declarations/GridColumnDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridColumnDeclaration.cs
@@ -19,32 +19,24 @@ static class GridColumnDeclaration
public static readonly IValueConverter Converter = new GridColumnAggregator();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class GridColumnAggregator : IValueAggregator, IValueConverter
{
private static readonly String seperator = " / ";
- private static readonly IValueConverter converter = Or(
- SlashSeparated(Or(
- Assign(CssKeywords.Auto, null),
- WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 2, seperator),
- AssignInitial());
+ private static readonly IValueConverter converter = SlashSeparated(Or(
+ Assign(CssKeywords.Auto, null),
+ WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 2, seperator);
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
- public ICssValue Merge(ICssValue[] values)
- {
- return new CssTupleValue(values, seperator);
- }
+ public ICssValue Merge(ICssValue[] values) => new CssTupleValue(values, seperator);
public ICssValue[] Split(ICssValue value)
{
- var tuple = value as CssTupleValue;
-
- if (tuple != null)
+ if (value is CssTupleValue tuple)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridColumnEndDeclaration.cs b/src/AngleSharp.Css/Declarations/GridColumnEndDeclaration.cs
index 22372e44..43a656b2 100644
--- a/src/AngleSharp.Css/Declarations/GridColumnEndDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridColumnEndDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -15,6 +16,8 @@ static class GridColumnEndDeclaration
public static readonly IValueConverter Converter = GridLineConverter;
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridColumnGapDeclaration.cs b/src/AngleSharp.Css/Declarations/GridColumnGapDeclaration.cs
index 06871255..05ddb27d 100644
--- a/src/AngleSharp.Css/Declarations/GridColumnGapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridColumnGapDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class GridColumnGapDeclaration
PropertyNames.GridGap,
};
- public static readonly IValueConverter Converter = Or(GapConverter, AssignInitial(Length.Normal));
+ public static readonly IValueConverter Converter = GapConverter;
+
+ public static ICssValue InitialValue = InitialValues.GridColumnGapDecl;
public static readonly PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/GridColumnStartDeclaration.cs b/src/AngleSharp.Css/Declarations/GridColumnStartDeclaration.cs
index 733a05a1..18bf2cbd 100644
--- a/src/AngleSharp.Css/Declarations/GridColumnStartDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridColumnStartDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -15,6 +16,8 @@ static class GridColumnStartDeclaration
public static readonly IValueConverter Converter = GridLineConverter;
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridDeclaration.cs b/src/AngleSharp.Css/Declarations/GridDeclaration.cs
index ab547813..d5053f4f 100644
--- a/src/AngleSharp.Css/Declarations/GridDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridDeclaration.cs
@@ -6,7 +6,6 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Text;
using System;
using System.Collections.Generic;
- using static ValueConverters;
static class GridDeclaration
{
@@ -14,6 +13,8 @@ static class GridDeclaration
public static readonly IValueConverter Converter = new GridAggregator();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly String[] Longhands = new[]
{
PropertyNames.GridTemplateRows,
@@ -66,7 +67,7 @@ public ICssValue Convert(StringSource source)
sizes.Add(size);
}
- return new Grid(rows, null, sizes, isDense);
+ return new CssGridValue(rows, null, sizes, isDense);
}
}
}
@@ -97,11 +98,11 @@ public ICssValue Convert(StringSource source)
if (columns != null)
{
- return new Grid(null, columns, sizes, isDense);
+ return new CssGridValue(null, columns, sizes, isDense);
}
}
- return new Grid(null, null, sizes, isDense);
+ return new CssGridValue(null, null, sizes, isDense);
}
}
@@ -111,12 +112,9 @@ public ICssValue Convert(StringSource source)
sealed class GridAggregator : IValueConverter, IValueAggregator
{
- private static readonly IValueConverter converter = Or(new GridConverter(), AssignInitial());
+ private static readonly IValueConverter converter = new GridConverter();
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -135,14 +133,12 @@ public ICssValue Merge(ICssValue[] values)
}
else if (templateRows != null || templateColumns != null)
{
- var tuple = (autoRows ?? autoColumns) as CssTupleValue;
-
- if (tuple != null)
+ if ((autoRows ?? autoColumns) is CssTupleValue tuple)
{
- return new Grid(templateRows, templateColumns, tuple.Items, autoFlow != null);
+ return new CssGridValue(templateRows, templateColumns, tuple.Items, autoFlow != null);
}
- return new GridTemplate(templateRows, templateColumns, templateAreas);
+ return new CssGridTemplateValue(templateRows, templateColumns, templateAreas);
}
return null;
@@ -150,10 +146,8 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- if (value is GridTemplate)
+ if (value is CssGridTemplateValue gt)
{
- var gt = (GridTemplate)value;
-
return new[]
{
gt.TemplateRows,
@@ -168,9 +162,8 @@ public ICssValue[] Split(ICssValue value)
null,
};
}
- else if (value is Grid)
+ else if (value is CssGridValue grid)
{
- var grid = (Grid)value;
var dense = grid.Rows != null ? CssKeywords.Row : CssKeywords.Column;
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridGapDeclaration.cs b/src/AngleSharp.Css/Declarations/GridGapDeclaration.cs
index 552fe60b..fc0a9b41 100644
--- a/src/AngleSharp.Css/Declarations/GridGapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridGapDeclaration.cs
@@ -18,16 +18,15 @@ static class GridGapDeclaration
public static readonly IValueConverter Converter = new GridGapAggregagtor();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
sealed class GridGapAggregagtor : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(WithOrder(GapConverter, GapConverter), AssignInitial());
+ private static readonly IValueConverter converter = WithOrder(GapConverter, GapConverter);
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -44,9 +43,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var list = value as CssTupleValue;
-
- if (list != null)
+ if (value is CssTupleValue list)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridRowDeclaration.cs b/src/AngleSharp.Css/Declarations/GridRowDeclaration.cs
index 58850f10..9f8bfdee 100644
--- a/src/AngleSharp.Css/Declarations/GridRowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridRowDeclaration.cs
@@ -19,16 +19,16 @@ static class GridRowDeclaration
public static readonly IValueConverter Converter = new GridRowAggregator();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class GridRowAggregator : IValueAggregator, IValueConverter
{
private static readonly String seperator = " / ";
- private static readonly IValueConverter converter = Or(
- SlashSeparated(Or(
- Assign(CssKeywords.Auto, null),
- WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 2, seperator),
- AssignInitial());
+ private static readonly IValueConverter converter = SlashSeparated(Or(
+ Assign(CssKeywords.Auto, null),
+ WithAny(Assign(CssKeywords.Span, true), IntegerConverter, IdentifierConverter))).Many(1, 2, seperator);
public ICssValue Convert(StringSource source)
{
@@ -42,9 +42,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var tuple = value as CssTupleValue;
-
- if (tuple != null)
+ if (value is CssTupleValue tuple)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/GridRowEndDeclaration.cs b/src/AngleSharp.Css/Declarations/GridRowEndDeclaration.cs
index 8c37da48..1cadd95b 100644
--- a/src/AngleSharp.Css/Declarations/GridRowEndDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridRowEndDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -15,6 +16,8 @@ static class GridRowEndDeclaration
public static readonly IValueConverter Converter = GridLineConverter;
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridRowGapDeclaration.cs b/src/AngleSharp.Css/Declarations/GridRowGapDeclaration.cs
index 04112421..6274db36 100644
--- a/src/AngleSharp.Css/Declarations/GridRowGapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridRowGapDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class GridRowGapDeclaration
PropertyNames.GridGap,
};
- public static readonly IValueConverter Converter = Or(GapConverter, AssignInitial(Length.Normal));
+ public static readonly IValueConverter Converter = GapConverter;
+
+ public static ICssValue InitialValue = InitialValues.GridRowGapDecl;
public static readonly PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/GridRowStartDeclaration.cs b/src/AngleSharp.Css/Declarations/GridRowStartDeclaration.cs
index 2b0c6308..5f92a618 100644
--- a/src/AngleSharp.Css/Declarations/GridRowStartDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridRowStartDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -15,6 +16,8 @@ static class GridRowStartDeclaration
public static readonly IValueConverter Converter = GridLineConverter;
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridTemplateAreasDeclaration.cs b/src/AngleSharp.Css/Declarations/GridTemplateAreasDeclaration.cs
index feb450ea..151372a1 100644
--- a/src/AngleSharp.Css/Declarations/GridTemplateAreasDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridTemplateAreasDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +14,9 @@ static class GridTemplateAreasDeclaration
PropertyNames.GridTemplate,
};
- public static readonly IValueConverter Converter = Or(None, StringConverter.Many(), AssignInitial());
+ public static readonly IValueConverter Converter = Or(None, StringConverter.Many());
+
+ public static readonly ICssValue InitialValue = InitialValues.GridTemplateAreasDecl;
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/GridTemplateColumnsDeclaration.cs b/src/AngleSharp.Css/Declarations/GridTemplateColumnsDeclaration.cs
index 9b2feb17..85ac0130 100644
--- a/src/AngleSharp.Css/Declarations/GridTemplateColumnsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridTemplateColumnsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,6 +15,8 @@ static class GridTemplateColumnsDeclaration
public static readonly IValueConverter Converter = GridTemplateConverter;
+ public static readonly ICssValue InitialValue = InitialValues.GridTemplateColumnsDecl;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/GridTemplateDeclaration.cs b/src/AngleSharp.Css/Declarations/GridTemplateDeclaration.cs
index 1e4cdc1b..89ba5482 100644
--- a/src/AngleSharp.Css/Declarations/GridTemplateDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridTemplateDeclaration.cs
@@ -5,7 +5,6 @@ namespace AngleSharp.Css.Declarations
using AngleSharp.Css.Values;
using AngleSharp.Text;
using System;
- using static ValueConverters;
static class GridTemplateDeclaration
{
@@ -20,6 +19,8 @@ static class GridTemplateDeclaration
public static readonly IValueConverter Converter = new GridTemplateAggregator();
+ public static readonly ICssValue InitialValue = null;
+
public static readonly PropertyFlags Flags = PropertyFlags.Shorthand;
sealed class GridTemplateConverter : IValueConverter
@@ -32,7 +33,7 @@ public ICssValue Convert(StringSource source)
sealed class GridTemplateAggregator : IValueConverter, IValueAggregator
{
- private static readonly IValueConverter converter = Or(new GridTemplateConverter(), AssignInitial());
+ private static readonly IValueConverter converter = new GridTemplateConverter();
public ICssValue Convert(StringSource source)
{
@@ -51,7 +52,7 @@ public ICssValue Merge(ICssValue[] values)
}
else if (cols != null || rows != null || areas != null)
{
- return new GridTemplate(rows, cols, areas);
+ return new CssGridTemplateValue(rows, cols, areas);
}
return null;
@@ -59,9 +60,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var template = value as GridTemplate;
-
- if (template != null)
+ if (value is CssGridTemplateValue template)
{
return new[] { template.TemplateRows, template.TemplateColumns, template.TemplateAreas };
}
diff --git a/src/AngleSharp.Css/Declarations/GridTemplateRowsDeclaration.cs b/src/AngleSharp.Css/Declarations/GridTemplateRowsDeclaration.cs
index 78f7a1f3..1d12c4c0 100644
--- a/src/AngleSharp.Css/Declarations/GridTemplateRowsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/GridTemplateRowsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,6 +15,8 @@ static class GridTemplateRowsDeclaration
public static readonly IValueConverter Converter = GridTemplateConverter;
+ public static readonly ICssValue InitialValue = InitialValues.GridTemplateRowsDecl;
+
public static readonly PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/HeightDeclaration.cs b/src/AngleSharp.Css/Declarations/HeightDeclaration.cs
index 877e56fa..7aa57cf4 100644
--- a/src/AngleSharp.Css/Declarations/HeightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/HeightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class HeightDeclaration
{
public static String Name = PropertyNames.Height;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.HeightDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/JustifyContentDeclaration.cs b/src/AngleSharp.Css/Declarations/JustifyContentDeclaration.cs
index a3d2fa9f..f97a6981 100644
--- a/src/AngleSharp.Css/Declarations/JustifyContentDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/JustifyContentDeclaration.cs
@@ -8,7 +8,9 @@ static class JustifyContentDeclaration
{
public static String Name = PropertyNames.JustifyContent;
- public static IValueConverter Converter = Or(JustifyContentConverter, AssignInitial(FlexContentMode.Start));
+ public static IValueConverter Converter = JustifyContentConverter;
+
+ public static ICssValue InitialValue = InitialValues.JustifyContentDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/LeftDeclaration.cs b/src/AngleSharp.Css/Declarations/LeftDeclaration.cs
index d5402d86..c1dfee0c 100644
--- a/src/AngleSharp.Css/Declarations/LeftDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/LeftDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class LeftDeclaration
{
public static String Name = PropertyNames.Left;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.LeftDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/LetterSpacingDeclaration.cs b/src/AngleSharp.Css/Declarations/LetterSpacingDeclaration.cs
index 5e445b49..627b4fcd 100644
--- a/src/AngleSharp.Css/Declarations/LetterSpacingDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/LetterSpacingDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class LetterSpacingDeclaration
{
public static String Name = PropertyNames.LetterSpacing;
- public static IValueConverter Converter = Or(OptionalLengthConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalLengthConverter;
+
+ public static ICssValue InitialValue = InitialValues.LetterSpacingDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Unitless;
}
diff --git a/src/AngleSharp.Css/Declarations/LineHeightDeclaration.cs b/src/AngleSharp.Css/Declarations/LineHeightDeclaration.cs
index 8567ee45..8ba11166 100644
--- a/src/AngleSharp.Css/Declarations/LineHeightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/LineHeightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class LineHeightDeclaration
PropertyNames.Font,
};
- public static IValueConverter Converter = Or(LineHeightConverter, AssignInitial(new Length(120f, Length.Unit.Percent)));
+ public static IValueConverter Converter = LineHeightConverter;
+
+ public static ICssValue InitialValue = InitialValues.LineHeightDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ListStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/ListStyleDeclaration.cs
index 68b6f4f0..c753e530 100644
--- a/src/AngleSharp.Css/Declarations/ListStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ListStyleDeclaration.cs
@@ -2,8 +2,6 @@ namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -11,7 +9,13 @@ static class ListStyleDeclaration
{
public static String Name = PropertyNames.ListStyle;
- public static IValueConverter Converter = new ListStyleAggregator();
+ public static IValueConverter Converter = AggregateTuple(
+ WithAny(
+ ListStyleConverter.Option(InitialValues.ListStyleTypeDecl),
+ ListPositionConverter.Option(InitialValues.ListStylePositionDecl),
+ OptionalImageSourceConverter.Option(InitialValues.ListStyleImageDecl)));
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Shorthand;
@@ -21,59 +25,5 @@ static class ListStyleDeclaration
PropertyNames.ListStylePosition,
PropertyNames.ListStyleImage,
};
-
- sealed class ListStyleValueConverter : IValueConverter
- {
- private static readonly IValueConverter converter = WithAny(
- ListStyleConverter.Option(),
- ListPositionConverter.Option(),
- OptionalImageSourceConverter.Option());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
- }
-
- sealed class ListStyleAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(new ListStyleValueConverter(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var type = values[0];
- var position = values[1];
- var image = values[2];
-
- if (type != null || position != null || image != null)
- {
- return new CssTupleValue(new[] { type, position, image });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/ListStyleImageDeclaration.cs b/src/AngleSharp.Css/Declarations/ListStyleImageDeclaration.cs
index 97033b49..cc7c46a3 100644
--- a/src/AngleSharp.Css/Declarations/ListStyleImageDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ListStyleImageDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class ListStyleImageDeclaration
PropertyNames.ListStyle,
};
- public static IValueConverter Converter = Or(OptionalImageSourceConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalImageSourceConverter;
+
+ public static ICssValue InitialValue = InitialValues.ListStyleImageDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ListStylePositionDeclaration.cs b/src/AngleSharp.Css/Declarations/ListStylePositionDeclaration.cs
index 55aff2d7..fecbf4ff 100644
--- a/src/AngleSharp.Css/Declarations/ListStylePositionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ListStylePositionDeclaration.cs
@@ -13,7 +13,9 @@ static class ListStylePositionDeclaration
PropertyNames.ListStyle,
};
- public static IValueConverter Converter = Or(ListPositionConverter, AssignInitial(ListPosition.Outside));
+ public static IValueConverter Converter = ListPositionConverter;
+
+ public static ICssValue InitialValue = InitialValues.ListStylePositionDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ListStyleTypeDeclaration.cs b/src/AngleSharp.Css/Declarations/ListStyleTypeDeclaration.cs
index 5b095e95..8f7bbee3 100644
--- a/src/AngleSharp.Css/Declarations/ListStyleTypeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ListStyleTypeDeclaration.cs
@@ -13,7 +13,9 @@ static class ListStyleTypeDeclaration
PropertyNames.ListStyle,
};
- public static IValueConverter Converter = Or(ListStyleConverter, AssignInitial(ListStyle.Disc));
+ public static IValueConverter Converter = ListStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.ListStyleTypeDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/MarginBottomDeclaration.cs b/src/AngleSharp.Css/Declarations/MarginBottomDeclaration.cs
index 82718669..5fdf81ff 100644
--- a/src/AngleSharp.Css/Declarations/MarginBottomDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MarginBottomDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class MarginBottomDeclaration
PropertyNames.Margin,
};
- public static IValueConverter Converter = MarginConverter;
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MarginBottomDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MarginDeclaration.cs b/src/AngleSharp.Css/Declarations/MarginDeclaration.cs
index 0de560a9..93ba9f93 100644
--- a/src/AngleSharp.Css/Declarations/MarginDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MarginDeclaration.cs
@@ -13,6 +13,8 @@ static class MarginDeclaration
public static IValueConverter Converter = new MarginAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -25,7 +27,7 @@ static class MarginDeclaration
sealed class MarginAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(AutoLengthOrPercentConverter.Periodic(), AssignInitial(Length.Zero));
+ private static readonly IValueConverter converter = AutoLengthOrPercentConverter.Periodic();
public ICssValue Convert(StringSource source)
{
@@ -41,7 +43,7 @@ public ICssValue Merge(ICssValue[] values)
if (top != null && right != null && bottom != null && left != null)
{
- return new Periodic(new[] { top, right, bottom, left });
+ return new CssPeriodicValue(new[] { top, right, bottom, left });
}
return null;
@@ -49,9 +51,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var period = value as Periodic;
-
- if (period != null)
+ if (value is CssPeriodicValue period)
{
return new[] { period.Top, period.Right, period.Bottom, period.Left };
}
diff --git a/src/AngleSharp.Css/Declarations/MarginLeftDeclaration.cs b/src/AngleSharp.Css/Declarations/MarginLeftDeclaration.cs
index 98e7dd41..d8125180 100644
--- a/src/AngleSharp.Css/Declarations/MarginLeftDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MarginLeftDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class MarginLeftDeclaration
PropertyNames.Margin,
};
- public static IValueConverter Converter = MarginConverter;
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MarginLeftDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MarginRightDeclaration.cs b/src/AngleSharp.Css/Declarations/MarginRightDeclaration.cs
index b65a5e56..c770daac 100644
--- a/src/AngleSharp.Css/Declarations/MarginRightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MarginRightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class MarginRightDeclaration
PropertyNames.Margin,
};
- public static IValueConverter Converter = MarginConverter;
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MarginRightDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MarginTopDeclaration.cs b/src/AngleSharp.Css/Declarations/MarginTopDeclaration.cs
index 657a8fa1..db00dd53 100644
--- a/src/AngleSharp.Css/Declarations/MarginTopDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MarginTopDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class MarginTopDeclaration
PropertyNames.Margin,
};
- public static IValueConverter Converter = MarginConverter;
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MarginTopDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MaxHeightDeclaration.cs b/src/AngleSharp.Css/Declarations/MaxHeightDeclaration.cs
index 8ca5c2a0..975eb9ea 100644
--- a/src/AngleSharp.Css/Declarations/MaxHeightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MaxHeightDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class MaxHeightDeclaration
{
public static String Name = PropertyNames.MaxHeight;
- public static IValueConverter Converter = Or(OptionalLengthOrPercentConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MaxHeightDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MaxWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/MaxWidthDeclaration.cs
index ed95e033..ced82b68 100644
--- a/src/AngleSharp.Css/Declarations/MaxWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MaxWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class MaxWidthDeclaration
{
public static String Name = PropertyNames.MaxWidth;
- public static IValueConverter Converter = Or(OptionalLengthOrPercentConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MaxWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/MinHeightDeclaration.cs b/src/AngleSharp.Css/Declarations/MinHeightDeclaration.cs
index b3b39366..86e4f737 100644
--- a/src/AngleSharp.Css/Declarations/MinHeightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MinHeightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class MinHeightDeclaration
{
public static String Name = PropertyNames.MinHeight;
- public static IValueConverter Converter = Or(LengthOrPercentConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MinHeightDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/MinWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/MinWidthDeclaration.cs
index 6e8997c4..f261b889 100644
--- a/src/AngleSharp.Css/Declarations/MinWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/MinWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class MinWidthDeclaration
{
public static String Name = PropertyNames.MinWidth;
- public static IValueConverter Converter = Or(LengthOrPercentConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.MinWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/ObjectFitDeclaration.cs b/src/AngleSharp.Css/Declarations/ObjectFitDeclaration.cs
index 4575113f..a6c24b33 100644
--- a/src/AngleSharp.Css/Declarations/ObjectFitDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ObjectFitDeclaration.cs
@@ -8,7 +8,9 @@ static class ObjectFitDeclaration
{
public static String Name = PropertyNames.ObjectFit;
- public static IValueConverter Converter = Or(ObjectFittingConverter, AssignInitial(ObjectFitting.Fill));
+ public static IValueConverter Converter = ObjectFittingConverter;
+
+ public static ICssValue InitialValue = InitialValues.ObjectFitDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/ObjectPositionDeclaration.cs b/src/AngleSharp.Css/Declarations/ObjectPositionDeclaration.cs
index b786ce9c..46cf0ec4 100644
--- a/src/AngleSharp.Css/Declarations/ObjectPositionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ObjectPositionDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ObjectPositionDeclaration
{
public static String Name = PropertyNames.ObjectPosition;
- public static IValueConverter Converter = Or(PointConverter, AssignInitial(Point.Center));
+ public static IValueConverter Converter = PointConverter;
+
+ public static ICssValue InitialValue = InitialValues.ObjectPositionDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/OpacityDeclaration.cs b/src/AngleSharp.Css/Declarations/OpacityDeclaration.cs
index 504c6863..a9ffccc1 100644
--- a/src/AngleSharp.Css/Declarations/OpacityDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OpacityDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class OpacityDeclaration
{
public static String Name = PropertyNames.Opacity;
- public static IValueConverter Converter = Or(NumberConverter, AssignInitial(1f));
+ public static IValueConverter Converter = NumberConverter;
+
+ public static ICssValue InitialValue = InitialValues.OpacityDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/OrderDeclaration.cs b/src/AngleSharp.Css/Declarations/OrderDeclaration.cs
index 7dded82d..a4ed999f 100644
--- a/src/AngleSharp.Css/Declarations/OrderDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OrderDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class OrderDeclaration
{
public static String Name = PropertyNames.Order;
- public static IValueConverter Converter = Or(IntegerConverter, AssignInitial(0));
+ public static IValueConverter Converter = Or(IntegerConverter, AssignInitial(InitialValues.OrderDecl));
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/OrphansDeclaration.cs b/src/AngleSharp.Css/Declarations/OrphansDeclaration.cs
index 13ff02ab..a9cc7bf2 100644
--- a/src/AngleSharp.Css/Declarations/OrphansDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OrphansDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class OrphansDeclaration
{
public static String Name = PropertyNames.Orphans;
- public static IValueConverter Converter = Or(NaturalIntegerConverter, AssignInitial(2));
+ public static IValueConverter Converter = NaturalIntegerConverter;
+
+ public static ICssValue InitialValue = InitialValues.OrphansDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/OutlineColorDeclaration.cs b/src/AngleSharp.Css/Declarations/OutlineColorDeclaration.cs
index 164c34c6..21352853 100644
--- a/src/AngleSharp.Css/Declarations/OutlineColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OutlineColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class OutlineColorDeclaration
PropertyNames.Outline,
};
- public static IValueConverter Converter = Or(InvertedColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = InvertedColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.OutlineColorDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/OutlineDeclaration.cs b/src/AngleSharp.Css/Declarations/OutlineDeclaration.cs
index 0692adb3..7b467cbc 100644
--- a/src/AngleSharp.Css/Declarations/OutlineDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OutlineDeclaration.cs
@@ -2,8 +2,6 @@ namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -11,7 +9,13 @@ static class OutlineDeclaration
{
public static String Name = PropertyNames.Outline;
- public static IValueConverter Converter = new OutlineAggregator();
+ public static IValueConverter Converter = AggregateTuple(
+ WithAny(
+ LineWidthConverter.Option(InitialValues.OutlineWidthDecl),
+ LineStyleConverter.Option(InitialValues.OutlineStyleDecl),
+ InvertedColorConverter.Option(InitialValues.OutlineColorDecl)));
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -21,59 +25,5 @@ static class OutlineDeclaration
PropertyNames.OutlineStyle,
PropertyNames.OutlineColor,
};
-
- sealed class OutlineValueConverter : IValueConverter
- {
- private static readonly IValueConverter converter = WithAny(
- LineWidthConverter.Option(),
- LineStyleConverter.Option(),
- InvertedColorConverter.Option());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
- }
-
- sealed class OutlineAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(new OutlineValueConverter(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var width = values[0];
- var style = values[1];
- var color = values[2];
-
- if (width != null || style != null || color != null)
- {
- return new CssTupleValue(new[] { width, style, color });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/OutlineStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/OutlineStyleDeclaration.cs
index d8079889..668aa48a 100644
--- a/src/AngleSharp.Css/Declarations/OutlineStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OutlineStyleDeclaration.cs
@@ -13,7 +13,9 @@ static class OutlineStyleDeclaration
PropertyNames.Outline,
};
- public static IValueConverter Converter = Or(LineStyleConverter, AssignInitial(LineStyle.None));
+ public static IValueConverter Converter = LineStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.OutlineStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/OutlineWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/OutlineWidthDeclaration.cs
index 6cb178bc..007f5d16 100644
--- a/src/AngleSharp.Css/Declarations/OutlineWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OutlineWidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class OutlineWidthDeclaration
PropertyNames.Outline,
};
- public static IValueConverter Converter = Or(LineWidthConverter, AssignInitial(Length.Medium));
+ public static IValueConverter Converter = LineWidthConverter;
+
+ public static ICssValue InitialValue = InitialValues.OutlineWidthDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/OverflowDeclaration.cs b/src/AngleSharp.Css/Declarations/OverflowDeclaration.cs
index ef840f05..d4818969 100644
--- a/src/AngleSharp.Css/Declarations/OverflowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OverflowDeclaration.cs
@@ -8,7 +8,9 @@ static class OverflowDeclaration
{
public static String Name = PropertyNames.Overflow;
- public static IValueConverter Converter = Or(OverflowModeConverter, AssignInitial(OverflowMode.Visible));
+ public static IValueConverter Converter = OverflowModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.OverflowDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/OverflowWrapDeclaration.cs b/src/AngleSharp.Css/Declarations/OverflowWrapDeclaration.cs
index 080260a6..6001f5c9 100644
--- a/src/AngleSharp.Css/Declarations/OverflowWrapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OverflowWrapDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class OverflowWrapDeclaration
public static IValueConverter Converter = OverflowWrapConverter;
+ public static ICssValue InitialValue = InitialValues.OverflowWrapDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/OverflowXDeclaration.cs b/src/AngleSharp.Css/Declarations/OverflowXDeclaration.cs
index c77b274c..ec680aab 100644
--- a/src/AngleSharp.Css/Declarations/OverflowXDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OverflowXDeclaration.cs
@@ -8,7 +8,9 @@ static class OverflowXDeclaration
{
public static String Name = PropertyNames.OverflowX;
- public static IValueConverter Converter = Or(OverflowExtendedModeConverter, AssignInitial(OverflowMode.Visible));
+ public static IValueConverter Converter = OverflowExtendedModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.OverflowDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/OverflowYDeclaration.cs b/src/AngleSharp.Css/Declarations/OverflowYDeclaration.cs
index f41aca0f..214058d2 100644
--- a/src/AngleSharp.Css/Declarations/OverflowYDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/OverflowYDeclaration.cs
@@ -8,7 +8,9 @@ static class OverflowYDeclaration
{
public static String Name = PropertyNames.OverflowY;
- public static IValueConverter Converter = Or(OverflowExtendedModeConverter, AssignInitial(OverflowMode.Visible));
+ public static IValueConverter Converter = OverflowExtendedModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.OverflowDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/PaddingBottomDeclaration.cs b/src/AngleSharp.Css/Declarations/PaddingBottomDeclaration.cs
index 1e7e9800..2eeb5c23 100644
--- a/src/AngleSharp.Css/Declarations/PaddingBottomDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PaddingBottomDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class PaddingBottomDeclaration
PropertyNames.Padding,
};
- public static IValueConverter Converter = PaddingConverter;
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.PaddingBottomDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PaddingDeclaration.cs b/src/AngleSharp.Css/Declarations/PaddingDeclaration.cs
index b4afc3d6..20d08b4d 100644
--- a/src/AngleSharp.Css/Declarations/PaddingDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PaddingDeclaration.cs
@@ -13,6 +13,8 @@ static class PaddingDeclaration
public static IValueConverter Converter = new PaddingAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -25,12 +27,9 @@ static class PaddingDeclaration
sealed class PaddingAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(LengthOrPercentConverter.Periodic(), AssignInitial(Length.Zero));
+ private static readonly IValueConverter converter = LengthOrPercentConverter.Periodic();
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -41,7 +40,7 @@ public ICssValue Merge(ICssValue[] values)
if (top != null && right != null && bottom != null && left != null)
{
- return new Periodic(new[] { top, right, bottom, left });
+ return new CssPeriodicValue(new[] { top, right, bottom, left });
}
return null;
@@ -49,9 +48,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var period = value as Periodic;
-
- if (period != null)
+ if (value is CssPeriodicValue period)
{
return new[] { period.Top, period.Right, period.Bottom, period.Left };
}
diff --git a/src/AngleSharp.Css/Declarations/PaddingLeftDeclaration.cs b/src/AngleSharp.Css/Declarations/PaddingLeftDeclaration.cs
index 7f2386e8..fc63fa57 100644
--- a/src/AngleSharp.Css/Declarations/PaddingLeftDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PaddingLeftDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class PaddingLeftDeclaration
PropertyNames.Padding,
};
- public static IValueConverter Converter = PaddingConverter;
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.PaddingLeftDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PaddingRightDeclaration.cs b/src/AngleSharp.Css/Declarations/PaddingRightDeclaration.cs
index 7652e727..93c9ded0 100644
--- a/src/AngleSharp.Css/Declarations/PaddingRightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PaddingRightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class PaddingRightDeclaration
PropertyNames.Padding,
};
- public static IValueConverter Converter = PaddingConverter;
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.PaddingRightDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PaddingTopDeclaration.cs b/src/AngleSharp.Css/Declarations/PaddingTopDeclaration.cs
index e4fe268b..5e126dd5 100644
--- a/src/AngleSharp.Css/Declarations/PaddingTopDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PaddingTopDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class PaddingTopDeclaration
PropertyNames.Padding,
};
- public static IValueConverter Converter = PaddingConverter;
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.PaddingTopDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PageBreakAfterDeclaration.cs b/src/AngleSharp.Css/Declarations/PageBreakAfterDeclaration.cs
index c0a0a697..ffc53c1f 100644
--- a/src/AngleSharp.Css/Declarations/PageBreakAfterDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PageBreakAfterDeclaration.cs
@@ -8,7 +8,9 @@ static class PageBreakAfterDeclaration
{
public static String Name = PropertyNames.PageBreakAfter;
- public static IValueConverter Converter = Or(PageBreakModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = PageBreakModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.PageBreakAfterDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/PageBreakBeforeDeclaration.cs b/src/AngleSharp.Css/Declarations/PageBreakBeforeDeclaration.cs
index 5864bd44..1ee476d6 100644
--- a/src/AngleSharp.Css/Declarations/PageBreakBeforeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PageBreakBeforeDeclaration.cs
@@ -8,7 +8,9 @@ static class PageBreakBeforeDeclaration
{
public static String Name = PropertyNames.PageBreakBefore;
- public static IValueConverter Converter = Or(PageBreakModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = PageBreakModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.PageBreakBeforeDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/PageBreakInsideDeclaration.cs b/src/AngleSharp.Css/Declarations/PageBreakInsideDeclaration.cs
index d50472b7..fc5b2ba7 100644
--- a/src/AngleSharp.Css/Declarations/PageBreakInsideDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PageBreakInsideDeclaration.cs
@@ -8,7 +8,9 @@ static class PageBreakInsideDeclaration
{
public static String Name = PropertyNames.PageBreakInside;
- public static IValueConverter Converter = Or(PageBreakInsideModeConverter, AssignInitial(BreakMode.Auto));
+ public static IValueConverter Converter = PageBreakInsideModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.PageBreakInsideDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/PerspectiveDeclaration.cs b/src/AngleSharp.Css/Declarations/PerspectiveDeclaration.cs
index caf76e77..fa894748 100644
--- a/src/AngleSharp.Css/Declarations/PerspectiveDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PerspectiveDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class PerspectiveDeclaration
{
public static String Name = PropertyNames.Perspective;
- public static IValueConverter Converter = Or(LengthConverter, None, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = Or(LengthConverter, None);
+
+ public static ICssValue InitialValue = InitialValues.PerspectiveDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PerspectiveOriginDeclaration.cs b/src/AngleSharp.Css/Declarations/PerspectiveOriginDeclaration.cs
index f737747e..6b34bc16 100644
--- a/src/AngleSharp.Css/Declarations/PerspectiveOriginDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PerspectiveOriginDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class PerspectiveOriginDeclaration
{
public static String Name = PropertyNames.PerspectiveOrigin;
- public static IValueConverter Converter = Or(PointConverter, AssignInitial(Point.Center));
+ public static IValueConverter Converter = PointConverter;
+
+ public static ICssValue InitialValue = InitialValues.PerspectiveOriginDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/PointerEventsDeclaration.cs b/src/AngleSharp.Css/Declarations/PointerEventsDeclaration.cs
new file mode 100644
index 00000000..5db9a539
--- /dev/null
+++ b/src/AngleSharp.Css/Declarations/PointerEventsDeclaration.cs
@@ -0,0 +1,17 @@
+namespace AngleSharp.Css.Declarations
+{
+ using AngleSharp.Css.Dom;
+ using System;
+ using static ValueConverters;
+
+ static class PointerEventsDeclaration
+ {
+ public static String Name = PropertyNames.PointerEvents;
+
+ public static IValueConverter Converter = PointerEventConverter;
+
+ public static ICssValue InitialValue = InitialValues.PointerEventsDecl;
+
+ public static PropertyFlags Flags = PropertyFlags.Inherited;
+ }
+}
diff --git a/src/AngleSharp.Css/Declarations/PositionDeclaration.cs b/src/AngleSharp.Css/Declarations/PositionDeclaration.cs
index 198726fa..995ad836 100644
--- a/src/AngleSharp.Css/Declarations/PositionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/PositionDeclaration.cs
@@ -8,7 +8,9 @@ static class PositionDeclaration
{
public static String Name = PropertyNames.Position;
- public static IValueConverter Converter = Or(PositionModeConverter, AssignInitial(PositionMode.Static));
+ public static IValueConverter Converter = PositionModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.PositionDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/QuotesDeclaration.cs b/src/AngleSharp.Css/Declarations/QuotesDeclaration.cs
index f53254f7..ed68d75a 100644
--- a/src/AngleSharp.Css/Declarations/QuotesDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/QuotesDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class QuotesDeclaration
{
public static String Name = PropertyNames.Quotes;
- public static IValueConverter Converter = Or(QuotesConverter, None, AssignInitial(new[] { "«", "»" }));
+ public static IValueConverter Converter = Or(QuotesConverter, None);
+
+ public static ICssValue InitialValue = InitialValues.QuotesDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/RightDeclaration.cs b/src/AngleSharp.Css/Declarations/RightDeclaration.cs
index bfd51fc0..777f8e03 100644
--- a/src/AngleSharp.Css/Declarations/RightDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/RightDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class RightDeclaration
{
public static String Name = PropertyNames.Right;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.RightDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/RowGapDeclaration.cs b/src/AngleSharp.Css/Declarations/RowGapDeclaration.cs
index daaec665..e9483249 100644
--- a/src/AngleSharp.Css/Declarations/RowGapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/RowGapDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class RowGapDeclaration
PropertyNames.Gap,
};
- public static IValueConverter Converter = Or(GapConverter, AssignInitial(Length.Normal));
+ public static IValueConverter Converter = GapConverter;
+
+ public static ICssValue InitialValue = InitialValues.RowGapDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/RubyAlignDeclaration.cs b/src/AngleSharp.Css/Declarations/RubyAlignDeclaration.cs
index 1955f7f0..ab318bd1 100644
--- a/src/AngleSharp.Css/Declarations/RubyAlignDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/RubyAlignDeclaration.cs
@@ -8,7 +8,9 @@ static class RubyAlignDeclaration
{
public static String Name = PropertyNames.RubyAlign;
- public static IValueConverter Converter = Or(RubyAlignmentConverter, AssignInitial(RubyAlignment.SpaceAround));
+ public static IValueConverter Converter = RubyAlignmentConverter;
+
+ public static ICssValue InitialValue = InitialValues.RubyAlignDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/RubyOverhangDeclaration.cs b/src/AngleSharp.Css/Declarations/RubyOverhangDeclaration.cs
index bbd1ec93..46038370 100644
--- a/src/AngleSharp.Css/Declarations/RubyOverhangDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/RubyOverhangDeclaration.cs
@@ -8,7 +8,9 @@ static class RubyOverhangDeclaration
{
public static String Name = PropertyNames.RubyOverhang;
- public static IValueConverter Converter = Or(RubyOverhangModeConverter, AssignInitial(RubyOverhangMode.None));
+ public static IValueConverter Converter = RubyOverhangModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.RubyOverhangDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/RubyPositionDeclaration.cs b/src/AngleSharp.Css/Declarations/RubyPositionDeclaration.cs
index f9c45264..a5a6a0a2 100644
--- a/src/AngleSharp.Css/Declarations/RubyPositionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/RubyPositionDeclaration.cs
@@ -8,7 +8,9 @@ static class RubyPositionDeclaration
{
public static String Name = PropertyNames.RubyPosition;
- public static IValueConverter Converter = Or(RubyPositionConverter, AssignInitial(RubyPosition.Over));
+ public static IValueConverter Converter = RubyPositionConverter;
+
+ public static ICssValue InitialValue = InitialValues.RubyPositionDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/Scrollbar3dLightColorDeclaration.cs b/src/AngleSharp.Css/Declarations/Scrollbar3dLightColorDeclaration.cs
index 90c23c18..1e7ea1f3 100644
--- a/src/AngleSharp.Css/Declarations/Scrollbar3dLightColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/Scrollbar3dLightColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class Scrollbar3dLightColorDeclaration
{
public static String Name = PropertyNames.Scrollbar3dLightColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Color.White));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.Scrollbar3dLightColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarArrowColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarArrowColorDeclaration.cs
index a551f170..ba302c70 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarArrowColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarArrowColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarArrowColorDeclaration
{
public static String Name = PropertyNames.ScrollbarArrowColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("buttontext")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarArrowColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarBaseColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarBaseColorDeclaration.cs
index 3388b4d5..09e5ad92 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarBaseColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarBaseColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarBaseColorDeclaration
{
public static String Name = PropertyNames.ScrollbarBaseColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Color.Transparent));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarBaseColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarDarkshadowColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarDarkshadowColorDeclaration.cs
index ab3e7c57..5f95d7f7 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarDarkshadowColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarDarkshadowColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarDarkshadowColorDeclaration
{
public static String Name = PropertyNames.ScrollbarDarkShadowColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("threeddarkshadow")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarDarkshadowColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarFaceColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarFaceColorDeclaration.cs
index dbac4b4d..a66047ac 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarFaceColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarFaceColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarFaceColorDeclaration
{
public static String Name = PropertyNames.ScrollbarFaceColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("threedface")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarFaceColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarHighlightColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarHighlightColorDeclaration.cs
index f2e2ef85..539f962a 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarHighlightColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarHighlightColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarHighlightColorDeclaration
{
public static String Name = PropertyNames.ScrollbarHighlightColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("threedhighlight")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarHighlightColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarShadowColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarShadowColorDeclaration.cs
index c40fb9a6..26cc1816 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarShadowColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarShadowColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarShadowColorDeclaration
{
public static String Name = PropertyNames.ScrollbarShadowColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("threeddarkshadow")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarShadowColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/ScrollbarTrackColorDeclaration.cs b/src/AngleSharp.Css/Declarations/ScrollbarTrackColorDeclaration.cs
index 9fd1a032..4f255dff 100644
--- a/src/AngleSharp.Css/Declarations/ScrollbarTrackColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ScrollbarTrackColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class ScrollbarTrackColorDeclaration
{
public static String Name = PropertyNames.ScrollbarTrackColor;
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Colors.GetColor("scrollbar")));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.ScrollbarTrackColorDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/SrcDeclaration.cs b/src/AngleSharp.Css/Declarations/SrcDeclaration.cs
index 4b1d0db1..2461c578 100644
--- a/src/AngleSharp.Css/Declarations/SrcDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/SrcDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class SrcDeclaration
{
public static String Name = PropertyNames.Src;
- public static IValueConverter Converter = Any;
+ public static IValueConverter Converter = SrcListConverter;
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeDasharrayDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeDasharrayDeclaration.cs
index 9d27c1ad..80787bd3 100644
--- a/src/AngleSharp.Css/Declarations/StrokeDasharrayDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeDasharrayDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class StrokeDasharrayDeclaration
public static IValueConverter Converter = StrokeDasharrayConverter;
+ public static ICssValue InitialValue = InitialValues.StrokeDasharrayDecl;
+
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Unitless;
}
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeDashoffsetDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeDashoffsetDeclaration.cs
index a3e1bbdc..fc4ce26b 100644
--- a/src/AngleSharp.Css/Declarations/StrokeDashoffsetDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeDashoffsetDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class StrokeDashoffsetDeclaration
public static IValueConverter Converter = LengthOrPercentConverter;
+ public static ICssValue InitialValue = InitialValues.StrokeDashoffsetDecl;
+
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeDeclaration.cs
index 5c635bf4..0fd39c07 100644
--- a/src/AngleSharp.Css/Declarations/StrokeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class StrokeDeclaration
public static IValueConverter Converter = PaintConverter;
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeLinecapDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeLinecapDeclaration.cs
index 8db941ce..47ebbded 100644
--- a/src/AngleSharp.Css/Declarations/StrokeLinecapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeLinecapDeclaration.cs
@@ -8,7 +8,9 @@ static class StrokeLinecapDeclaration
{
public static String Name = PropertyNames.StrokeLinecap;
- public static IValueConverter Converter = Or(StrokeLinecapConverter, AssignInitial(StrokeLinecap.Butt));
+ public static IValueConverter Converter = StrokeLinecapConverter;
+
+ public static ICssValue InitialValue = InitialValues.StrokeLinecapDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeLinejoinDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeLinejoinDeclaration.cs
index 0a3ba257..0f615254 100644
--- a/src/AngleSharp.Css/Declarations/StrokeLinejoinDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeLinejoinDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class StrokeLinejoinDeclaration
public static IValueConverter Converter = StrokeLinejoinConverter;
+ public static ICssValue InitialValue = InitialValues.StrokeLinejoinDecl;
+
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeMiterlimitDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeMiterlimitDeclaration.cs
index cadc8d82..2deced4a 100644
--- a/src/AngleSharp.Css/Declarations/StrokeMiterlimitDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeMiterlimitDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class StrokeMiterlimitDeclaration
public static IValueConverter Converter = StrokeMiterlimitConverter;
+ public static ICssValue InitialValue = InitialValues.StrokeMiterlimitDecl;
+
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeOpacityDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeOpacityDeclaration.cs
index 1fe913a3..60bc5c88 100644
--- a/src/AngleSharp.Css/Declarations/StrokeOpacityDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeOpacityDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class StrokeOpacityDeclaration
{
public static String Name = PropertyNames.StrokeOpacity;
- public static IValueConverter Converter = Or(NumberConverter, AssignInitial(1f));
+ public static IValueConverter Converter = NumberConverter;
+
+ public static ICssValue InitialValue = InitialValues.StrokeOpacityDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/StrokeWidthDeclaration.cs b/src/AngleSharp.Css/Declarations/StrokeWidthDeclaration.cs
index cfe20827..5ffed1fe 100644
--- a/src/AngleSharp.Css/Declarations/StrokeWidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/StrokeWidthDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,8 +8,12 @@ static class StrokeWidthDeclaration
{
public static String Name = PropertyNames.StrokeWidth;
- public static IValueConverter Converter = LengthOrPercentConverter;
+ public static IValueConverter Converter = Or(
+ LengthOrPercentConverter,
+ NumberConverter);
- public static PropertyFlags Flags = PropertyFlags.Animatable;
+ public static ICssValue InitialValue = InitialValues.StrokeWidthDecl;
+
+ public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
}
diff --git a/src/AngleSharp.Css/Declarations/TableLayoutDeclaration.cs b/src/AngleSharp.Css/Declarations/TableLayoutDeclaration.cs
index dbe2d8f3..08df851b 100644
--- a/src/AngleSharp.Css/Declarations/TableLayoutDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TableLayoutDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class TableLayoutDeclaration
{
public static String Name = PropertyNames.TableLayout;
- public static IValueConverter Converter = Or(TableLayoutConverter, AssignInitial(false));
+ public static IValueConverter Converter = TableLayoutConverter;
+
+ public static ICssValue InitialValue = InitialValues.TableLayoutDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TextAlignDeclaration.cs b/src/AngleSharp.Css/Declarations/TextAlignDeclaration.cs
index f5013d08..ac7baf45 100644
--- a/src/AngleSharp.Css/Declarations/TextAlignDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextAlignDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Dom;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class TextAlignDeclaration
{
public static String Name = PropertyNames.TextAlign;
- public static IValueConverter Converter = Or(HorizontalAlignmentConverter, AssignInitial(HorizontalAlignment.Left));
+ public static IValueConverter Converter = HorizontalAlignmentConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextAlignDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/TextAlignLastDeclaration.cs b/src/AngleSharp.Css/Declarations/TextAlignLastDeclaration.cs
index 1044f8a8..31b73a8d 100644
--- a/src/AngleSharp.Css/Declarations/TextAlignLastDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextAlignLastDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class TextAlignLastDeclaration
public static IValueConverter Converter = TextAlignLastConverter;
+ public static ICssValue InitialValue = InitialValues.TextAlignLastDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/TextAnchorDeclaration.cs b/src/AngleSharp.Css/Declarations/TextAnchorDeclaration.cs
index ebd69b92..a8010900 100644
--- a/src/AngleSharp.Css/Declarations/TextAnchorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextAnchorDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class TextAnchorDeclaration
public static IValueConverter Converter = TextAnchorConverter;
+ public static ICssValue InitialValue = InitialValues.TextAnchorDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/TextDecorationColorDeclaration.cs b/src/AngleSharp.Css/Declarations/TextDecorationColorDeclaration.cs
index d4c49c7d..13824241 100644
--- a/src/AngleSharp.Css/Declarations/TextDecorationColorDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextDecorationColorDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +13,9 @@ static class TextDecorationColorDeclaration
PropertyNames.TextDecoration,
};
- public static IValueConverter Converter = Or(ColorConverter, AssignInitial(Color.Black));
+ public static IValueConverter Converter = ColorConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextDecorationColorDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TextDecorationDeclaration.cs b/src/AngleSharp.Css/Declarations/TextDecorationDeclaration.cs
index fb1a7e3e..88f1c4ba 100644
--- a/src/AngleSharp.Css/Declarations/TextDecorationDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextDecorationDeclaration.cs
@@ -2,8 +2,6 @@ namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
- using AngleSharp.Css.Values;
- using AngleSharp.Text;
using System;
using static ValueConverters;
@@ -11,7 +9,13 @@ static class TextDecorationDeclaration
{
public static String Name = PropertyNames.TextDecoration;
- public static IValueConverter Converter = new TextDecorationAggregator();
+ public static IValueConverter Converter = AggregateTuple(
+ WithAny(
+ ColorConverter.Option(InitialValues.TextDecorationColorDecl),
+ TextDecorationStyleConverter.Option(InitialValues.TextDecorationLineDecl),
+ TextDecorationLinesConverter.Option(InitialValues.TextDecorationStyleDecl)));
+
+ public static ICssValue InitialValue = null;
public static PropertyFlags Flags = PropertyFlags.Animatable | PropertyFlags.Shorthand;
@@ -21,59 +25,5 @@ static class TextDecorationDeclaration
PropertyNames.TextDecorationLine,
PropertyNames.TextDecorationStyle,
};
-
- sealed class TextDecorationValueConverter : IValueConverter
- {
- private static readonly IValueConverter converter = WithAny(
- ColorConverter.Option(),
- TextDecorationStyleConverter.Option(),
- TextDecorationLinesConverter.Option());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
- }
-
- sealed class TextDecorationAggregator : IValueAggregator, IValueConverter
- {
- private static readonly IValueConverter converter = Or(new TextDecorationValueConverter(), AssignInitial());
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
-
- public ICssValue Merge(ICssValue[] values)
- {
- var color = values[0];
- var line = values[1];
- var style = values[2];
-
- if (color != null || style != null || line != null)
- {
- return new CssTupleValue(new[] { color, style, line });
- }
-
- return null;
- }
-
- public ICssValue[] Split(ICssValue value)
- {
- var options = value as CssTupleValue;
-
- if (options != null)
- {
- return new[]
- {
- options.Items[0],
- options.Items[1],
- options.Items[2],
- };
- }
-
- return null;
- }
- }
}
}
diff --git a/src/AngleSharp.Css/Declarations/TextDecorationLineDeclaration.cs b/src/AngleSharp.Css/Declarations/TextDecorationLineDeclaration.cs
index e2135a3c..35abcd92 100644
--- a/src/AngleSharp.Css/Declarations/TextDecorationLineDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextDecorationLineDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -12,7 +13,9 @@ static class TextDecorationLineDeclaration
PropertyNames.TextDecoration,
};
- public static IValueConverter Converter = Or(TextDecorationLinesConverter, AssignInitial());
+ public static IValueConverter Converter = TextDecorationLinesConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextDecorationLineDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TextDecorationStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/TextDecorationStyleDeclaration.cs
index 8bc2a4a1..b5df3f2b 100644
--- a/src/AngleSharp.Css/Declarations/TextDecorationStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextDecorationStyleDeclaration.cs
@@ -13,7 +13,9 @@ static class TextDecorationStyleDeclaration
PropertyNames.TextDecoration,
};
- public static IValueConverter Converter = Or(TextDecorationStyleConverter, AssignInitial(TextDecorationStyle.Solid));
+ public static IValueConverter Converter = TextDecorationStyleConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextDecorationStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TextIndentDeclaration.cs b/src/AngleSharp.Css/Declarations/TextIndentDeclaration.cs
index 52297de1..4dc67038 100644
--- a/src/AngleSharp.Css/Declarations/TextIndentDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextIndentDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class TextIndentDeclaration
{
public static String Name = PropertyNames.TextIndent;
- public static IValueConverter Converter = Or(LengthOrPercentConverter, AssignInitial(Length.Zero));
+ public static IValueConverter Converter = LengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextIndentDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TextJustifyDeclaration.cs b/src/AngleSharp.Css/Declarations/TextJustifyDeclaration.cs
index 18f0dfbd..30de8539 100644
--- a/src/AngleSharp.Css/Declarations/TextJustifyDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextJustifyDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class TextJustifyDeclaration
public static IValueConverter Converter = TextJustifyConverter;
+ public static ICssValue InitialValue = InitialValues.TextJustifyDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/TextShadowDeclaration.cs b/src/AngleSharp.Css/Declarations/TextShadowDeclaration.cs
index 3b186ff7..c27e2028 100644
--- a/src/AngleSharp.Css/Declarations/TextShadowDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextShadowDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class TextShadowDeclaration
{
public static String Name = PropertyNames.TextShadow;
- public static IValueConverter Converter = Or(MultipleShadowConverter, AssignInitial());
+ public static IValueConverter Converter = MultipleShadowConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextShadowDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TextTransformDeclaration.cs b/src/AngleSharp.Css/Declarations/TextTransformDeclaration.cs
index 38d6b078..76f914dc 100644
--- a/src/AngleSharp.Css/Declarations/TextTransformDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TextTransformDeclaration.cs
@@ -8,7 +8,9 @@ static class TextTransformDeclaration
{
public static String Name = PropertyNames.TextTransform;
- public static IValueConverter Converter = Or(TextTransformConverter, AssignInitial(TextTransform.None));
+ public static IValueConverter Converter = TextTransformConverter;
+
+ public static ICssValue InitialValue = InitialValues.TextTransformDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/TopDeclaration.cs b/src/AngleSharp.Css/Declarations/TopDeclaration.cs
index eae5ef00..adaa9611 100644
--- a/src/AngleSharp.Css/Declarations/TopDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TopDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class TopDeclaration
{
public static String Name = PropertyNames.Top;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.TopDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TransformDeclaration.cs b/src/AngleSharp.Css/Declarations/TransformDeclaration.cs
index 3a153732..c4ff76e0 100644
--- a/src/AngleSharp.Css/Declarations/TransformDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransformDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +9,9 @@ static class TransformDeclaration
{
public static String Name = PropertyNames.Transform;
- public static IValueConverter Converter = Or(TransformConverter.Many(), None, AssignInitial());
+ public static IValueConverter Converter = Or(TransformConverter.Many(), None);
+
+ public static ICssValue InitialValue = InitialValues.TransformDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TransformOriginDeclaration.cs b/src/AngleSharp.Css/Declarations/TransformOriginDeclaration.cs
index 69188078..5ff289fb 100644
--- a/src/AngleSharp.Css/Declarations/TransformOriginDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransformOriginDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class TransformOriginDeclaration
{
public static String Name = PropertyNames.TransformOrigin;
- public static IValueConverter Converter = Or(Point3Converter, AssignInitial(Point.Center));
+ public static IValueConverter Converter = OriginConverter;
+
+ public static ICssValue InitialValue = InitialValues.TransformOriginDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/TransformStyleDeclaration.cs b/src/AngleSharp.Css/Declarations/TransformStyleDeclaration.cs
index eee2e7c0..2f0f484f 100644
--- a/src/AngleSharp.Css/Declarations/TransformStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransformStyleDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class TransformStyleDeclaration
{
public static String Name = PropertyNames.TransformStyle;
- public static IValueConverter Converter = Or(Toggle(CssKeywords.Flat, CssKeywords.Preserve3d), AssignInitial(true));
+ public static IValueConverter Converter = Toggle(CssKeywords.Flat, CssKeywords.Preserve3d);
+
+ public static ICssValue InitialValue = InitialValues.TransformStyleDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TransitionDeclaration.cs b/src/AngleSharp.Css/Declarations/TransitionDeclaration.cs
index 17d1cd0e..30e345e0 100644
--- a/src/AngleSharp.Css/Declarations/TransitionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransitionDeclaration.cs
@@ -14,6 +14,8 @@ static class TransitionDeclaration
public static IValueConverter Converter = new TransitionAggregator();
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.Shorthand;
public static String[] Longhands = new[]
@@ -24,28 +26,15 @@ static class TransitionDeclaration
PropertyNames.TransitionDelay,
};
- sealed class TransitionValueConverter : IValueConverter
- {
- private static readonly IValueConverter converter = WithAny(
- AnimatableConverter.Option(),
- TimeConverter.Option(),
- TransitionConverter.Option(),
- TimeConverter.Option()).FromList();
-
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
- }
-
sealed class TransitionAggregator : IValueAggregator, IValueConverter
{
- private static readonly IValueConverter converter = Or(new TransitionValueConverter(), AssignInitial());
+ private static readonly IValueConverter converter = WithAny(
+ AnimatableConverter.Option(InitialValues.TransitionPropertyDecl),
+ TimeConverter.Option(InitialValues.TransitionDurationDecl),
+ TransitionConverter.Option(InitialValues.TransitionTimingFunctionDecl),
+ TimeConverter.Option(InitialValues.TransitionDelayDecl)).FromList();
- public ICssValue Convert(StringSource source)
- {
- return converter.Convert(source);
- }
+ public ICssValue Convert(StringSource source) => converter.Convert(source);
public ICssValue Merge(ICssValue[] values)
{
@@ -64,9 +53,7 @@ public ICssValue Merge(ICssValue[] values)
public ICssValue[] Split(ICssValue value)
{
- var list = value as CssListValue;
-
- if (list != null)
+ if (value is CssListValue list)
{
return new[]
{
diff --git a/src/AngleSharp.Css/Declarations/TransitionDelayDeclaration.cs b/src/AngleSharp.Css/Declarations/TransitionDelayDeclaration.cs
index f09399af..37d3c090 100644
--- a/src/AngleSharp.Css/Declarations/TransitionDelayDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransitionDelayDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class TransitionDelayDeclaration
PropertyNames.Transition,
};
- public static IValueConverter Converter = Or(TimeConverter.FromList(), AssignInitial(Time.Zero));
+ public static IValueConverter Converter = TimeConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.TransitionDelayDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TransitionDurationDeclaration.cs b/src/AngleSharp.Css/Declarations/TransitionDurationDeclaration.cs
index f1988e21..bed76a15 100644
--- a/src/AngleSharp.Css/Declarations/TransitionDurationDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransitionDurationDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class TransitionDurationDeclaration
PropertyNames.Transition,
};
- public static IValueConverter Converter = Or(TimeConverter.FromList(), AssignInitial(Time.Zero));
+ public static IValueConverter Converter = TimeConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.TransitionDurationDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TransitionPropertyDeclaration.cs b/src/AngleSharp.Css/Declarations/TransitionPropertyDeclaration.cs
index 709a4457..11e642fa 100644
--- a/src/AngleSharp.Css/Declarations/TransitionPropertyDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransitionPropertyDeclaration.cs
@@ -1,6 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -13,7 +14,9 @@ static class TransitionPropertyDeclaration
PropertyNames.Transition,
};
- public static IValueConverter Converter = Or(AnimatableConverter.FromList(), None, AssignInitial(CssKeywords.All));
+ public static IValueConverter Converter = Or(AnimatableConverter.FromList(), None);
+
+ public static ICssValue InitialValue = InitialValues.TransitionPropertyDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/TransitionTimingFunctionDeclaration.cs b/src/AngleSharp.Css/Declarations/TransitionTimingFunctionDeclaration.cs
index f66e4302..389a1f8c 100644
--- a/src/AngleSharp.Css/Declarations/TransitionTimingFunctionDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/TransitionTimingFunctionDeclaration.cs
@@ -1,7 +1,7 @@
namespace AngleSharp.Css.Declarations
{
using AngleSharp.Css.Converters;
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -14,7 +14,9 @@ static class TransitionTimingFunctionDeclaration
PropertyNames.Transition,
};
- public static IValueConverter Converter = Or(TransitionConverter.FromList(), AssignInitial(CubicBezierTimingFunction.Ease));
+ public static IValueConverter Converter = TransitionConverter.FromList();
+
+ public static ICssValue InitialValue = InitialValues.TransitionTimingFunctionDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/UnicodeBidiDeclaration.cs b/src/AngleSharp.Css/Declarations/UnicodeBidiDeclaration.cs
index 4bf886db..2773f900 100644
--- a/src/AngleSharp.Css/Declarations/UnicodeBidiDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/UnicodeBidiDeclaration.cs
@@ -8,7 +8,9 @@ static class UnicodeBidiDeclaration
{
public static String Name = PropertyNames.UnicodeBidi;
- public static IValueConverter Converter = Or(UnicodeModeConverter, AssignInitial(UnicodeMode.Normal));
+ public static IValueConverter Converter = UnicodeModeConverter;
+
+ public static ICssValue InitialValue = InitialValues.UnicodeBidiDecl;
public static PropertyFlags Flags = PropertyFlags.None;
}
diff --git a/src/AngleSharp.Css/Declarations/UnicodeRangeDeclaration.cs b/src/AngleSharp.Css/Declarations/UnicodeRangeDeclaration.cs
index 256f4074..12279b56 100644
--- a/src/AngleSharp.Css/Declarations/UnicodeRangeDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/UnicodeRangeDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class UnicodeRangeDeclaration
public static IValueConverter Converter = Any;
+ public static ICssValue InitialValue = null;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/VerticalAlignDeclaration.cs b/src/AngleSharp.Css/Declarations/VerticalAlignDeclaration.cs
index c4a91120..68cb8437 100644
--- a/src/AngleSharp.Css/Declarations/VerticalAlignDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/VerticalAlignDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Dom;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class VerticalAlignDeclaration
{
public static String Name = PropertyNames.VerticalAlign;
- public static IValueConverter Converter = Or(LengthOrPercentConverter, VerticalAlignmentConverter, AssignInitial(VerticalAlignment.Baseline));
+ public static IValueConverter Converter = Or(LengthOrPercentConverter, VerticalAlignmentConverter);
+
+ public static ICssValue InitialValue = InitialValues.VerticalAlignDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/VisibilityDeclaration.cs b/src/AngleSharp.Css/Declarations/VisibilityDeclaration.cs
index 113877ea..7b8ec773 100644
--- a/src/AngleSharp.Css/Declarations/VisibilityDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/VisibilityDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Dom;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class VisibilityDeclaration
{
public static String Name = PropertyNames.Visibility;
- public static IValueConverter Converter = Or(VisibilityConverter, AssignInitial(Visibility.Visible));
+ public static IValueConverter Converter = VisibilityConverter;
+
+ public static ICssValue InitialValue = InitialValues.VisibilityDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/WhiteSpaceDeclaration.cs b/src/AngleSharp.Css/Declarations/WhiteSpaceDeclaration.cs
index 6f8d108a..09439cf0 100644
--- a/src/AngleSharp.Css/Declarations/WhiteSpaceDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WhiteSpaceDeclaration.cs
@@ -8,7 +8,9 @@ static class WhiteSpaceDeclaration
{
public static String Name = PropertyNames.WhiteSpace;
- public static IValueConverter Converter = Or(WhitespaceConverter, AssignInitial(Whitespace.Normal));
+ public static IValueConverter Converter = WhitespaceConverter;
+
+ public static ICssValue InitialValue = InitialValues.WhiteSpaceDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/WidowsDeclaration.cs b/src/AngleSharp.Css/Declarations/WidowsDeclaration.cs
index 2258ab6f..aa99aaad 100644
--- a/src/AngleSharp.Css/Declarations/WidowsDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WidowsDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class WidowsDeclaration
{
public static String Name = PropertyNames.Widows;
- public static IValueConverter Converter = Or(IntegerConverter, AssignInitial(2));
+ public static IValueConverter Converter = IntegerConverter;
+
+ public static ICssValue InitialValue = InitialValues.WidowsDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited;
}
diff --git a/src/AngleSharp.Css/Declarations/WidthDeclaration.cs b/src/AngleSharp.Css/Declarations/WidthDeclaration.cs
index 85657d6f..8e71056e 100644
--- a/src/AngleSharp.Css/Declarations/WidthDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WidthDeclaration.cs
@@ -1,6 +1,6 @@
namespace AngleSharp.Css.Declarations
{
- using AngleSharp.Css.Values;
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -8,7 +8,9 @@ static class WidthDeclaration
{
public static String Name = PropertyNames.Width;
- public static IValueConverter Converter = Or(AutoLengthOrPercentConverter, AssignInitial(Length.Auto));
+ public static IValueConverter Converter = AutoLengthOrPercentConverter;
+
+ public static ICssValue InitialValue = InitialValues.WidthDecl;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/WordBreakDeclaration.cs b/src/AngleSharp.Css/Declarations/WordBreakDeclaration.cs
index 9dd28d1b..0f111e69 100644
--- a/src/AngleSharp.Css/Declarations/WordBreakDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WordBreakDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class WordBreakDeclaration
public static IValueConverter Converter = WordBreakConverter;
+ public static ICssValue InitialValue = InitialValues.WordBreakDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/WordSpacingDeclaration.cs b/src/AngleSharp.Css/Declarations/WordSpacingDeclaration.cs
index 68a00c09..5103f876 100644
--- a/src/AngleSharp.Css/Declarations/WordSpacingDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WordSpacingDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class WordSpacingDeclaration
{
public static String Name = PropertyNames.WordSpacing;
- public static IValueConverter Converter = Or(OptionalLengthConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalLengthConverter;
+
+ public static ICssValue InitialValue = InitialValues.WordSpacingDecl;
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Unitless | PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/Declarations/WordWrapDeclaration.cs b/src/AngleSharp.Css/Declarations/WordWrapDeclaration.cs
index e176bee4..c880acde 100644
--- a/src/AngleSharp.Css/Declarations/WordWrapDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/WordWrapDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -9,6 +10,8 @@ static class WordWrapDeclaration
public static IValueConverter Converter = OverflowWrapConverter;
+ public static ICssValue InitialValue = InitialValues.WordWrapDecl;
+
public static PropertyFlags Flags = PropertyFlags.None;
}
}
diff --git a/src/AngleSharp.Css/Declarations/ZIndexDeclaration.cs b/src/AngleSharp.Css/Declarations/ZIndexDeclaration.cs
index 0eb836f8..1d8068e0 100644
--- a/src/AngleSharp.Css/Declarations/ZIndexDeclaration.cs
+++ b/src/AngleSharp.Css/Declarations/ZIndexDeclaration.cs
@@ -1,5 +1,6 @@
namespace AngleSharp.Css.Declarations
{
+ using AngleSharp.Css.Dom;
using System;
using static ValueConverters;
@@ -7,7 +8,9 @@ static class ZIndexDeclaration
{
public static String Name = PropertyNames.ZIndex;
- public static IValueConverter Converter = Or(OptionalIntegerConverter, AssignInitial());
+ public static IValueConverter Converter = OptionalIntegerConverter;
+
+ public static ICssValue InitialValue = InitialValues.ZIndexDecl;
public static PropertyFlags Flags = PropertyFlags.Animatable;
}
diff --git a/src/AngleSharp.Css/DefaultRenderDevice.cs b/src/AngleSharp.Css/DefaultRenderDevice.cs
new file mode 100644
index 00000000..89c2a016
--- /dev/null
+++ b/src/AngleSharp.Css/DefaultRenderDevice.cs
@@ -0,0 +1,94 @@
+namespace AngleSharp.Css
+{
+ using System;
+
+ ///
+ /// Represents the default render device.
+ ///
+ public class DefaultRenderDevice : IRenderDevice
+ {
+ ///
+ public DeviceCategory Category
+ {
+ get;
+ set;
+ } = DeviceCategory.Screen;
+
+ ///
+ public Int32 ColorBits
+ {
+ get;
+ set;
+ } = 32;
+
+ ///
+ public Int32 DeviceHeight
+ {
+ get;
+ set;
+ } = 0;
+
+ ///
+ public Int32 DeviceWidth
+ {
+ get;
+ set;
+ } = 0;
+
+ ///
+ public Int32 Frequency
+ {
+ get;
+ set;
+ } = 60;
+
+ ///
+ public Boolean IsGrid
+ {
+ get;
+ set;
+ } = false;
+
+ ///
+ public Boolean IsInterlaced
+ {
+ get;
+ set;
+ } = false;
+
+ ///
+ public Boolean IsScripting
+ {
+ get;
+ set;
+ } = true;
+
+ ///
+ public Int32 MonochromeBits
+ {
+ get;
+ set;
+ } = 16;
+
+ ///
+ public Int32 Resolution
+ {
+ get;
+ set;
+ } = 96;
+
+ ///
+ public Int32 ViewPortHeight
+ {
+ get;
+ set;
+ } = 0;
+
+ ///
+ public Int32 ViewPortWidth
+ {
+ get;
+ set;
+ } = 0;
+ }
+}
diff --git a/src/AngleSharp.Css/Dom/CssHelpers.cs b/src/AngleSharp.Css/Dom/CssHelpers.cs
index 63ee582b..f10c12db 100644
--- a/src/AngleSharp.Css/Dom/CssHelpers.cs
+++ b/src/AngleSharp.Css/Dom/CssHelpers.cs
@@ -2,6 +2,7 @@ namespace AngleSharp.Css.Dom
{
using AngleSharp.Attributes;
using AngleSharp.Css.Parser;
+ using AngleSharp.Dom;
using AngleSharp.Text;
using System;
@@ -9,6 +10,7 @@ namespace AngleSharp.Css.Dom
/// A set of globally exposed CSS utilities.
///
[DomName("CSS")]
+ [DomExposed("Window")]
public static class CssHelpers
{
///
@@ -61,13 +63,15 @@ public static String Escape(String str)
/// Returns a boolean value indicating if the browser supports a given CSS feature,
/// or not.
///
+ /// The hosting window.
/// The name of the CSS property to check.
/// The value of the CSS property to check.
/// True if the CSS feature is supported, otherwise false.
[DomName("supports")]
- public static Boolean Supports(String propertyName, String value)
+ public static Boolean Supports(this IWindow window, String propertyName, String value)
{
- var condition = new DeclarationCondition(propertyName, value);
+ var context = window.Document?.Context;
+ var condition = new DeclarationCondition(context, propertyName, value);
return condition.Check(null);
}
@@ -75,12 +79,14 @@ public static Boolean Supports(String propertyName, String value)
/// Returns a boolean value indicating if the browser supports a given CSS feature,
/// or not.
///
+ /// The hosting window.
/// The condition to check.
/// True if the CSS feature is supported, otherwise false.
[DomName("supports")]
- public static Boolean Supports(String conditionText)
+ public static Boolean Supports(this IWindow window, String conditionText)
{
- var condition = ConditionParser.Parse(conditionText);
+ var context = window.Document?.Context;
+ var condition = ConditionParser.Parse(conditionText, context);
return condition.Check(null);
}
}
diff --git a/src/AngleSharp.Css/Dom/ElementCssInlineStyleExtensions.cs b/src/AngleSharp.Css/Dom/ElementCssInlineStyleExtensions.cs
index f1f7c340..a6cab36f 100644
--- a/src/AngleSharp.Css/Dom/ElementCssInlineStyleExtensions.cs
+++ b/src/AngleSharp.Css/Dom/ElementCssInlineStyleExtensions.cs
@@ -1,6 +1,7 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Attributes;
+ using AngleSharp.Css.Parser;
using AngleSharp.Dom;
using System;
using System.Runtime.CompilerServices;
@@ -20,49 +21,35 @@ public static class ElementCssInlineStyleExtensions
///
[DomName("style")]
[DomAccessor(Accessors.Getter)]
- public static ICssStyleDeclaration GetStyle(this IElement element)
- {
- return _styles.GetValue(element, CreateStyle);
- }
+ public static ICssStyleDeclaration GetStyle(this IElement element) => _styles.GetValue(element, CreateStyle);
///
/// Sets the style declaration of an element.
///
[DomName("style")]
[DomAccessor(Accessors.Setter)]
- public static void SetStyle(this IElement element, String value)
- {
- element.SetAttribute(AttributeNames.Style, value);
- }
+ public static void SetStyle(this IElement element, String value) => element.SetAttribute(AttributeNames.Style, value);
- internal static void UpdateStyle(this IElement element, String value)
- {
- var style = default(ICssStyleDeclaration);
+ internal static void UpdateStyle(this IElement element, String value) => element.GetStyle()?.Update(value);
- if (_styles.TryGetValue(element, out style))
- {
- style.Update(value);
- }
- else
- {
- style = CreateStyle(element);
- _styles.Add(element, style);
- }
- }
-
- private static ICssStyleDeclaration CreateStyle(IElement element)
- {
- return CreateStyle(element, null);
- }
+ private static ICssStyleDeclaration CreateStyle(IElement element) => CreateStyle(element, null);
private static ICssStyleDeclaration CreateStyle(IElement element, String source)
{
var document = element.Owner;
var context = document.Context;
- var style = new CssStyleDeclaration(context);
- style.Update(source ?? element.GetAttribute(AttributeNames.Style));
- style.Changed += value => element.SetAttribute(AttributeNames.Style, value);
- return style;
+ var parser = context?.GetService();
+
+ // Seems to be run from a context with CSS
+ if (parser != null)
+ {
+ var style = new CssStyleDeclaration(context);
+ style.Update(source ?? element.GetAttribute(AttributeNames.Style));
+ style.Changed += value => element.SetAttribute(AttributeNames.Style, value);
+ return style;
+ }
+
+ return null;
}
}
}
diff --git a/src/AngleSharp.Css/Dom/Events/CssErrorEvent.cs b/src/AngleSharp.Css/Dom/Events/CssErrorEvent.cs
index 8f1d8d1e..0932a197 100644
--- a/src/AngleSharp.Css/Dom/Events/CssErrorEvent.cs
+++ b/src/AngleSharp.Css/Dom/Events/CssErrorEvent.cs
@@ -41,26 +41,17 @@ public CssErrorEvent(CssParseError code, TextPosition position)
///
/// Gets the position of the error.
///
- public TextPosition Position
- {
- get { return _position; }
- }
+ public TextPosition Position => _position;
///
/// Gets the provided error code.
///
- public Int32 Code
- {
- get { return _code.GetCode(); }
- }
+ public Int32 Code => _code.GetCode();
///
/// Gets the associated error message.
///
- public String Message
- {
- get { return _code.GetMessage(); }
- }
+ public String Message => _code.GetMessage();
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/ICssProperties .cs b/src/AngleSharp.Css/Dom/ICssProperties .cs
index 85f390ec..24671af2 100644
--- a/src/AngleSharp.Css/Dom/ICssProperties .cs
+++ b/src/AngleSharp.Css/Dom/ICssProperties .cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Attributes;
using System;
@@ -33,6 +33,13 @@ public interface ICssProperties : IEnumerable
[DomName("getPropertyValue")]
String GetPropertyValue(String propertyName);
+ ///
+ /// Gets the full property model for the given property name.
+ ///
+ /// The name of the property to get.
+ /// The computed or stored property model.
+ ICssProperty GetProperty(String propertyName);
+
///
/// Returns the optional priority, "important" or null, if no priority
/// has been set.
diff --git a/src/AngleSharp.Css/Dom/Internal/ConditionFunctions/DeclarationCondition.cs b/src/AngleSharp.Css/Dom/Internal/ConditionFunctions/DeclarationCondition.cs
index dc07eca3..313dba45 100644
--- a/src/AngleSharp.Css/Dom/Internal/ConditionFunctions/DeclarationCondition.cs
+++ b/src/AngleSharp.Css/Dom/Internal/ConditionFunctions/DeclarationCondition.cs
@@ -8,16 +8,18 @@ sealed class DeclarationCondition : IConditionFunction
{
private readonly String _name;
private readonly String _value;
+ private readonly IBrowsingContext _context;
- public DeclarationCondition(String name, String value)
+ public DeclarationCondition(IBrowsingContext context, String name, String value)
{
+ _context = context;
_name = name;
_value = value;
}
public Boolean Check(IRenderDevice device)
{
- var factory = device?.Context?.GetService() ?? Factory.Declaration;
+ var factory = _context?.GetService() ?? Factory.Declaration;
var info = factory?.Create(_name);
if (info != null && !Object.Equals(info.Converter, ValueConverters.Any))
@@ -30,18 +32,16 @@ public Boolean Check(IRenderDevice device)
return false;
}
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) =>
writer.Write(formatter.Declaration(_name, _value, false));
- }
private static String Normalize(String value)
{
- var important = "!important";
+ var keyword = CssKeywords.BangImportant;
- if (value.EndsWith(important))
+ if (value.EndsWith(keyword))
{
- return value.Remove(value.Length - important.Length).Trim();
+ return value.Remove(value.Length - keyword.Length).Trim();
}
return value;
diff --git a/src/AngleSharp.Css/Dom/Internal/CssComment.cs b/src/AngleSharp.Css/Dom/Internal/CssComment.cs
index 11deb2ca..fb7f8f56 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssComment.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssComment.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using System;
using System.IO;
@@ -25,19 +25,13 @@ public CssComment(String data)
#region Properties
- public String Data
- {
- get { return _data; }
- }
+ public String Data => _data;
#endregion
#region String Representation
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
- writer.Write(formatter.Comment(_data));
- }
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) => writer.Write(formatter.Comment(_data));
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/Internal/CssMediaQueryList.cs b/src/AngleSharp.Css/Dom/Internal/CssMediaQueryList.cs
index 1ecfa63d..b57932d7 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssMediaQueryList.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssMediaQueryList.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Css.Dom.Events;
using AngleSharp.Dom;
@@ -40,30 +40,18 @@ public CssMediaQueryList(IWindow window, IMediaList media)
#region Properties
- public String MediaText
- {
- get { return _media.MediaText; }
- }
+ public String MediaText => _media.MediaText;
- public IMediaList Media
- {
- get { return _media; }
- }
+ public IMediaList Media => _media;
- public Boolean IsMatched
- {
- get { return _matched; }
- }
+ public Boolean IsMatched => _matched;
#endregion
#region Helpers
- private Boolean ComputeMatched(IWindow window)
- {
- //TODO use Validate with RenderDevice
- return false;
- }
+ //TODO use Validate with RenderDevice
+ private Boolean ComputeMatched(IWindow window) => false;
private void Resized(Object sender, Event ev)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/CssMedium.cs b/src/AngleSharp.Css/Dom/Internal/CssMedium.cs
index 50153f9a..986c7e63 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssMedium.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssMedium.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Text;
using System;
@@ -40,34 +40,15 @@ public CssMedium(String type, Boolean inverse, Boolean exclusive, IEnumerable Features
- {
- get { return _features; }
- }
+ public IEnumerable Features => _features;
- public String Type
- {
- get { return _type; }
- }
+ public String Type => _type;
- public Boolean IsExclusive
- {
- get { return _exclusive; }
- }
+ public Boolean IsExclusive => _exclusive;
- public Boolean IsInverse
- {
- get { return _inverse; }
- }
+ public Boolean IsInverse => _inverse;
- public String Constraints
- {
- get
- {
- var constraints = Features.Select(m => m.ToCss());
- return String.Join(" and ", constraints);
- }
- }
+ public String Constraints => String.Join(" and ", Features.Select(m => m.ToCss()));
#endregion
@@ -99,10 +80,7 @@ public override Boolean Equals(Object obj)
return false;
}
- public override Int32 GetHashCode()
- {
- return base.GetHashCode();
- }
+ public override Int32 GetHashCode() => base.GetHashCode();
public void ToCss(TextWriter writer, IStyleFormatter formatter)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/CssProperty.cs b/src/AngleSharp.Css/Dom/Internal/CssProperty.cs
index 330ad8d3..46129396 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssProperty.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssProperty.cs
@@ -40,89 +40,53 @@ internal CssProperty(String name, IValueConverter converter, PropertyFlags flags
public ICssValue RawValue
{
- get { return _value; }
- set { _value = value; }
+ get => _value;
+ set => _value = value;
}
-
+
public String Value
{
- get { return _value?.CssText ?? CssKeywords.Initial; }
- set { _value = _converter.Convert(value); }
+ get => _value?.CssText ?? String.Empty;
+ set => _value = _converter.Convert(value);
}
- public Boolean HasValue
- {
- get { return _value != null; }
- }
+ public Boolean HasValue => _value != null;
- public Boolean IsInherited
- {
- get { return (((_flags & PropertyFlags.Inherited) == PropertyFlags.Inherited) && IsInitial) || (HasValue && _value.CssText.Is(CssKeywords.Inherit)); }
- }
+ public Boolean IsInherited => (((_flags & PropertyFlags.Inherited) == PropertyFlags.Inherited) && IsInitial) || (HasValue && _value.CssText.Is(CssKeywords.Inherit));
- public Boolean CanBeInherited
- {
- get { return (_flags & PropertyFlags.Inherited) == PropertyFlags.Inherited; }
- }
+ public Boolean CanBeInherited => (_flags & PropertyFlags.Inherited) == PropertyFlags.Inherited;
- public Boolean IsAnimatable
- {
- get { return (_flags & PropertyFlags.Animatable) == PropertyFlags.Animatable; }
- }
+ public Boolean IsAnimatable => (_flags & PropertyFlags.Animatable) == PropertyFlags.Animatable;
- public Boolean IsInitial
- {
- get { return !HasValue || _value.CssText.Is(CssKeywords.Initial); }
- }
+ public Boolean IsInitial => !HasValue || _value.CssText.Is(CssKeywords.Initial);
- public Boolean IsShorthand
- {
- get { return (_flags & PropertyFlags.Shorthand) == PropertyFlags.Shorthand; }
- }
+ public Boolean IsShorthand => (_flags & PropertyFlags.Shorthand) == PropertyFlags.Shorthand;
- public String Name
- {
- get { return _name; }
- }
+ public String Name => _name;
public Boolean IsImportant
{
- get { return _important; }
- set { _important = value; }
+ get => _important;
+ set => _important = value;
}
- public String CssText
- {
- get { return this.ToCss(); }
- }
+ public String CssText => this.ToCss();
#endregion
#region Internal Properties
- internal Boolean CanBeHashless
- {
- get { return (_flags & PropertyFlags.Hashless) == PropertyFlags.Hashless; }
- }
+ internal Boolean CanBeHashless => (_flags & PropertyFlags.Hashless) == PropertyFlags.Hashless;
- internal Boolean CanBeUnitless
- {
- get { return (_flags & PropertyFlags.Unitless) == PropertyFlags.Unitless; }
- }
+ internal Boolean CanBeUnitless => (_flags & PropertyFlags.Unitless) == PropertyFlags.Unitless;
- internal IValueConverter Converter
- {
- get { return _converter; }
- }
+ internal IValueConverter Converter => _converter;
#endregion
#region String Representation
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
- writer.Write(formatter.Declaration(Name, Value, IsImportant));
- }
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) => writer.Write(formatter.Declaration(Name, Value, IsImportant));
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/Internal/CssRule.cs b/src/AngleSharp.Css/Dom/Internal/CssRule.cs
index 6f0d98a0..d1e5b93d 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssRule.cs
@@ -33,7 +33,7 @@ internal CssRule(ICssStyleSheet owner, CssRuleType type)
public String CssText
{
- get { return this.ToCss(); }
+ get => this.ToCss();
set
{
var rule = Parser.ParseRule(Owner, value);
@@ -50,7 +50,7 @@ public String CssText
public ICssRule Parent
{
- get { return _parent; }
+ get => _parent;
set
{
_parent = value;
@@ -64,19 +64,13 @@ public ICssRule Parent
public ICssStyleSheet Owner
{
- get { return _owner; }
- set { _owner = value; }
+ get => _owner;
+ set => _owner = value;
}
- public CssRuleType Type
- {
- get { return _type; }
- }
+ public CssRuleType Type => _type;
- public ICssParser Parser
- {
- get { return _owner.Context.GetService(); }
- }
+ public ICssParser Parser => _owner.Context.GetService();
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/CssRuleList.cs b/src/AngleSharp.Css/Dom/Internal/CssRuleList.cs
index 27e34b2b..fe5c7a37 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssRuleList.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssRuleList.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Dom;
using System;
@@ -28,33 +28,21 @@ internal CssRuleList()
#region Index
- public ICssRule this[Int32 index]
- {
- get { return _rules[index]; }
- }
+ public ICssRule this[Int32 index] => _rules[index];
#endregion
#region Properties
- public Boolean HasDeclarativeRules
- {
- get { return _rules.Any(IsDeclarativeRule); }
- }
+ public Boolean HasDeclarativeRules => _rules.Any(IsDeclarativeRule);
- public Int32 Length
- {
- get { return _rules.Count; }
- }
+ public Int32 Length => _rules.Count;
#endregion
#region Methods
- public void Clear()
- {
- _rules.Clear();
- }
+ public void Clear() => _rules.Clear();
public void RemoveAt(Int32 index)
{
@@ -109,24 +97,15 @@ public void Add(ICssRule rule)
}
}
- public void AddRange(IEnumerable rules)
- {
- _rules.AddRange(rules);
- }
+ public void AddRange(IEnumerable rules) => _rules.AddRange(rules);
#endregion
#region Implemented Interface
- public IEnumerator GetEnumerator()
- {
- return _rules.GetEnumerator();
- }
+ public IEnumerator GetEnumerator() => _rules.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/CssStyleDeclaration.cs b/src/AngleSharp.Css/Dom/Internal/CssStyleDeclaration.cs
index 8ef808ed..05c51c0b 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssStyleDeclaration.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssStyleDeclaration.cs
@@ -48,55 +48,49 @@ public CssStyleDeclaration(ICssRule parent)
#region Index
- public String this[Int32 index]
- {
- get { return _declarations[index]?.Name; }
- }
+ public String this[Int32 index] => _declarations[index]?.Name;
- public String this[String name]
- {
- get { return GetPropertyValue(name); }
- }
+ public String this[String name] => GetPropertyValue(name);
#endregion
#region Properties
- public IEnumerable Declarations
- {
- get { return _declarations; }
- }
+ public IEnumerable Declarations => _declarations;
public String CssText
{
- get { return this.ToCss(); }
+ get => this.ToCss();
set { Update(value); RaiseChanged(); }
}
- public Boolean IsReadOnly
- {
- get { return _context == null; }
- }
+ public Boolean IsReadOnly => _context == null;
- public Int32 Length
- {
- get { return Declarations.Count(); }
- }
+ public Int32 Length => Declarations.Count();
- public ICssRule Parent
- {
- get { return _parent; }
- }
+ public ICssRule Parent => _parent;
#endregion
#region Methods
- public void SetParent(ICssRule parent)
+ public ICssProperty GetProperty(String name)
{
- _parent = parent;
+ for (var i = 0; i < _declarations.Count; i++)
+ {
+ var declaration = _declarations[i];
+
+ if (declaration.Name.Isi(name))
+ {
+ return declaration;
+ }
+ }
+
+ return GetPropertyShorthand(name);
}
-
+
+ public void SetParent(ICssRule parent) => _parent = parent;
+
public void Update(String value)
{
if (IsReadOnly)
@@ -109,7 +103,7 @@ public void Update(String value)
if (!String.IsNullOrEmpty(value))
{
var parser = _context.GetService();
- var decl = parser.ParseDeclaration(value);
+ var decl = parser?.ParseDeclaration(value);
if (decl != null)
{
@@ -119,10 +113,49 @@ public void Update(String value)
}
}
+ private ICssProperty TryCreateShorthand(String shorthandName, IEnumerable serialized, List usedProperties, Boolean force)
+ {
+ var factory = _context.GetFactory();
+ var shorthand = factory.Create(shorthandName);
+ var requiredProperties = shorthand.Longhands;
+
+ if (requiredProperties.Length > 0)
+ {
+ var longhands = Declarations.Where(m => !serialized.Contains(m.Name)).ToList();
+ var values = new ICssValue[requiredProperties.Length];
+ var important = 0;
+ var count = 0;
+
+ for (var i = 0; i < values.Length; i++)
+ {
+ var name = requiredProperties[i];
+ var propInfo = factory.Create(name);
+ var property = propInfo.Longhands.Any() ?
+ TryCreateShorthand(name, serialized, usedProperties, force) :
+ longhands.Where(m => m.Name == name).FirstOrDefault();
+
+ if (property != null)
+ {
+ usedProperties.Add(name);
+ count = count + 1;
+ important = important + (property.IsImportant ? 1 : 0);
+ values[i] = property.RawValue;
+ }
+ }
+
+ var valid = count == values.Length && (important == 0 || important == count);
+ var result = force || valid ? _context.CreateShorthand(shorthandName, values, important != 0) : null;
+ return force || result?.RawValue != null ? result : null;
+ }
+
+ return _context.CreateProperty(shorthandName);
+ }
+
public String ToCssBlock(IStyleFormatter formatter)
{
- var list = new List();
+ var list = new List();
var serialized = new List();
+ var factory = _context.GetFactory();
foreach (var declaration in Declarations)
{
@@ -130,53 +163,28 @@ public String ToCssBlock(IStyleFormatter formatter)
if (!serialized.Contains(property))
{
- var info = _context.GetDeclarationInfo(property);
+ var info = factory.Create(property);
var shorthands = info.Shorthands;
if (shorthands.Any())
{
- var longhands = Declarations.Where(m => !serialized.Contains(m.Name)).ToList();
+ var sortedShorthands = shorthands.OrderByDescending(shorthand => factory.Create(property).Longhands.Length);
- foreach (var shorthandName in shorthands.OrderByDescending(shorthand => _context.GetDeclarationInfo(property).Longhands.Length))
+ foreach (var shorthandName in sortedShorthands)
{
- var shorthand = _context.GetDeclarationInfo(shorthandName);
- var properties = shorthand.Longhands;
- var values = new ICssValue[properties.Length];
- var important = 0;
- var count = 0;
- var aggregator = shorthand.Converter as IValueAggregator;
-
- for (var i = 0; i < values.Length; i++)
- {
- var name = properties[i];
- var longhand = longhands.Where(m => m.Name == name).FirstOrDefault();
+ var usedProperties = new List();
+ var shorthand = TryCreateShorthand(shorthandName, serialized, usedProperties, false);
- if (longhand != null)
- {
- count = count + 1;
- important = important + (longhand.IsImportant ? 1 : 0);
- count++;
- values[i] = longhand.RawValue;
- }
- }
-
- if (count == 0 || aggregator == null)
- continue;
-
- if (important > 0 && important != count)
- continue;
-
- var value = aggregator.Merge(values);
-
- if (value != null)
+ if (shorthand != null)
{
- list.Add(CreateNewProperty(shorthandName, value, important != 0));
+ list.Add(shorthand);
- foreach (var name in properties)
+ foreach (var name in usedProperties)
{
serialized.Add(name);
- longhands.RemoveAll(m => m.Name == name);
}
+
+ break;
}
}
}
@@ -192,11 +200,8 @@ public String ToCssBlock(IStyleFormatter formatter)
return formatter.BlockDeclarations(list);
}
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
- var block = ToCssBlock(formatter);
- writer.Write(block.Trim(' ', '\t', '\r', '\n', '{', '}'));
- }
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) =>
+ writer.Write(ToCssBlock(formatter).Trim(' ', '\t', '\r', '\n', '{', '}'));
public String RemoveProperty(String propertyName)
{
@@ -237,29 +242,11 @@ public String GetPropertyPriority(String propertyName)
return CssKeywords.Important;
}
- public String GetPropertyValue(String propertyName)
- {
- var property = GetProperty(propertyName);
-
- if (property == null)
- {
- var value = GetShorthandInfo(propertyName).Value;
-
- if (value != null)
- {
- return value.CssText;
- }
+ public String GetPropertyValue(String propertyName) =>
+ GetProperty(propertyName)?.Value ?? String.Empty;
- return String.Empty;
- }
-
- return property.Value;
- }
-
- public void SetPropertyValue(String propertyName, String propertyValue)
- {
+ public void SetPropertyValue(String propertyName, String propertyValue) =>
SetProperty(propertyName, propertyValue);
- }
public void SetPropertyPriority(String propertyName, String priority)
{
@@ -298,9 +285,13 @@ public void SetProperty(String propertyName, String propertyValue, String priori
if (property != null)
{
property.Value = propertyValue;
- property.IsImportant = priority != null;
- SetProperty(property);
- RaiseChanged();
+
+ if (property.RawValue != null)
+ {
+ property.IsImportant = priority != null;
+ SetProperty(property);
+ RaiseChanged();
+ }
}
}
}
@@ -314,125 +305,21 @@ public void SetProperty(String propertyName, String propertyValue, String priori
#region Internal Methods
- internal ICssProperty GetProperty(String name)
- {
- for (var i = 0; i < _declarations.Count; i++)
- {
- var declaration = _declarations[i];
-
- if (declaration.Name.Isi(name))
- {
- return declaration;
- }
- }
-
- return GetPropertyShorthand(name);
- }
-
- private ICssProperty GetPropertyShorthand(String name)
- {
- var result = GetShorthandInfo(name);
- var value = result.Value;
-
- if (value != null)
- {
- var decl = result.Declaration;
- return new CssProperty(name, decl.Converter, decl.Flags, value, result.IsImportant);
- }
-
- return null;
- }
-
- internal void SetDeclarations(IEnumerable decls)
- {
+ internal void SetDeclarations(IEnumerable decls) =>
ChangeDeclarations(decls, m => false, (o, n) => !o.IsImportant || n.IsImportant);
- }
- internal void UpdateDeclarations(IEnumerable decls)
- {
+ internal void UpdateDeclarations(IEnumerable decls) =>
ChangeDeclarations(decls, m => !m.CanBeInherited, (o, n) => o.IsInherited);
- }
#endregion
#region Helpers
- struct ShorthandInfo
- {
- public DeclarationInfo Declaration;
- public ICssValue Value;
- public Boolean IsImportant;
- }
-
- private ShorthandInfo GetShorthandInfo(String propertyName)
- {
- var info = _context.GetDeclarationInfo(propertyName);
- var aggregator = info.Converter as IValueAggregator;
- var important = false;
+ private ICssProperty GetPropertyShorthand(String name) =>
+ TryCreateShorthand(name, Enumerable.Empty(), new List(), true);
- if (aggregator != null)
- {
- var declarations = info.Longhands;
- var values = new ICssValue[declarations.Length];
-
- for (var i = 0; i < values.Length; i++)
- {
- var prop = GetProperty(declarations[i]);
-
- if (prop != null)
- {
- var value = prop.RawValue;
- var child = value as Values.CssChildValue;
- important = important || prop.IsImportant;
-
- if (child != null)
- {
- return new ShorthandInfo
- {
- Value = child.Parent,
- IsImportant = important,
- Declaration = info,
- };
- }
-
- values[i] = value;
- }
- }
-
- if (values.Any(m => m != null))
- {
- var value = aggregator.Merge(values);
-
- if (value != null)
- {
- return new ShorthandInfo
- {
- Value = value,
- IsImportant = important,
- Declaration = info,
- };
- }
- }
- }
-
- return new ShorthandInfo
- {
- Value = null,
- IsImportant = important,
- Declaration = info,
- };
- }
-
- private ICssProperty CreateProperty(String propertyName)
- {
- return GetProperty(propertyName) ?? _context.CreateProperty(propertyName);
- }
-
- private ICssProperty CreateNewProperty(String propertyName, ICssValue value, Boolean important = false)
- {
- var info = _context.GetDeclarationInfo(propertyName);
- return new CssProperty(propertyName, info.Converter, info.Flags, value, important);
- }
+ private ICssProperty CreateProperty(String propertyName) =>
+ GetProperty(propertyName) ?? _context.CreateProperty(propertyName);
private void SetProperty(ICssProperty property)
{
@@ -522,18 +409,13 @@ private void SetLonghand(ICssProperty property)
private void SetShorthand(ICssProperty shorthand)
{
- var info = _context.GetDeclarationInfo(shorthand.Name);
- var properties = info.CreateLonghands(shorthand.RawValue, (name, value) =>
- {
- return CreateNewProperty(name, value, shorthand.IsImportant);
- });
+ var properties = _context.CreateLonghands(shorthand);
if (properties != null)
{
foreach (var property in properties)
{
- property.IsImportant = shorthand.IsImportant;
- SetLonghand(property);
+ SetProperty(property);
}
}
}
@@ -552,15 +434,9 @@ private void RaiseChanged()
#region Interface implementation
- public IEnumerator GetEnumerator()
- {
- return Declarations.GetEnumerator();
- }
+ public IEnumerator GetEnumerator() => Declarations.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/Internal/CssStyleSheet.cs b/src/AngleSharp.Css/Dom/Internal/CssStyleSheet.cs
index 8bb277ea..fc91f96d 100644
--- a/src/AngleSharp.Css/Dom/Internal/CssStyleSheet.cs
+++ b/src/AngleSharp.Css/Dom/Internal/CssStyleSheet.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Css.Parser;
using AngleSharp.Dom;
@@ -39,35 +39,17 @@ internal CssStyleSheet(IBrowsingContext context, TextSource source)
#region Properties
- public String Type
- {
- get { return MimeTypeNames.Css; }
- }
+ public String Type => MimeTypeNames.Css;
- public String Title
- {
- get { return OwnerNode?.GetAttribute(AttributeNames.Title); }
- }
+ public String Title => OwnerNode?.GetAttribute(AttributeNames.Title);
- public IMediaList Media
- {
- get { return _media; }
- }
+ public IMediaList Media => _media;
- public ICssRuleList Rules
- {
- get { return _rules; }
- }
+ public ICssRuleList Rules => _rules;
- public IBrowsingContext Context
- {
- get { return _context; }
- }
+ public IBrowsingContext Context => _context;
- public TextSource Source
- {
- get { return _source; }
- }
+ public TextSource Source => _source;
public Boolean IsDisabled
{
@@ -75,20 +57,11 @@ public Boolean IsDisabled
set;
}
- public IElement OwnerNode
- {
- get { return _element; }
- }
+ public IElement OwnerNode => _element;
- public ICssStyleSheet Parent
- {
- get { return _parent; }
- }
+ public ICssStyleSheet Parent => _parent;
- public ICssRule OwnerRule
- {
- get { return _owner; }
- }
+ public ICssRule OwnerRule => _owner;
public String Href
{
@@ -100,10 +73,7 @@ public String Href
#region Methods
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
- writer.Write(formatter.Sheet(Rules));
- }
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) => writer.Write(formatter.Sheet(Rules));
public void Add(ICssRule rule)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/DocumentFunction.cs b/src/AngleSharp.Css/Dom/Internal/DocumentFunction.cs
index 935d5bd4..40d19114 100644
--- a/src/AngleSharp.Css/Dom/Internal/DocumentFunction.cs
+++ b/src/AngleSharp.Css/Dom/Internal/DocumentFunction.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Text;
using System;
@@ -28,15 +28,9 @@ internal DocumentFunction(String name, String data)
#region Properties
- public String Name
- {
- get { return _name; }
- }
+ public String Name => _name;
- public String Data
- {
- get { return _data; }
- }
+ public String Data => _data;
#endregion
@@ -48,10 +42,7 @@ public String Data
#region String Representation
- public void ToCss(TextWriter writer, IStyleFormatter formatter)
- {
- writer.Write(_name.CssFunction(_data.CssString()));
- }
+ public void ToCss(TextWriter writer, IStyleFormatter formatter) => writer.Write(_name.CssFunction(_data.CssString()));
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/Internal/DocumentFunctions.cs b/src/AngleSharp.Css/Dom/Internal/DocumentFunctions.cs
index 84a2ccd6..fe96d11f 100644
--- a/src/AngleSharp.Css/Dom/Internal/DocumentFunctions.cs
+++ b/src/AngleSharp.Css/Dom/Internal/DocumentFunctions.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using System;
using System.Collections;
@@ -19,45 +19,21 @@ public DocumentFunctions(List functions)
_functions = functions;
}
- public IDocumentFunction this[Int32 index]
- {
- get { return _functions[index]; }
- }
+ public IDocumentFunction this[Int32 index] => _functions[index];
- public Int32 Length
- {
- get { return _functions.Count; }
- }
+ public Int32 Length => _functions.Count;
- public IEnumerator GetEnumerator()
- {
- return _functions.GetEnumerator();
- }
+ public IEnumerator GetEnumerator() => _functions.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- public void Add(IDocumentFunction function)
- {
- _functions.Add(function);
- }
+ public void Add(IDocumentFunction function) => _functions.Add(function);
- public void Remove(IDocumentFunction function)
- {
- _functions.Remove(function);
- }
+ public void Remove(IDocumentFunction function) => _functions.Remove(function);
- public void Clear()
- {
- _functions.Clear();
- }
+ public void Clear() => _functions.Clear();
- public void AddRange(IEnumerable functions)
- {
- _functions.AddRange(functions);
- }
+ public void AddRange(IEnumerable functions) => _functions.AddRange(functions);
public void ToCss(TextWriter writer, IStyleFormatter formatter)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/KeyframeSelector.cs b/src/AngleSharp.Css/Dom/Internal/KeyframeSelector.cs
index dad7e376..14ed2e7f 100644
--- a/src/AngleSharp.Css/Dom/Internal/KeyframeSelector.cs
+++ b/src/AngleSharp.Css/Dom/Internal/KeyframeSelector.cs
@@ -28,15 +28,9 @@ public KeyframeSelector(List stops)
#region Properties
- public IEnumerable Stops
- {
- get { return _stops; }
- }
+ public IEnumerable Stops => _stops;
- public String Text
- {
- get { return this.ToCss(); }
- }
+ public String Text => this.ToCss();
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/MediaFeature.cs b/src/AngleSharp.Css/Dom/Internal/MediaFeature.cs
index 3636e8c3..ed97d792 100644
--- a/src/AngleSharp.Css/Dom/Internal/MediaFeature.cs
+++ b/src/AngleSharp.Css/Dom/Internal/MediaFeature.cs
@@ -32,30 +32,15 @@ internal MediaFeature(String name, String value)
#region Properties
- public String Name
- {
- get { return _name; }
- }
+ public String Name => _name;
- public Boolean IsMinimum
- {
- get { return _min; }
- }
+ public Boolean IsMinimum => _min;
- public Boolean IsMaximum
- {
- get { return _max; }
- }
+ public Boolean IsMaximum => _max;
- public String Value
- {
- get { return _value; }
- }
+ public String Value => _value;
- public Boolean HasValue
- {
- get { return _value != null; }
- }
+ public Boolean HasValue => _value != null;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/MediaList.cs b/src/AngleSharp.Css/Dom/Internal/MediaList.cs
index 277fa5e8..0081e0fe 100644
--- a/src/AngleSharp.Css/Dom/Internal/MediaList.cs
+++ b/src/AngleSharp.Css/Dom/Internal/MediaList.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Css.Parser;
using AngleSharp.Dom;
@@ -31,29 +31,22 @@ internal MediaList(IBrowsingContext context)
#region Index
- public String this[Int32 index]
- {
- get { return _media[index].ToCss(); }
- }
+ public String this[Int32 index] => _media[index].ToCss();
#endregion
#region Properties
- public Int32 Length
- {
- get { return _media.Count; }
- }
+ public Int32 Length => _media.Count;
- public ICssParser Parser
- {
- get { return _context.GetService(); }
- }
+ public ICssParser Parser => _context.GetService();
+
+ public IFeatureValidatorFactory ValidatorFactory => _context.GetService();
public String MediaText
{
- get { return this.ToCss(); }
- set { SetMediaText(value, throwOnError: true); }
+ get => this.ToCss();
+ set => SetMediaText(value, throwOnError: true);
}
#endregion
@@ -63,7 +56,7 @@ public String MediaText
public void SetMediaText(String value, Boolean throwOnError)
{
_media.Clear();
- var media = MediaParser.Parse(value);
+ var media = MediaParser.Parse(value, ValidatorFactory);
if (media != null)
{
@@ -82,20 +75,13 @@ public void SetMediaText(String value, Boolean throwOnError)
public void Add(String newMedium)
{
- var medium = MediumParser.Parse(newMedium);
-
- if (medium == null)
- throw new DomException(DomError.Syntax);
-
+ var medium = MediumParser.Parse(newMedium, ValidatorFactory) ?? throw new DomException(DomError.Syntax);
_media.Add(medium);
}
public void Remove(String oldMedium)
{
- var medium = MediumParser.Parse(oldMedium);
-
- if (medium == null)
- throw new DomException(DomError.Syntax);
+ var medium = MediumParser.Parse(oldMedium, ValidatorFactory) ?? throw new DomException(DomError.Syntax);
for (var i = 0; i < _media.Count; i++)
{
@@ -133,15 +119,9 @@ public void ToCss(TextWriter writer, IStyleFormatter formatter)
#region IEnumerable implementation
- public IEnumerator GetEnumerator()
- {
- return _media.GetEnumerator();
- }
+ public IEnumerator GetEnumerator() => _media.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/Internal/PseudoElement.cs b/src/AngleSharp.Css/Dom/Internal/PseudoElement.cs
index 504ae6dc..3a68f57a 100644
--- a/src/AngleSharp.Css/Dom/Internal/PseudoElement.cs
+++ b/src/AngleSharp.Css/Dom/Internal/PseudoElement.cs
@@ -28,193 +28,108 @@ public PseudoElement(IElement host, String name)
#endregion
#region Properties
-
- public IElement AssignedSlot
- {
- get { return _host.AssignedSlot; }
- }
+
+ public IElement AssignedSlot => _host.AssignedSlot;
public String Slot
{
- get { return _host.Slot; }
+ get => _host.Slot;
set { }
}
- public IShadowRoot ShadowRoot
- {
- get { return _host.ShadowRoot; }
- }
+ public ISourceReference SourceReference => null;
- public String Prefix
- {
- get { return _host.Prefix; }
- }
+ public IShadowRoot ShadowRoot => _host.ShadowRoot;
- public String PseudoName
- {
- get { return _name; }
- }
+ public String Prefix => _host.Prefix;
- public String LocalName
- {
- get { return _host.LocalName; }
- }
+ public String PseudoName => _name;
- public String NamespaceUri
- {
- get { return _host.NamespaceUri; }
- }
+ public String LocalName => _host.LocalName;
- public INamedNodeMap Attributes
- {
- get { return _host.Attributes; }
- }
+ public String NamespaceUri => _host.NamespaceUri;
- public ITokenList ClassList
- {
- get { return _host.ClassList; }
- }
+ public INamedNodeMap Attributes => _host.Attributes;
+
+ public ITokenList ClassList => _host.ClassList;
public String ClassName
{
- get { return _host.ClassName; }
+ get => _host.ClassName;
set { }
}
public String Id
{
- get { return _host.Id; }
+ get => _host.Id;
set { }
}
public String InnerHtml
{
- get { return String.Empty; }
+ get => String.Empty;
set { }
}
public String OuterHtml
{
- get { return String.Empty; }
+ get => String.Empty;
set { }
}
- public String TagName
- {
- get { return _host.TagName; }
- }
+ public String TagName => _host.TagName;
- public Boolean IsFocused
- {
- get { return _host.IsFocused; }
- }
+ public Boolean IsFocused => _host.IsFocused;
- public String BaseUri
- {
- get { return _host.BaseUri; }
- }
+ public String BaseUri => _host.BaseUri;
- public Url BaseUrl
- {
- get { return _host.BaseUrl; }
- }
+ public Url BaseUrl => _host.BaseUrl;
- public String NodeName
- {
- get { return _host.NodeName; }
- }
+ public String NodeName => _host.NodeName;
- public INodeList ChildNodes
- {
- get { return _host.ChildNodes; }
- }
+ public INodeList ChildNodes => _host.ChildNodes;
- public IDocument Owner
- {
- get { return _host.Owner; }
- }
+ public IDocument Owner => _host.Owner;
- public IElement ParentElement
- {
- get { return _host.ParentElement; }
- }
+ public IElement ParentElement => _host.ParentElement;
- public INode Parent
- {
- get { return _host.Parent; }
- }
+ public INode Parent => _host.Parent;
- public INode FirstChild
- {
- get { return _host.FirstChild; }
- }
+ public INode FirstChild => _host.FirstChild;
- public INode LastChild
- {
- get { return _host.LastChild; }
- }
+ public INode LastChild => _host.LastChild;
- public INode NextSibling
- {
- get { return _host.NextSibling; }
- }
+ public INode NextSibling => _host.NextSibling;
- public INode PreviousSibling
- {
- get { return _host.PreviousSibling; }
- }
+ public INode PreviousSibling => _host.PreviousSibling;
- public NodeType NodeType
- {
- get { return NodeType.Element; }
- }
+ public NodeType NodeType => NodeType.Element;
public String NodeValue
{
- get { return _host.NodeValue; }
+ get => _host.NodeValue;
set { }
}
public String TextContent
{
- get { return String.Empty; }
- set { }
+ get => String.Empty;
+ set { }
}
- public Boolean HasChildNodes
- {
- get { return _host.HasChildNodes; }
- }
+ public Boolean HasChildNodes => _host.HasChildNodes;
- public IHtmlCollection Children
- {
- get { return _host.Children; }
- }
+ public IHtmlCollection Children => _host.Children;
- public IElement FirstElementChild
- {
- get { return _host.FirstElementChild; }
- }
+ public IElement FirstElementChild => _host.FirstElementChild;
- public IElement LastElementChild
- {
- get { return _host.LastElementChild; }
- }
+ public IElement LastElementChild => _host.LastElementChild;
- public Int32 ChildElementCount
- {
- get { return _host.ChildElementCount; }
- }
+ public Int32 ChildElementCount => _host.ChildElementCount;
- public IElement NextElementSibling
- {
- get { return _host.NextElementSibling; }
- }
+ public IElement NextElementSibling => _host.NextElementSibling;
- public IElement PreviousElementSibling
- {
- get { return _host.PreviousElementSibling; }
- }
+ public IElement PreviousElementSibling => _host.PreviousElementSibling;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssCharsetRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssCharsetRule.cs
index 824c1063..391b5d8b 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssCharsetRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssCharsetRule.cs
@@ -29,8 +29,8 @@ internal CssCharsetRule(ICssStyleSheet sheet)
public String CharacterSet
{
- get { return _charSet; }
- set { _charSet = value ?? String.Empty; }
+ get => _charSet;
+ set => _charSet = value ?? String.Empty;
}
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssDeclarationRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssDeclarationRule.cs
index 625c539d..8dffb90e 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssDeclarationRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssDeclarationRule.cs
@@ -34,34 +34,23 @@ internal CssDeclarationRule(ICssStyleSheet owner, CssRuleType type, String name,
#region Properties
- public String this[String propertyName]
- {
- get { return GetValue(propertyName); }
- }
+ public String this[String propertyName] => GetValue(propertyName);
- public Int32 Length
- {
- get { return _declarations.Count; }
- }
+ public Int32 Length => _declarations.Count;
#endregion
#region Methods
- public String GetPropertyValue(String propertyName)
- {
- return GetValue(propertyName);
- }
+ public ICssProperty GetProperty(String propertyName) =>
+ _declarations.Find(m => m.Name.Is(propertyName));
- public String GetPropertyPriority(String propertyName)
- {
- return null;
- }
+ public String GetPropertyValue(String propertyName) => GetValue(propertyName);
- public void SetProperty(String propertyName, String propertyValue, String priority = null)
- {
+ public String GetPropertyPriority(String propertyName) => null;
+
+ public void SetProperty(String propertyName, String propertyValue, String priority = null) =>
SetValue(propertyName, propertyValue);
- }
public String RemoveProperty(String propertyName)
{
@@ -79,15 +68,9 @@ public String RemoveProperty(String propertyName)
return null;
}
- public IEnumerator GetEnumerator()
- {
- return _declarations.GetEnumerator();
- }
+ public IEnumerator GetEnumerator() => _declarations.GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public override void ToCss(TextWriter writer, IStyleFormatter formatter)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssDocumentRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssDocumentRule.cs
index 8305ac42..2c47ead0 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssDocumentRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssDocumentRule.cs
@@ -30,14 +30,11 @@ internal CssDocumentRule(ICssStyleSheet owner)
public String ConditionText
{
- get { return _conditions.ToCss(); }
- set { SetConditionText(value, throwOnError: true); }
+ get => _conditions.ToCss();
+ set => SetConditionText(value, throwOnError: true);
}
- public IDocumentFunctions Conditions
- {
- get { return _conditions; }
- }
+ public IDocumentFunctions Conditions => _conditions;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssFontFaceRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssFontFaceRule.cs
index e6f92c04..88280984 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssFontFaceRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssFontFaceRule.cs
@@ -37,49 +37,49 @@ internal CssFontFaceRule(ICssStyleSheet owner)
String ICssFontFaceRule.Family
{
- get { return GetValue(PropertyNames.FontFamily); }
- set { SetValue(PropertyNames.FontFamily, value); }
+ get => GetValue(PropertyNames.FontFamily);
+ set => SetValue(PropertyNames.FontFamily, value);
}
String ICssFontFaceRule.Source
{
- get { return GetValue(PropertyNames.Src); }
- set { SetValue(PropertyNames.Src, value); }
+ get => GetValue(PropertyNames.Src);
+ set => SetValue(PropertyNames.Src, value);
}
String ICssFontFaceRule.Style
{
- get { return GetValue(PropertyNames.FontStyle); }
- set { SetValue(PropertyNames.FontStyle, value); }
+ get => GetValue(PropertyNames.FontStyle);
+ set => SetValue(PropertyNames.FontStyle, value);
}
String ICssFontFaceRule.Weight
{
- get { return GetValue(PropertyNames.FontWeight); }
- set { SetValue(PropertyNames.FontWeight, value); }
+ get => GetValue(PropertyNames.FontWeight);
+ set => SetValue(PropertyNames.FontWeight, value);
}
String ICssFontFaceRule.Stretch
{
- get { return GetValue(PropertyNames.FontStretch); }
- set { SetValue(PropertyNames.FontStretch, value); }
+ get => GetValue(PropertyNames.FontStretch);
+ set => SetValue(PropertyNames.FontStretch, value);
}
String ICssFontFaceRule.Range
{
- get { return GetValue(PropertyNames.UnicodeRange); }
- set { SetValue(PropertyNames.UnicodeRange, value); }
+ get => GetValue(PropertyNames.UnicodeRange);
+ set => SetValue(PropertyNames.UnicodeRange, value);
}
String ICssFontFaceRule.Variant
{
- get { return GetValue(PropertyNames.FontVariant); }
- set { SetValue(PropertyNames.FontVariant, value); }
+ get => GetValue(PropertyNames.FontVariant);
+ set => SetValue(PropertyNames.FontVariant, value);
}
String ICssFontFaceRule.Features
{
- get { return String.Empty; }
+ get => String.Empty;
set { }
}
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssGroupingRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssGroupingRule.cs
index f1310183..017bc32e 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssGroupingRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssGroupingRule.cs
@@ -26,10 +26,7 @@ internal CssGroupingRule(ICssStyleSheet owner, CssRuleType type)
#region Properties
- public ICssRuleList Rules
- {
- get { return _rules; }
- }
+ public ICssRuleList Rules => _rules;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssImportRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssImportRule.cs
index 14728768..1aec5a80 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssImportRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssImportRule.cs
@@ -31,23 +31,17 @@ internal CssImportRule(ICssStyleSheet owner)
public String Href
{
- get { return _href; }
- set { _href = value; }
+ get => _href;
+ set => _href = value;
}
- IMediaList ICssImportRule.Media
- {
- get { return _media; }
- }
+ IMediaList ICssImportRule.Media => _media;
- public MediaList Media
- {
- get { return _media; }
- }
+ public MediaList Media => _media;
public ICssStyleSheet Sheet
{
- get { return _styleSheet; }
+ get => _styleSheet;
set { _styleSheet = value; _styleSheet?.SetParent(Owner); }
}
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframeRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframeRule.cs
index 63d9cf4e..49bacd6b 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframeRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframeRule.cs
@@ -30,24 +30,15 @@ internal CssKeyframeRule(ICssStyleSheet owner)
public String KeyText
{
- get { return _selector?.ToCss(); }
- set { _selector = KeyframeParser.Parse(value); }
+ get => _selector?.ToCss();
+ set => _selector = KeyframeParser.Parse(value);
}
- public IKeyframeSelector Key
- {
- get { return _selector; }
- }
+ public IKeyframeSelector Key => _selector;
- ICssStyleDeclaration ICssKeyframeRule.Style
- {
- get { return _style; }
- }
+ ICssStyleDeclaration ICssKeyframeRule.Style => _style;
- public CssStyleDeclaration Style
- {
- get { return _style; }
- }
+ public CssStyleDeclaration Style => _style;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframesRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframesRule.cs
index 7eab58a1..ba792adf 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframesRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssKeyframesRule.cs
@@ -29,8 +29,8 @@ internal CssKeyframesRule(ICssStyleSheet owner)
public String Name
{
- get { return _name; }
- set { _name = value; }
+ get => _name;
+ set => _name = value;
}
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssMediaRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssMediaRule.cs
index 02d81b8e..e3333dd5 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssMediaRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssMediaRule.cs
@@ -28,19 +28,13 @@ internal CssMediaRule(ICssStyleSheet owner)
public String ConditionText
{
- get { return _media.MediaText; }
- set { _media.MediaText = value; }
+ get => _media.MediaText;
+ set => _media.MediaText = value;
}
- IMediaList ICssMediaRule.Media
- {
- get { return _media; }
- }
+ IMediaList ICssMediaRule.Media => _media;
- public MediaList Media
- {
- get { return _media; }
- }
+ public MediaList Media => _media;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssNamespaceRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssNamespaceRule.cs
index eca3811c..b0d6db4b 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssNamespaceRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssNamespaceRule.cs
@@ -32,13 +32,13 @@ internal CssNamespaceRule(ICssStyleSheet owner)
public String NamespaceUri
{
- get { return _namespaceUri; }
+ get => _namespaceUri;
set { CheckValidity(); _namespaceUri = value ?? String.Empty; }
}
public String Prefix
{
- get { return _prefix; }
+ get => _prefix;
set { CheckValidity(); _prefix = value ?? String.Empty; }
}
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssPageRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssPageRule.cs
index 8786360a..bebb2bcf 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssPageRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssPageRule.cs
@@ -29,24 +29,15 @@ internal CssPageRule(ICssStyleSheet owner)
public String SelectorText
{
- get { return _selector?.Text; }
+ get => _selector?.Text;
set { _selector = ParseSelector(value); ; }
}
- public ISelector Selector
- {
- get { return _selector; }
- }
+ public ISelector Selector => _selector;
- ICssStyleDeclaration ICssPageRule.Style
- {
- get { return _style; }
- }
+ ICssStyleDeclaration ICssPageRule.Style => _style;
- public CssStyleDeclaration Style
- {
- get { return _style; }
- }
+ public CssStyleDeclaration Style => _style;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssStyleRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssStyleRule.cs
index 7994b03e..8d8f5b0c 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssStyleRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssStyleRule.cs
@@ -27,26 +27,17 @@ internal CssStyleRule(ICssStyleSheet owner)
#region Properties
- public ISelector Selector
- {
- get { return _selector; }
- }
+ public ISelector Selector => _selector;
public String SelectorText
{
- get { return _selector?.Text; }
- set { _selector = ParseSelector(value); }
+ get => _selector?.Text;
+ set => _selector = ParseSelector(value);
}
- ICssStyleDeclaration ICssStyleRule.Style
- {
- get { return _style; }
- }
+ ICssStyleDeclaration ICssStyleRule.Style => _style;
- public CssStyleDeclaration Style
- {
- get { return _style; }
- }
+ public CssStyleDeclaration Style => _style;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssSupportsRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssSupportsRule.cs
index 60f3b698..e16aa801 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssSupportsRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssSupportsRule.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Css.Parser;
using AngleSharp.Dom;
@@ -29,14 +29,11 @@ internal CssSupportsRule(ICssStyleSheet owner)
public String ConditionText
{
- get { return _condition.ToCss(); }
- set { SetConditionText(value, throwOnError: true); }
+ get => _condition.ToCss();
+ set => SetConditionText(value, throwOnError: true);
}
- public IConditionFunction Condition
- {
- get { return _condition; }
- }
+ public IConditionFunction Condition => _condition;
#endregion
@@ -44,7 +41,8 @@ public IConditionFunction Condition
public Boolean SetConditionText(String value, Boolean throwOnError)
{
- var condition = ConditionParser.Parse(value);
+ var context = Owner?.Context;
+ var condition = ConditionParser.Parse(value, context);
if (condition == null)
{
diff --git a/src/AngleSharp.Css/Dom/Internal/Rules/CssUnknownRule.cs b/src/AngleSharp.Css/Dom/Internal/Rules/CssUnknownRule.cs
index 32ec7621..43c2881e 100644
--- a/src/AngleSharp.Css/Dom/Internal/Rules/CssUnknownRule.cs
+++ b/src/AngleSharp.Css/Dom/Internal/Rules/CssUnknownRule.cs
@@ -29,15 +29,9 @@ public CssUnknownRule(ICssStyleSheet owner, String name, TextView content)
#region Properties
- public String Name
- {
- get { return _name; }
- }
+ public String Name => _name;
- public TextView Content
- {
- get { return _content; }
- }
+ public TextView Content => _content;
#endregion
diff --git a/src/AngleSharp.Css/Dom/Internal/StyleCollection.cs b/src/AngleSharp.Css/Dom/Internal/StyleCollection.cs
index 473dc73c..7aeea81d 100644
--- a/src/AngleSharp.Css/Dom/Internal/StyleCollection.cs
+++ b/src/AngleSharp.Css/Dom/Internal/StyleCollection.cs
@@ -1,6 +1,5 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
- using AngleSharp.Css.Extensions;
using System.Collections;
using System.Collections.Generic;
@@ -28,10 +27,7 @@ public StyleCollection(IEnumerable sheets, IRenderDevice device)
#region Properties
- public IRenderDevice Device
- {
- get { return _device; }
- }
+ public IRenderDevice Device => _device;
#endregion
@@ -96,10 +92,7 @@ private IEnumerable GetRules(ICssRuleList rules)
}
}
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/PointerEvent.cs b/src/AngleSharp.Css/Dom/PointerEvent.cs
new file mode 100644
index 00000000..b791ba33
--- /dev/null
+++ b/src/AngleSharp.Css/Dom/PointerEvent.cs
@@ -0,0 +1,49 @@
+namespace AngleSharp.Css.Dom
+{
+ ///
+ /// The values for pointer-event.
+ ///
+ public enum PointerEvent
+ {
+ ///
+ /// The element is never the target of pointer events; however, pointer events may target its descendant elements if those descendants have pointer-events set to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases.
+ ///
+ None,
+ ///
+ /// The element behaves as it would if the pointer-events property were not specified. In SVG content, this value and the value visiblePainted have the same effect.
+ ///
+ Auto,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and e.g. when a mouse cursor is over the interior (i.e., 'fill') of the element and the fill property is set to a value other than none, or when a mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none.
+ ///
+ VisiblePainted,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and when e.g. a mouse cursor is over the interior (i.e., fill) of the element. The value of the fill property does not affect event processing.
+ ///
+ VisibleFill,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the visibility property is set to visible and e.g. when the mouse cursor is over the perimeter (i.e., stroke) of the element. The value of the stroke property does not affect event processing.
+ ///
+ VisibleStroke,
+ ///
+ /// SVG only. The element can be the target of a pointer event when the visibility property is set to visible and e.g. the mouse cursor is over either the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill and stroke do not affect event processing.
+ ///
+ Visible,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when e.g. the mouse cursor is over the interior (i.e., 'fill') of the element and the fill property is set to a value other than none, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none. The value of the visibility property does not affect event processing.
+ ///
+ Painted,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) of the element. The values of the fill and visibility properties do not affect event processing.
+ ///
+ Fill,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the pointer is over the perimeter (i.e., stroke) of the element. The values of the stroke and visibility properties do not affect event processing.
+ ///
+ Stroke,
+ ///
+ /// SVG only. The element can only be the target of a pointer event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the fill, stroke, and visibility properties do not affect event processing.
+ ///
+ All,
+ }
+}
diff --git a/src/AngleSharp.Css/Dom/StyleCollectionExtensions.cs b/src/AngleSharp.Css/Dom/StyleCollectionExtensions.cs
index 81f249a8..3c5953c4 100644
--- a/src/AngleSharp.Css/Dom/StyleCollectionExtensions.cs
+++ b/src/AngleSharp.Css/Dom/StyleCollectionExtensions.cs
@@ -23,8 +23,12 @@ static class StyleCollectionExtensions
public static StyleCollection GetStyleCollection(this IWindow window)
{
var document = window.Document;
- var device = document.Context.GetService();
- var stylesheets = document.GetStyleSheets().OfType();
+ var ctx = document.Context;
+ var device = ctx.GetService();
+ var defaultStyleSheetProvider = ctx.GetServices();
+ var defaultSheets = defaultStyleSheetProvider.Select(m => m.Default).Where(m => m != null);
+ var currentSheets = document.GetStyleSheets().OfType();
+ var stylesheets = defaultSheets.Concat(currentSheets);
return new StyleCollection(stylesheets, device);
}
@@ -92,10 +96,8 @@ public static ICssStyleDeclaration ComputeCascadedStyle(this StyleCollection sty
#region Helpers
- private static IEnumerable SortBySpecificity(this IEnumerable rules, IElement element)
- {
- return rules.Where(m => m.Selector.Match(element)).OrderBy(m => m.Selector.Specificity);
- }
+ private static IEnumerable SortBySpecificity(this IEnumerable rules, IElement element) =>
+ rules.Where(m => m.Selector.Match(element)).OrderBy(m => m.Selector.Specificity);
#endregion
}
diff --git a/src/AngleSharp.Css/Dom/StyleDeclarationExtensions.cs b/src/AngleSharp.Css/Dom/StyleDeclarationExtensions.cs
index 9908374c..d0826383 100644
--- a/src/AngleSharp.Css/Dom/StyleDeclarationExtensions.cs
+++ b/src/AngleSharp.Css/Dom/StyleDeclarationExtensions.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Dom
+namespace AngleSharp.Css.Dom
{
using AngleSharp.Attributes;
using System;
@@ -16,10 +16,8 @@ public static class StyleDeclarationExtensions
///
[DomName("alignContent")]
[DomAccessor(Accessors.Getter)]
- public static String GetAlignContent(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AlignContent);
- }
+ public static String GetAlignContent(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AlignContent);
///
/// Sets how a flex item's lines align within the flex
@@ -28,10 +26,8 @@ public static String GetAlignContent(this ICssStyleDeclaration style)
///
[DomName("alignContent")]
[DomAccessor(Accessors.Setter)]
- public static void SetAlignContent(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAlignContent(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AlignContent, value);
- }
///
/// Gets the alignment value (perpendicular to the layout axis
@@ -40,10 +36,8 @@ public static void SetAlignContent(this ICssStyleDeclaration style, String value
///
[DomName("alignItems")]
[DomAccessor(Accessors.Getter)]
- public static String GetAlignItems(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AlignItems);
- }
+ public static String GetAlignItems(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AlignItems);
///
/// Sets the alignment value (perpendicular to the layout axis
@@ -52,10 +46,8 @@ public static String GetAlignItems(this ICssStyleDeclaration style)
///
[DomName("alignItems")]
[DomAccessor(Accessors.Setter)]
- public static void SetAlignItems(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAlignItems(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AlignItems, value);
- }
///
/// Gets the alignment value (perpendicular to the layout axis
@@ -64,10 +56,8 @@ public static void SetAlignItems(this ICssStyleDeclaration style, String value)
///
[DomName("alignSelf")]
[DomAccessor(Accessors.Getter)]
- public static String GetAlignSelf(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AlignSelf);
- }
+ public static String GetAlignSelf(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AlignSelf);
///
/// Sets the alignment value (perpendicular to the layout axis
@@ -76,10 +66,8 @@ public static String GetAlignSelf(this ICssStyleDeclaration style)
///
[DomName("alignSelf")]
[DomAccessor(Accessors.Setter)]
- public static void SetAlignSelf(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAlignSelf(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AlignSelf, value);
- }
///
/// Gets a string that indicates whether the object represents
@@ -87,10 +75,8 @@ public static void SetAlignSelf(this ICssStyleDeclaration style, String value)
///
[DomName("accelerator")]
[DomAccessor(Accessors.Getter)]
- public static String GetAccelerator(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Accelerator);
- }
+ public static String GetAccelerator(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Accelerator);
///
/// Sets a string that indicates whether the object represents
@@ -98,10 +84,8 @@ public static String GetAccelerator(this ICssStyleDeclaration style)
///
[DomName("accelerator")]
[DomAccessor(Accessors.Setter)]
- public static void SetAccelerator(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAccelerator(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Accelerator, value);
- }
///
/// Gets which baseline of this element is to be aligned with
@@ -109,10 +93,8 @@ public static void SetAccelerator(this ICssStyleDeclaration style, String value)
///
[DomName("alignmentBaseline")]
[DomAccessor(Accessors.Getter)]
- public static String GetAlignmentBaseline(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AlignBaseline);
- }
+ public static String GetAlignmentBaseline(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AlignBaseline);
///
/// Sets which baseline of this element is to be aligned with
@@ -120,10 +102,8 @@ public static String GetAlignmentBaseline(this ICssStyleDeclaration style)
///
[DomName("alignmentBaseline")]
[DomAccessor(Accessors.Setter)]
- public static void SetAlignmentBaseline(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAlignmentBaseline(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AlignBaseline, value);
- }
///
/// Gets one or more shorthand values that define all animation
@@ -133,10 +113,8 @@ public static void SetAlignmentBaseline(this ICssStyleDeclaration style, String
///
[DomName("animation")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimation(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Animation);
- }
+ public static String GetAnimation(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Animation);
///
/// Sets one or more shorthand values that define all animation
@@ -146,10 +124,8 @@ public static String GetAnimation(this ICssStyleDeclaration style)
///
[DomName("animation")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimation(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimation(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Animation, value);
- }
///
/// Gets the offset within an animation cycle (the amount of
@@ -159,10 +135,8 @@ public static void SetAnimation(this ICssStyleDeclaration style, String value)
///
[DomName("animationDelay")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationDelay(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationDelay);
- }
+ public static String GetAnimationDelay(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationDelay);
///
/// Sets the offset within an animation cycle (the amount of
@@ -172,30 +146,24 @@ public static String GetAnimationDelay(this ICssStyleDeclaration style)
///
[DomName("animationDelay")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationDelay(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationDelay(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationDelay, value);
- }
///
/// Gets the direction of play for an animation cycle.
///
[DomName("animationDirection")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationDirection(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationDirection);
- }
+ public static String GetAnimationDirection(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationDirection);
///
/// Sets the direction of play for an animation cycle.
///
[DomName("animationDirection")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationDirection(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationDirection(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationDirection, value);
- }
///
/// Gets the length of time to complete one cycle of the
@@ -203,10 +171,8 @@ public static void SetAnimationDirection(this ICssStyleDeclaration style, String
///
[DomName("animationDuration")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationDuration(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationDuration);
- }
+ public static String GetAnimationDuration(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationDuration);
///
/// Sets the length of time to complete one cycle of the
@@ -214,10 +180,8 @@ public static String GetAnimationDuration(this ICssStyleDeclaration style)
///
[DomName("animationDuration")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationDuration(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationDuration(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationDuration, value);
- }
///
/// Gets whether the effects of an animation are visible before
@@ -225,10 +189,8 @@ public static void SetAnimationDuration(this ICssStyleDeclaration style, String
///
[DomName("animationFillMode")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationFillMode(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationFillMode);
- }
+ public static String GetAnimationFillMode(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationFillMode);
///
/// Sets whether the effects of an animation are visible before
@@ -236,30 +198,24 @@ public static String GetAnimationFillMode(this ICssStyleDeclaration style)
///
[DomName("animationFillMode")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationFillMode(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationFillMode(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationFillMode, value);
- }
///
/// Gets the number of times an animation cycle is played.
///
[DomName("animationIterationCount")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationIterationCount(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationIterationCount);
- }
+ public static String GetAnimationIterationCount(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationIterationCount);
///
/// Sets the number of times an animation cycle is played.
///
[DomName("animationIterationCount")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationIterationCount(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationIterationCount(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationIterationCount, value);
- }
///
/// Gets one or more animation names. An animation name selects
@@ -267,10 +223,8 @@ public static void SetAnimationIterationCount(this ICssStyleDeclaration style, S
///
[DomName("animationName")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationName(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationName);
- }
+ public static String GetAnimationName(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationName);
///
/// Sets one or more animation names. An animation name selects
@@ -278,30 +232,24 @@ public static String GetAnimationName(this ICssStyleDeclaration style)
///
[DomName("animationName")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationName(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationName(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationName, value);
- }
///
/// Gets whether an animation is playing or paused.
///
[DomName("animationPlayState")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationPlayState(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationPlayState);
- }
+ public static String GetAnimationPlayState(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationPlayState);
///
/// Sets whether an animation is playing or paused.
///
[DomName("animationPlayState")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationPlayState(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationPlayState(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationPlayState, value);
- }
///
/// Gets the intermediate property values to be used during a
@@ -311,10 +259,8 @@ public static void SetAnimationPlayState(this ICssStyleDeclaration style, String
///
[DomName("animationTimingFunction")]
[DomAccessor(Accessors.Getter)]
- public static String GetAnimationTimingFunction(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.AnimationTimingFunction);
- }
+ public static String GetAnimationTimingFunction(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.AnimationTimingFunction);
///
/// Sets the intermediate property values to be used during a
@@ -324,10 +270,8 @@ public static String GetAnimationTimingFunction(this ICssStyleDeclaration style)
///
[DomName("animationTimingFunction")]
[DomAccessor(Accessors.Setter)]
- public static void SetAnimationTimingFunction(this ICssStyleDeclaration style, String value)
- {
+ public static void SetAnimationTimingFunction(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.AnimationTimingFunction, value);
- }
///
/// Gets a value that specifies whether the back face (reverse
@@ -335,10 +279,8 @@ public static void SetAnimationTimingFunction(this ICssStyleDeclaration style, S
///
[DomName("backfaceVisibility")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackfaceVisibility(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackfaceVisibility);
- }
+ public static String GetBackfaceVisibility(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackfaceVisibility);
///
/// Sets a value that specifies whether the back face (reverse
@@ -346,30 +288,24 @@ public static String GetBackfaceVisibility(this ICssStyleDeclaration style)
///
[DomName("backfaceVisibility")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackfaceVisibility(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackfaceVisibility(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackfaceVisibility, value);
- }
///
/// Gets up to five separate background properties of an object.
///
[DomName("background")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackground(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Background);
- }
+ public static String GetBackground(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Background);
///
/// Sets up to five separate background properties of an object.
///
[DomName("background")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackground(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackground(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Background, value);
- }
///
/// Gets how the background image (or images) is attached to
@@ -377,10 +313,8 @@ public static void SetBackground(this ICssStyleDeclaration style, String value)
///
[DomName("backgroundAttachment")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundAttachment(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundAttachment);
- }
+ public static String GetBackgroundAttachment(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundAttachment);
///
/// Sets how the background image (or images) is attached to
@@ -388,10 +322,8 @@ public static String GetBackgroundAttachment(this ICssStyleDeclaration style)
///
[DomName("backgroundAttachment")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundAttachment(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundAttachment(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundAttachment, value);
- }
///
/// Gets the background painting area or areas relative to the
@@ -399,10 +331,8 @@ public static void SetBackgroundAttachment(this ICssStyleDeclaration style, Stri
///
[DomName("backgroundClip")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundClip(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundClip);
- }
+ public static String GetBackgroundClip(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundClip);
///
/// Sets the background painting area or areas relative to the
@@ -410,50 +340,40 @@ public static String GetBackgroundClip(this ICssStyleDeclaration style)
///
[DomName("backgroundClip")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundClip(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundClip(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundClip, value);
- }
///
/// Gets the color behind the content of the object.
///
[DomName("backgroundColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundColor);
- }
+ public static String GetBackgroundColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundColor);
///
/// Sets the color behind the content of the object.
///
[DomName("backgroundColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundColor, value);
- }
///
/// Gets the background image or images of the object.
///
[DomName("backgroundImage")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundImage(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundImage);
- }
+ public static String GetBackgroundImage(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundImage);
///
/// Sets the background image or images of the object.
///
[DomName("backgroundImage")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundImage(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundImage(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundImage, value);
- }
///
/// Gets the positioning area of an element or multiple
@@ -461,10 +381,8 @@ public static void SetBackgroundImage(this ICssStyleDeclaration style, String va
///
[DomName("backgroundOrigin")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundOrigin(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundOrigin);
- }
+ public static String GetBackgroundOrigin(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundOrigin);
///
/// Sets the positioning area of an element or multiple
@@ -472,70 +390,56 @@ public static String GetBackgroundOrigin(this ICssStyleDeclaration style)
///
[DomName("backgroundOrigin")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundOrigin(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundOrigin(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundOrigin, value);
- }
///
/// Gets the position of the background of the object.
///
[DomName("backgroundPosition")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundPosition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundPosition);
- }
+ public static String GetBackgroundPosition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundPosition);
///
/// Sets the position of the background of the object.
///
[DomName("backgroundPosition")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundPosition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundPosition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundPosition, value);
- }
///
/// Gets the x-coordinate of the background-position property.
///
[DomName("backgroundPositionX")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundPositionX(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundPositionX);
- }
+ public static String GetBackgroundPositionX(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundPositionX);
///
/// Sets the x-coordinate of the background-position property.
///
[DomName("backgroundPositionX")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundPositionX(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundPositionX(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundPositionX, value);
- }
///
/// Gets the y-coordinate of the background-position property.
///
[DomName("backgroundPositionY")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundPositionY(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundPositionY);
- }
+ public static String GetBackgroundPositionY(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundPositionY);
///
/// Sets the y-coordinate of the background-position property.
///
[DomName("backgroundPositionY")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundPositionY(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundPositionY(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundPositionY, value);
- }
///
/// Gets whether and how the background image (or images) is
@@ -543,10 +447,8 @@ public static void SetBackgroundPositionY(this ICssStyleDeclaration style, Strin
///
[DomName("backgroundRepeat")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundRepeat(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundRepeat);
- }
+ public static String GetBackgroundRepeat(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundRepeat);
///
/// Sets whether and how the background image (or images) is
@@ -554,30 +456,24 @@ public static String GetBackgroundRepeat(this ICssStyleDeclaration style)
///
[DomName("backgroundRepeat")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundRepeat(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundRepeat(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundRepeat, value);
- }
///
/// Gets the size of the background images.
///
[DomName("backgroundSize")]
[DomAccessor(Accessors.Getter)]
- public static String GetBackgroundSize(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BackgroundSize);
- }
+ public static String GetBackgroundSize(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BackgroundSize);
///
/// Sets the size of the background images.
///
[DomName("backgroundSize")]
[DomAccessor(Accessors.Setter)]
- public static void SetBackgroundSize(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBackgroundSize(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BackgroundSize, value);
- }
///
/// Gets a value that indicates how the dominant baseline
@@ -586,10 +482,8 @@ public static void SetBackgroundSize(this ICssStyleDeclaration style, String val
///
[DomName("baselineShift")]
[DomAccessor(Accessors.Getter)]
- public static String GetBaselineShift(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BaselineShift);
- }
+ public static String GetBaselineShift(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BaselineShift);
///
/// Sets a value that indicates how the dominant baseline
@@ -598,10 +492,8 @@ public static String GetBaselineShift(this ICssStyleDeclaration style)
///
[DomName("baselineShift")]
[DomAccessor(Accessors.Setter)]
- public static void SetBaselineShift(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBaselineShift(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BaselineShift, value);
- }
///
/// Gets the location of the Dynamic HTML (DHTML) behavior
@@ -609,10 +501,8 @@ public static void SetBaselineShift(this ICssStyleDeclaration style, String valu
///
[DomName("behavior")]
[DomAccessor(Accessors.Getter)]
- public static String GetBehavior(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Behavior);
- }
+ public static String GetBehavior(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Behavior);
///
/// Sets the location of the Dynamic HTML (DHTML) behavior
@@ -620,10 +510,8 @@ public static String GetBehavior(this ICssStyleDeclaration style)
///
[DomName("behavior")]
[DomAccessor(Accessors.Setter)]
- public static void SetBehavior(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBehavior(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Behavior, value);
- }
///
/// Gets the position of the object relative to the top of
@@ -631,10 +519,8 @@ public static void SetBehavior(this ICssStyleDeclaration style, String value)
///
[DomName("bottom")]
[DomAccessor(Accessors.Getter)]
- public static String GetBottom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Bottom);
- }
+ public static String GetBottom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Bottom);
///
/// Sets the position of the object relative to the top of
@@ -642,50 +528,40 @@ public static String GetBottom(this ICssStyleDeclaration style)
///
[DomName("bottom")]
[DomAccessor(Accessors.Setter)]
- public static void SetBottom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBottom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Bottom, value);
- }
///
/// Gets the properties of a border drawn around an object.
///
[DomName("border")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorder(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Border);
- }
+ public static String GetBorder(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Border);
///
/// Sets the properties of a border drawn around an object.
///
[DomName("border")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorder(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorder(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Border, value);
- }
///
/// Gets the properties of the bottom border of the object.
///
[DomName("borderBottom")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottom);
- }
+ public static String GetBorderBottom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottom);
///
/// Sets the properties of the bottom border of the object.
///
[DomName("borderBottom")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottom, value);
- }
///
/// Gets the foreground color of the bottom border of an
@@ -693,10 +569,8 @@ public static void SetBorderBottom(this ICssStyleDeclaration style, String value
///
[DomName("borderBottomColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottomColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottomColor);
- }
+ public static String GetBorderBottomColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottomColor);
///
/// Sets the foreground color of the bottom border of an
@@ -704,10 +578,8 @@ public static String GetBorderBottomColor(this ICssStyleDeclaration style)
///
[DomName("borderBottomColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottomColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottomColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottomColor, value);
- }
///
/// Gets the radii of the quarter ellipse that defines the
@@ -716,10 +588,8 @@ public static void SetBorderBottomColor(this ICssStyleDeclaration style, String
///
[DomName("borderBottomLeftRadius")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottomLeftRadius(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottomLeftRadius);
- }
+ public static String GetBorderBottomLeftRadius(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottomLeftRadius);
///
/// Sets the radii of the quarter ellipse that defines the
@@ -728,10 +598,8 @@ public static String GetBorderBottomLeftRadius(this ICssStyleDeclaration style)
///
[DomName("borderBottomLeftRadius")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottomLeftRadius(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottomLeftRadius(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottomLeftRadius, value);
- }
///
/// Gets one or two values that define the radii of the quarter
@@ -740,10 +608,8 @@ public static void SetBorderBottomLeftRadius(this ICssStyleDeclaration style, St
///
[DomName("borderBottomRightRadius")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottomRightRadius(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottomRightRadius);
- }
+ public static String GetBorderBottomRightRadius(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottomRightRadius);
///
/// Sets one or two values that define the radii of the quarter
@@ -752,50 +618,40 @@ public static String GetBorderBottomRightRadius(this ICssStyleDeclaration style)
///
[DomName("borderBottomRightRadius")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottomRightRadius(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottomRightRadius(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottomRightRadius, value);
- }
///
/// Gets the style of the bottom border of the object.
///
[DomName("borderBottomStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottomStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottomStyle);
- }
+ public static String GetBorderBottomStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottomStyle);
///
/// Sets the style of the bottom border of the object.
///
[DomName("borderBottomStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottomStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottomStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottomStyle, value);
- }
///
/// Gets the thickness of the bottom border of the object.
///
[DomName("borderBottomWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderBottomWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderBottomWidth);
- }
+ public static String GetBorderBottomWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderBottomWidth);
///
/// Sets the thickness of the bottom border of the object.
///
[DomName("borderBottomWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderBottomWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderBottomWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderBottomWidth, value);
- }
///
/// Gets whether the row and cell borders of a table are joined
@@ -803,10 +659,8 @@ public static void SetBorderBottomWidth(this ICssStyleDeclaration style, String
///
[DomName("borderCollapse")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderCollapse(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderCollapse);
- }
+ public static String GetBorderCollapse(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderCollapse);
///
/// Sets whether the row and cell borders of a table are joined
@@ -814,50 +668,40 @@ public static String GetBorderCollapse(this ICssStyleDeclaration style)
///
[DomName("borderCollapse")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderCollapse(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderCollapse(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderCollapse, value);
- }
///
/// Gets the border color of the object.
///
[DomName("borderColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderColor);
- }
+ public static String GetBorderColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderColor);
///
/// Sets the border color of the object.
///
[DomName("borderColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderColor, value);
- }
///
/// Gets an image to be used in place of the border styles.
///
[DomName("borderImage")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImage(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImage);
- }
+ public static String GetBorderImage(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImage);
///
/// Sets an image to be used in place of the border styles.
///
[DomName("borderImage")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImage(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImage(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImage, value);
- }
///
/// Gets the amount by which the border image area extends
@@ -865,10 +709,8 @@ public static void SetBorderImage(this ICssStyleDeclaration style, String value)
///
[DomName("borderImageOutset")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImageOutset(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImageOutset);
- }
+ public static String GetBorderImageOutset(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImageOutset);
///
/// Sets the amount by which the border image area extends
@@ -876,30 +718,24 @@ public static String GetBorderImageOutset(this ICssStyleDeclaration style)
///
[DomName("borderImageOutset")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImageOutset(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImageOutset(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImageOutset, value);
- }
///
/// Gets how the image is scaled and tiled.
///
[DomName("borderImageRepeat")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImageRepeat(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImageRepeat);
- }
+ public static String GetBorderImageRepeat(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImageRepeat);
///
/// Sets how the image is scaled and tiled.
///
[DomName("borderImageRepeat")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImageRepeat(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImageRepeat(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImageRepeat, value);
- }
///
/// Gets four inward offsets, this property slices the
@@ -908,10 +744,8 @@ public static void SetBorderImageRepeat(this ICssStyleDeclaration style, String
///
[DomName("borderImageSlice")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImageSlice(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImageSlice);
- }
+ public static String GetBorderImageSlice(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImageSlice);
///
/// Sets four inward offsets, this property slices the
@@ -920,130 +754,104 @@ public static String GetBorderImageSlice(this ICssStyleDeclaration style)
///
[DomName("borderImageSlice")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImageSlice(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImageSlice(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImageSlice, value);
- }
///
/// Gets the path of the image to be used for the border.
///
[DomName("borderImageSource")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImageSource(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImageSource);
- }
+ public static String GetBorderImageSource(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImageSource);
///
/// Sets the path of the image to be used for the border.
///
[DomName("borderImageSource")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImageSource(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImageSource(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImageSource, value);
- }
///
/// Gets the inward offsets from the outer border edge.
///
[DomName("borderImageWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderImageWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderImageWidth);
- }
+ public static String GetBorderImageWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderImageWidth);
///
/// Sets the inward offsets from the outer border edge.
///
[DomName("borderImageWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderImageWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderImageWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderImageWidth, value);
- }
///
/// Gets the properties of the left border of the object.
///
[DomName("borderLeft")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderLeft(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderLeft);
- }
+ public static String GetBorderLeft(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderLeft);
///
/// Sets the properties of the left border of the object.
///
[DomName("borderLeft")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderLeft(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderLeft(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderLeft, value);
- }
///
/// Gets the foreground color of the left border of an object.
///
[DomName("borderLeftColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderLeftColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderLeftColor);
- }
+ public static String GetBorderLeftColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderLeftColor);
///
/// Sets the foreground color of the left border of an object.
///
[DomName("borderLeftColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderLeftColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderLeftColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderLeftColor, value);
- }
///
/// Gets the style of the left border of the object.
///
[DomName("borderLeftStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderLeftStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderLeftStyle);
- }
+ public static String GetBorderLeftStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderLeftStyle);
///
/// Sets the style of the left border of the object.
///
[DomName("borderLeftStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderLeftStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderLeftStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderLeftStyle, value);
- }
///
/// Gets the thickness of the left border of the object.
///
[DomName("borderLeftWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderLeftWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderLeftWidth);
- }
+ public static String GetBorderLeftWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderLeftWidth);
///
/// Sets the thickness of the left border of the object.
///
[DomName("borderLeftWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderLeftWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderLeftWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderLeftWidth, value);
- }
///
/// Gets the radii of a quarter ellipse that defines the shape
@@ -1051,10 +859,8 @@ public static void SetBorderLeftWidth(this ICssStyleDeclaration style, String va
///
[DomName("borderRadius")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderRadius(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderRadius);
- }
+ public static String GetBorderRadius(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderRadius);
///
/// Sets the radii of a quarter ellipse that defines the shape
@@ -1062,90 +868,72 @@ public static String GetBorderRadius(this ICssStyleDeclaration style)
///
[DomName("borderRadius")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderRadius(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderRadius(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderRadius, value);
- }
///
/// Gets the properties of the right border of the object.
///
[DomName("borderRight")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderRight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderRight);
- }
+ public static String GetBorderRight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderRight);
///
/// Sets the properties of the right border of the object.
///
[DomName("borderRight")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderRight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderRight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderRight, value);
- }
///
/// Gets the foreground color of the right border of an object.
///
[DomName("borderRightColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderRightColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderRightColor);
- }
+ public static String GetBorderRightColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderRightColor);
///
/// Sets the foreground color of the right border of an object.
///
[DomName("borderRightColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderRightColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderRightColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderRightColor, value);
- }
///
/// Gets the style of the right border of the object.
///
[DomName("borderRightStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderRightStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderRightStyle);
- }
+ public static String GetBorderRightStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderRightStyle);
///
/// Sets the style of the right border of the object.
///
[DomName("borderRightStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderRightStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderRightStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderRightStyle, value);
- }
///
/// Gets the thickness of the right border of the object.
///
[DomName("borderRightWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderRightWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderRightWidth);
- }
+ public static String GetBorderRightWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderRightWidth);
///
/// Sets the thickness of the right border of the object.
///
[DomName("borderRightWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderRightWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderRightWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderRightWidth, value);
- }
///
/// Gets the distance between the borders of adjoining cells in
@@ -1153,10 +941,8 @@ public static void SetBorderRightWidth(this ICssStyleDeclaration style, String v
///
[DomName("borderSpacing")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderSpacing(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderSpacing);
- }
+ public static String GetBorderSpacing(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderSpacing);
///
/// Sets the distance between the borders of adjoining cells in
@@ -1164,10 +950,8 @@ public static String GetBorderSpacing(this ICssStyleDeclaration style)
///
[DomName("borderSpacing")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderSpacing(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderSpacing(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderSpacing, value);
- }
///
/// Gets the style of the left, right, top, and bottom borders
@@ -1175,10 +959,8 @@ public static void SetBorderSpacing(this ICssStyleDeclaration style, String valu
///
[DomName("borderStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderStyle);
- }
+ public static String GetBorderStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderStyle);
///
/// Sets the style of the left, right, top, and bottom borders
@@ -1186,50 +968,40 @@ public static String GetBorderStyle(this ICssStyleDeclaration style)
///
[DomName("borderStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderStyle, value);
- }
///
/// Gets the properties of the top border of the object.
///
[DomName("borderTop")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTop(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTop);
- }
+ public static String GetBorderTop(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTop);
///
/// Sets the properties of the top border of the object.
///
[DomName("borderTop")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTop(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTop(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTop, value);
- }
///
/// Gets the foreground color of the top border of an object.
///
[DomName("borderTopColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTopColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTopColor);
- }
+ public static String GetBorderTopColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTopColor);
///
/// Sets the foreground color of the top border of an object.
///
[DomName("borderTopColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTopColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTopColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTopColor, value);
- }
///
/// Gets one or two values that define the radii of the
@@ -1238,10 +1010,8 @@ public static void SetBorderTopColor(this ICssStyleDeclaration style, String val
///
[DomName("borderTopLeftRadius")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTopLeftRadius(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTopLeftRadius);
- }
+ public static String GetBorderTopLeftRadius(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTopLeftRadius);
///
/// Sets one or two values that define the radii of the
@@ -1250,10 +1020,8 @@ public static String GetBorderTopLeftRadius(this ICssStyleDeclaration style)
///
[DomName("borderTopLeftRadius")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTopLeftRadius(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTopLeftRadius(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTopLeftRadius, value);
- }
///
/// Gets one or two values that define the radii of the quarter
@@ -1262,10 +1030,8 @@ public static void SetBorderTopLeftRadius(this ICssStyleDeclaration style, Strin
///
[DomName("borderTopRightRadius")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTopRightRadius(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTopRightRadius);
- }
+ public static String GetBorderTopRightRadius(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTopRightRadius);
///
/// Sets one or two values that define the radii of the quarter
@@ -1274,50 +1040,40 @@ public static String GetBorderTopRightRadius(this ICssStyleDeclaration style)
///
[DomName("borderTopRightRadius")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTopRightRadius(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTopRightRadius(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTopRightRadius, value);
- }
///
/// Gets the style of the top border of the object.
///
[DomName("borderTopStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTopStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTopStyle);
- }
+ public static String GetBorderTopStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTopStyle);
///
/// Sets the style of the top border of the object.
///
[DomName("borderTopStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTopStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTopStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTopStyle, value);
- }
///
/// Gets the thickness of the top border of the object.
///
[DomName("borderTopWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderTopWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderTopWidth);
- }
+ public static String GetBorderTopWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderTopWidth);
///
/// Sets the thickness of the top border of the object.
///
[DomName("borderTopWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderTopWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderTopWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderTopWidth, value);
- }
///
/// Gets the thicknesses of the left, right, top, and bottom
@@ -1325,10 +1081,8 @@ public static void SetBorderTopWidth(this ICssStyleDeclaration style, String val
///
[DomName("borderWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetBorderWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BorderWidth);
- }
+ public static String GetBorderWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BorderWidth);
///
/// Sets the thicknesses of the left, right, top, and bottom
@@ -1336,10 +1090,8 @@ public static String GetBorderWidth(this ICssStyleDeclaration style)
///
[DomName("borderWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetBorderWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBorderWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BorderWidth, value);
- }
///
/// Gets one or more set of shadow values that attaches one or
@@ -1347,10 +1099,8 @@ public static void SetBorderWidth(this ICssStyleDeclaration style, String value)
///
[DomName("boxShadow")]
[DomAccessor(Accessors.Getter)]
- public static String GetBoxShadow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BoxShadow);
- }
+ public static String GetBoxShadow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BoxShadow);
///
/// Sets one or more set of shadow values that attaches one or
@@ -1358,30 +1108,24 @@ public static String GetBoxShadow(this ICssStyleDeclaration style)
///
[DomName("boxShadow")]
[DomAccessor(Accessors.Setter)]
- public static void SetBoxShadow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBoxShadow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BoxShadow, value);
- }
///
/// Gets the box model to use for object sizing.
///
[DomName("boxSizing")]
[DomAccessor(Accessors.Getter)]
- public static String GetBoxSizing(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BoxSizing);
- }
+ public static String GetBoxSizing(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BoxSizing);
///
/// Sets the box model to use for object sizing.
///
[DomName("boxSizing")]
[DomAccessor(Accessors.Setter)]
- public static void SetBoxSizing(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBoxSizing(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BoxSizing, value);
- }
///
/// Gets the column-break behavior that follows a content block
@@ -1389,10 +1133,8 @@ public static void SetBoxSizing(this ICssStyleDeclaration style, String value)
///
[DomName("breakAfter")]
[DomAccessor(Accessors.Getter)]
- public static String GetBreakAfter(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BreakAfter);
- }
+ public static String GetBreakAfter(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BreakAfter);
///
/// Sets the column-break behavior that follows a content block
@@ -1400,10 +1142,8 @@ public static String GetBreakAfter(this ICssStyleDeclaration style)
///
[DomName("breakAfter")]
[DomAccessor(Accessors.Setter)]
- public static void SetBreakAfter(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBreakAfter(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BreakAfter, value);
- }
///
/// Gets the column-break behavior that precedes a content
@@ -1411,10 +1151,8 @@ public static void SetBreakAfter(this ICssStyleDeclaration style, String value)
///
[DomName("breakBefore")]
[DomAccessor(Accessors.Getter)]
- public static String GetBreakBefore(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BreakBefore);
- }
+ public static String GetBreakBefore(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BreakBefore);
///
/// Sets the column-break behavior that precedes a content
@@ -1422,10 +1160,8 @@ public static String GetBreakBefore(this ICssStyleDeclaration style)
///
[DomName("breakBefore")]
[DomAccessor(Accessors.Setter)]
- public static void SetBreakBefore(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBreakBefore(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BreakBefore, value);
- }
///
/// Gets the column-break behavior that occurs within a
@@ -1433,10 +1169,8 @@ public static void SetBreakBefore(this ICssStyleDeclaration style, String value)
///
[DomName("breakInside")]
[DomAccessor(Accessors.Getter)]
- public static String GetBreakInside(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.BreakInside);
- }
+ public static String GetBreakInside(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.BreakInside);
///
/// Sets the column-break behavior that occurs within a
@@ -1444,30 +1178,24 @@ public static String GetBreakInside(this ICssStyleDeclaration style)
///
[DomName("breakInside")]
[DomAccessor(Accessors.Setter)]
- public static void SetBreakInside(this ICssStyleDeclaration style, String value)
- {
+ public static void SetBreakInside(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.BreakInside, value);
- }
///
/// Gets where the caption of a table is located.
///
[DomName("captionSide")]
[DomAccessor(Accessors.Getter)]
- public static String GetCaptionSide(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.CaptionSide);
- }
+ public static String GetCaptionSide(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.CaptionSide);
///
/// Sets where the caption of a table is located.
///
[DomName("captionSide")]
[DomAccessor(Accessors.Setter)]
- public static void SetCaptionSide(this ICssStyleDeclaration style, String value)
- {
+ public static void SetCaptionSide(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.CaptionSide, value);
- }
///
/// Gets whether the object allows floating objects on its left
@@ -1476,10 +1204,8 @@ public static void SetCaptionSide(this ICssStyleDeclaration style, String value)
///
[DomName("clear")]
[DomAccessor(Accessors.Getter)]
- public static String GetClear(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Clear);
- }
+ public static String GetClear(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Clear);
///
/// Sets whether the object allows floating objects on its left
@@ -1488,70 +1214,56 @@ public static String GetClear(this ICssStyleDeclaration style)
///
[DomName("clear")]
[DomAccessor(Accessors.Setter)]
- public static void SetClear(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClear(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Clear, value);
- }
///
/// Gets which part of a positioned object is visible.
///
[DomName("clip")]
[DomAccessor(Accessors.Getter)]
- public static String GetClip(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Clip);
- }
+ public static String GetClip(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Clip);
///
/// Sets which part of a positioned object is visible.
///
[DomName("clip")]
[DomAccessor(Accessors.Setter)]
- public static void SetClip(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClip(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Clip, value);
- }
///
/// Gets the bottom coordinate of the object clipping region.
///
[DomName("clipBottom")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipBottom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipBottom);
- }
+ public static String GetClipBottom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipBottom);
///
/// Sets the bottom coordinate of the object clipping region.
///
[DomName("clipBottom")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipBottom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipBottom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipBottom, value);
- }
///
/// Gets the left coordinate of the object clipping region.
///
[DomName("clipLeft")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipLeft(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipLeft);
- }
+ public static String GetClipLeft(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipLeft);
///
/// Sets the left coordinate of the object clipping region.
///
[DomName("clipLeft")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipLeft(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipLeft(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipLeft, value);
- }
///
/// Gets a reference to the SVG graphical object
@@ -1559,10 +1271,8 @@ public static void SetClipLeft(this ICssStyleDeclaration style, String value)
///
[DomName("clipPath")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipPath(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipPath);
- }
+ public static String GetClipPath(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipPath);
///
/// Sets a reference to the SVG graphical object
@@ -1570,30 +1280,24 @@ public static String GetClipPath(this ICssStyleDeclaration style)
///
[DomName("clipPath")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipPath(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipPath(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipPath, value);
- }
///
/// Gets the right coordinate of the object clipping region.
///
[DomName("clipRight")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipRight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipRight);
- }
+ public static String GetClipRight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipRight);
///
/// Sets the right coordinate of the object clipping region.
///
[DomName("clipRight")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipRight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipRight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipRight, value);
- }
///
/// Gets the algorithm used to determine what parts of the
@@ -1601,10 +1305,8 @@ public static void SetClipRight(this ICssStyleDeclaration style, String value)
///
[DomName("clipRule")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipRule(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipRule);
- }
+ public static String GetClipRule(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipRule);
///
/// Sets the algorithm used to determine what parts of the
@@ -1612,70 +1314,56 @@ public static String GetClipRule(this ICssStyleDeclaration style)
///
[DomName("clipRule")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipRule(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipRule(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipRule, value);
- }
///
/// Gets the top coordinate of the object clipping region.
///
[DomName("clipTop")]
[DomAccessor(Accessors.Getter)]
- public static String GetClipTop(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ClipTop);
- }
+ public static String GetClipTop(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ClipTop);
///
/// Sets the top coordinate of the object clipping region.
///
[DomName("clipTop")]
[DomAccessor(Accessors.Setter)]
- public static void SetClipTop(this ICssStyleDeclaration style, String value)
- {
+ public static void SetClipTop(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ClipTop, value);
- }
///
/// Gets the foreground color of the text of an object.
///
[DomName("color")]
[DomAccessor(Accessors.Getter)]
- public static String GetColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Color);
- }
+ public static String GetColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Color);
///
/// Sets the foreground color of the text of an object.
///
[DomName("color")]
[DomAccessor(Accessors.Setter)]
- public static void SetColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Color, value);
- }
///
/// Gets which color space to use for filter effects.
///
[DomName("colorInterpolationFilters")]
[DomAccessor(Accessors.Getter)]
- public static String GetColorInterpolationFilters(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColorInterpolationFilters);
- }
+ public static String GetColorInterpolationFilters(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColorInterpolationFilters);
///
/// Sets which color space to use for filter effects.
///
[DomName("colorInterpolationFilters")]
[DomAccessor(Accessors.Setter)]
- public static void SetColorInterpolationFilters(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColorInterpolationFilters(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColorInterpolationFilters, value);
- }
///
/// Gets the optimal number of columns in a multi-column
@@ -1683,10 +1371,8 @@ public static void SetColorInterpolationFilters(this ICssStyleDeclaration style,
///
[DomName("columnCount")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnCount(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnCount);
- }
+ public static String GetColumnCount(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnCount);
///
/// Sets the optimal number of columns in a multi-column
@@ -1694,10 +1380,8 @@ public static String GetColumnCount(this ICssStyleDeclaration style)
///
[DomName("columnCount")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnCount(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnCount(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnCount, value);
- }
///
/// Gets a value that indicates how the column lengths in a
@@ -1705,10 +1389,8 @@ public static void SetColumnCount(this ICssStyleDeclaration style, String value)
///
[DomName("columnFill")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnFill(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnFill);
- }
+ public static String GetColumnFill(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnFill);
///
/// Sets a value that indicates how the column lengths in a
@@ -1716,10 +1398,8 @@ public static String GetColumnFill(this ICssStyleDeclaration style)
///
[DomName("columnFill")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnFill(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnFill(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnFill, value);
- }
///
/// Gets the width of the gap between columns in a multi-column
@@ -1727,10 +1407,8 @@ public static void SetColumnFill(this ICssStyleDeclaration style, String value)
///
[DomName("columnGap")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnGap(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnGap);
- }
+ public static String GetColumnGap(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnGap);
///
/// Sets the width of the gap between columns in a multi-column
@@ -1738,10 +1416,8 @@ public static String GetColumnGap(this ICssStyleDeclaration style)
///
[DomName("columnGap")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnGap(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnGap(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnGap, value);
- }
///
/// Gets a shorthand value that specifies values for the
@@ -1750,10 +1426,8 @@ public static void SetColumnGap(this ICssStyleDeclaration style, String value)
///
[DomName("columnRule")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnRule(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnRule);
- }
+ public static String GetColumnRule(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnRule);
///
/// Sets a shorthand value that specifies values for the
@@ -1762,10 +1436,8 @@ public static String GetColumnRule(this ICssStyleDeclaration style)
///
[DomName("columnRule")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnRule(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnRule(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnRule, value);
- }
///
/// Gets the color for all column rules in a multi-column
@@ -1773,10 +1445,8 @@ public static void SetColumnRule(this ICssStyleDeclaration style, String value)
///
[DomName("columnRuleColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnRuleColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnRuleColor);
- }
+ public static String GetColumnRuleColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnRuleColor);
///
/// Sets the color for all column rules in a multi-column
@@ -1784,10 +1454,8 @@ public static String GetColumnRuleColor(this ICssStyleDeclaration style)
///
[DomName("columnRuleColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnRuleColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnRuleColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnRuleColor, value);
- }
///
/// Gets the style for all column rules in a multi-column
@@ -1795,10 +1463,8 @@ public static void SetColumnRuleColor(this ICssStyleDeclaration style, String va
///
[DomName("columnRuleStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnRuleStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnRuleStyle);
- }
+ public static String GetColumnRuleStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnRuleStyle);
///
/// Sets the style for all column rules in a multi-column
@@ -1806,10 +1472,8 @@ public static String GetColumnRuleStyle(this ICssStyleDeclaration style)
///
[DomName("columnRuleStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnRuleStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnRuleStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnRuleStyle, value);
- }
///
/// Gets the width of all column rules in a multi-column
@@ -1817,10 +1481,8 @@ public static void SetColumnRuleStyle(this ICssStyleDeclaration style, String va
///
[DomName("columnRuleWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnRuleWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnRuleWidth);
- }
+ public static String GetColumnRuleWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnRuleWidth);
///
/// Sets the width of all column rules in a multi-column
@@ -1828,10 +1490,8 @@ public static String GetColumnRuleWidth(this ICssStyleDeclaration style)
///
[DomName("columnRuleWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnRuleWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnRuleWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnRuleWidth, value);
- }
///
/// Gets a shorthand value that specifies values for the
@@ -1839,10 +1499,8 @@ public static void SetColumnRuleWidth(this ICssStyleDeclaration style, String va
///
[DomName("columns")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumns(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Columns);
- }
+ public static String GetColumns(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Columns);
///
/// Sets a shorthand value that specifies values for the
@@ -1850,10 +1508,8 @@ public static String GetColumns(this ICssStyleDeclaration style)
///
[DomName("columns")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumns(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumns(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Columns, value);
- }
///
/// Gets the number of columns that a content block
@@ -1861,10 +1517,8 @@ public static void SetColumns(this ICssStyleDeclaration style, String value)
///
[DomName("columnSpan")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnSpan(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnSpan);
- }
+ public static String GetColumnSpan(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnSpan);
///
/// Sets the number of columns that a content block
@@ -1872,10 +1526,8 @@ public static String GetColumnSpan(this ICssStyleDeclaration style)
///
[DomName("columnSpan")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnSpan(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnSpan(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnSpan, value);
- }
///
/// Gets the optimal width of the columns in a multi-column
@@ -1883,10 +1535,8 @@ public static void SetColumnSpan(this ICssStyleDeclaration style, String value)
///
[DomName("columnWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetColumnWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ColumnWidth);
- }
+ public static String GetColumnWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ColumnWidth);
///
/// Sets the optimal width of the columns in a multi-column
@@ -1894,10 +1544,8 @@ public static String GetColumnWidth(this ICssStyleDeclaration style)
///
[DomName("columnWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetColumnWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetColumnWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ColumnWidth, value);
- }
///
/// Gets generated content to insert before or after an
@@ -1905,10 +1553,8 @@ public static void SetColumnWidth(this ICssStyleDeclaration style, String value)
///
[DomName("content")]
[DomAccessor(Accessors.Getter)]
- public static String GetContent(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Content);
- }
+ public static String GetContent(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Content);
///
/// Sets generated content to insert before or after an
@@ -1916,50 +1562,40 @@ public static String GetContent(this ICssStyleDeclaration style)
///
[DomName("content")]
[DomAccessor(Accessors.Setter)]
- public static void SetContent(this ICssStyleDeclaration style, String value)
- {
+ public static void SetContent(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Content, value);
- }
///
/// Gets a list of counters to increment.
///
[DomName("counterIncrement")]
[DomAccessor(Accessors.Getter)]
- public static String GetCounterIncrement(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.CounterIncrement);
- }
+ public static String GetCounterIncrement(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.CounterIncrement);
///
/// Sets a list of counters to increment.
///
[DomName("counterIncrement")]
[DomAccessor(Accessors.Setter)]
- public static void SetCounterIncrement(this ICssStyleDeclaration style, String value)
- {
+ public static void SetCounterIncrement(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.CounterIncrement, value);
- }
///
/// Gets a list of counters to create or reset to zero.
///
[DomName("counterReset")]
[DomAccessor(Accessors.Getter)]
- public static String GetCounterReset(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.CounterReset);
- }
+ public static String GetCounterReset(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.CounterReset);
///
/// Sets a list of counters to create or reset to zero.
///
[DomName("counterReset")]
[DomAccessor(Accessors.Setter)]
- public static void SetCounterReset(this ICssStyleDeclaration style, String value)
- {
+ public static void SetCounterReset(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.CounterReset, value);
- }
///
/// Gets a value that specifies whether a box should float to
@@ -1967,10 +1603,8 @@ public static void SetCounterReset(this ICssStyleDeclaration style, String value
///
[DomName("cssFloat")]
[DomAccessor(Accessors.Getter)]
- public static String GetFloat(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Float);
- }
+ public static String GetFloat(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Float);
///
/// Sets a value that specifies whether a box should float to
@@ -1978,10 +1612,8 @@ public static String GetFloat(this ICssStyleDeclaration style)
///
[DomName("cssFloat")]
[DomAccessor(Accessors.Setter)]
- public static void SetFloat(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFloat(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Float, value);
- }
///
/// Gets the type of cursor to display as the mouse pointer
@@ -1989,10 +1621,8 @@ public static void SetFloat(this ICssStyleDeclaration style, String value)
///
[DomName("cursor")]
[DomAccessor(Accessors.Getter)]
- public static String GetCursor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Cursor);
- }
+ public static String GetCursor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Cursor);
///
/// Sets the type of cursor to display as the mouse pointer
@@ -2000,30 +1630,24 @@ public static String GetCursor(this ICssStyleDeclaration style)
///
[DomName("cursor")]
[DomAccessor(Accessors.Setter)]
- public static void SetCursor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetCursor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Cursor, value);
- }
///
/// Gets the reading order of the object.
///
[DomName("direction")]
[DomAccessor(Accessors.Getter)]
- public static String GetDirection(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Direction);
- }
+ public static String GetDirection(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Direction);
///
/// Sets the reading order of the object.
///
[DomName("direction")]
[DomAccessor(Accessors.Setter)]
- public static void SetDirection(this ICssStyleDeclaration style, String value)
- {
+ public static void SetDirection(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Direction, value);
- }
///
/// Gets a value that indicates whether and how the object is
@@ -2031,10 +1655,8 @@ public static void SetDirection(this ICssStyleDeclaration style, String value)
///
[DomName("display")]
[DomAccessor(Accessors.Getter)]
- public static String GetDisplay(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Display);
- }
+ public static String GetDisplay(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Display);
///
/// Sets a value that indicates whether and how the object is
@@ -2042,10 +1664,8 @@ public static String GetDisplay(this ICssStyleDeclaration style)
///
[DomName("display")]
[DomAccessor(Accessors.Setter)]
- public static void SetDisplay(this ICssStyleDeclaration style, String value)
- {
+ public static void SetDisplay(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Display, value);
- }
///
/// Gets a value that determines or redetermines a
@@ -2053,10 +1673,8 @@ public static void SetDisplay(this ICssStyleDeclaration style, String value)
///
[DomName("dominantBaseline")]
[DomAccessor(Accessors.Getter)]
- public static String GetDominantBaseline(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.DominantBaseline);
- }
+ public static String GetDominantBaseline(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.DominantBaseline);
///
/// Sets a value that determines or redetermines a
@@ -2064,30 +1682,24 @@ public static String GetDominantBaseline(this ICssStyleDeclaration style)
///
[DomName("dominantBaseline")]
[DomAccessor(Accessors.Setter)]
- public static void SetDominantBaseline(this ICssStyleDeclaration style, String value)
- {
+ public static void SetDominantBaseline(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.DominantBaseline, value);
- }
///
/// Gets whether to show or hide a cell without content.
///
[DomName("emptyCells")]
[DomAccessor(Accessors.Getter)]
- public static String GetEmptyCells(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.EmptyCells);
- }
+ public static String GetEmptyCells(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.EmptyCells);
///
/// Sets whether to show or hide a cell without content.
///
[DomName("emptyCells")]
[DomAccessor(Accessors.Setter)]
- public static void SetEmptyCells(this ICssStyleDeclaration style, String value)
- {
+ public static void SetEmptyCells(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.EmptyCells, value);
- }
///
/// Gets a shared background image all graphic elements within a
@@ -2095,10 +1707,8 @@ public static void SetEmptyCells(this ICssStyleDeclaration style, String value)
///
[DomName("enableBackground")]
[DomAccessor(Accessors.Getter)]
- public static String GetEnableBackground(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.EnableBackground);
- }
+ public static String GetEnableBackground(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.EnableBackground);
///
/// Sets a shared background image all graphic elements within a
@@ -2106,10 +1716,8 @@ public static String GetEnableBackground(this ICssStyleDeclaration style)
///
[DomName("enableBackground")]
[DomAccessor(Accessors.Setter)]
- public static void SetEnableBackground(this ICssStyleDeclaration style, String value)
- {
+ public static void SetEnableBackground(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.EnableBackground, value);
- }
///
/// Gets a value that indicates the color to paint the
@@ -2117,10 +1725,8 @@ public static void SetEnableBackground(this ICssStyleDeclaration style, String v
///
[DomName("fill")]
[DomAccessor(Accessors.Getter)]
- public static String GetFill(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Fill);
- }
+ public static String GetFill(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Fill);
///
/// Sets a value that indicates the color to paint the
@@ -2128,10 +1734,8 @@ public static String GetFill(this ICssStyleDeclaration style)
///
[DomName("fill")]
[DomAccessor(Accessors.Setter)]
- public static void SetFill(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFill(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Fill, value);
- }
///
/// Gets a value that specifies the opacity of the painting
@@ -2139,10 +1743,8 @@ public static void SetFill(this ICssStyleDeclaration style, String value)
///
[DomName("fillOpacity")]
[DomAccessor(Accessors.Getter)]
- public static String GetFillOpacity(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FillOpacity);
- }
+ public static String GetFillOpacity(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FillOpacity);
///
/// Sets a value that specifies the opacity of the painting
@@ -2150,10 +1752,8 @@ public static String GetFillOpacity(this ICssStyleDeclaration style)
///
[DomName("fillOpacity")]
[DomAccessor(Accessors.Setter)]
- public static void SetFillOpacity(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFillOpacity(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FillOpacity, value);
- }
///
/// Gets a value that indicates the algorithm that is to be
@@ -2162,10 +1762,8 @@ public static void SetFillOpacity(this ICssStyleDeclaration style, String value)
///
[DomName("fillRule")]
[DomAccessor(Accessors.Getter)]
- public static String GetFillRule(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FillRule);
- }
+ public static String GetFillRule(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FillRule);
///
/// Sets a value that indicates the algorithm that is to be
@@ -2174,10 +1772,8 @@ public static String GetFillRule(this ICssStyleDeclaration style)
///
[DomName("fillRule")]
[DomAccessor(Accessors.Setter)]
- public static void SetFillRule(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFillRule(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FillRule, value);
- }
///
/// Gets the filter property is generally used to apply a previously
@@ -2185,10 +1781,8 @@ public static void SetFillRule(this ICssStyleDeclaration style, String value)
///
[DomName("filter")]
[DomAccessor(Accessors.Getter)]
- public static String GetFilter(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Filter);
- }
+ public static String GetFilter(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Filter);
///
/// Sets the filter property is generally used to apply a previously
@@ -2196,10 +1790,8 @@ public static String GetFilter(this ICssStyleDeclaration style)
///
[DomName("filter")]
[DomAccessor(Accessors.Setter)]
- public static void SetFilter(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFilter(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Filter, value);
- }
///
/// Gets the parameter values of a flexible length, the
@@ -2207,10 +1799,8 @@ public static void SetFilter(this ICssStyleDeclaration style, String value)
///
[DomName("flex")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlex(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Flex);
- }
+ public static String GetFlex(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Flex);
///
/// Sets the parameter values of a flexible length, the
@@ -2218,30 +1808,24 @@ public static String GetFlex(this ICssStyleDeclaration style)
///
[DomName("flex")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlex(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlex(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Flex, value);
- }
///
/// Gets the initial main size of the flex item.
///
[DomName("flexBasis")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexBasis(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexBasis);
- }
+ public static String GetFlexBasis(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexBasis);
///
/// Sets the initial main size of the flex item.
///
[DomName("flexBasis")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexBasis(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexBasis(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexBasis, value);
- }
///
/// Gets the direction of the main axis which specifies how the
@@ -2249,10 +1833,8 @@ public static void SetFlexBasis(this ICssStyleDeclaration style, String value)
///
[DomName("flexDirection")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexDirection(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexDirection);
- }
+ public static String GetFlexDirection(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexDirection);
///
/// Sets the direction of the main axis which specifies how the
@@ -2260,10 +1842,8 @@ public static String GetFlexDirection(this ICssStyleDeclaration style)
///
[DomName("flexDirection")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexDirection(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexDirection(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexDirection, value);
- }
///
/// Gets the shorthand property to set both the flex-direction
@@ -2271,10 +1851,8 @@ public static void SetFlexDirection(this ICssStyleDeclaration style, String valu
///
[DomName("flexFlow")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexFlow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexFlow);
- }
+ public static String GetFlexFlow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexFlow);
///
/// Sets the shorthand property to set both the flex-direction
@@ -2282,50 +1860,40 @@ public static String GetFlexFlow(this ICssStyleDeclaration style)
///
[DomName("flexFlow")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexFlow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexFlow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexFlow, value);
- }
///
/// Gets the flex grow factor for the flex item.
///
[DomName("flexGrow")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexGrow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexGrow);
- }
+ public static String GetFlexGrow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexGrow);
///
/// Sets the flex grow factor for the flex item.
///
[DomName("flexGrow")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexGrow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexGrow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexGrow, value);
- }
///
/// Gets the flex shrink factor for the flex item.
///
[DomName("flexShrink")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexShrink(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexShrink);
- }
+ public static String GetFlexShrink(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexShrink);
///
/// Sets the flex shrink factor for the flex item.
///
[DomName("flexShrink")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexShrink(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexShrink(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexShrink, value);
- }
///
/// Gets whether flex items wrap and the direction they wrap
@@ -2334,10 +1902,8 @@ public static void SetFlexShrink(this ICssStyleDeclaration style, String value)
///
[DomName("flexWrap")]
[DomAccessor(Accessors.Getter)]
- public static String GetFlexWrap(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FlexWrap);
- }
+ public static String GetFlexWrap(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FlexWrap);
///
/// Sets whether flex items wrap and the direction they wrap
@@ -2346,10 +1912,8 @@ public static String GetFlexWrap(this ICssStyleDeclaration style)
///
[DomName("flexWrap")]
[DomAccessor(Accessors.Setter)]
- public static void SetFlexWrap(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFlexWrap(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FlexWrap, value);
- }
///
/// Gets a combination of separate font properties of the
@@ -2358,10 +1922,8 @@ public static void SetFlexWrap(this ICssStyleDeclaration style, String value)
///
[DomName("font")]
[DomAccessor(Accessors.Getter)]
- public static String GetFont(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Font);
- }
+ public static String GetFont(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Font);
///
/// Sets a combination of separate font properties of the
@@ -2370,30 +1932,24 @@ public static String GetFont(this ICssStyleDeclaration style)
///
[DomName("font")]
[DomAccessor(Accessors.Setter)]
- public static void SetFont(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFont(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Font, value);
- }
///
/// Gets the name of the font used for text in the object.
///
[DomName("fontFamily")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontFamily(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontFamily);
- }
+ public static String GetFontFamily(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontFamily);
///
/// Sets the name of the font used for text in the object.
///
[DomName("fontFamily")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontFamily(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontFamily(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontFamily, value);
- }
///
/// Gets one or more values that specify glyph substitution and
@@ -2401,10 +1957,8 @@ public static void SetFontFamily(this ICssStyleDeclaration style, String value)
///
[DomName("fontFeatureSettings")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontFeatureSettings(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontFeatureSettings);
- }
+ public static String GetFontFeatureSettings(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontFeatureSettings);
///
/// Sets one or more values that specify glyph substitution and
@@ -2412,10 +1966,8 @@ public static String GetFontFeatureSettings(this ICssStyleDeclaration style)
///
[DomName("fontFeatureSettings")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontFeatureSettings(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontFeatureSettings(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontFeatureSettings, value);
- }
///
/// Gets a value that indicates the font size used for text in
@@ -2423,10 +1975,8 @@ public static void SetFontFeatureSettings(this ICssStyleDeclaration style, Strin
///
[DomName("fontSize")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontSize(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontSize);
- }
+ public static String GetFontSize(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontSize);
///
/// Sets a value that indicates the font size used for text in
@@ -2434,10 +1984,8 @@ public static String GetFontSize(this ICssStyleDeclaration style)
///
[DomName("fontSize")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontSize(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontSize(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontSize, value);
- }
///
/// Gets a value that specifies an aspect value for an element
@@ -2446,10 +1994,8 @@ public static void SetFontSize(this ICssStyleDeclaration style, String value)
///
[DomName("fontSizeAdjust")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontSizeAdjust(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontSizeAdjust);
- }
+ public static String GetFontSizeAdjust(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontSizeAdjust);
///
/// Sets a value that specifies an aspect value for an element
@@ -2458,10 +2004,8 @@ public static String GetFontSizeAdjust(this ICssStyleDeclaration style)
///
[DomName("fontSizeAdjust")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontSizeAdjust(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontSizeAdjust(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontSizeAdjust, value);
- }
///
/// Gets a value that indicates a normal, condensed, or
@@ -2469,10 +2013,8 @@ public static void SetFontSizeAdjust(this ICssStyleDeclaration style, String val
///
[DomName("fontStretch")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontStretch(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontStretch);
- }
+ public static String GetFontStretch(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontStretch);
///
/// Sets a value that indicates a normal, condensed, or
@@ -2480,10 +2022,8 @@ public static String GetFontStretch(this ICssStyleDeclaration style)
///
[DomName("fontStretch")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontStretch(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontStretch(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontStretch, value);
- }
///
/// Gets the font style of the object as italic, normal, or
@@ -2491,10 +2031,8 @@ public static void SetFontStretch(this ICssStyleDeclaration style, String value)
///
[DomName("fontStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontStyle);
- }
+ public static String GetFontStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontStyle);
///
/// Sets the font style of the object as italic, normal, or
@@ -2502,10 +2040,8 @@ public static String GetFontStyle(this ICssStyleDeclaration style)
///
[DomName("fontStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontStyle, value);
- }
///
/// Gets whether the text of the object is in small capital
@@ -2513,10 +2049,8 @@ public static void SetFontStyle(this ICssStyleDeclaration style, String value)
///
[DomName("fontVariant")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontVariant(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontVariant);
- }
+ public static String GetFontVariant(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontVariant);
///
/// Sets whether the text of the object is in small capital
@@ -2524,30 +2058,24 @@ public static String GetFontVariant(this ICssStyleDeclaration style)
///
[DomName("fontVariant")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontVariant(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontVariant(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontVariant, value);
- }
///
/// Gets of sets the weight of the font of the object.
///
[DomName("fontWeight")]
[DomAccessor(Accessors.Getter)]
- public static String GetFontWeight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.FontWeight);
- }
+ public static String GetFontWeight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.FontWeight);
///
/// Sets of sets the weight of the font of the object.
///
[DomName("fontWeight")]
[DomAccessor(Accessors.Setter)]
- public static void SetFontWeight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetFontWeight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.FontWeight, value);
- }
///
/// Gets a value that alters the orientation of a sequence of
@@ -2556,10 +2084,8 @@ public static void SetFontWeight(this ICssStyleDeclaration style, String value)
///
[DomName("glyphOrientationHorizontal")]
[DomAccessor(Accessors.Getter)]
- public static String GetGlyphOrientationHorizontal(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.GlyphOrientationHorizontal);
- }
+ public static String GetGlyphOrientationHorizontal(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.GlyphOrientationHorizontal);
///
/// Sets a value that alters the orientation of a sequence of
@@ -2568,10 +2094,8 @@ public static String GetGlyphOrientationHorizontal(this ICssStyleDeclaration sty
///
[DomName("glyphOrientationHorizontal")]
[DomAccessor(Accessors.Setter)]
- public static void SetGlyphOrientationHorizontal(this ICssStyleDeclaration style, String value)
- {
+ public static void SetGlyphOrientationHorizontal(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.GlyphOrientationHorizontal, value);
- }
///
/// Gets a value that alters the orientation of a sequence
@@ -2580,10 +2104,8 @@ public static void SetGlyphOrientationHorizontal(this ICssStyleDeclaration style
///
[DomName("glyphOrientationVertical")]
[DomAccessor(Accessors.Getter)]
- public static String GetGlyphOrientationVertical(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.GlyphOrientationVertical);
- }
+ public static String GetGlyphOrientationVertical(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.GlyphOrientationVertical);
///
/// Sets a value that alters the orientation of a sequence
@@ -2592,50 +2114,40 @@ public static String GetGlyphOrientationVertical(this ICssStyleDeclaration style
///
[DomName("glyphOrientationVertical")]
[DomAccessor(Accessors.Setter)]
- public static void SetGlyphOrientationVertical(this ICssStyleDeclaration style, String value)
- {
+ public static void SetGlyphOrientationVertical(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.GlyphOrientationVertical, value);
- }
///
/// Gets the height of the object.
///
[DomName("height")]
[DomAccessor(Accessors.Getter)]
- public static String GetHeight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Height);
- }
+ public static String GetHeight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Height);
///
/// Sets the height of the object.
///
[DomName("height")]
[DomAccessor(Accessors.Setter)]
- public static void SetHeight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetHeight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Height, value);
- }
///
/// Gets the state of an IME.
///
[DomName("imeMode")]
[DomAccessor(Accessors.Getter)]
- public static String GetImeMode(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ImeMode);
- }
+ public static String GetImeMode(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ImeMode);
///
/// Sets the state of an IME.
///
[DomName("imeMode")]
[DomAccessor(Accessors.Setter)]
- public static void SetImeMode(this ICssStyleDeclaration style, String value)
- {
+ public static void SetImeMode(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ImeMode, value);
- }
///
/// Gets a how flex items are aligned along the main axis of
@@ -2644,10 +2156,8 @@ public static void SetImeMode(this ICssStyleDeclaration style, String value)
///
[DomName("justifyContent")]
[DomAccessor(Accessors.Getter)]
- public static String GetJustifyContent(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.JustifyContent);
- }
+ public static String GetJustifyContent(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.JustifyContent);
///
/// Sets a how flex items are aligned along the main axis of
@@ -2656,10 +2166,8 @@ public static String GetJustifyContent(this ICssStyleDeclaration style)
///
[DomName("justifyContent")]
[DomAccessor(Accessors.Setter)]
- public static void SetJustifyContent(this ICssStyleDeclaration style, String value)
- {
+ public static void SetJustifyContent(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.JustifyContent, value);
- }
///
/// Gets the composite document grid properties that specify
@@ -2667,10 +2175,8 @@ public static void SetJustifyContent(this ICssStyleDeclaration style, String val
///
[DomName("layoutGrid")]
[DomAccessor(Accessors.Getter)]
- public static String GetLayoutGrid(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LayoutGrid);
- }
+ public static String GetLayoutGrid(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LayoutGrid);
///
/// Sets the composite document grid properties that specify
@@ -2678,10 +2184,8 @@ public static String GetLayoutGrid(this ICssStyleDeclaration style)
///
[DomName("layoutGrid")]
[DomAccessor(Accessors.Setter)]
- public static void SetLayoutGrid(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLayoutGrid(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LayoutGrid, value);
- }
///
/// Gets the size of the character grid used for rendering
@@ -2689,10 +2193,8 @@ public static void SetLayoutGrid(this ICssStyleDeclaration style, String value)
///
[DomName("layoutGridChar")]
[DomAccessor(Accessors.Getter)]
- public static String GetLayoutGridChar(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LayoutGridChar);
- }
+ public static String GetLayoutGridChar(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LayoutGridChar);
///
/// Sets the size of the character grid used for rendering
@@ -2700,10 +2202,8 @@ public static String GetLayoutGridChar(this ICssStyleDeclaration style)
///
[DomName("layoutGridChar")]
[DomAccessor(Accessors.Setter)]
- public static void SetLayoutGridChar(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLayoutGridChar(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LayoutGridChar, value);
- }
///
/// Gets the gridline value used for rendering the text content
@@ -2711,10 +2211,8 @@ public static void SetLayoutGridChar(this ICssStyleDeclaration style, String val
///
[DomName("layoutGridLine")]
[DomAccessor(Accessors.Getter)]
- public static String GetLayoutGridLine(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LayoutGridLine);
- }
+ public static String GetLayoutGridLine(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LayoutGridLine);
///
/// Sets the gridline value used for rendering the text content
@@ -2722,30 +2220,24 @@ public static String GetLayoutGridLine(this ICssStyleDeclaration style)
///
[DomName("layoutGridLine")]
[DomAccessor(Accessors.Setter)]
- public static void SetLayoutGridLine(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLayoutGridLine(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LayoutGridLine, value);
- }
///
/// Gets whether the text layout grid uses two dimensions.
///
[DomName("layoutGridMode")]
[DomAccessor(Accessors.Getter)]
- public static String GetLayoutGridMode(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LayoutGridMode);
- }
+ public static String GetLayoutGridMode(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LayoutGridMode);
///
/// Sets whether the text layout grid uses two dimensions.
///
[DomName("layoutGridMode")]
[DomAccessor(Accessors.Setter)]
- public static void SetLayoutGridMode(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLayoutGridMode(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LayoutGridMode, value);
- }
///
/// Gets the type of grid used for rendering the text content
@@ -2753,10 +2245,8 @@ public static void SetLayoutGridMode(this ICssStyleDeclaration style, String val
///
[DomName("layoutGridType")]
[DomAccessor(Accessors.Getter)]
- public static String GetLayoutGridType(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LayoutGridType);
- }
+ public static String GetLayoutGridType(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LayoutGridType);
///
/// Sets the type of grid used for rendering the text content
@@ -2764,10 +2254,8 @@ public static String GetLayoutGridType(this ICssStyleDeclaration style)
///
[DomName("layoutGridType")]
[DomAccessor(Accessors.Setter)]
- public static void SetLayoutGridType(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLayoutGridType(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LayoutGridType, value);
- }
///
/// Gets the position of the object relative to the left edge
@@ -2775,10 +2263,8 @@ public static void SetLayoutGridType(this ICssStyleDeclaration style, String val
///
[DomName("left")]
[DomAccessor(Accessors.Getter)]
- public static String GetLeft(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Left);
- }
+ public static String GetLeft(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Left);
///
/// Sets the position of the object relative to the left edge
@@ -2786,10 +2272,8 @@ public static String GetLeft(this ICssStyleDeclaration style)
///
[DomName("left")]
[DomAccessor(Accessors.Setter)]
- public static void SetLeft(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLeft(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Left, value);
- }
///
/// Gets the amount of additional space between letters in the
@@ -2797,10 +2281,8 @@ public static void SetLeft(this ICssStyleDeclaration style, String value)
///
[DomName("letterSpacing")]
[DomAccessor(Accessors.Getter)]
- public static String GetLetterSpacing(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LetterSpacing);
- }
+ public static String GetLetterSpacing(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LetterSpacing);
///
/// Sets the amount of additional space between letters in the
@@ -2808,30 +2290,24 @@ public static String GetLetterSpacing(this ICssStyleDeclaration style)
///
[DomName("letterSpacing")]
[DomAccessor(Accessors.Setter)]
- public static void SetLetterSpacing(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLetterSpacing(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LetterSpacing, value);
- }
///
/// Gets the distance between lines in the object.
///
[DomName("lineHeight")]
[DomAccessor(Accessors.Getter)]
- public static String GetLineHeight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.LineHeight);
- }
+ public static String GetLineHeight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.LineHeight);
///
/// Sets the distance between lines in the object.
///
[DomName("lineHeight")]
[DomAccessor(Accessors.Setter)]
- public static void SetLineHeight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetLineHeight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.LineHeight, value);
- }
///
/// Gets up to three separate list-style properties of the
@@ -2839,10 +2315,8 @@ public static void SetLineHeight(this ICssStyleDeclaration style, String value)
///
[DomName("listStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetListStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ListStyle);
- }
+ public static String GetListStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ListStyle);
///
/// Sets up to three separate list-style properties of the
@@ -2850,10 +2324,8 @@ public static String GetListStyle(this ICssStyleDeclaration style)
///
[DomName("listStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetListStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetListStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ListStyle, value);
- }
///
/// Gets a value that indicates which image to use as a
@@ -2861,10 +2333,8 @@ public static void SetListStyle(this ICssStyleDeclaration style, String value)
///
[DomName("listStyleImage")]
[DomAccessor(Accessors.Getter)]
- public static String GetListStyleImage(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ListStyleImage);
- }
+ public static String GetListStyleImage(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ListStyleImage);
///
/// Sets a value that indicates which image to use as a
@@ -2872,10 +2342,8 @@ public static String GetListStyleImage(this ICssStyleDeclaration style)
///
[DomName("listStyleImage")]
[DomAccessor(Accessors.Setter)]
- public static void SetListStyleImage(this ICssStyleDeclaration style, String value)
- {
+ public static void SetListStyleImage(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ListStyleImage, value);
- }
///
/// Gets a variable that indicates how the list-item marker is
@@ -2883,10 +2351,8 @@ public static void SetListStyleImage(this ICssStyleDeclaration style, String val
///
[DomName("listStylePosition")]
[DomAccessor(Accessors.Getter)]
- public static String GetListStylePosition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ListStylePosition);
- }
+ public static String GetListStylePosition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ListStylePosition);
///
/// Sets a variable that indicates how the list-item marker is
@@ -2894,10 +2360,8 @@ public static String GetListStylePosition(this ICssStyleDeclaration style)
///
[DomName("listStylePosition")]
[DomAccessor(Accessors.Setter)]
- public static void SetListStylePosition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetListStylePosition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ListStylePosition, value);
- }
///
/// Gets the predefined type of the line-item marker for the
@@ -2905,10 +2369,8 @@ public static void SetListStylePosition(this ICssStyleDeclaration style, String
///
[DomName("listStyleType")]
[DomAccessor(Accessors.Getter)]
- public static String GetListStyleType(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ListStyleType);
- }
+ public static String GetListStyleType(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ListStyleType);
///
/// Sets the predefined type of the line-item marker for the
@@ -2916,10 +2378,8 @@ public static String GetListStyleType(this ICssStyleDeclaration style)
///
[DomName("listStyleType")]
[DomAccessor(Accessors.Setter)]
- public static void SetListStyleType(this ICssStyleDeclaration style, String value)
- {
+ public static void SetListStyleType(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ListStyleType, value);
- }
///
/// Gets the width of the top, right, bottom, and left margins
@@ -2927,10 +2387,8 @@ public static void SetListStyleType(this ICssStyleDeclaration style, String valu
///
[DomName("margin")]
[DomAccessor(Accessors.Getter)]
- public static String GetMargin(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Margin);
- }
+ public static String GetMargin(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Margin);
///
/// Sets the width of the top, right, bottom, and left margins
@@ -2938,90 +2396,72 @@ public static String GetMargin(this ICssStyleDeclaration style)
///
[DomName("margin")]
[DomAccessor(Accessors.Setter)]
- public static void SetMargin(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMargin(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Margin, value);
- }
///
/// Gets the height of the bottom margin of the object.
///
[DomName("marginBottom")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarginBottom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarginBottom);
- }
+ public static String GetMarginBottom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarginBottom);
///
/// Sets the height of the bottom margin of the object.
///
[DomName("marginBottom")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarginBottom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarginBottom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarginBottom, value);
- }
///
/// Gets the width of the left margin of the object.
///
[DomName("marginLeft")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarginLeft(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarginLeft);
- }
+ public static String GetMarginLeft(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarginLeft);
///
/// Sets the width of the left margin of the object.
///
[DomName("marginLeft")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarginLeft(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarginLeft(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarginLeft, value);
- }
///
/// Gets the width of the right margin of the object.
///
[DomName("marginRight")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarginRight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarginRight);
- }
+ public static String GetMarginRight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarginRight);
///
/// Sets the width of the right margin of the object.
///
[DomName("marginRight")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarginRight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarginRight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarginRight, value);
- }
///
/// Gets the height of the top margin of the object.
///
[DomName("marginTop")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarginTop(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarginTop);
- }
+ public static String GetMarginTop(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarginTop);
///
/// Sets the height of the top margin of the object.
///
[DomName("marginTop")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarginTop(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarginTop(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarginTop, value);
- }
///
/// Gets a value that specifies the marker symbol that is
@@ -3029,10 +2469,8 @@ public static void SetMarginTop(this ICssStyleDeclaration style, String value)
///
[DomName("marker")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarker(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Marker);
- }
+ public static String GetMarker(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Marker);
///
/// Sets a value that specifies the marker symbol that is
@@ -3040,10 +2478,8 @@ public static String GetMarker(this ICssStyleDeclaration style)
///
[DomName("marker")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarker(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarker(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Marker, value);
- }
///
/// Gets a value that defines the arrowhead or polymarker that
@@ -3052,10 +2488,8 @@ public static void SetMarker(this ICssStyleDeclaration style, String value)
///
[DomName("markerEnd")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarkerEnd(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarkerEnd);
- }
+ public static String GetMarkerEnd(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarkerEnd);
///
/// Sets a value that defines the arrowhead or polymarker that
@@ -3064,10 +2498,8 @@ public static String GetMarkerEnd(this ICssStyleDeclaration style)
///
[DomName("markerEnd")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarkerEnd(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarkerEnd(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarkerEnd, value);
- }
///
/// Gets a value that defines the arrowhead or polymarker that
@@ -3076,10 +2508,8 @@ public static void SetMarkerEnd(this ICssStyleDeclaration style, String value)
///
[DomName("markerMid")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarkerMid(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarkerMid);
- }
+ public static String GetMarkerMid(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarkerMid);
///
/// Sets a value that defines the arrowhead or polymarker that
@@ -3088,10 +2518,8 @@ public static String GetMarkerMid(this ICssStyleDeclaration style)
///
[DomName("markerMid")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarkerMid(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarkerMid(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarkerMid, value);
- }
///
/// Gets a value that defines the arrowhead or polymarker that
@@ -3100,10 +2528,8 @@ public static void SetMarkerMid(this ICssStyleDeclaration style, String value)
///
[DomName("markerStart")]
[DomAccessor(Accessors.Getter)]
- public static String GetMarkerStart(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MarkerStart);
- }
+ public static String GetMarkerStart(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MarkerStart);
///
/// Sets a value that defines the arrowhead or polymarker that
@@ -3112,109 +2538,87 @@ public static String GetMarkerStart(this ICssStyleDeclaration style)
///
[DomName("markerStart")]
[DomAccessor(Accessors.Setter)]
- public static void SetMarkerStart(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMarkerStart(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MarkerStart, value);
- }
///
/// Gets a value that indicates a SVG mask.
///
[DomName("mask")]
[DomAccessor(Accessors.Getter)]
- public static String GetMask(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Mask);
- }
+ public static String GetMask(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Mask);
///
/// Sets a value that indicates a SVG mask.
///
[DomName("mask")]
[DomAccessor(Accessors.Setter)]
- public static void SetMask(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMask(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Mask, value);
- }
///
/// Gets the maximum height for an element.
///
[DomName("maxHeight")]
[DomAccessor(Accessors.Getter)]
- public static String GetMaxHeight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MaxHeight);
- }
+ public static String GetMaxHeight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MaxHeight);
///
/// Sets the maximum height for an element.
///
[DomName("maxHeight")]
[DomAccessor(Accessors.Setter)]
- public static void SetMaxHeight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMaxHeight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MaxHeight, value);
- }
///
/// Gets the maximum width for an element.
///
[DomName("maxWidth")]
- public static String GetMaxWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MaxWidth);
- }
+ public static String GetMaxWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MaxWidth);
///
/// Sets the maximum width for an element.
///
[DomName("maxWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetMaxWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMaxWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MaxWidth, value);
- }
///
/// Gets the minimum height for an element.
///
[DomName("minHeight")]
[DomAccessor(Accessors.Getter)]
- public static String GetMinHeight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MinHeight);
- }
+ public static String GetMinHeight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MinHeight);
///
/// Sets the minimum height for an element.
///
[DomName("minHeight")]
[DomAccessor(Accessors.Setter)]
- public static void SetMinHeight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMinHeight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MinHeight, value);
- }
///
/// Gets the minimum width for an element.
///
[DomName("minWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetMinWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.MinWidth);
- }
+ public static String GetMinWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.MinWidth);
///
/// Sets the minimum width for an element.
///
[DomName("minWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetMinWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetMinWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.MinWidth, value);
- }
///
/// Gets a value that specifies object or group opacity in CSS
@@ -3222,10 +2626,8 @@ public static void SetMinWidth(this ICssStyleDeclaration style, String value)
///
[DomName("opacity")]
[DomAccessor(Accessors.Getter)]
- public static String GetOpacity(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Opacity);
- }
+ public static String GetOpacity(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Opacity);
///
/// Sets a value that specifies object or group opacity in CSS
@@ -3233,10 +2635,8 @@ public static String GetOpacity(this ICssStyleDeclaration style)
///
[DomName("opacity")]
[DomAccessor(Accessors.Setter)]
- public static void SetOpacity(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOpacity(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Opacity, value);
- }
///
/// Gets the order, which property specifies the order used to
@@ -3246,10 +2646,8 @@ public static void SetOpacity(this ICssStyleDeclaration style, String value)
///
[DomName("order")]
[DomAccessor(Accessors.Getter)]
- public static String GetOrder(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Order);
- }
+ public static String GetOrder(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Order);
///
/// Sets the order, which property specifies the order used to
@@ -3259,10 +2657,8 @@ public static String GetOrder(this ICssStyleDeclaration style)
///
[DomName("order")]
[DomAccessor(Accessors.Setter)]
- public static void SetOrder(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOrder(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Order, value);
- }
///
/// Gets the minimum number of lines of a paragraph that must
@@ -3270,10 +2666,8 @@ public static void SetOrder(this ICssStyleDeclaration style, String value)
///
[DomName("orphans")]
[DomAccessor(Accessors.Getter)]
- public static String GetOrphans(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Orphans);
- }
+ public static String GetOrphans(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Orphans);
///
/// Sets the minimum number of lines of a paragraph that must
@@ -3281,90 +2675,72 @@ public static String GetOrphans(this ICssStyleDeclaration style)
///
[DomName("orphans")]
[DomAccessor(Accessors.Setter)]
- public static void SetOrphans(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOrphans(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Orphans, value);
- }
///
/// Gets the outline frame.
///
[DomName("outline")]
[DomAccessor(Accessors.Getter)]
- public static String GetOutline(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Outline);
- }
+ public static String GetOutline(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Outline);
///
/// Sets the outline frame.
///
[DomName("outline")]
[DomAccessor(Accessors.Setter)]
- public static void SetOutline(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOutline(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Outline, value);
- }
///
/// Gets the color of the outline frame.
///
[DomName("outlineColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetOutlineColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OutlineColor);
- }
+ public static String GetOutlineColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OutlineColor);
///
/// Sets the color of the outline frame.
///
[DomName("outlineColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetOutlineColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOutlineColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OutlineColor, value);
- }
///
/// Gets the style of the outline frame.
///
[DomName("outlineStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetOutlineStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OutlineStyle);
- }
+ public static String GetOutlineStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OutlineStyle);
///
/// Sets the style of the outline frame.
///
[DomName("outlineStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetOutlineStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOutlineStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OutlineStyle, value);
- }
///
/// Gets the width of the outline frame.
///
[DomName("outlineWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetOutlineWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OutlineWidth);
- }
+ public static String GetOutlineWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OutlineWidth);
///
/// Sets the width of the outline frame.
///
[DomName("outlineWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetOutlineWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOutlineWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OutlineWidth, value);
- }
///
/// Gets a value indicating how to manage the content of the
@@ -3372,10 +2748,8 @@ public static void SetOutlineWidth(this ICssStyleDeclaration style, String value
///
[DomName("overflow")]
[DomAccessor(Accessors.Getter)]
- public static String GetOverflow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Overflow);
- }
+ public static String GetOverflow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Overflow);
///
/// Sets a value indicating how to manage the content of the
@@ -3383,10 +2757,8 @@ public static String GetOverflow(this ICssStyleDeclaration style)
///
[DomName("overflow")]
[DomAccessor(Accessors.Setter)]
- public static void SetOverflow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOverflow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Overflow, value);
- }
///
/// Gets how to manage the content of the object when the
@@ -3394,10 +2766,8 @@ public static void SetOverflow(this ICssStyleDeclaration style, String value)
///
[DomName("overflowX")]
[DomAccessor(Accessors.Getter)]
- public static String GetOverflowX(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OverflowX);
- }
+ public static String GetOverflowX(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OverflowX);
///
/// Sets how to manage the content of the object when the
@@ -3405,10 +2775,8 @@ public static String GetOverflowX(this ICssStyleDeclaration style)
///
[DomName("overflowX")]
[DomAccessor(Accessors.Setter)]
- public static void SetOverflowX(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOverflowX(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OverflowX, value);
- }
///
/// Gets how to manage the content of the object when the
@@ -3416,10 +2784,8 @@ public static void SetOverflowX(this ICssStyleDeclaration style, String value)
///
[DomName("overflowY")]
[DomAccessor(Accessors.Getter)]
- public static String GetOverflowY(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OverflowY);
- }
+ public static String GetOverflowY(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OverflowY);
///
/// Sets how to manage the content of the object when the
@@ -3427,10 +2793,8 @@ public static String GetOverflowY(this ICssStyleDeclaration style)
///
[DomName("overflowY")]
[DomAccessor(Accessors.Setter)]
- public static void SetOverflowY(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOverflowY(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OverflowY, value);
- }
///
/// Gets the amount of space to insert between the object and
@@ -3439,10 +2803,8 @@ public static void SetOverflowY(this ICssStyleDeclaration style, String value)
///
[DomName("padding")]
[DomAccessor(Accessors.Getter)]
- public static String GetPadding(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Padding);
- }
+ public static String GetPadding(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Padding);
///
/// Sets the amount of space to insert between the object and
@@ -3451,10 +2813,8 @@ public static String GetPadding(this ICssStyleDeclaration style)
///
[DomName("padding")]
[DomAccessor(Accessors.Setter)]
- public static void SetPadding(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPadding(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Padding, value);
- }
///
/// Gets the amount of space to insert between the bottom
@@ -3462,10 +2822,8 @@ public static void SetPadding(this ICssStyleDeclaration style, String value)
///
[DomName("paddingBottom")]
[DomAccessor(Accessors.Getter)]
- public static String GetPaddingBottom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PaddingBottom);
- }
+ public static String GetPaddingBottom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PaddingBottom);
///
/// Sets the amount of space to insert between the bottom
@@ -3473,10 +2831,8 @@ public static String GetPaddingBottom(this ICssStyleDeclaration style)
///
[DomName("paddingBottom")]
[DomAccessor(Accessors.Setter)]
- public static void SetPaddingBottom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPaddingBottom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PaddingBottom, value);
- }
///
/// Gets the amount of space to insert between the left
@@ -3484,10 +2840,8 @@ public static void SetPaddingBottom(this ICssStyleDeclaration style, String valu
///
[DomName("paddingLeft")]
[DomAccessor(Accessors.Getter)]
- public static String GetPaddingLeft(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PaddingLeft);
- }
+ public static String GetPaddingLeft(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PaddingLeft);
///
/// Sets the amount of space to insert between the left
@@ -3495,10 +2849,8 @@ public static String GetPaddingLeft(this ICssStyleDeclaration style)
///
[DomName("paddingLeft")]
[DomAccessor(Accessors.Setter)]
- public static void SetPaddingLeft(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPaddingLeft(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PaddingLeft, value);
- }
///
/// Gets the amount of space to insert between the right border
@@ -3506,10 +2858,8 @@ public static void SetPaddingLeft(this ICssStyleDeclaration style, String value)
///
[DomName("paddingRight")]
[DomAccessor(Accessors.Getter)]
- public static String GetPaddingRight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PaddingRight);
- }
+ public static String GetPaddingRight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PaddingRight);
///
/// Sets the amount of space to insert between the right border
@@ -3517,10 +2867,8 @@ public static String GetPaddingRight(this ICssStyleDeclaration style)
///
[DomName("paddingRight")]
[DomAccessor(Accessors.Setter)]
- public static void SetPaddingRight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPaddingRight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PaddingRight, value);
- }
///
/// Gets the amount of space to insert between the top border
@@ -3528,10 +2876,8 @@ public static void SetPaddingRight(this ICssStyleDeclaration style, String value
///
[DomName("paddingTop")]
[DomAccessor(Accessors.Getter)]
- public static String GetPaddingTop(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PaddingTop);
- }
+ public static String GetPaddingTop(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PaddingTop);
///
/// Sets the amount of space to insert between the top border
@@ -3539,10 +2885,8 @@ public static String GetPaddingTop(this ICssStyleDeclaration style)
///
[DomName("paddingTop")]
[DomAccessor(Accessors.Setter)]
- public static void SetPaddingTop(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPaddingTop(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PaddingTop, value);
- }
///
/// Gets a value indicating whether a page break occurs after
@@ -3550,10 +2894,8 @@ public static void SetPaddingTop(this ICssStyleDeclaration style, String value)
///
[DomName("pageBreakAfter")]
[DomAccessor(Accessors.Getter)]
- public static String GetPageBreakAfter(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PageBreakAfter);
- }
+ public static String GetPageBreakAfter(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PageBreakAfter);
///
/// Sets a value indicating whether a page break occurs after
@@ -3561,10 +2903,8 @@ public static String GetPageBreakAfter(this ICssStyleDeclaration style)
///
[DomName("pageBreakAfter")]
[DomAccessor(Accessors.Setter)]
- public static void SetPageBreakAfter(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPageBreakAfter(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PageBreakAfter, value);
- }
///
/// Gets a string indicating whether a page break occurs before
@@ -3572,10 +2912,8 @@ public static void SetPageBreakAfter(this ICssStyleDeclaration style, String val
///
[DomName("pageBreakBefore")]
[DomAccessor(Accessors.Getter)]
- public static String GetPageBreakBefore(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PageBreakBefore);
- }
+ public static String GetPageBreakBefore(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PageBreakBefore);
///
/// Sets a string indicating whether a page break occurs before
@@ -3583,10 +2921,8 @@ public static String GetPageBreakBefore(this ICssStyleDeclaration style)
///
[DomName("pageBreakBefore")]
[DomAccessor(Accessors.Setter)]
- public static void SetPageBreakBefore(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPageBreakBefore(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PageBreakBefore, value);
- }
///
/// Gets a string indicating whether a page break is allowed to
@@ -3594,10 +2930,8 @@ public static void SetPageBreakBefore(this ICssStyleDeclaration style, String va
///
[DomName("pageBreakInside")]
[DomAccessor(Accessors.Getter)]
- public static String GetPageBreakInside(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PageBreakInside);
- }
+ public static String GetPageBreakInside(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PageBreakInside);
///
/// Sets a string indicating whether a page break is allowed to
@@ -3605,10 +2939,8 @@ public static String GetPageBreakInside(this ICssStyleDeclaration style)
///
[DomName("pageBreakInside")]
[DomAccessor(Accessors.Setter)]
- public static void SetPageBreakInside(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPageBreakInside(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PageBreakInside, value);
- }
///
/// Gets a value that represents the perspective from which all
@@ -3616,10 +2948,8 @@ public static void SetPageBreakInside(this ICssStyleDeclaration style, String va
///
[DomName("perspective")]
[DomAccessor(Accessors.Getter)]
- public static String GetPerspective(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Perspective);
- }
+ public static String GetPerspective(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Perspective);
///
/// Sets a value that represents the perspective from which all
@@ -3627,10 +2957,8 @@ public static String GetPerspective(this ICssStyleDeclaration style)
///
[DomName("perspective")]
[DomAccessor(Accessors.Setter)]
- public static void SetPerspective(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPerspective(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Perspective, value);
- }
///
/// Gets one or two values that represent the origin (the
@@ -3639,10 +2967,8 @@ public static void SetPerspective(this ICssStyleDeclaration style, String value)
///
[DomName("perspectiveOrigin")]
[DomAccessor(Accessors.Getter)]
- public static String GetPerspectiveOrigin(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PerspectiveOrigin);
- }
+ public static String GetPerspectiveOrigin(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PerspectiveOrigin);
///
/// Sets one or two values that represent the origin (the
@@ -3651,10 +2977,8 @@ public static String GetPerspectiveOrigin(this ICssStyleDeclaration style)
///
[DomName("perspectiveOrigin")]
[DomAccessor(Accessors.Setter)]
- public static void SetPerspectiveOrigin(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPerspectiveOrigin(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PerspectiveOrigin, value);
- }
///
/// Gets a value that specifies under what circumstances a
@@ -3663,10 +2987,8 @@ public static void SetPerspectiveOrigin(this ICssStyleDeclaration style, String
///
[DomName("pointerEvents")]
[DomAccessor(Accessors.Getter)]
- public static String GetPointerEvents(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.PointerEvents);
- }
+ public static String GetPointerEvents(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.PointerEvents);
///
/// Sets a value that specifies under what circumstances a
@@ -3675,10 +2997,8 @@ public static String GetPointerEvents(this ICssStyleDeclaration style)
///
[DomName("pointerEvents")]
[DomAccessor(Accessors.Setter)]
- public static void SetPointerEvents(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPointerEvents(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.PointerEvents, value);
- }
///
/// Gets the pairs of strings to be used as quotes in generated
@@ -3686,10 +3006,8 @@ public static void SetPointerEvents(this ICssStyleDeclaration style, String valu
///
[DomName("quotes")]
[DomAccessor(Accessors.Getter)]
- public static String GetQuotes(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Quotes);
- }
+ public static String GetQuotes(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Quotes);
///
/// Sets the pairs of strings to be used as quotes in generated
@@ -3697,30 +3015,24 @@ public static String GetQuotes(this ICssStyleDeclaration style)
///
[DomName("quotes")]
[DomAccessor(Accessors.Setter)]
- public static void SetQuotes(this ICssStyleDeclaration style, String value)
- {
+ public static void SetQuotes(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Quotes, value);
- }
///
/// Gets the type of positioning used for the object.
///
[DomName("position")]
[DomAccessor(Accessors.Getter)]
- public static String GetPosition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Position);
- }
+ public static String GetPosition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Position);
///
/// Sets the type of positioning used for the object.
///
[DomName("position")]
[DomAccessor(Accessors.Setter)]
- public static void SetPosition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetPosition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Position, value);
- }
///
/// Gets the position of the object relative to the right edge
@@ -3728,10 +3040,8 @@ public static void SetPosition(this ICssStyleDeclaration style, String value)
///
[DomName("right")]
[DomAccessor(Accessors.Getter)]
- public static String GetRight(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Right);
- }
+ public static String GetRight(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Right);
///
/// Sets the position of the object relative to the right edge
@@ -3739,10 +3049,8 @@ public static String GetRight(this ICssStyleDeclaration style)
///
[DomName("right")]
[DomAccessor(Accessors.Setter)]
- public static void SetRight(this ICssStyleDeclaration style, String value)
- {
+ public static void SetRight(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Right, value);
- }
///
/// Gets a value that indicates how to align the ruby text
@@ -3750,10 +3058,8 @@ public static void SetRight(this ICssStyleDeclaration style, String value)
///
[DomName("rubyAlign")]
[DomAccessor(Accessors.Getter)]
- public static String GetRubyAlign(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.RubyAlign);
- }
+ public static String GetRubyAlign(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.RubyAlign);
///
/// Sets a value that indicates how to align the ruby text
@@ -3761,10 +3067,8 @@ public static String GetRubyAlign(this ICssStyleDeclaration style)
///
[DomName("rubyAlign")]
[DomAccessor(Accessors.Setter)]
- public static void SetRubyAlign(this ICssStyleDeclaration style, String value)
- {
+ public static void SetRubyAlign(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.RubyAlign, value);
- }
///
/// Gets a value that indicates whether, and on which side,
@@ -3774,10 +3078,8 @@ public static void SetRubyAlign(this ICssStyleDeclaration style, String value)
///
[DomName("rubyOverhang")]
[DomAccessor(Accessors.Getter)]
- public static String GetRubyOverhang(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.RubyOverhang);
- }
+ public static String GetRubyOverhang(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.RubyOverhang);
///
/// Sets a value that indicates whether, and on which side,
@@ -3787,10 +3089,8 @@ public static String GetRubyOverhang(this ICssStyleDeclaration style)
///
[DomName("rubyOverhang")]
[DomAccessor(Accessors.Setter)]
- public static void SetRubyOverhang(this ICssStyleDeclaration style, String value)
- {
+ public static void SetRubyOverhang(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.RubyOverhang, value);
- }
///
/// Gets a value that controls the position of the ruby text
@@ -3798,10 +3098,8 @@ public static void SetRubyOverhang(this ICssStyleDeclaration style, String value
///
[DomName("rubyPosition")]
[DomAccessor(Accessors.Getter)]
- public static String GetRubyPosition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.RubyPosition);
- }
+ public static String GetRubyPosition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.RubyPosition);
///
/// Sets a value that controls the position of the ruby text
@@ -3809,10 +3107,8 @@ public static String GetRubyPosition(this ICssStyleDeclaration style)
///
[DomName("rubyPosition")]
[DomAccessor(Accessors.Setter)]
- public static void SetRubyPosition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetRubyPosition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.RubyPosition, value);
- }
///
/// Gets the color of the top and left edges of the scroll
@@ -3820,10 +3116,8 @@ public static void SetRubyPosition(this ICssStyleDeclaration style, String value
///
[DomName("scrollbar3dLightColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbar3dLightColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Scrollbar3dLightColor);
- }
+ public static String GetScrollbar3dLightColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Scrollbar3dLightColor);
///
/// Sets the color of the top and left edges of the scroll
@@ -3831,50 +3125,40 @@ public static String GetScrollbar3dLightColor(this ICssStyleDeclaration style)
///
[DomName("scrollbar3dLightColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbar3dLightColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbar3dLightColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Scrollbar3dLightColor, value);
- }
///
/// Gets the color of the arrow elements of a scroll arrow.
///
[DomName("scrollbarArrowColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarArrowColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarArrowColor);
- }
+ public static String GetScrollbarArrowColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarArrowColor);
///
/// Sets the color of the arrow elements of a scroll arrow.
///
[DomName("scrollbarArrowColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarArrowColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarArrowColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarArrowColor, value);
- }
///
/// Gets the color of the gutter of a scroll bar.
///
[DomName("scrollbarDarkShadowColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarDarkShadowColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarDarkShadowColor);
- }
+ public static String GetScrollbarDarkShadowColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarDarkShadowColor);
///
/// Sets the color of the gutter of a scroll bar.
///
[DomName("scrollbarDarkShadowColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarDarkShadowColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarDarkShadowColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarDarkShadowColor, value);
- }
///
/// Gets the color of the scroll box and scroll arrows of a
@@ -3882,10 +3166,8 @@ public static void SetScrollbarDarkShadowColor(this ICssStyleDeclaration style,
///
[DomName("scrollbarFaceColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarFaceColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarFaceColor);
- }
+ public static String GetScrollbarFaceColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarFaceColor);
///
/// Sets the color of the scroll box and scroll arrows of a
@@ -3893,10 +3175,8 @@ public static String GetScrollbarFaceColor(this ICssStyleDeclaration style)
///
[DomName("scrollbarFaceColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarFaceColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarFaceColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarFaceColor, value);
- }
///
/// Gets the color of the top and left edges of the scroll box
@@ -3904,10 +3184,8 @@ public static void SetScrollbarFaceColor(this ICssStyleDeclaration style, String
///
[DomName("scrollbarHighlightColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarHighlightColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarHighlightColor);
- }
+ public static String GetScrollbarHighlightColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarHighlightColor);
///
/// Sets the color of the top and left edges of the scroll box
@@ -3915,10 +3193,8 @@ public static String GetScrollbarHighlightColor(this ICssStyleDeclaration style)
///
[DomName("scrollbarHighlightColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarHighlightColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarHighlightColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarHighlightColor, value);
- }
///
/// Gets the color of the bottom and right edges of the scroll
@@ -3926,10 +3202,8 @@ public static void SetScrollbarHighlightColor(this ICssStyleDeclaration style, S
///
[DomName("scrollbarShadowColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarShadowColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarShadowColor);
- }
+ public static String GetScrollbarShadowColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarShadowColor);
///
/// Sets the color of the bottom and right edges of the scroll
@@ -3937,30 +3211,24 @@ public static String GetScrollbarShadowColor(this ICssStyleDeclaration style)
///
[DomName("scrollbarShadowColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarShadowColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarShadowColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarShadowColor, value);
- }
///
/// Gets the color of the track element of a scroll bar.
///
[DomName("scrollbarTrackColor")]
[DomAccessor(Accessors.Getter)]
- public static String GetScrollbarTrackColor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ScrollbarTrackColor);
- }
+ public static String GetScrollbarTrackColor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ScrollbarTrackColor);
///
/// Sets the color of the track element of a scroll bar.
///
[DomName("scrollbarTrackColor")]
[DomAccessor(Accessors.Setter)]
- public static void SetScrollbarTrackColor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetScrollbarTrackColor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ScrollbarTrackColor, value);
- }
///
/// Gets a value that indicates the color to paint along the
@@ -3968,10 +3236,8 @@ public static void SetScrollbarTrackColor(this ICssStyleDeclaration style, Strin
///
[DomName("stroke")]
[DomAccessor(Accessors.Getter)]
- public static String GetStroke(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Stroke);
- }
+ public static String GetStroke(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Stroke);
///
/// Sets a value that indicates the color to paint along the
@@ -3979,10 +3245,8 @@ public static String GetStroke(this ICssStyleDeclaration style)
///
[DomName("stroke")]
[DomAccessor(Accessors.Setter)]
- public static void SetStroke(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStroke(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Stroke, value);
- }
///
/// Gets one or more values that indicate the pattern of dashes
@@ -3990,10 +3254,8 @@ public static void SetStroke(this ICssStyleDeclaration style, String value)
///
[DomName("strokeDasharray")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeDashArray(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeDasharray);
- }
+ public static String GetStrokeDashArray(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeDasharray);
///
/// Sets one or more values that indicate the pattern of dashes
@@ -4001,10 +3263,8 @@ public static String GetStrokeDashArray(this ICssStyleDeclaration style)
///
[DomName("strokeDasharray")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeDashArray(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeDashArray(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeDasharray, value);
- }
///
/// Gets a value that specifies the distance into the dash
@@ -4012,10 +3272,8 @@ public static void SetStrokeDashArray(this ICssStyleDeclaration style, String va
///
[DomName("strokeDashoffset")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeDashOffset(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeDashoffset);
- }
+ public static String GetStrokeDashOffset(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeDashoffset);
///
/// Sets a value that specifies the distance into the dash
@@ -4023,10 +3281,8 @@ public static String GetStrokeDashOffset(this ICssStyleDeclaration style)
///
[DomName("strokeDashoffset")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeDashOffset(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeDashOffset(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeDashoffset, value);
- }
///
/// Gets a value that specifies the shape to be used at the end
@@ -4034,10 +3290,8 @@ public static void SetStrokeDashOffset(this ICssStyleDeclaration style, String v
///
[DomName("strokeLinecap")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeLineCap(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeLinecap);
- }
+ public static String GetStrokeLineCap(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeLinecap);
///
/// Sets a value that specifies the shape to be used at the end
@@ -4045,10 +3299,8 @@ public static String GetStrokeLineCap(this ICssStyleDeclaration style)
///
[DomName("strokeLinecap")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeLineCap(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeLineCap(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeLinecap, value);
- }
///
/// Gets a value that specifies the shape to be used at the
@@ -4056,10 +3308,8 @@ public static void SetStrokeLineCap(this ICssStyleDeclaration style, String valu
///
[DomName("strokeLinejoin")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeLineJoin(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeLinejoin);
- }
+ public static String GetStrokeLineJoin(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeLinejoin);
///
/// Sets a value that specifies the shape to be used at the
@@ -4067,10 +3317,8 @@ public static String GetStrokeLineJoin(this ICssStyleDeclaration style)
///
[DomName("strokeLinejoin")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeLineJoin(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeLineJoin(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeLinejoin, value);
- }
///
/// Gets a value that indicates the limit on the ratio of the
@@ -4079,10 +3327,8 @@ public static void SetStrokeLineJoin(this ICssStyleDeclaration style, String val
///
[DomName("strokeMiterlimit")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeMiterLimit(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeMiterlimit);
- }
+ public static String GetStrokeMiterLimit(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeMiterlimit);
///
/// Sets a value that indicates the limit on the ratio of the
@@ -4091,10 +3337,8 @@ public static String GetStrokeMiterLimit(this ICssStyleDeclaration style)
///
[DomName("strokeMiterlimit")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeMiterLimit(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeMiterLimit(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeMiterlimit, value);
- }
///
/// Gets a value that specifies the opacity of the painting
@@ -4102,10 +3346,8 @@ public static void SetStrokeMiterLimit(this ICssStyleDeclaration style, String v
///
[DomName("strokeOpacity")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeOpacity(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeOpacity);
- }
+ public static String GetStrokeOpacity(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeOpacity);
///
/// Sets a value that specifies the opacity of the painting
@@ -4113,10 +3355,8 @@ public static String GetStrokeOpacity(this ICssStyleDeclaration style)
///
[DomName("strokeOpacity")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeOpacity(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeOpacity(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeOpacity, value);
- }
///
/// Gets a value that specifies the width of the stroke on the
@@ -4124,10 +3364,8 @@ public static void SetStrokeOpacity(this ICssStyleDeclaration style, String valu
///
[DomName("strokeWidth")]
[DomAccessor(Accessors.Getter)]
- public static String GetStrokeWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.StrokeWidth);
- }
+ public static String GetStrokeWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.StrokeWidth);
///
/// Sets a value that specifies the width of the stroke on the
@@ -4135,10 +3373,8 @@ public static String GetStrokeWidth(this ICssStyleDeclaration style)
///
[DomName("strokeWidth")]
[DomAccessor(Accessors.Setter)]
- public static void SetStrokeWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetStrokeWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.StrokeWidth, value);
- }
///
/// Gets a string that indicates whether the table layout is
@@ -4146,10 +3382,8 @@ public static void SetStrokeWidth(this ICssStyleDeclaration style, String value)
///
[DomName("tableLayout")]
[DomAccessor(Accessors.Getter)]
- public static String GetTableLayout(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TableLayout);
- }
+ public static String GetTableLayout(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TableLayout);
///
/// Sets a string that indicates whether the table layout is
@@ -4157,10 +3391,8 @@ public static String GetTableLayout(this ICssStyleDeclaration style)
///
[DomName("tableLayout")]
[DomAccessor(Accessors.Setter)]
- public static void SetTableLayout(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTableLayout(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TableLayout, value);
- }
///
/// Gets whether the text in the object is left-aligned,
@@ -4168,10 +3400,8 @@ public static void SetTableLayout(this ICssStyleDeclaration style, String value)
///
[DomName("textAlign")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextAlign(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextAlign);
- }
+ public static String GetTextAlign(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextAlign);
///
/// Sets whether the text in the object is left-aligned,
@@ -4179,10 +3409,8 @@ public static String GetTextAlign(this ICssStyleDeclaration style)
///
[DomName("textAlign")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextAlign(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextAlign(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextAlign, value);
- }
///
@@ -4191,10 +3419,8 @@ public static void SetTextAlign(this ICssStyleDeclaration style, String value)
///
[DomName("textAlignLast")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextAlignLast(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextAlignLast);
- }
+ public static String GetTextAlignLast(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextAlignLast);
///
@@ -4203,30 +3429,24 @@ public static String GetTextAlignLast(this ICssStyleDeclaration style)
///
[DomName("textAlignLast")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextAlignLast(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextAlignLast(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextAlignLast, value);
- }
///
/// Gets aligns a string of text relative to the specified point.
///
[DomName("textAnchor")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextAnchor(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextAnchor);
- }
+ public static String GetTextAnchor(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextAnchor);
///
/// Sets aligns a string of text relative to the specified point.
///
[DomName("textAnchor")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextAnchor(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextAnchor(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextAnchor, value);
- }
///
/// Gets the autospacing and narrow space width adjustment of
@@ -4234,10 +3454,8 @@ public static void SetTextAnchor(this ICssStyleDeclaration style, String value)
///
[DomName("textAutospace")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextAutospace(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextAutospace);
- }
+ public static String GetTextAutospace(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextAutospace);
///
/// Sets the autospacing and narrow space width adjustment of
@@ -4245,10 +3463,8 @@ public static String GetTextAutospace(this ICssStyleDeclaration style)
///
[DomName("textAutospace")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextAutospace(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextAutospace(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextAutospace, value);
- }
///
/// Gets a value that indicates whether the text in the object
@@ -4256,10 +3472,8 @@ public static void SetTextAutospace(this ICssStyleDeclaration style, String valu
///
[DomName("textDecoration")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextDecoration(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextDecoration);
- }
+ public static String GetTextDecoration(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextDecoration);
///
/// Sets a value that indicates whether the text in the object
@@ -4267,10 +3481,8 @@ public static String GetTextDecoration(this ICssStyleDeclaration style)
///
[DomName("textDecoration")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextDecoration(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextDecoration(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextDecoration, value);
- }
///
/// Gets the indentation of the first line of text in the
@@ -4278,10 +3490,8 @@ public static void SetTextDecoration(this ICssStyleDeclaration style, String val
///
[DomName("textIndent")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextIndent(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextIndent);
- }
+ public static String GetTextIndent(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextIndent);
///
/// Sets the indentation of the first line of text in the
@@ -4289,10 +3499,8 @@ public static String GetTextIndent(this ICssStyleDeclaration style)
///
[DomName("textIndent")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextIndent(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextIndent(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextIndent, value);
- }
///
/// Gets the type of alignment used to justify text in the
@@ -4300,10 +3508,8 @@ public static void SetTextIndent(this ICssStyleDeclaration style, String value)
///
[DomName("textJustify")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextJustify(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextJustify);
- }
+ public static String GetTextJustify(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextJustify);
///
/// Sets the type of alignment used to justify text in the
@@ -4311,10 +3517,8 @@ public static String GetTextJustify(this ICssStyleDeclaration style)
///
[DomName("textJustify")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextJustify(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextJustify(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextJustify, value);
- }
///
/// Gets a value that indicates whether to render ellipses
@@ -4322,10 +3526,8 @@ public static void SetTextJustify(this ICssStyleDeclaration style, String value)
///
[DomName("textOverflow")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextOverflow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextOverflow);
- }
+ public static String GetTextOverflow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextOverflow);
///
/// Sets a value that indicates whether to render ellipses
@@ -4333,10 +3535,8 @@ public static String GetTextOverflow(this ICssStyleDeclaration style)
///
[DomName("textOverflow")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextOverflow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextOverflow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextOverflow, value);
- }
///
/// Gets a comma-separated list of shadows that attaches one or
@@ -4344,10 +3544,8 @@ public static void SetTextOverflow(this ICssStyleDeclaration style, String value
///
[DomName("textShadow")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextShadow(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextShadow);
- }
+ public static String GetTextShadow(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextShadow);
///
/// Sets a comma-separated list of shadows that attaches one or
@@ -4355,30 +3553,24 @@ public static String GetTextShadow(this ICssStyleDeclaration style)
///
[DomName("textShadow")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextShadow(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextShadow(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextShadow, value);
- }
///
/// Gets the rendering of the text in the object.
///
[DomName("textTransform")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextTransform(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextTransform);
- }
+ public static String GetTextTransform(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextTransform);
///
/// Sets the rendering of the text in the object.
///
[DomName("textTransform")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextTransform(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextTransform(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextTransform, value);
- }
///
/// Gets the position of the underline decoration that is set
@@ -4386,10 +3578,8 @@ public static void SetTextTransform(this ICssStyleDeclaration style, String valu
///
[DomName("textUnderlinePosition")]
[DomAccessor(Accessors.Getter)]
- public static String GetTextUnderlinePosition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TextUnderlinePosition);
- }
+ public static String GetTextUnderlinePosition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TextUnderlinePosition);
///
/// Sets the position of the underline decoration that is set
@@ -4397,10 +3587,8 @@ public static String GetTextUnderlinePosition(this ICssStyleDeclaration style)
///
[DomName("textUnderlinePosition")]
[DomAccessor(Accessors.Setter)]
- public static void SetTextUnderlinePosition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTextUnderlinePosition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TextUnderlinePosition, value);
- }
///
/// Gets the position of the object relative to the top of the
@@ -4408,10 +3596,8 @@ public static void SetTextUnderlinePosition(this ICssStyleDeclaration style, Str
///
[DomName("top")]
[DomAccessor(Accessors.Getter)]
- public static String GetTop(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Top);
- }
+ public static String GetTop(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Top);
///
/// Sets the position of the object relative to the top of the
@@ -4419,10 +3605,8 @@ public static String GetTop(this ICssStyleDeclaration style)
///
[DomName("top")]
[DomAccessor(Accessors.Setter)]
- public static void SetTop(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTop(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Top, value);
- }
///
/// Gets a list of one or more transform functions that specify
@@ -4430,10 +3614,8 @@ public static void SetTop(this ICssStyleDeclaration style, String value)
///
[DomName("transform")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransform(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Transform);
- }
+ public static String GetTransform(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Transform);
///
/// Sets a list of one or more transform functions that specify
@@ -4441,10 +3623,8 @@ public static String GetTransform(this ICssStyleDeclaration style)
///
[DomName("transform")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransform(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransform(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Transform, value);
- }
///
/// Gets one or two values that establish the origin of
@@ -4452,10 +3632,8 @@ public static void SetTransform(this ICssStyleDeclaration style, String value)
///
[DomName("transformOrigin")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransformOrigin(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransformOrigin);
- }
+ public static String GetTransformOrigin(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransformOrigin);
///
/// Sets one or two values that establish the origin of
@@ -4463,10 +3641,8 @@ public static String GetTransformOrigin(this ICssStyleDeclaration style)
///
[DomName("transformOrigin")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransformOrigin(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransformOrigin(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransformOrigin, value);
- }
///
/// Gets a value that specifies how child elements of the
@@ -4474,10 +3650,8 @@ public static void SetTransformOrigin(this ICssStyleDeclaration style, String va
///
[DomName("transformStyle")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransformStyle(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransformStyle);
- }
+ public static String GetTransformStyle(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransformStyle);
///
/// Sets a value that specifies how child elements of the
@@ -4485,10 +3659,8 @@ public static String GetTransformStyle(this ICssStyleDeclaration style)
///
[DomName("transformStyle")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransformStyle(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransformStyle(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransformStyle, value);
- }
///
/// Gets one or more shorthand values that specify the
@@ -4497,10 +3669,8 @@ public static void SetTransformStyle(this ICssStyleDeclaration style, String val
///
[DomName("transition")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransition(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Transition);
- }
+ public static String GetTransition(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Transition);
///
/// Sets one or more shorthand values that specify the
@@ -4509,10 +3679,8 @@ public static String GetTransition(this ICssStyleDeclaration style)
///
[DomName("transition")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransition(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransition(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Transition, value);
- }
///
/// Gets one or more values that specify the offset within a
@@ -4522,10 +3690,8 @@ public static void SetTransition(this ICssStyleDeclaration style, String value)
///
[DomName("transitionDelay")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransitionDelay(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransitionDelay);
- }
+ public static String GetTransitionDelay(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransitionDelay);
///
/// Sets one or more values that specify the offset within a
@@ -4535,10 +3701,8 @@ public static String GetTransitionDelay(this ICssStyleDeclaration style)
///
[DomName("transitionDelay")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransitionDelay(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransitionDelay(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransitionDelay, value);
- }
///
/// Gets one or more values that specify the durations of
@@ -4547,10 +3711,8 @@ public static void SetTransitionDelay(this ICssStyleDeclaration style, String va
///
[DomName("transitionDuration")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransitionDuration(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransitionDuration);
- }
+ public static String GetTransitionDuration(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransitionDuration);
///
/// Sets one or more values that specify the durations of
@@ -4559,10 +3721,8 @@ public static String GetTransitionDuration(this ICssStyleDeclaration style)
///
[DomName("transitionDuration")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransitionDuration(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransitionDuration(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransitionDuration, value);
- }
///
/// Gets a value that identifies the CSS property name or names
@@ -4572,10 +3732,8 @@ public static void SetTransitionDuration(this ICssStyleDeclaration style, String
///
[DomName("transitionProperty")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransitionProperty(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransitionProperty);
- }
+ public static String GetTransitionProperty(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransitionProperty);
///
/// Sets a value that identifies the CSS property name or names
@@ -4585,10 +3743,8 @@ public static String GetTransitionProperty(this ICssStyleDeclaration style)
///
[DomName("transitionProperty")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransitionProperty(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransitionProperty(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransitionProperty, value);
- }
///
/// Gets one or more values that specify the intermediate
@@ -4598,10 +3754,8 @@ public static void SetTransitionProperty(this ICssStyleDeclaration style, String
///
[DomName("transitionTimingFunction")]
[DomAccessor(Accessors.Getter)]
- public static String GetTransitionTimingFunction(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.TransitionTimingFunction);
- }
+ public static String GetTransitionTimingFunction(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.TransitionTimingFunction);
///
/// Sets one or more values that specify the intermediate
@@ -4611,10 +3765,8 @@ public static String GetTransitionTimingFunction(this ICssStyleDeclaration style
///
[DomName("transitionTimingFunction")]
[DomAccessor(Accessors.Setter)]
- public static void SetTransitionTimingFunction(this ICssStyleDeclaration style, String value)
- {
+ public static void SetTransitionTimingFunction(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.TransitionTimingFunction, value);
- }
///
/// Gets the level of embedding with respect to the
@@ -4622,10 +3774,8 @@ public static void SetTransitionTimingFunction(this ICssStyleDeclaration style,
///
[DomName("unicodeBidi")]
[DomAccessor(Accessors.Getter)]
- public static String GetUnicodeBidi(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.UnicodeBidi);
- }
+ public static String GetUnicodeBidi(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.UnicodeBidi);
///
/// Sets the level of embedding with respect to the
@@ -4633,50 +3783,40 @@ public static String GetUnicodeBidi(this ICssStyleDeclaration style)
///
[DomName("unicodeBidi")]
[DomAccessor(Accessors.Setter)]
- public static void SetUnicodeBidi(this ICssStyleDeclaration style, String value)
- {
+ public static void SetUnicodeBidi(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.UnicodeBidi, value);
- }
///
/// Gets the vertical alignment of the object.
///
[DomName("verticalAlign")]
[DomAccessor(Accessors.Getter)]
- public static String GetVerticalAlign(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.VerticalAlign);
- }
+ public static String GetVerticalAlign(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.VerticalAlign);
///
/// Sets the vertical alignment of the object.
///
[DomName("verticalAlign")]
[DomAccessor(Accessors.Setter)]
- public static void SetVerticalAlign(this ICssStyleDeclaration style, String value)
- {
+ public static void SetVerticalAlign(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.VerticalAlign, value);
- }
///
/// Gets whether the content of the object is displayed.
///
[DomName("visibility")]
[DomAccessor(Accessors.Getter)]
- public static String GetVisibility(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Visibility);
- }
+ public static String GetVisibility(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Visibility);
///
/// Sets whether the content of the object is displayed.
///
[DomName("visibility")]
[DomAccessor(Accessors.Setter)]
- public static void SetVisibility(this ICssStyleDeclaration style, String value)
- {
+ public static void SetVisibility(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Visibility, value);
- }
///
/// Gets a value that indicates whether lines are automatically
@@ -4684,10 +3824,8 @@ public static void SetVisibility(this ICssStyleDeclaration style, String value)
///
[DomName("whiteSpace")]
[DomAccessor(Accessors.Getter)]
- public static String GetWhiteSpace(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.WhiteSpace);
- }
+ public static String GetWhiteSpace(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.WhiteSpace);
///
/// Sets a value that indicates whether lines are automatically
@@ -4695,10 +3833,8 @@ public static String GetWhiteSpace(this ICssStyleDeclaration style)
///
[DomName("whiteSpace")]
[DomAccessor(Accessors.Setter)]
- public static void SetWhiteSpace(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWhiteSpace(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.WhiteSpace, value);
- }
///
/// Gets the minimum number of lines of a paragraph that must
@@ -4706,10 +3842,8 @@ public static void SetWhiteSpace(this ICssStyleDeclaration style, String value)
///
[DomName("widows")]
[DomAccessor(Accessors.Getter)]
- public static String GetWidows(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Widows);
- }
+ public static String GetWidows(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Widows);
///
/// Sets the minimum number of lines of a paragraph that must
@@ -4717,30 +3851,24 @@ public static String GetWidows(this ICssStyleDeclaration style)
///
[DomName("widows")]
[DomAccessor(Accessors.Setter)]
- public static void SetWidows(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWidows(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Widows, value);
- }
///
/// Gets the width of the object.
///
[DomName("width")]
[DomAccessor(Accessors.Getter)]
- public static String GetWidth(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Width);
- }
+ public static String GetWidth(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Width);
///
/// Sets the width of the object.
///
[DomName("width")]
[DomAccessor(Accessors.Setter)]
- public static void SetWidth(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWidth(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Width, value);
- }
///
/// Gets line-breaking behavior within words, particularly
@@ -4748,10 +3876,8 @@ public static void SetWidth(this ICssStyleDeclaration style, String value)
///
[DomName("wordBreak")]
[DomAccessor(Accessors.Getter)]
- public static String GetWordBreak(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.WordBreak);
- }
+ public static String GetWordBreak(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.WordBreak);
///
/// Sets line-breaking behavior within words, particularly
@@ -4759,10 +3885,8 @@ public static String GetWordBreak(this ICssStyleDeclaration style)
///
[DomName("wordBreak")]
[DomAccessor(Accessors.Setter)]
- public static void SetWordBreak(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWordBreak(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.WordBreak, value);
- }
///
/// Gets the amount of additional space between words in the
@@ -4770,10 +3894,8 @@ public static void SetWordBreak(this ICssStyleDeclaration style, String value)
///
[DomName("wordSpacing")]
[DomAccessor(Accessors.Getter)]
- public static String GetWordSpacing(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.WordSpacing);
- }
+ public static String GetWordSpacing(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.WordSpacing);
///
/// Sets the amount of additional space between words in the
@@ -4781,10 +3903,8 @@ public static String GetWordSpacing(this ICssStyleDeclaration style)
///
[DomName("wordSpacing")]
[DomAccessor(Accessors.Setter)]
- public static void SetWordSpacing(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWordSpacing(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.WordSpacing, value);
- }
///
/// Gets whether to break words when the content exceeds the
@@ -4792,10 +3912,8 @@ public static void SetWordSpacing(this ICssStyleDeclaration style, String value)
///
[DomName("wordWrap")]
[DomAccessor(Accessors.Getter)]
- public static String GetWordWrap(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.WordWrap);
- }
+ public static String GetWordWrap(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.WordWrap);
///
/// Sets whether to break words when the content exceeds the
@@ -4803,89 +3921,71 @@ public static String GetWordWrap(this ICssStyleDeclaration style)
///
[DomName("wordWrap")]
[DomAccessor(Accessors.Setter)]
- public static void SetWordWrap(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWordWrap(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.WordWrap, value);
- }
///
/// Gets the overflow-wrap value.
///
[DomName("overflowWrap")]
[DomAccessor(Accessors.Getter)]
- public static String GetOverflowWrap(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.OverflowWrap);
- }
+ public static String GetOverflowWrap(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.OverflowWrap);
///
/// Sets the overflow-wrap value.
///
[DomName("overflowWrap")]
[DomAccessor(Accessors.Setter)]
- public static void SetOverflowWrap(this ICssStyleDeclaration style, String value)
- {
+ public static void SetOverflowWrap(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.OverflowWrap, value);
- }
///
/// Gets the direction and flow of the content in the object.
///
[DomName("writingMode")]
[DomAccessor(Accessors.Getter)]
- public static String GetWritingMode(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.WritingMode);
- }
+ public static String GetWritingMode(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.WritingMode);
///
/// Sets the direction and flow of the content in the object.
///
[DomName("writingMode")]
[DomAccessor(Accessors.Setter)]
- public static void SetWritingMode(this ICssStyleDeclaration style, String value)
- {
+ public static void SetWritingMode(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.WritingMode, value);
- }
///
/// Gets the stacking order of positioned objects.
///
[DomName("zIndex")]
[DomAccessor(Accessors.Getter)]
- public static String GetZIndex(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.ZIndex);
- }
+ public static String GetZIndex(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.ZIndex);
///
/// Sets the stacking order of positioned objects.
///
[DomName("zIndex")]
[DomAccessor(Accessors.Setter)]
- public static void SetZIndex(this ICssStyleDeclaration style, String value)
- {
+ public static void SetZIndex(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.ZIndex, value);
- }
///
/// Gets the magnification scale of the object.
///
[DomName("zoom")]
[DomAccessor(Accessors.Getter)]
- public static String GetZoom(this ICssStyleDeclaration style)
- {
- return style.GetPropertyValue(PropertyNames.Zoom);
- }
+ public static String GetZoom(this ICssStyleDeclaration style) =>
+ style.GetPropertyValue(PropertyNames.Zoom);
///
/// Sets the magnification scale of the object.
///
[DomName("zoom")]
[DomAccessor(Accessors.Setter)]
- public static void SetZoom(this ICssStyleDeclaration style, String value)
- {
+ public static void SetZoom(this ICssStyleDeclaration style, String value) =>
style.SetProperty(PropertyNames.Zoom, value);
- }
}
}
diff --git a/src/AngleSharp.Css/Extensions/CssApiExtensions.cs b/src/AngleSharp.Css/Extensions/CssApiExtensions.cs
index 4aa2e12d..272520df 100644
--- a/src/AngleSharp.Css/Extensions/CssApiExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/CssApiExtensions.cs
@@ -19,9 +19,7 @@ public static class CssApiExtensions
/// The computed style declaration if available.
public static ICssStyleDeclaration ComputeCurrentStyle(this IElement element)
{
- if (element == null)
- throw new ArgumentNullException(nameof(element));
-
+ element = element ?? throw new ArgumentNullException(nameof(element));
var document = element.Owner;
var window = document?.DefaultView;
return window?.GetComputedStyle(element);
@@ -39,13 +37,10 @@ public static ICssStyleDeclaration ComputeCurrentStyle(this IElement element)
///
/// The collection itself.
public static T Css(this T elements, String propertyName, String propertyValue)
- where T : IEnumerable
+ where T : class, IEnumerable
{
- if (elements == null)
- throw new ArgumentNullException(nameof(elements));
-
- if (propertyName == null)
- throw new ArgumentNullException(nameof(propertyName));
+ elements = elements ?? throw new ArgumentNullException(nameof(elements));
+ propertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName));
foreach (var element in elements.OfType())
{
@@ -66,13 +61,10 @@ public static T Css(this T elements, String propertyName, String propertyValu
///
/// The collection itself.
public static T Css(this T elements, IEnumerable> properties)
- where T : IEnumerable
+ where T : class, IEnumerable
{
- if (elements == null)
- throw new ArgumentNullException(nameof(elements));
-
- if (properties == null)
- throw new ArgumentNullException(nameof(properties));
+ elements = elements ?? throw new ArgumentNullException(nameof(elements));
+ properties = properties ?? throw new ArgumentNullException(nameof(properties));
foreach (var element in elements.OfType())
{
@@ -97,7 +89,7 @@ public static T Css(this T elements, IEnumerable
///
/// The collection itself.
public static T Css(this T elements, Object properties)
- where T : IEnumerable
+ where T : class, IEnumerable
{
var realProperties = properties.ToDictionary();
return elements.Css(realProperties);
diff --git a/src/AngleSharp.Css/Extensions/CssOmExtensions.cs b/src/AngleSharp.Css/Extensions/CssOmExtensions.cs
new file mode 100644
index 00000000..e8607017
--- /dev/null
+++ b/src/AngleSharp.Css/Extensions/CssOmExtensions.cs
@@ -0,0 +1,68 @@
+namespace AngleSharp.Css.Dom
+{
+ using AngleSharp.Css.Parser;
+ using AngleSharp.Text;
+ using System;
+ using System.Linq;
+
+ ///
+ /// CSSOM API extension methods.
+ ///
+ public static class CssOmExtensions
+ {
+ ///
+ /// Gets the style rule with the provided selector text.
+ ///
+ /// The container rule.
+ /// The selector text to look for.
+ /// The style rule, if any.
+ public static ICssStyleRule GetStyleRuleWith(this ICssGroupingRule rule, String selectorText) =>
+ rule.Rules.GetStyleRuleWith(selectorText, rule.Owner?.Context);
+
+ ///
+ /// Gets the style rule with the provided selector text.
+ ///
+ /// The sheet.
+ /// The selector text to look for.
+ /// The style rule, if any.
+ public static ICssStyleRule GetStyleRuleWith(this ICssStyleSheet sheet, String selectorText) =>
+ sheet.Rules.GetStyleRuleWith(selectorText, sheet.Context);
+
+ ///
+ /// Gets the style rule with the provided selector text.
+ ///
+ /// The rules to look in.
+ /// The selector text to look for.
+ /// The context for normalizing the CSS selector.
+ /// The style rule, if any.
+ public static ICssStyleRule GetStyleRuleWith(this ICssRuleList rules, String selectorText, IBrowsingContext context = null)
+ {
+ var styleRules = rules.OfType();
+ var parser = context?.GetService();
+ var normalizedSelectorText = parser?.ParseSelector(selectorText)?.Text ?? selectorText;
+
+ foreach (var rule in styleRules)
+ {
+ if (rule.SelectorText.Is(normalizedSelectorText))
+ {
+ return rule;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the ICssValue of a property with the given name.
+ ///
+ /// The rule to extend.
+ /// The property to obtain.
+ /// The value of the provided property, if any.
+ public static ICssValue GetValueOf(this ICssStyleRule rule, String propertyName)
+ {
+ rule = rule ?? throw new ArgumentNullException(nameof(rule));
+ var property = rule.Style.GetProperty(propertyName);
+ return property?.RawValue;
+ }
+ }
+}
diff --git a/src/AngleSharp.Css/Extensions/CssValueExtensions.cs b/src/AngleSharp.Css/Extensions/CssValueExtensions.cs
new file mode 100644
index 00000000..4143c1eb
--- /dev/null
+++ b/src/AngleSharp.Css/Extensions/CssValueExtensions.cs
@@ -0,0 +1,289 @@
+namespace AngleSharp.Css.Dom
+{
+ using AngleSharp.Css.Values;
+ using AngleSharp.Text;
+ using System;
+
+ ///
+ /// Extensions for the ICssValue interface.
+ ///
+ public static class CssValueExtensions
+ {
+ ///
+ /// Tries to convert the value to a unitless double precision number.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsDouble(this ICssValue value)
+ {
+ if (value is Length length && length.Type == Length.Unit.None)
+ {
+ return length.Value;
+ }
+ else if (value is Fraction fr)
+ {
+ return fr.Value;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsDouble();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsDouble();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to a number of pixels.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsPx(this ICssValue value)
+ {
+ if (value is Length length && length.Type != Length.Unit.None)
+ {
+ return length.ToPixel();
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsPx();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsPx();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to a number of milliseconds.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsMs(this ICssValue value)
+ {
+ if (value is Time time && time.Type != Time.Unit.None)
+ {
+ return time.ToMilliseconds();
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsMs();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsMs();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to a number of hertz.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsHz(this ICssValue value)
+ {
+ if (value is Frequency freq && freq.Type != Frequency.Unit.None)
+ {
+ return freq.ToHertz();
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsHz();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsHz();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to a number of degrees.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsDeg(this ICssValue value)
+ {
+ if (value is Angle angle && angle.Type != Angle.Unit.None)
+ {
+ return angle.Value;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsDeg();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsDeg();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to a number of dots per inch.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Double AsDpi(this ICssValue value)
+ {
+ if (value is Resolution res && res.Type != Resolution.Unit.None)
+ {
+ return res.ToDotsPerPixel();
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsDpi();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsDpi();
+ }
+
+ return 0.0;
+ }
+
+ ///
+ /// Tries to convert the value to an RGBA integer.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Int32 AsRgba(this ICssValue value)
+ {
+ if (value is Color res)
+ {
+ return res.Value;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsRgba();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsRgba();
+ }
+
+ return Color.Black.Value;
+ }
+
+ ///
+ /// Tries to convert the value to an RGBA integer.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static String AsUrl(this ICssValue value)
+ {
+ if (value is CssUrlValue res)
+ {
+ return res.Path;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsUrl();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsUrl();
+ }
+
+ return null;
+ }
+
+ ///
+ /// Tries to convert the value to a transformation matrix.
+ ///
+ /// The value to convert.
+ /// The resulting matrix.
+ public static TransformMatrix AsMatrix(this ICssValue value)
+ {
+ if (value is ICssTransformFunctionValue res)
+ {
+ return res.ComputeMatrix();
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsMatrix();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsMatrix();
+ }
+
+ return null;
+ }
+
+ ///
+ /// Tries to convert the value to a unitless integer number.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Int32 AsInt32(this ICssValue value) => (Int32)value.AsDouble();
+
+ ///
+ /// Tries to convert the value to a boolean.
+ ///
+ /// The value to convert.
+ /// The resulting number.
+ public static Boolean AsBoolean(this ICssValue value) => value.AsInt32() != 0;
+
+ ///
+ /// Tries to match the value against a specified enumeration.
+ ///
+ /// The value to convert.
+ /// The enumeration value or its default value.
+ public static T AsEnum(this ICssValue value)
+ where T : struct, IComparable
+ {
+ if (value is Constant constant)
+ {
+ return constant.Value;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].AsEnum();
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.AsEnum();
+ }
+
+ return default(T);
+ }
+
+ ///
+ /// Tries to match the value against a known keyword.
+ ///
+ /// The value to convert.
+ /// The keyword to match.
+ /// True if the keyword was matched, false otherwise.
+ public static Boolean Is(this ICssValue value, String keyword)
+ {
+ if (value is Identifier ident && ident.Value.Isi(keyword))
+ {
+ return true;
+ }
+ else if (value?.GetType() == typeof(Constant<>) && value.CssText.Isi(keyword))
+ {
+ return true;
+ }
+ else if (value is ICssMultipleValue multiple && multiple.Count == 1)
+ {
+ return multiple[0].Is(keyword);
+ }
+ else if (value is ICssSpecialValue special && special.Value != null)
+ {
+ return special.Value.Is(keyword);
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/src/AngleSharp.Css/Extensions/DeclarationInfoExtensions.cs b/src/AngleSharp.Css/Extensions/DeclarationInfoExtensions.cs
index ad346c8f..e840bd35 100644
--- a/src/AngleSharp.Css/Extensions/DeclarationInfoExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/DeclarationInfoExtensions.cs
@@ -8,41 +8,58 @@ namespace AngleSharp.Css
static class DeclarationInfoExtensions
{
- public static ICssProperty[] CreateLonghands(this DeclarationInfo info, ICssValue value, Func createProperty)
+ public static IEnumerable GetMappings(this DeclarationInfo info) =>
+ info.Longhands.Length > 0 ? info.Longhands : Enumerable.Repeat(info.Name, 1);
+
+ public static ICssValue Collapse(this DeclarationInfo info, IDeclarationFactory factory, ICssValue[] longhands)
{
- var aggregator = info.Converter as IValueAggregator;
- var longhands = info.Longhands;
+ var initial = true;
+ var unset = true;
+ var child = true;
- if (value is ICssRawValue)
+ foreach (var longhand in longhands)
{
- var child = new CssChildValue(value);
- var values = Enumerable.Repeat(child, longhands.Length).ToArray();
- return CreateProperties(longhands, values, createProperty);
+ initial = initial && longhand is CssInitialValue;
+ unset = unset && longhand is CssUnsetValue;
+ child = child && longhand is CssChildValue;
}
- return CreateProperties(longhands, aggregator?.Split(value), createProperty);
- }
+ if (initial)
+ {
+ return new CssInitialValue(info.InitialValue);
+ }
+ else if (unset)
+ {
+ return new CssUnsetValue(info.InitialValue);
+ }
+ else if (child)
+ {
+ return ((CssChildValue)longhands[0]).Parent;
+ }
- public static IEnumerable GetMappings(this DeclarationInfo info)
- {
- return info.Longhands.Length > 0 ? info.Longhands : Enumerable.Repeat(info.Name, 1);
+ return info.Aggregator?.Merge(longhands);
}
- private static ICssProperty[] CreateProperties(String[] names, ICssValue[] values, Func createProperty)
+ public static ICssValue[] Expand(this DeclarationInfo info, IDeclarationFactory factory, ICssValue value)
{
- if (values != null && values.Length == names.Length)
- {
- var properties = new ICssProperty[names.Length];
-
- for (var i = 0; i < names.Length; i++)
- {
- properties[i] = createProperty(names[i], values[i]);
- }
+ var longhands = info.Longhands;
- return properties;
+ if (value is ICssRawValue || value is CssChildValue)
+ {
+ var child = new CssChildValue(value);
+ return Enumerable
+ .Repeat(child, longhands.Length)
+ .ToArray();
+ }
+ else if (value is CssInitialValue)
+ {
+ return longhands
+ .Select(name => new CssInitialValue(factory.Create(name)?.InitialValue))
+ .OfType()
+ .ToArray();
}
- return null;
+ return info.Aggregator?.Split(value);
}
}
}
diff --git a/src/AngleSharp.Css/Extensions/ElementExtensions.cs b/src/AngleSharp.Css/Extensions/ElementExtensions.cs
index acf871e8..698e11a5 100644
--- a/src/AngleSharp.Css/Extensions/ElementExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/ElementExtensions.cs
@@ -169,6 +169,7 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
{
elementHidden = elementStyle.GetDisplay() == "none";
}
+
if (!String.IsNullOrEmpty(elementStyle.GetVisibility()) && elementHidden != true)
{
elementHidden = elementStyle.GetVisibility() != "visible";
@@ -190,9 +191,8 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
InnerTextCollection(child, sb, requiredLineBreakCounts, elementStyle);
}
- if (node is IText)
+ if (node is IText textElement)
{
- var textElement = (IText)node;
ProcessText(textElement.Data, sb, parentStyle);
}
else if (node is IHtmlBreakRowElement)
@@ -201,9 +201,7 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
}
else if ((node is IHtmlTableCellElement && String.IsNullOrEmpty(elementStyle.GetDisplay())) || elementStyle.GetDisplay() == "table-cell")
{
- var nextSibling = node.NextSibling as IElement;
-
- if (nextSibling != null)
+ if (node.NextSibling is IElement nextSibling)
{
var nextSiblingCss = nextSibling.ComputeCurrentStyle();
@@ -215,9 +213,7 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
}
else if ((node is IHtmlTableRowElement && String.IsNullOrEmpty(elementStyle.GetDisplay())) || elementStyle.GetDisplay() == "table-row")
{
- var nextSibling = node.NextSibling as IElement;
-
- if (nextSibling != null)
+ if (node.NextSibling is IElement nextSibling)
{
var nextSiblingCss = nextSibling.ComputeCurrentStyle();
@@ -229,16 +225,14 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
}
else if (node is IHtmlParagraphElement)
{
- var startIndexCount = 0;
- requiredLineBreakCounts.TryGetValue(startIndex, out startIndexCount);
+ requiredLineBreakCounts.TryGetValue(startIndex, out int startIndexCount);
if (startIndexCount < 2)
{
requiredLineBreakCounts[startIndex] = 2;
}
- var endIndexCount = 0;
- requiredLineBreakCounts.TryGetValue(sb.Length, out endIndexCount);
+ requiredLineBreakCounts.TryGetValue(sb.Length, out int endIndexCount);
if (endIndexCount < 2)
{
@@ -261,16 +255,14 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
if (isBlockLevel.Value)
{
- var startIndexCount = 0;
- requiredLineBreakCounts.TryGetValue(startIndex, out startIndexCount);
+ requiredLineBreakCounts.TryGetValue(startIndex, out int startIndexCount);
if (startIndexCount < 1)
{
requiredLineBreakCounts[startIndex] = 1;
}
- var endIndexCount = 0;
- requiredLineBreakCounts.TryGetValue(sb.Length, out endIndexCount);
+ requiredLineBreakCounts.TryGetValue(sb.Length, out int endIndexCount);
if (endIndexCount < 1)
{
@@ -280,6 +272,26 @@ private static void ItcInCssBox(ICssStyleDeclaration elementStyle, ICssStyleDecl
}
}
+ ///
+ /// Sets the style on all elements of the collection.
+ ///
+ /// The type of elements.
+ /// The collection to go over.
+ /// The action to trigger for each element style.
+ /// The collection for chaining.
+ public static IEnumerable SetStyle(this IEnumerable elements, Action change)
+ where TElement : IElement
+ {
+ change = change ?? throw new ArgumentNullException(nameof(change));
+
+ foreach (var element in elements)
+ {
+ change.Invoke(element.GetStyle());
+ }
+
+ return elements;
+ }
+
private static Boolean HasCssBox(INode node)
{
switch (node.NodeName)
diff --git a/src/AngleSharp.Css/Extensions/MediaListExtensions.cs b/src/AngleSharp.Css/Extensions/MediaListExtensions.cs
index 37602619..8ed669c3 100644
--- a/src/AngleSharp.Css/Extensions/MediaListExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/MediaListExtensions.cs
@@ -7,7 +7,8 @@ namespace AngleSharp.Css.Dom
static class MediaListExtensions
{
- private readonly static ConditionalWeakTable AssociatedValidators = new ConditionalWeakTable();
+ private readonly static ConditionalWeakTable AssociatedValidators =
+ new ConditionalWeakTable();
private readonly static String[] KnownTypes =
{
@@ -21,22 +22,16 @@ static class MediaListExtensions
CssKeywords.All
};
- public static void AssociateValidator(this IMediaFeature feature, IFeatureValidator validator)
- {
+ public static void AssociateValidator(this IMediaFeature feature, IFeatureValidator validator) =>
AssociatedValidators.Add(feature, validator);
- }
public static Boolean Validate(this IMediaFeature feature, IRenderDevice device)
{
- var validator = default(IFeatureValidator);
- AssociatedValidators.TryGetValue(feature, out validator);
+ AssociatedValidators.TryGetValue(feature, out var validator);
return validator?.Validate(feature, device) ?? false;
}
- public static Boolean Validate(this IMediaList list, IRenderDevice device)
- {
- return !list.Any(m => !m.Validate(device));
- }
+ public static Boolean Validate(this IMediaList list, IRenderDevice device) => !list.Any(m => !m.Validate(device));
public static Boolean Validate(this ICssMedium medium, IRenderDevice device)
{
@@ -48,16 +43,12 @@ public static Boolean Validate(this ICssMedium medium, IRenderDevice device)
return !medium.IsInvalid(device) && !medium.Features.Any(m => m.Validate(device) == medium.IsInverse);
}
- private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device)
- {
- return medium.IsInvalid(device, CssKeywords.Screen, DeviceCategory.Screen) ||
- medium.IsInvalid(device, CssKeywords.Speech, DeviceCategory.Speech) ||
- medium.IsInvalid(device, CssKeywords.Print, DeviceCategory.Printer);
- }
+ private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device) =>
+ medium.IsInvalid(device, CssKeywords.Screen, DeviceCategory.Screen) ||
+ medium.IsInvalid(device, CssKeywords.Speech, DeviceCategory.Speech) ||
+ medium.IsInvalid(device, CssKeywords.Print, DeviceCategory.Printer);
- private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device, String keyword, DeviceCategory category)
- {
- return keyword.Is(medium.Type) && (device.Category == category) == medium.IsInverse;
- }
+ private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device, String keyword, DeviceCategory category) =>
+ device != null && keyword.Is(medium.Type) && device.Category == category == medium.IsInverse;
}
}
diff --git a/src/AngleSharp.Css/Extensions/StyleSheetExtensions.cs b/src/AngleSharp.Css/Extensions/StyleSheetExtensions.cs
index 5aec47ee..cf486916 100644
--- a/src/AngleSharp.Css/Extensions/StyleSheetExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/StyleSheetExtensions.cs
@@ -19,9 +19,7 @@ public static class StyleSheetExtensions
public static IEnumerable RulesOf(this IEnumerable sheets)
where TRule : ICssRule
{
- if (sheets == null)
- throw new ArgumentNullException(nameof(sheets));
-
+ sheets = sheets ?? throw new ArgumentNullException(nameof(sheets));
return sheets.Where(m => !m.IsDisabled).OfType().SelectMany(m => m.Rules).OfType();
}
@@ -33,9 +31,7 @@ public static IEnumerable RulesOf(this IEnumerable sh
/// The list of style rules.
public static IEnumerable StylesWith(this IEnumerable sheets, ISelector selector)
{
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
-
+ selector = selector ?? throw new ArgumentNullException(nameof(selector));
var selectorText = selector.Text;
return sheets.RulesOf().Where(m => m.SelectorText == selectorText);
}
@@ -45,9 +41,6 @@ public static IEnumerable StylesWith(this IEnumerable
/// The sheet.
/// The associated document, if any.
- public static IDocument GetDocument(this IStyleSheet sheet)
- {
- return sheet?.OwnerNode?.Owner;
- }
+ public static IDocument GetDocument(this IStyleSheet sheet) => sheet?.OwnerNode?.Owner;
}
}
diff --git a/src/AngleSharp.Css/Extensions/ValidationExtensions.cs b/src/AngleSharp.Css/Extensions/ValidationExtensions.cs
index 02fc5ccf..937c4cb5 100644
--- a/src/AngleSharp.Css/Extensions/ValidationExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/ValidationExtensions.cs
@@ -14,10 +14,7 @@ public static class ValidationExtensions
/// The rule to extend.
/// The device to check for support.
/// True if support is given, otherwise false.
- public static Boolean IsValid(this ICssSupportsRule rule, IRenderDevice device)
- {
- return rule.Condition.Check(device);
- }
+ public static Boolean IsValid(this ICssSupportsRule rule, IRenderDevice device) => rule.Condition.Check(device);
///
/// Determines if the rule is valid for a given device.
@@ -25,10 +22,7 @@ public static Boolean IsValid(this ICssSupportsRule rule, IRenderDevice device)
/// The rule to extend.
/// The device to check for conformance.
/// True if support is given, otherwise false.
- public static Boolean IsValid(this ICssMediaRule rule, IRenderDevice device)
- {
- return rule.Media.Validate(device);
- }
+ public static Boolean IsValid(this ICssMediaRule rule, IRenderDevice device) => rule.Media.Validate(device);
///
/// Determines if the rule is valid for a given URL.
@@ -36,9 +30,6 @@ public static Boolean IsValid(this ICssMediaRule rule, IRenderDevice device)
/// The rule to extend.
/// The URL to check for conformance.
/// True if the URL is matching, otherwise false.
- public static Boolean IsValid(this ICssDocumentRule rule, Url url)
- {
- return rule.Conditions.Any(m => m.Matches(url));
- }
+ public static Boolean IsValid(this ICssDocumentRule rule, Url url) => rule.Conditions.Any(m => m.Matches(url));
}
}
diff --git a/src/AngleSharp.Css/Converters/ValueConverterExtensions.cs b/src/AngleSharp.Css/Extensions/ValueConverterExtensions.cs
similarity index 59%
rename from src/AngleSharp.Css/Converters/ValueConverterExtensions.cs
rename to src/AngleSharp.Css/Extensions/ValueConverterExtensions.cs
index 31a4f043..ba84dbfc 100644
--- a/src/AngleSharp.Css/Converters/ValueConverterExtensions.cs
+++ b/src/AngleSharp.Css/Extensions/ValueConverterExtensions.cs
@@ -27,25 +27,20 @@ public static ICssValue Convert(this IValueConverter converter, String value)
return varRefs;
}
- public static IValueConverter Many(this IValueConverter converter, Int32 min = 1, Int32 max = UInt16.MaxValue, String separator = null)
- {
- return new OneOrMoreValueConverter(converter, min, max, separator);
- }
+ public static IValueConverter Many(this IValueConverter converter, Int32 min = 1, Int32 max = UInt16.MaxValue, String separator = null) =>
+ new OneOrMoreValueConverter(converter, min, max, separator);
- public static IValueConverter FromList(this IValueConverter converter)
- {
- return new ListValueConverter(converter);
- }
+ public static IValueConverter FromList(this IValueConverter converter) =>
+ new ListValueConverter(converter);
- public static IValueConverter ToConverter(this Dictionary values)
- {
- return new DictionaryValueConverter(values);
- }
+ public static IValueConverter ToConverter(this Dictionary values) =>
+ new DictionaryValueConverter(values);
- public static IValueConverter Periodic(this IValueConverter converter)
- {
- return new PeriodicValueConverter(converter);
- }
+ public static IValueConverter Periodic(this IValueConverter converter) =>
+ new PeriodicValueConverter(converter);
+
+ public static IValueConverter Radius(this IValueConverter converter) =>
+ new RadiusValueConverter(converter);
public static IValueConverter Exclusive(this IValueConverter converter)
{
@@ -65,48 +60,18 @@ public static IValueConverter Exclusive(this IValueConverter converter)
});
}
- public static IValueConverter Option(this IValueConverter converter)
- {
- return new OptionValueConverter(converter, null);
- }
-
- public static IValueConverter Option(this IValueConverter converter, T defaultValue)
- {
- return new OptionValueConverter(converter, defaultValue);
- }
-
- public static String Join(this ICssValue[] values, String separator)
- {
- var buffer = StringBuilderPool.Obtain();
- var previous = false;
-
- for (var i = 0; i < values.Length; i++)
- {
- var str = values[i]?.CssText;
-
- if (!String.IsNullOrEmpty(str))
- {
- if (previous)
- {
- buffer.Append(separator);
- }
-
- buffer.Append(str);
- previous = true;
- }
- }
-
- return buffer.ToPool();
- }
+ public static IValueConverter Option(this IValueConverter converter, ICssValue defaultValue) =>
+ new OptionValueConverter(converter, defaultValue);
- public static String Join(this T[] values, String separator)
+ public static String Join(this IEnumerable values, String separator)
+ where T : ICssValue
{
var buffer = StringBuilderPool.Obtain();
var previous = false;
- for (var i = 0; i < values.Length; i++)
+ foreach (var value in values)
{
- var str = values[i].ToString();
+ var str = value?.CssText;
if (!String.IsNullOrEmpty(str))
{
diff --git a/src/AngleSharp.Css/DefaultDeclarationFactory.cs b/src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs
similarity index 81%
rename from src/AngleSharp.Css/DefaultDeclarationFactory.cs
rename to src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs
index 295aabc2..93580923 100644
--- a/src/AngleSharp.Css/DefaultDeclarationFactory.cs
+++ b/src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs
@@ -15,318 +15,371 @@ public class DefaultDeclarationFactory : IDeclarationFactory
CaptionSideDeclaration.Name, new DeclarationInfo(
name: CaptionSideDeclaration.Name,
converter: CaptionSideDeclaration.Converter,
+ initialValue: CaptionSideDeclaration.InitialValue,
flags: CaptionSideDeclaration.Flags)
},
{
CursorDeclaration.Name, new DeclarationInfo(
name: CursorDeclaration.Name,
converter: CursorDeclaration.Converter,
+ initialValue: CursorDeclaration.InitialValue,
flags: CursorDeclaration.Flags)
},
{
EmptyCellsDeclaration.Name, new DeclarationInfo(
name: EmptyCellsDeclaration.Name,
converter: EmptyCellsDeclaration.Converter,
+ initialValue: EmptyCellsDeclaration.InitialValue,
flags: EmptyCellsDeclaration.Flags)
},
{
OrphansDeclaration.Name, new DeclarationInfo(
name: OrphansDeclaration.Name,
converter: OrphansDeclaration.Converter,
+ initialValue: OrphansDeclaration.InitialValue,
flags: OrphansDeclaration.Flags)
},
{
QuotesDeclaration.Name, new DeclarationInfo(
name: QuotesDeclaration.Name,
converter: QuotesDeclaration.Converter,
+ initialValue: QuotesDeclaration.InitialValue,
flags: QuotesDeclaration.Flags)
},
{
TableLayoutDeclaration.Name, new DeclarationInfo(
name: TableLayoutDeclaration.Name,
converter: TableLayoutDeclaration.Converter,
+ initialValue: TableLayoutDeclaration.InitialValue,
flags: TableLayoutDeclaration.Flags)
},
{
UnicodeBidiDeclaration.Name, new DeclarationInfo(
name: UnicodeBidiDeclaration.Name,
converter: UnicodeBidiDeclaration.Converter,
+ initialValue: UnicodeBidiDeclaration.InitialValue,
flags: UnicodeBidiDeclaration.Flags)
},
{
WidowsDeclaration.Name, new DeclarationInfo(
name: WidowsDeclaration.Name,
converter: WidowsDeclaration.Converter,
+ initialValue: WidowsDeclaration.InitialValue,
flags: WidowsDeclaration.Flags)
},
{
ContentDeclaration.Name, new DeclarationInfo(
name: ContentDeclaration.Name,
converter: ContentDeclaration.Converter,
+ initialValue: ContentDeclaration.InitialValue,
flags: ContentDeclaration.Flags)
},
{
BoxDecorationBreakDeclaration.Name, new DeclarationInfo(
name: BoxDecorationBreakDeclaration.Name,
converter: BoxDecorationBreakDeclaration.Converter,
+ initialValue: BoxDecorationBreakDeclaration.InitialValue,
flags: BoxDecorationBreakDeclaration.Flags)
},
{
BoxShadowDeclaration.Name, new DeclarationInfo(
name: BoxShadowDeclaration.Name,
converter: BoxShadowDeclaration.Converter,
+ initialValue: BoxShadowDeclaration.InitialValue,
flags: BoxShadowDeclaration.Flags)
},
{
ClearDeclaration.Name, new DeclarationInfo(
name: ClearDeclaration.Name,
converter: ClearDeclaration.Converter,
+ initialValue: ClearDeclaration.InitialValue,
flags: ClearDeclaration.Flags)
},
{
DisplayDeclaration.Name, new DeclarationInfo(
name: DisplayDeclaration.Name,
converter: DisplayDeclaration.Converter,
+ initialValue: DisplayDeclaration.InitialValue,
flags: DisplayDeclaration.Flags)
},
{
FloatDeclaration.Name, new DeclarationInfo(
name: FloatDeclaration.Name,
converter: FloatDeclaration.Converter,
+ initialValue: FloatDeclaration.InitialValue,
flags: FloatDeclaration.Flags)
},
{
OverflowDeclaration.Name, new DeclarationInfo(
name: OverflowDeclaration.Name,
converter: OverflowDeclaration.Converter,
+ initialValue: OverflowDeclaration.InitialValue,
flags: OverflowDeclaration.Flags)
},
{
OverflowXDeclaration.Name, new DeclarationInfo(
name: OverflowXDeclaration.Name,
converter: OverflowXDeclaration.Converter,
+ initialValue: OverflowXDeclaration.InitialValue,
flags: OverflowXDeclaration.Flags)
},
{
OverflowYDeclaration.Name, new DeclarationInfo(
name: OverflowYDeclaration.Name,
converter: OverflowYDeclaration.Converter,
+ initialValue: OverflowYDeclaration.InitialValue,
flags: OverflowYDeclaration.Flags)
},
{
PositionDeclaration.Name, new DeclarationInfo(
name: PositionDeclaration.Name,
converter: PositionDeclaration.Converter,
+ initialValue: PositionDeclaration.InitialValue,
flags: PositionDeclaration.Flags)
},
{
ZIndexDeclaration.Name, new DeclarationInfo(
name: ZIndexDeclaration.Name,
converter: ZIndexDeclaration.Converter,
+ initialValue: ZIndexDeclaration.InitialValue,
flags: ZIndexDeclaration.Flags)
},
{
CounterResetDeclaration.Name, new DeclarationInfo(
name: CounterResetDeclaration.Name,
converter: CounterResetDeclaration.Converter,
+ initialValue: CounterResetDeclaration.InitialValue,
flags: CounterResetDeclaration.Flags)
},
{
CounterIncrementDeclaration.Name, new DeclarationInfo(
name: CounterIncrementDeclaration.Name,
converter: CounterIncrementDeclaration.Converter,
+ initialValue: CounterIncrementDeclaration.InitialValue,
flags: CounterIncrementDeclaration.Flags)
},
{
ObjectFitDeclaration.Name, new DeclarationInfo(
name: ObjectFitDeclaration.Name,
converter: ObjectFitDeclaration.Converter,
+ initialValue: ObjectFitDeclaration.InitialValue,
flags: ObjectFitDeclaration.Flags)
},
{
ObjectPositionDeclaration.Name, new DeclarationInfo(
name: ObjectPositionDeclaration.Name,
converter: ObjectPositionDeclaration.Converter,
+ initialValue: ObjectPositionDeclaration.InitialValue,
flags: ObjectPositionDeclaration.Flags)
},
{
StrokeDasharrayDeclaration.Name, new DeclarationInfo(
name: StrokeDasharrayDeclaration.Name,
converter: StrokeDasharrayDeclaration.Converter,
+ initialValue: StrokeDasharrayDeclaration.InitialValue,
flags: StrokeDasharrayDeclaration.Flags)
},
{
StrokeDashoffsetDeclaration.Name, new DeclarationInfo(
name: StrokeDashoffsetDeclaration.Name,
converter: StrokeDashoffsetDeclaration.Converter,
+ initialValue: StrokeDashoffsetDeclaration.InitialValue,
flags: StrokeDashoffsetDeclaration.Flags)
},
{
StrokeLinecapDeclaration.Name, new DeclarationInfo(
name: StrokeLinecapDeclaration.Name,
converter: StrokeLinecapDeclaration.Converter,
+ initialValue: StrokeLinecapDeclaration.InitialValue,
flags: StrokeLinecapDeclaration.Flags)
},
{
StrokeLinejoinDeclaration.Name, new DeclarationInfo(
name: StrokeLinejoinDeclaration.Name,
converter: StrokeLinejoinDeclaration.Converter,
+ initialValue: StrokeLinejoinDeclaration.InitialValue,
flags: StrokeLinejoinDeclaration.Flags)
},
{
StrokeMiterlimitDeclaration.Name, new DeclarationInfo(
name: StrokeMiterlimitDeclaration.Name,
converter: StrokeMiterlimitDeclaration.Converter,
+ initialValue: StrokeMiterlimitDeclaration.InitialValue,
flags: StrokeMiterlimitDeclaration.Flags)
},
{
StrokeOpacityDeclaration.Name, new DeclarationInfo(
name: StrokeOpacityDeclaration.Name,
converter: StrokeOpacityDeclaration.Converter,
+ initialValue: StrokeOpacityDeclaration.InitialValue,
flags: StrokeOpacityDeclaration.Flags)
},
{
StrokeDeclaration.Name, new DeclarationInfo(
name: StrokeDeclaration.Name,
converter: StrokeDeclaration.Converter,
+ initialValue: StrokeDeclaration.InitialValue,
flags: StrokeDeclaration.Flags)
},
{
StrokeWidthDeclaration.Name, new DeclarationInfo(
name: StrokeWidthDeclaration.Name,
converter: StrokeWidthDeclaration.Converter,
+ initialValue: StrokeWidthDeclaration.InitialValue,
flags: StrokeWidthDeclaration.Flags)
},
{
DirectionDeclaration.Name, new DeclarationInfo(
name: DirectionDeclaration.Name,
converter: DirectionDeclaration.Converter,
+ initialValue: DirectionDeclaration.InitialValue,
flags: DirectionDeclaration.Flags)
},
{
OverflowWrapDeclaration.Name, new DeclarationInfo(
name: OverflowWrapDeclaration.Name,
converter: OverflowWrapDeclaration.Converter,
+ initialValue: OverflowWrapDeclaration.InitialValue,
flags: OverflowWrapDeclaration.Flags)
},
{
WordWrapDeclaration.Name, new DeclarationInfo(
name: WordWrapDeclaration.Name,
converter: WordWrapDeclaration.Converter,
+ initialValue: WordWrapDeclaration.InitialValue,
flags: WordWrapDeclaration.Flags)
},
{
PerspectiveOriginDeclaration.Name, new DeclarationInfo(
name: PerspectiveOriginDeclaration.Name,
converter: PerspectiveOriginDeclaration.Converter,
+ initialValue: PerspectiveOriginDeclaration.InitialValue,
flags: PerspectiveOriginDeclaration.Flags)
},
{
PerspectiveDeclaration.Name, new DeclarationInfo(
name: PerspectiveDeclaration.Name,
converter: PerspectiveDeclaration.Converter,
+ initialValue: PerspectiveDeclaration.InitialValue,
flags: PerspectiveDeclaration.Flags)
},
{
BackfaceVisibilityDeclaration.Name, new DeclarationInfo(
name: BackfaceVisibilityDeclaration.Name,
converter: BackfaceVisibilityDeclaration.Converter,
+ initialValue: BackfaceVisibilityDeclaration.InitialValue,
flags: BackfaceVisibilityDeclaration.Flags)
},
{
ClipDeclaration.Name, new DeclarationInfo(
name: ClipDeclaration.Name,
converter: ClipDeclaration.Converter,
+ initialValue: ClipDeclaration.InitialValue,
flags: ClipDeclaration.Flags)
},
{
OpacityDeclaration.Name, new DeclarationInfo(
name: OpacityDeclaration.Name,
converter: OpacityDeclaration.Converter,
+ initialValue: OpacityDeclaration.InitialValue,
flags: OpacityDeclaration.Flags)
},
{
VisibilityDeclaration.Name, new DeclarationInfo(
name: VisibilityDeclaration.Name,
converter: VisibilityDeclaration.Converter,
+ initialValue: VisibilityDeclaration.InitialValue,
flags: VisibilityDeclaration.Flags)
},
{
BottomDeclaration.Name, new DeclarationInfo(
name: BottomDeclaration.Name,
converter: BottomDeclaration.Converter,
+ initialValue: BottomDeclaration.InitialValue,
flags: BottomDeclaration.Flags)
},
{
HeightDeclaration.Name, new DeclarationInfo(
name: HeightDeclaration.Name,
converter: HeightDeclaration.Converter,
+ initialValue: HeightDeclaration.InitialValue,
flags: HeightDeclaration.Flags)
},
{
LeftDeclaration.Name, new DeclarationInfo(
name: LeftDeclaration.Name,
converter: LeftDeclaration.Converter,
+ initialValue: LeftDeclaration.InitialValue,
flags: LeftDeclaration.Flags)
},
{
MaxHeightDeclaration.Name, new DeclarationInfo(
name: MaxHeightDeclaration.Name,
converter: MaxHeightDeclaration.Converter,
+ initialValue: MaxHeightDeclaration.InitialValue,
flags: MaxHeightDeclaration.Flags)
},
{
MaxWidthDeclaration.Name, new DeclarationInfo(
name: MaxWidthDeclaration.Name,
converter: MaxWidthDeclaration.Converter,
+ initialValue: MaxWidthDeclaration.InitialValue,
flags: MaxWidthDeclaration.Flags)
},
{
MinHeightDeclaration.Name, new DeclarationInfo(
name: MinHeightDeclaration.Name,
converter: MinHeightDeclaration.Converter,
+ initialValue: MinHeightDeclaration.InitialValue,
flags: MinHeightDeclaration.Flags)
},
{
MinWidthDeclaration.Name, new DeclarationInfo(
name: MinWidthDeclaration.Name,
converter: MinWidthDeclaration.Converter,
+ initialValue: MinWidthDeclaration.InitialValue,
flags: MinWidthDeclaration.Flags)
},
{
RightDeclaration.Name, new DeclarationInfo(
name: RightDeclaration.Name,
converter: RightDeclaration.Converter,
+ initialValue: RightDeclaration.InitialValue,
flags: RightDeclaration.Flags)
},
{
TopDeclaration.Name, new DeclarationInfo(
name: TopDeclaration.Name,
converter: TopDeclaration.Converter,
+ initialValue: TopDeclaration.InitialValue,
flags: TopDeclaration.Flags)
},
{
WidthDeclaration.Name, new DeclarationInfo(
name: WidthDeclaration.Name,
converter: WidthDeclaration.Converter,
+ initialValue: WidthDeclaration.InitialValue,
flags: WidthDeclaration.Flags)
},
{
ColorDeclaration.Name, new DeclarationInfo(
name: ColorDeclaration.Name,
converter: ColorDeclaration.Converter,
+ initialValue: ColorDeclaration.InitialValue,
flags: ColorDeclaration.Flags)
},
{
WordSpacingDeclaration.Name, new DeclarationInfo(
name: WordSpacingDeclaration.Name,
converter: WordSpacingDeclaration.Converter,
+ initialValue: WordSpacingDeclaration.InitialValue,
flags: WordSpacingDeclaration.Flags)
},
{
LineHeightDeclaration.Name, new DeclarationInfo(
name: LineHeightDeclaration.Name,
converter: LineHeightDeclaration.Converter,
+ initialValue: LineHeightDeclaration.InitialValue,
flags: LineHeightDeclaration.Flags,
shorthands: LineHeightDeclaration.Shorthands)
},
@@ -334,72 +387,84 @@ public class DefaultDeclarationFactory : IDeclarationFactory
LetterSpacingDeclaration.Name, new DeclarationInfo(
name: LetterSpacingDeclaration.Name,
converter: LetterSpacingDeclaration.Converter,
+ initialValue: LetterSpacingDeclaration.InitialValue,
flags: LetterSpacingDeclaration.Flags)
},
{
FontSizeAdjustDeclaration.Name, new DeclarationInfo(
name: FontSizeAdjustDeclaration.Name,
converter: FontSizeAdjustDeclaration.Converter,
+ initialValue: FontSizeAdjustDeclaration.InitialValue,
flags: FontSizeAdjustDeclaration.Flags)
},
{
BreakAfterDeclaration.Name, new DeclarationInfo(
name: BreakAfterDeclaration.Name,
converter: BreakAfterDeclaration.Converter,
+ initialValue: BreakAfterDeclaration.InitialValue,
flags: BreakAfterDeclaration.Flags)
},
{
BreakBeforeDeclaration.Name, new DeclarationInfo(
name: BreakBeforeDeclaration.Name,
converter: BreakBeforeDeclaration.Converter,
+ initialValue: BreakBeforeDeclaration.InitialValue,
flags: BreakBeforeDeclaration.Flags)
},
{
BreakInsideDeclaration.Name, new DeclarationInfo(
name: BreakInsideDeclaration.Name,
converter: BreakInsideDeclaration.Converter,
+ initialValue: BreakInsideDeclaration.InitialValue,
flags: BreakInsideDeclaration.Flags)
},
{
PageBreakAfterDeclaration.Name, new DeclarationInfo(
name: PageBreakAfterDeclaration.Name,
converter: PageBreakAfterDeclaration.Converter,
+ initialValue: PageBreakAfterDeclaration.InitialValue,
flags: PageBreakAfterDeclaration.Flags)
},
{
PageBreakBeforeDeclaration.Name, new DeclarationInfo(
name: PageBreakBeforeDeclaration.Name,
converter: PageBreakBeforeDeclaration.Converter,
+ initialValue: PageBreakBeforeDeclaration.InitialValue,
flags: PageBreakBeforeDeclaration.Flags)
},
{
PageBreakInsideDeclaration.Name, new DeclarationInfo(
name: PageBreakInsideDeclaration.Name,
converter: PageBreakInsideDeclaration.Converter,
+ initialValue: PageBreakInsideDeclaration.InitialValue,
flags: PageBreakInsideDeclaration.Flags)
},
{
TransformOriginDeclaration.Name, new DeclarationInfo(
name: TransformOriginDeclaration.Name,
converter: TransformOriginDeclaration.Converter,
+ initialValue: TransformOriginDeclaration.InitialValue,
flags: TransformOriginDeclaration.Flags)
},
{
TransformDeclaration.Name, new DeclarationInfo(
name: TransformDeclaration.Name,
converter: TransformDeclaration.Converter,
+ initialValue: TransformDeclaration.InitialValue,
flags: TransformDeclaration.Flags)
},
{
TransformStyleDeclaration.Name, new DeclarationInfo(
name: TransformStyleDeclaration.Name,
converter: TransformStyleDeclaration.Converter,
+ initialValue: TransformStyleDeclaration.InitialValue,
flags: TransformStyleDeclaration.Flags)
},
{
ColumnCountDeclaration.Name, new DeclarationInfo(
name: ColumnCountDeclaration.Name,
converter: ColumnCountDeclaration.Converter,
+ initialValue: ColumnCountDeclaration.InitialValue,
flags: ColumnCountDeclaration.Flags,
shorthands: ColumnCountDeclaration.Shorthands)
},
@@ -407,12 +472,14 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnFillDeclaration.Name, new DeclarationInfo(
name: ColumnFillDeclaration.Name,
converter: ColumnFillDeclaration.Converter,
+ initialValue: ColumnFillDeclaration.InitialValue,
flags: ColumnFillDeclaration.Flags)
},
{
ColumnGapDeclaration.Name, new DeclarationInfo(
name: ColumnGapDeclaration.Name,
converter: ColumnGapDeclaration.Converter,
+ initialValue: ColumnGapDeclaration.InitialValue,
shorthands: ColumnGapDeclaration.Shorthands,
flags: ColumnGapDeclaration.Flags)
},
@@ -420,6 +487,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
RowGapDeclaration.Name, new DeclarationInfo(
name: RowGapDeclaration.Name,
converter: RowGapDeclaration.Converter,
+ initialValue: RowGapDeclaration.InitialValue,
shorthands: RowGapDeclaration.Shorthands,
flags: RowGapDeclaration.Flags)
},
@@ -427,6 +495,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GapDeclaration.Name, new DeclarationInfo(
name: GapDeclaration.Name,
converter: GapDeclaration.Converter,
+ initialValue: GapDeclaration.InitialValue,
longhands: GapDeclaration.Longhands,
flags: GapDeclaration.Flags)
},
@@ -434,12 +503,14 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnSpanDeclaration.Name, new DeclarationInfo(
name: ColumnSpanDeclaration.Name,
converter: ColumnSpanDeclaration.Converter,
+ initialValue: ColumnSpanDeclaration.InitialValue,
flags: ColumnSpanDeclaration.Flags)
},
{
ColumnWidthDeclaration.Name, new DeclarationInfo(
name: ColumnWidthDeclaration.Name,
converter: ColumnWidthDeclaration.Converter,
+ initialValue: ColumnWidthDeclaration.InitialValue,
flags: ColumnWidthDeclaration.Flags,
shorthands: ColumnWidthDeclaration.Shorthands)
},
@@ -447,78 +518,91 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderCollapseDeclaration.Name, new DeclarationInfo(
name: BorderCollapseDeclaration.Name,
converter: BorderCollapseDeclaration.Converter,
+ initialValue: BorderCollapseDeclaration.InitialValue,
flags: BorderCollapseDeclaration.Flags)
},
{
BorderSpacingDeclaration.Name, new DeclarationInfo(
name: BorderSpacingDeclaration.Name,
converter: BorderSpacingDeclaration.Converter,
+ initialValue: BorderSpacingDeclaration.InitialValue,
flags: BorderSpacingDeclaration.Flags)
},
{
WordBreakDeclaration.Name, new DeclarationInfo(
name: WordBreakDeclaration.Name,
converter: WordBreakDeclaration.Converter,
+ initialValue: WordBreakDeclaration.InitialValue,
flags: WordBreakDeclaration.Flags)
},
{
WhiteSpaceDeclaration.Name, new DeclarationInfo(
name: WhiteSpaceDeclaration.Name,
converter: WhiteSpaceDeclaration.Converter,
+ initialValue: WhiteSpaceDeclaration.InitialValue,
flags: WhiteSpaceDeclaration.Flags)
},
{
VerticalAlignDeclaration.Name, new DeclarationInfo(
name: VerticalAlignDeclaration.Name,
converter: VerticalAlignDeclaration.Converter,
+ initialValue: VerticalAlignDeclaration.InitialValue,
flags: VerticalAlignDeclaration.Flags)
},
{
TextShadowDeclaration.Name, new DeclarationInfo(
name: TextShadowDeclaration.Name,
converter: TextShadowDeclaration.Converter,
+ initialValue: TextShadowDeclaration.InitialValue,
flags: TextShadowDeclaration.Flags)
},
{
TextJustifyDeclaration.Name, new DeclarationInfo(
name: TextJustifyDeclaration.Name,
converter: TextJustifyDeclaration.Converter,
+ initialValue: TextJustifyDeclaration.InitialValue,
flags: TextJustifyDeclaration.Flags)
},
{
TextIndentDeclaration.Name, new DeclarationInfo(
name: TextIndentDeclaration.Name,
converter: TextIndentDeclaration.Converter,
+ initialValue: TextIndentDeclaration.InitialValue,
flags: TextIndentDeclaration.Flags)
},
{
TextAnchorDeclaration.Name, new DeclarationInfo(
name: TextAnchorDeclaration.Name,
converter: TextAnchorDeclaration.Converter,
+ initialValue: TextAnchorDeclaration.InitialValue,
flags: TextAnchorDeclaration.Flags)
},
{
TextAlignDeclaration.Name, new DeclarationInfo(
name: TextAlignDeclaration.Name,
converter: TextAlignDeclaration.Converter,
+ initialValue: TextAlignDeclaration.InitialValue,
flags: TextAlignDeclaration.Flags)
},
{
TextAlignLastDeclaration.Name, new DeclarationInfo(
name: TextAlignLastDeclaration.Name,
converter: TextAlignLastDeclaration.Converter,
+ initialValue: TextAlignLastDeclaration.InitialValue,
flags: TextAlignLastDeclaration.Flags)
},
{
TextTransformDeclaration.Name, new DeclarationInfo(
name: TextTransformDeclaration.Name,
converter: TextTransformDeclaration.Converter,
+ initialValue: TextTransformDeclaration.InitialValue,
flags: TextTransformDeclaration.Flags)
},
{
ListStyleImageDeclaration.Name, new DeclarationInfo(
name: ListStyleImageDeclaration.Name,
converter: ListStyleImageDeclaration.Converter,
+ initialValue: ListStyleImageDeclaration.InitialValue,
flags: ListStyleImageDeclaration.Flags,
shorthands: ListStyleImageDeclaration.Shorthands)
},
@@ -526,6 +610,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ListStylePositionDeclaration.Name, new DeclarationInfo(
name: ListStylePositionDeclaration.Name,
converter: ListStylePositionDeclaration.Converter,
+ initialValue: ListStylePositionDeclaration.InitialValue,
flags: ListStylePositionDeclaration.Flags,
shorthands: ListStylePositionDeclaration.Shorthands)
},
@@ -533,6 +618,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ListStyleTypeDeclaration.Name, new DeclarationInfo(
name: ListStyleTypeDeclaration.Name,
converter: ListStyleTypeDeclaration.Converter,
+ initialValue: ListStyleTypeDeclaration.InitialValue,
flags: ListStyleTypeDeclaration.Flags,
shorthands: ListStyleTypeDeclaration.Shorthands)
},
@@ -540,6 +626,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontFamilyDeclaration.Name, new DeclarationInfo(
name: FontFamilyDeclaration.Name,
converter: FontFamilyDeclaration.Converter,
+ initialValue: FontFamilyDeclaration.InitialValue,
flags: FontFamilyDeclaration.Flags,
shorthands: FontFamilyDeclaration.Shorthands)
},
@@ -547,6 +634,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontSizeDeclaration.Name, new DeclarationInfo(
name: FontSizeDeclaration.Name,
converter: FontSizeDeclaration.Converter,
+ initialValue: FontSizeDeclaration.InitialValue,
flags: FontSizeDeclaration.Flags,
shorthands: FontSizeDeclaration.Shorthands)
},
@@ -554,6 +642,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontStyleDeclaration.Name, new DeclarationInfo(
name: FontStyleDeclaration.Name,
converter: FontStyleDeclaration.Converter,
+ initialValue: FontStyleDeclaration.InitialValue,
flags: FontStyleDeclaration.Flags,
shorthands: FontStyleDeclaration.Shorthands)
},
@@ -561,12 +650,14 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontStretchDeclaration.Name, new DeclarationInfo(
name: FontStretchDeclaration.Name,
converter: FontStretchDeclaration.Converter,
+ initialValue: FontStretchDeclaration.InitialValue,
flags: FontStretchDeclaration.Flags)
},
{
FontVariantDeclaration.Name, new DeclarationInfo(
name: FontVariantDeclaration.Name,
converter: FontVariantDeclaration.Converter,
+ initialValue: FontVariantDeclaration.InitialValue,
flags: FontVariantDeclaration.Flags,
shorthands: FontVariantDeclaration.Shorthands)
},
@@ -574,6 +665,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontWeightDeclaration.Name, new DeclarationInfo(
name: FontWeightDeclaration.Name,
converter: FontWeightDeclaration.Converter,
+ initialValue: FontWeightDeclaration.InitialValue,
flags: FontWeightDeclaration.Flags,
shorthands: FontWeightDeclaration.Shorthands)
},
@@ -581,18 +673,21 @@ public class DefaultDeclarationFactory : IDeclarationFactory
UnicodeRangeDeclaration.Name, new DeclarationInfo(
name: UnicodeRangeDeclaration.Name,
converter: UnicodeRangeDeclaration.Converter,
+ initialValue: UnicodeRangeDeclaration.InitialValue,
flags: UnicodeRangeDeclaration.Flags)
},
{
SrcDeclaration.Name, new DeclarationInfo(
name: SrcDeclaration.Name,
converter: SrcDeclaration.Converter,
+ initialValue: SrcDeclaration.InitialValue,
flags: SrcDeclaration.Flags)
},
{
ColumnRuleWidthDeclaration.Name, new DeclarationInfo(
name: ColumnRuleWidthDeclaration.Name,
converter: ColumnRuleWidthDeclaration.Converter,
+ initialValue: ColumnRuleWidthDeclaration.InitialValue,
flags: ColumnRuleWidthDeclaration.Flags,
shorthands: ColumnRuleWidthDeclaration.Shorthands)
},
@@ -600,6 +695,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnRuleStyleDeclaration.Name, new DeclarationInfo(
name: ColumnRuleStyleDeclaration.Name,
converter: ColumnRuleStyleDeclaration.Converter,
+ initialValue: ColumnRuleStyleDeclaration.InitialValue,
flags: ColumnRuleStyleDeclaration.Flags,
shorthands: ColumnRuleStyleDeclaration.Shorthands)
},
@@ -607,6 +703,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnRuleColorDeclaration.Name, new DeclarationInfo(
name: ColumnRuleColorDeclaration.Name,
converter: ColumnRuleColorDeclaration.Converter,
+ initialValue: ColumnRuleColorDeclaration.InitialValue,
flags: ColumnRuleColorDeclaration.Flags,
shorthands: ColumnRuleColorDeclaration.Shorthands)
},
@@ -614,6 +711,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
PaddingTopDeclaration.Name, new DeclarationInfo(
name: PaddingTopDeclaration.Name,
converter: PaddingTopDeclaration.Converter,
+ initialValue: PaddingTopDeclaration.InitialValue,
flags: PaddingTopDeclaration.Flags,
shorthands: PaddingTopDeclaration.Shorthands)
},
@@ -621,6 +719,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
PaddingRightDeclaration.Name, new DeclarationInfo(
name: PaddingRightDeclaration.Name,
converter: PaddingRightDeclaration.Converter,
+ initialValue: PaddingRightDeclaration.InitialValue,
flags: PaddingRightDeclaration.Flags,
shorthands: PaddingRightDeclaration.Shorthands)
},
@@ -628,6 +727,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
PaddingLeftDeclaration.Name, new DeclarationInfo(
name: PaddingLeftDeclaration.Name,
converter: PaddingLeftDeclaration.Converter,
+ initialValue: PaddingLeftDeclaration.InitialValue,
flags: PaddingLeftDeclaration.Flags,
shorthands: PaddingLeftDeclaration.Shorthands)
},
@@ -635,6 +735,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
PaddingBottomDeclaration.Name, new DeclarationInfo(
name: PaddingBottomDeclaration.Name,
converter: PaddingBottomDeclaration.Converter,
+ initialValue: PaddingBottomDeclaration.InitialValue,
flags: PaddingBottomDeclaration.Flags,
shorthands: PaddingBottomDeclaration.Shorthands)
},
@@ -642,6 +743,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
MarginTopDeclaration.Name, new DeclarationInfo(
name: MarginTopDeclaration.Name,
converter: MarginTopDeclaration.Converter,
+ initialValue: MarginTopDeclaration.InitialValue,
flags: MarginTopDeclaration.Flags,
shorthands: MarginTopDeclaration.Shorthands)
},
@@ -649,6 +751,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
MarginRightDeclaration.Name, new DeclarationInfo(
name: MarginRightDeclaration.Name,
converter: MarginRightDeclaration.Converter,
+ initialValue: MarginRightDeclaration.InitialValue,
flags: MarginRightDeclaration.Flags,
shorthands: MarginRightDeclaration.Shorthands)
},
@@ -656,6 +759,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
MarginLeftDeclaration.Name, new DeclarationInfo(
name: MarginLeftDeclaration.Name,
converter: MarginLeftDeclaration.Converter,
+ initialValue: MarginLeftDeclaration.InitialValue,
flags: MarginLeftDeclaration.Flags,
shorthands: MarginLeftDeclaration.Shorthands)
},
@@ -663,6 +767,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
MarginBottomDeclaration.Name, new DeclarationInfo(
name: MarginBottomDeclaration.Name,
converter: MarginBottomDeclaration.Converter,
+ initialValue: MarginBottomDeclaration.InitialValue,
flags: MarginBottomDeclaration.Flags,
shorthands: MarginBottomDeclaration.Shorthands)
},
@@ -670,6 +775,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopRightRadiusDeclaration.Name, new DeclarationInfo(
name: BorderTopRightRadiusDeclaration.Name,
converter: BorderTopRightRadiusDeclaration.Converter,
+ initialValue: BorderTopRightRadiusDeclaration.InitialValue,
flags: BorderTopRightRadiusDeclaration.Flags,
shorthands: BorderTopRightRadiusDeclaration.Shorthands)
},
@@ -677,6 +783,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopLeftRadiusDeclaration.Name, new DeclarationInfo(
name: BorderTopLeftRadiusDeclaration.Name,
converter: BorderTopLeftRadiusDeclaration.Converter,
+ initialValue: BorderTopLeftRadiusDeclaration.InitialValue,
flags: BorderTopLeftRadiusDeclaration.Flags,
shorthands: BorderTopLeftRadiusDeclaration.Shorthands)
},
@@ -684,6 +791,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomRightRadiusDeclaration.Name, new DeclarationInfo(
name: BorderBottomRightRadiusDeclaration.Name,
converter: BorderBottomRightRadiusDeclaration.Converter,
+ initialValue: BorderBottomRightRadiusDeclaration.InitialValue,
flags: BorderBottomRightRadiusDeclaration.Flags,
shorthands: BorderBottomRightRadiusDeclaration.Shorthands)
},
@@ -691,6 +799,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomLeftRadiusDeclaration.Name, new DeclarationInfo(
name: BorderBottomLeftRadiusDeclaration.Name,
converter: BorderBottomLeftRadiusDeclaration.Converter,
+ initialValue: BorderBottomLeftRadiusDeclaration.InitialValue,
flags: BorderBottomLeftRadiusDeclaration.Flags,
shorthands: BorderBottomLeftRadiusDeclaration.Shorthands)
},
@@ -698,6 +807,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
OutlineWidthDeclaration.Name, new DeclarationInfo(
name: OutlineWidthDeclaration.Name,
converter: OutlineWidthDeclaration.Converter,
+ initialValue: OutlineWidthDeclaration.InitialValue,
flags: OutlineWidthDeclaration.Flags,
shorthands: OutlineWidthDeclaration.Shorthands)
},
@@ -705,6 +815,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
OutlineStyleDeclaration.Name, new DeclarationInfo(
name: OutlineStyleDeclaration.Name,
converter: OutlineStyleDeclaration.Converter,
+ initialValue: OutlineStyleDeclaration.InitialValue,
flags: OutlineStyleDeclaration.Flags,
shorthands: OutlineStyleDeclaration.Shorthands)
},
@@ -712,6 +823,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
OutlineColorDeclaration.Name, new DeclarationInfo(
name: OutlineColorDeclaration.Name,
converter: OutlineColorDeclaration.Converter,
+ initialValue: OutlineColorDeclaration.InitialValue,
flags: OutlineColorDeclaration.Flags,
shorthands: OutlineColorDeclaration.Shorthands)
},
@@ -719,6 +831,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TextDecorationStyleDeclaration.Name, new DeclarationInfo(
name: TextDecorationStyleDeclaration.Name,
converter: TextDecorationStyleDeclaration.Converter,
+ initialValue: TextDecorationStyleDeclaration.InitialValue,
flags: TextDecorationStyleDeclaration.Flags,
shorthands: TextDecorationStyleDeclaration.Shorthands)
},
@@ -726,6 +839,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TextDecorationLineDeclaration.Name, new DeclarationInfo(
name: TextDecorationLineDeclaration.Name,
converter: TextDecorationLineDeclaration.Converter,
+ initialValue: TextDecorationLineDeclaration.InitialValue,
flags: TextDecorationLineDeclaration.Flags,
shorthands: TextDecorationLineDeclaration.Shorthands)
},
@@ -733,6 +847,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TextDecorationColorDeclaration.Name, new DeclarationInfo(
name: TextDecorationColorDeclaration.Name,
converter: TextDecorationColorDeclaration.Converter,
+ initialValue: TextDecorationColorDeclaration.InitialValue,
flags: TextDecorationColorDeclaration.Flags,
shorthands: TextDecorationColorDeclaration.Shorthands)
},
@@ -740,6 +855,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TransitionTimingFunctionDeclaration.Name, new DeclarationInfo(
name: TransitionTimingFunctionDeclaration.Name,
converter: TransitionTimingFunctionDeclaration.Converter,
+ initialValue: TransitionTimingFunctionDeclaration.InitialValue,
flags: TransitionTimingFunctionDeclaration.Flags,
shorthands: TransitionTimingFunctionDeclaration.Shorthands)
},
@@ -747,6 +863,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TransitionPropertyDeclaration.Name, new DeclarationInfo(
name: TransitionPropertyDeclaration.Name,
converter: TransitionPropertyDeclaration.Converter,
+ initialValue: TransitionPropertyDeclaration.InitialValue,
flags: TransitionPropertyDeclaration.Flags,
shorthands: TransitionPropertyDeclaration.Shorthands)
},
@@ -754,6 +871,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TransitionDurationDeclaration.Name, new DeclarationInfo(
name: TransitionDurationDeclaration.Name,
converter: TransitionDurationDeclaration.Converter,
+ initialValue: TransitionDurationDeclaration.InitialValue,
flags: TransitionDurationDeclaration.Flags,
shorthands: TransitionDurationDeclaration.Shorthands)
},
@@ -761,6 +879,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TransitionDelayDeclaration.Name, new DeclarationInfo(
name: TransitionDelayDeclaration.Name,
converter: TransitionDelayDeclaration.Converter,
+ initialValue: TransitionDelayDeclaration.InitialValue,
flags: TransitionDelayDeclaration.Flags,
shorthands: TransitionDelayDeclaration.Shorthands)
},
@@ -768,6 +887,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageWidthDeclaration.Name, new DeclarationInfo(
name: BorderImageWidthDeclaration.Name,
converter: BorderImageWidthDeclaration.Converter,
+ initialValue: BorderImageWidthDeclaration.InitialValue,
flags: BorderImageWidthDeclaration.Flags,
shorthands: BorderImageWidthDeclaration.Shorthands)
},
@@ -775,6 +895,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageSourceDeclaration.Name, new DeclarationInfo(
name: BorderImageSourceDeclaration.Name,
converter: BorderImageSourceDeclaration.Converter,
+ initialValue: BorderImageSourceDeclaration.InitialValue,
flags: BorderImageSourceDeclaration.Flags,
shorthands: BorderImageSourceDeclaration.Shorthands)
},
@@ -782,6 +903,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageSliceDeclaration.Name, new DeclarationInfo(
name: BorderImageSliceDeclaration.Name,
converter: BorderImageSliceDeclaration.Converter,
+ initialValue: BorderImageSliceDeclaration.InitialValue,
flags: BorderImageSliceDeclaration.Flags,
shorthands: BorderImageSliceDeclaration.Shorthands)
},
@@ -789,6 +911,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageRepeatDeclaration.Name, new DeclarationInfo(
name: BorderImageRepeatDeclaration.Name,
converter: BorderImageRepeatDeclaration.Converter,
+ initialValue: BorderImageRepeatDeclaration.InitialValue,
flags: BorderImageRepeatDeclaration.Flags,
shorthands: BorderImageRepeatDeclaration.Shorthands)
},
@@ -796,6 +919,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageOutsetDeclaration.Name, new DeclarationInfo(
name: BorderImageOutsetDeclaration.Name,
converter: BorderImageOutsetDeclaration.Converter,
+ initialValue: BorderImageOutsetDeclaration.InitialValue,
flags: BorderImageOutsetDeclaration.Flags,
shorthands: BorderImageOutsetDeclaration.Shorthands)
},
@@ -803,6 +927,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationTimingFunctionDeclaration.Name, new DeclarationInfo(
name: AnimationTimingFunctionDeclaration.Name,
converter: AnimationTimingFunctionDeclaration.Converter,
+ initialValue: AnimationTimingFunctionDeclaration.InitialValue,
flags: AnimationTimingFunctionDeclaration.Flags,
shorthands: AnimationTimingFunctionDeclaration.Shorthands)
},
@@ -810,6 +935,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationPlayStateDeclaration.Name, new DeclarationInfo(
name: AnimationPlayStateDeclaration.Name,
converter: AnimationPlayStateDeclaration.Converter,
+ initialValue: AnimationPlayStateDeclaration.InitialValue,
flags: AnimationPlayStateDeclaration.Flags,
shorthands: AnimationPlayStateDeclaration.Shorthands)
},
@@ -817,6 +943,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationNameDeclaration.Name, new DeclarationInfo(
name: AnimationNameDeclaration.Name,
converter: AnimationNameDeclaration.Converter,
+ initialValue: AnimationNameDeclaration.InitialValue,
flags: AnimationNameDeclaration.Flags,
shorthands: AnimationNameDeclaration.Shorthands)
},
@@ -824,6 +951,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationIterationCountDeclaration.Name, new DeclarationInfo(
name: AnimationIterationCountDeclaration.Name,
converter: AnimationIterationCountDeclaration.Converter,
+ initialValue: AnimationIterationCountDeclaration.InitialValue,
flags: AnimationIterationCountDeclaration.Flags,
shorthands: AnimationIterationCountDeclaration.Shorthands)
},
@@ -831,6 +959,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationFillModeDeclaration.Name, new DeclarationInfo(
name: AnimationFillModeDeclaration.Name,
converter: AnimationFillModeDeclaration.Converter,
+ initialValue: AnimationFillModeDeclaration.InitialValue,
flags: AnimationFillModeDeclaration.Flags,
shorthands: AnimationFillModeDeclaration.Shorthands)
},
@@ -838,6 +967,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationDurationDeclaration.Name, new DeclarationInfo(
name: AnimationDurationDeclaration.Name,
converter: AnimationDurationDeclaration.Converter,
+ initialValue: AnimationDurationDeclaration.InitialValue,
flags: AnimationDurationDeclaration.Flags,
shorthands: AnimationDurationDeclaration.Shorthands)
},
@@ -845,6 +975,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationDirectionDeclaration.Name, new DeclarationInfo(
name: AnimationDirectionDeclaration.Name,
converter: AnimationDirectionDeclaration.Converter,
+ initialValue: AnimationDirectionDeclaration.InitialValue,
flags: AnimationDirectionDeclaration.Flags,
shorthands: AnimationDirectionDeclaration.Shorthands)
},
@@ -852,6 +983,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationDelayDeclaration.Name, new DeclarationInfo(
name: AnimationDelayDeclaration.Name,
converter: AnimationDelayDeclaration.Converter,
+ initialValue: AnimationDelayDeclaration.InitialValue,
flags: AnimationDelayDeclaration.Flags,
shorthands: AnimationDelayDeclaration.Shorthands)
},
@@ -859,6 +991,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundSizeDeclaration.Name, new DeclarationInfo(
name: BackgroundSizeDeclaration.Name,
converter: BackgroundSizeDeclaration.Converter,
+ initialValue: BackgroundSizeDeclaration.InitialValue,
flags: BackgroundSizeDeclaration.Flags,
shorthands: BackgroundSizeDeclaration.Shorthands)
},
@@ -866,6 +999,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundRepeatDeclaration.Name, new DeclarationInfo(
name: BackgroundRepeatDeclaration.Name,
converter: BackgroundRepeatDeclaration.Converter,
+ initialValue: BackgroundRepeatDeclaration.InitialValue,
flags: BackgroundRepeatDeclaration.Flags,
longhands: BackgroundRepeatDeclaration.Longhands,
shorthands: BackgroundRepeatDeclaration.Shorthands)
@@ -874,6 +1008,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundRepeatXDeclaration.Name, new DeclarationInfo(
name: BackgroundRepeatXDeclaration.Name,
converter: BackgroundRepeatXDeclaration.Converter,
+ initialValue: BackgroundRepeatXDeclaration.InitialValue,
flags: BackgroundRepeatXDeclaration.Flags,
shorthands: BackgroundRepeatXDeclaration.Shorthands)
},
@@ -881,6 +1016,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundRepeatYDeclaration.Name, new DeclarationInfo(
name: BackgroundRepeatYDeclaration.Name,
converter: BackgroundRepeatYDeclaration.Converter,
+ initialValue: BackgroundRepeatYDeclaration.InitialValue,
flags: BackgroundRepeatYDeclaration.Flags,
shorthands: BackgroundRepeatYDeclaration.Shorthands)
},
@@ -888,6 +1024,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundPositionDeclaration.Name, new DeclarationInfo(
name: BackgroundPositionDeclaration.Name,
converter: BackgroundPositionDeclaration.Converter,
+ initialValue: BackgroundPositionDeclaration.InitialValue,
flags: BackgroundPositionDeclaration.Flags,
shorthands: BackgroundPositionDeclaration.Shorthands,
longhands: BackgroundPositionDeclaration.Longhands)
@@ -896,6 +1033,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundPositionXDeclaration.Name, new DeclarationInfo(
name: BackgroundPositionXDeclaration.Name,
converter: BackgroundPositionXDeclaration.Converter,
+ initialValue: BackgroundPositionXDeclaration.InitialValue,
flags: BackgroundPositionXDeclaration.Flags,
shorthands: BackgroundPositionXDeclaration.Shorthands)
},
@@ -903,6 +1041,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundPositionYDeclaration.Name, new DeclarationInfo(
name: BackgroundPositionYDeclaration.Name,
converter: BackgroundPositionYDeclaration.Converter,
+ initialValue: BackgroundPositionYDeclaration.InitialValue,
flags: BackgroundPositionYDeclaration.Flags,
shorthands: BackgroundPositionYDeclaration.Shorthands)
},
@@ -910,6 +1049,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundOriginDeclaration.Name, new DeclarationInfo(
name: BackgroundOriginDeclaration.Name,
converter: BackgroundOriginDeclaration.Converter,
+ initialValue: BackgroundOriginDeclaration.InitialValue,
flags: BackgroundOriginDeclaration.Flags,
shorthands: BackgroundOriginDeclaration.Shorthands)
},
@@ -917,6 +1057,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundImageDeclaration.Name, new DeclarationInfo(
name: BackgroundImageDeclaration.Name,
converter: BackgroundImageDeclaration.Converter,
+ initialValue: BackgroundImageDeclaration.InitialValue,
flags: BackgroundImageDeclaration.Flags,
shorthands: BackgroundImageDeclaration.Shorthands)
},
@@ -924,6 +1065,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundColorDeclaration.Name, new DeclarationInfo(
name: BackgroundColorDeclaration.Name,
converter: BackgroundColorDeclaration.Converter,
+ initialValue: BackgroundColorDeclaration.InitialValue,
flags: BackgroundColorDeclaration.Flags,
shorthands: BackgroundColorDeclaration.Shorthands)
},
@@ -931,6 +1073,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundClipDeclaration.Name, new DeclarationInfo(
name: BackgroundClipDeclaration.Name,
converter: BackgroundClipDeclaration.Converter,
+ initialValue: BackgroundClipDeclaration.InitialValue,
flags: BackgroundClipDeclaration.Flags,
shorthands: BackgroundClipDeclaration.Shorthands)
},
@@ -938,6 +1081,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundAttachmentDeclaration.Name, new DeclarationInfo(
name: BackgroundAttachmentDeclaration.Name,
converter: BackgroundAttachmentDeclaration.Converter,
+ initialValue: BackgroundAttachmentDeclaration.InitialValue,
flags: BackgroundAttachmentDeclaration.Flags,
shorthands: BackgroundAttachmentDeclaration.Shorthands)
},
@@ -945,6 +1089,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopWidthDeclaration.Name, new DeclarationInfo(
name: BorderTopWidthDeclaration.Name,
converter: BorderTopWidthDeclaration.Converter,
+ initialValue: BorderTopWidthDeclaration.InitialValue,
flags: BorderTopWidthDeclaration.Flags,
shorthands: BorderTopWidthDeclaration.Shorthands)
},
@@ -952,6 +1097,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopStyleDeclaration.Name, new DeclarationInfo(
name: BorderTopStyleDeclaration.Name,
converter: BorderTopStyleDeclaration.Converter,
+ initialValue: BorderTopStyleDeclaration.InitialValue,
flags: BorderTopStyleDeclaration.Flags,
shorthands: BorderTopStyleDeclaration.Shorthands)
},
@@ -959,6 +1105,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopColorDeclaration.Name, new DeclarationInfo(
name: BorderTopColorDeclaration.Name,
converter: BorderTopColorDeclaration.Converter,
+ initialValue: BorderTopColorDeclaration.InitialValue,
flags: BorderTopColorDeclaration.Flags,
shorthands: BorderTopColorDeclaration.Shorthands)
},
@@ -966,6 +1113,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderRightWidthDeclaration.Name, new DeclarationInfo(
name: BorderRightWidthDeclaration.Name,
converter: BorderRightWidthDeclaration.Converter,
+ initialValue: BorderRightWidthDeclaration.InitialValue,
flags: BorderRightWidthDeclaration.Flags,
shorthands: BorderRightWidthDeclaration.Shorthands)
},
@@ -973,6 +1121,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderRightStyleDeclaration.Name, new DeclarationInfo(
name: BorderRightStyleDeclaration.Name,
converter: BorderRightStyleDeclaration.Converter,
+ initialValue: BorderRightStyleDeclaration.InitialValue,
flags: BorderRightStyleDeclaration.Flags,
shorthands: BorderRightStyleDeclaration.Shorthands)
},
@@ -980,6 +1129,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderRightColorDeclaration.Name, new DeclarationInfo(
name: BorderRightColorDeclaration.Name,
converter: BorderRightColorDeclaration.Converter,
+ initialValue: BorderRightColorDeclaration.InitialValue,
flags: BorderRightColorDeclaration.Flags,
shorthands: BorderRightColorDeclaration.Shorthands)
},
@@ -987,6 +1137,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderLeftWidthDeclaration.Name, new DeclarationInfo(
name: BorderLeftWidthDeclaration.Name,
converter: BorderLeftWidthDeclaration.Converter,
+ initialValue: BorderLeftWidthDeclaration.InitialValue,
flags: BorderLeftWidthDeclaration.Flags,
shorthands: BorderLeftWidthDeclaration.Shorthands)
},
@@ -994,6 +1145,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderLeftStyleDeclaration.Name, new DeclarationInfo(
name: BorderLeftStyleDeclaration.Name,
converter: BorderLeftStyleDeclaration.Converter,
+ initialValue: BorderLeftStyleDeclaration.InitialValue,
flags: BorderLeftStyleDeclaration.Flags,
shorthands: BorderLeftStyleDeclaration.Shorthands)
},
@@ -1001,6 +1153,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderLeftColorDeclaration.Name, new DeclarationInfo(
name: BorderLeftColorDeclaration.Name,
converter: BorderLeftColorDeclaration.Converter,
+ initialValue: BorderLeftColorDeclaration.InitialValue,
flags: BorderLeftColorDeclaration.Flags,
shorthands: BorderLeftColorDeclaration.Shorthands)
},
@@ -1008,6 +1161,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomWidthDeclaration.Name, new DeclarationInfo(
name: BorderBottomWidthDeclaration.Name,
converter: BorderBottomWidthDeclaration.Converter,
+ initialValue: BorderBottomWidthDeclaration.InitialValue,
flags: BorderBottomWidthDeclaration.Flags,
shorthands: BorderBottomWidthDeclaration.Shorthands)
},
@@ -1015,6 +1169,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomStyleDeclaration.Name, new DeclarationInfo(
name: BorderBottomStyleDeclaration.Name,
converter: BorderBottomStyleDeclaration.Converter,
+ initialValue: BorderBottomStyleDeclaration.InitialValue,
flags: BorderBottomStyleDeclaration.Flags,
shorthands: BorderBottomStyleDeclaration.Shorthands)
},
@@ -1022,6 +1177,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomColorDeclaration.Name, new DeclarationInfo(
name: BorderBottomColorDeclaration.Name,
converter: BorderBottomColorDeclaration.Converter,
+ initialValue: BorderBottomColorDeclaration.InitialValue,
flags: BorderBottomColorDeclaration.Flags,
shorthands: BorderBottomColorDeclaration.Shorthands)
},
@@ -1029,6 +1185,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
AnimationDeclaration.Name, new DeclarationInfo(
name: AnimationDeclaration.Name,
converter: AnimationDeclaration.Converter,
+ initialValue: AnimationDeclaration.InitialValue,
flags: AnimationDeclaration.Flags,
longhands: AnimationDeclaration.Longhands)
},
@@ -1036,6 +1193,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BackgroundDeclaration.Name, new DeclarationInfo(
name: BackgroundDeclaration.Name,
converter: BackgroundDeclaration.Converter,
+ initialValue: BackgroundDeclaration.InitialValue,
flags: BackgroundDeclaration.Flags,
longhands: BackgroundDeclaration.Longhands)
},
@@ -1043,6 +1201,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TransitionDeclaration.Name, new DeclarationInfo(
name: TransitionDeclaration.Name,
converter: TransitionDeclaration.Converter,
+ initialValue: TransitionDeclaration.InitialValue,
flags: TransitionDeclaration.Flags,
longhands: TransitionDeclaration.Longhands)
},
@@ -1050,6 +1209,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
TextDecorationDeclaration.Name, new DeclarationInfo(
name: TextDecorationDeclaration.Name,
converter: TextDecorationDeclaration.Converter,
+ initialValue: TextDecorationDeclaration.InitialValue,
flags: TextDecorationDeclaration.Flags,
longhands: TextDecorationDeclaration.Longhands)
},
@@ -1057,6 +1217,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
OutlineDeclaration.Name, new DeclarationInfo(
name: OutlineDeclaration.Name,
converter: OutlineDeclaration.Converter,
+ initialValue: OutlineDeclaration.InitialValue,
flags: OutlineDeclaration.Flags,
longhands: OutlineDeclaration.Longhands)
},
@@ -1064,6 +1225,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ListStyleDeclaration.Name, new DeclarationInfo(
name: ListStyleDeclaration.Name,
converter: ListStyleDeclaration.Converter,
+ initialValue: ListStyleDeclaration.InitialValue,
flags: ListStyleDeclaration.Flags,
longhands: ListStyleDeclaration.Longhands)
},
@@ -1071,6 +1233,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FontDeclaration.Name, new DeclarationInfo(
name: FontDeclaration.Name,
converter: FontDeclaration.Converter,
+ initialValue: FontDeclaration.InitialValue,
flags: FontDeclaration.Flags,
longhands: FontDeclaration.Longhands)
},
@@ -1078,6 +1241,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnsDeclaration.Name, new DeclarationInfo(
name: ColumnsDeclaration.Name,
converter: ColumnsDeclaration.Converter,
+ initialValue: ColumnsDeclaration.InitialValue,
flags: ColumnsDeclaration.Flags,
longhands: ColumnsDeclaration.Longhands)
},
@@ -1085,6 +1249,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
ColumnRuleDeclaration.Name, new DeclarationInfo(
name: ColumnRuleDeclaration.Name,
converter: ColumnRuleDeclaration.Converter,
+ initialValue: ColumnRuleDeclaration.InitialValue,
flags: ColumnRuleDeclaration.Flags,
longhands: ColumnRuleDeclaration.Longhands)
},
@@ -1092,6 +1257,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
PaddingDeclaration.Name, new DeclarationInfo(
name: PaddingDeclaration.Name,
converter: PaddingDeclaration.Converter,
+ initialValue: PaddingDeclaration.InitialValue,
flags: PaddingDeclaration.Flags,
longhands: PaddingDeclaration.Longhands)
},
@@ -1099,6 +1265,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
MarginDeclaration.Name, new DeclarationInfo(
name: MarginDeclaration.Name,
converter: MarginDeclaration.Converter,
+ initialValue: MarginDeclaration.InitialValue,
flags: MarginDeclaration.Flags,
longhands: MarginDeclaration.Longhands)
},
@@ -1106,6 +1273,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderRadiusDeclaration.Name, new DeclarationInfo(
name: BorderRadiusDeclaration.Name,
converter: BorderRadiusDeclaration.Converter,
+ initialValue: BorderRadiusDeclaration.InitialValue,
flags: BorderRadiusDeclaration.Flags,
longhands: BorderRadiusDeclaration.Longhands)
},
@@ -1113,6 +1281,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderImageDeclaration.Name, new DeclarationInfo(
name: BorderImageDeclaration.Name,
converter: BorderImageDeclaration.Converter,
+ initialValue: BorderImageDeclaration.InitialValue,
flags: BorderImageDeclaration.Flags,
longhands: BorderImageDeclaration.Longhands)
},
@@ -1120,6 +1289,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderWidthDeclaration.Name, new DeclarationInfo(
name: BorderWidthDeclaration.Name,
converter: BorderWidthDeclaration.Converter,
+ initialValue: BorderWidthDeclaration.InitialValue,
flags: BorderWidthDeclaration.Flags,
shorthands: BorderWidthDeclaration.Shorthands,
longhands: BorderWidthDeclaration.Longhands)
@@ -1128,6 +1298,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderTopDeclaration.Name, new DeclarationInfo(
name: BorderTopDeclaration.Name,
converter: BorderTopDeclaration.Converter,
+ initialValue: BorderTopDeclaration.InitialValue,
flags: BorderTopDeclaration.Flags,
shorthands: BorderTopDeclaration.Shorthands,
longhands: BorderTopDeclaration.Longhands)
@@ -1136,6 +1307,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderStyleDeclaration.Name, new DeclarationInfo(
name: BorderStyleDeclaration.Name,
converter: BorderStyleDeclaration.Converter,
+ initialValue: BorderStyleDeclaration.InitialValue,
flags: BorderStyleDeclaration.Flags,
shorthands: BorderStyleDeclaration.Shorthands,
longhands: BorderStyleDeclaration.Longhands)
@@ -1144,6 +1316,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderRightDeclaration.Name, new DeclarationInfo(
name: BorderRightDeclaration.Name,
converter: BorderRightDeclaration.Converter,
+ initialValue: BorderRightDeclaration.InitialValue,
flags: BorderRightDeclaration.Flags,
shorthands: BorderRightDeclaration.Shorthands,
longhands: BorderRightDeclaration.Longhands)
@@ -1152,6 +1325,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderLeftDeclaration.Name, new DeclarationInfo(
name: BorderLeftDeclaration.Name,
converter: BorderLeftDeclaration.Converter,
+ initialValue: BorderLeftDeclaration.InitialValue,
flags: BorderLeftDeclaration.Flags,
shorthands: BorderLeftDeclaration.Shorthands,
longhands: BorderLeftDeclaration.Longhands)
@@ -1160,6 +1334,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderColorDeclaration.Name, new DeclarationInfo(
name: BorderColorDeclaration.Name,
converter: BorderColorDeclaration.Converter,
+ initialValue: BorderColorDeclaration.InitialValue,
flags: BorderColorDeclaration.Flags,
shorthands: BorderColorDeclaration.Shorthands,
longhands: BorderColorDeclaration.Longhands)
@@ -1168,6 +1343,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderBottomDeclaration.Name, new DeclarationInfo(
name: BorderBottomDeclaration.Name,
converter: BorderBottomDeclaration.Converter,
+ initialValue: BorderBottomDeclaration.InitialValue,
flags: BorderBottomDeclaration.Flags,
shorthands: BorderBottomDeclaration.Shorthands,
longhands: BorderBottomDeclaration.Longhands)
@@ -1176,6 +1352,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
BorderDeclaration.Name, new DeclarationInfo(
name: BorderDeclaration.Name,
converter: BorderDeclaration.Converter,
+ initialValue: BorderDeclaration.InitialValue,
flags: BorderDeclaration.Flags,
longhands: BorderDeclaration.Longhands)
},
@@ -1183,78 +1360,98 @@ public class DefaultDeclarationFactory : IDeclarationFactory
RubyAlignDeclaration.Name, new DeclarationInfo(
name: RubyAlignDeclaration.Name,
converter: RubyAlignDeclaration.Converter,
+ initialValue: RubyAlignDeclaration.InitialValue,
flags: RubyAlignDeclaration.Flags)
},
{
RubyOverhangDeclaration.Name, new DeclarationInfo(
name: RubyOverhangDeclaration.Name,
converter: RubyOverhangDeclaration.Converter,
+ initialValue: RubyOverhangDeclaration.InitialValue,
flags: RubyOverhangDeclaration.Flags)
},
{
RubyPositionDeclaration.Name, new DeclarationInfo(
name: RubyPositionDeclaration.Name,
converter: RubyPositionDeclaration.Converter,
+ initialValue: RubyPositionDeclaration.InitialValue,
flags: RubyPositionDeclaration.Flags)
},
{
Scrollbar3dLightColorDeclaration.Name, new DeclarationInfo(
name: Scrollbar3dLightColorDeclaration.Name,
converter: Scrollbar3dLightColorDeclaration.Converter,
+ initialValue: Scrollbar3dLightColorDeclaration.InitialValue,
flags: Scrollbar3dLightColorDeclaration.Flags)
},
{
ScrollbarArrowColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarArrowColorDeclaration.Name,
converter: ScrollbarArrowColorDeclaration.Converter,
+ initialValue: ScrollbarArrowColorDeclaration.InitialValue,
flags: ScrollbarArrowColorDeclaration.Flags)
},
{
ScrollbarBaseColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarBaseColorDeclaration.Name,
converter: ScrollbarBaseColorDeclaration.Converter,
+ initialValue: ScrollbarBaseColorDeclaration.InitialValue,
flags: ScrollbarBaseColorDeclaration.Flags)
},
{
ScrollbarDarkshadowColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarDarkshadowColorDeclaration.Name,
converter: ScrollbarDarkshadowColorDeclaration.Converter,
+ initialValue: ScrollbarDarkshadowColorDeclaration.InitialValue,
flags: ScrollbarDarkshadowColorDeclaration.Flags)
},
{
ScrollbarFaceColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarFaceColorDeclaration.Name,
converter: ScrollbarFaceColorDeclaration.Converter,
+ initialValue: ScrollbarFaceColorDeclaration.InitialValue,
flags: ScrollbarFaceColorDeclaration.Flags)
},
{
ScrollbarHighlightColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarHighlightColorDeclaration.Name,
converter: ScrollbarHighlightColorDeclaration.Converter,
+ initialValue: ScrollbarHighlightColorDeclaration.InitialValue,
flags: ScrollbarHighlightColorDeclaration.Flags)
},
{
ScrollbarShadowColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarShadowColorDeclaration.Name,
converter: ScrollbarShadowColorDeclaration.Converter,
+ initialValue: ScrollbarShadowColorDeclaration.InitialValue,
flags: ScrollbarShadowColorDeclaration.Flags)
},
{
ScrollbarTrackColorDeclaration.Name, new DeclarationInfo(
name: ScrollbarTrackColorDeclaration.Name,
converter: ScrollbarTrackColorDeclaration.Converter,
+ initialValue: ScrollbarTrackColorDeclaration.InitialValue,
flags: ScrollbarTrackColorDeclaration.Flags)
},
+ {
+ PointerEventsDeclaration.Name, new DeclarationInfo(
+ name: PointerEventsDeclaration.Name,
+ converter: PointerEventsDeclaration.Converter,
+ initialValue: PointerEventsDeclaration.InitialValue,
+ flags: PointerEventsDeclaration.Flags)
+ },
{
OrderDeclaration.Name, new DeclarationInfo(
name: OrderDeclaration.Name,
converter: OrderDeclaration.Converter,
+ initialValue: OrderDeclaration.InitialValue,
flags: OrderDeclaration.Flags)
},
{
FlexShrinkDeclaration.Name, new DeclarationInfo(
name: FlexShrinkDeclaration.Name,
converter: FlexShrinkDeclaration.Converter,
+ initialValue: FlexShrinkDeclaration.InitialValue,
shorthands: FlexShrinkDeclaration.Shorthands,
flags: FlexShrinkDeclaration.Flags)
},
@@ -1262,6 +1459,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FlexGrowDeclaration.Name, new DeclarationInfo(
name: FlexGrowDeclaration.Name,
converter: FlexGrowDeclaration.Converter,
+ initialValue: FlexGrowDeclaration.InitialValue,
shorthands: FlexGrowDeclaration.Shorthands,
flags: FlexGrowDeclaration.Flags)
},
@@ -1269,6 +1467,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FlexBasisDeclaration.Name, new DeclarationInfo(
name: FlexBasisDeclaration.Name,
converter: FlexBasisDeclaration.Converter,
+ initialValue: FlexBasisDeclaration.InitialValue,
shorthands: FlexBasisDeclaration.Shorthands,
flags: FlexBasisDeclaration.Flags)
},
@@ -1276,30 +1475,35 @@ public class DefaultDeclarationFactory : IDeclarationFactory
JustifyContentDeclaration.Name, new DeclarationInfo(
name: JustifyContentDeclaration.Name,
converter: JustifyContentDeclaration.Converter,
+ initialValue: JustifyContentDeclaration.InitialValue,
flags: JustifyContentDeclaration.Flags)
},
{
AlignContentDeclaration.Name, new DeclarationInfo(
name: AlignContentDeclaration.Name,
converter: AlignContentDeclaration.Converter,
+ initialValue: AlignContentDeclaration.InitialValue,
flags: AlignContentDeclaration.Flags)
},
{
AlignSelfDeclaration.Name, new DeclarationInfo(
name: AlignSelfDeclaration.Name,
converter: AlignSelfDeclaration.Converter,
+ initialValue: AlignSelfDeclaration.InitialValue,
flags: AlignSelfDeclaration.Flags)
},
{
AlignItemsDeclaration.Name, new DeclarationInfo(
name: AlignItemsDeclaration.Name,
converter: AlignItemsDeclaration.Converter,
+ initialValue: AlignItemsDeclaration.InitialValue,
flags: AlignItemsDeclaration.Flags)
},
{
FlexDirectionDeclaration.Name, new DeclarationInfo(
name: FlexDirectionDeclaration.Name,
converter: FlexDirectionDeclaration.Converter,
+ initialValue: FlexDirectionDeclaration.InitialValue,
shorthands: FlexDirectionDeclaration.Shorthands,
flags: FlexDirectionDeclaration.Flags)
},
@@ -1307,6 +1511,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FlexWrapDeclaration.Name, new DeclarationInfo(
name: FlexWrapDeclaration.Name,
converter: FlexWrapDeclaration.Converter,
+ initialValue: FlexWrapDeclaration.InitialValue,
shorthands: FlexWrapDeclaration.Shorthands,
flags: FlexWrapDeclaration.Flags)
},
@@ -1314,6 +1519,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FlexDeclaration.Name, new DeclarationInfo(
name: FlexDeclaration.Name,
converter: FlexDeclaration.Converter,
+ initialValue: FlexDeclaration.InitialValue,
longhands: FlexDeclaration.Longhands,
flags: FlexDeclaration.Flags)
},
@@ -1321,6 +1527,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
FlexFlowDeclaration.Name, new DeclarationInfo(
name: FlexFlowDeclaration.Name,
converter: FlexFlowDeclaration.Converter,
+ initialValue: FlexFlowDeclaration.InitialValue,
longhands: FlexFlowDeclaration.Longhands,
flags: FlexFlowDeclaration.Flags)
},
@@ -1328,6 +1535,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridTemplateColumnsDeclaration.Name, new DeclarationInfo(
name: GridTemplateColumnsDeclaration.Name,
converter: GridTemplateColumnsDeclaration.Converter,
+ initialValue: GridTemplateColumnsDeclaration.InitialValue,
shorthands: GridTemplateAreasDeclaration.Shorthands,
flags: GridTemplateColumnsDeclaration.Flags)
},
@@ -1335,6 +1543,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridTemplateRowsDeclaration.Name, new DeclarationInfo(
name: GridTemplateRowsDeclaration.Name,
converter: GridTemplateRowsDeclaration.Converter,
+ initialValue: GridTemplateRowsDeclaration.InitialValue,
shorthands: GridTemplateAreasDeclaration.Shorthands,
flags: GridTemplateRowsDeclaration.Flags)
},
@@ -1342,6 +1551,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridTemplateAreasDeclaration.Name, new DeclarationInfo(
name: GridTemplateAreasDeclaration.Name,
converter: GridTemplateAreasDeclaration.Converter,
+ initialValue: GridTemplateAreasDeclaration.InitialValue,
shorthands: GridTemplateAreasDeclaration.Shorthands,
flags: GridTemplateAreasDeclaration.Flags)
},
@@ -1349,6 +1559,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridTemplateDeclaration.Name, new DeclarationInfo(
name: GridTemplateDeclaration.Name,
converter: GridTemplateDeclaration.Converter,
+ initialValue: GridTemplateDeclaration.InitialValue,
longhands: GridTemplateDeclaration.Longhands,
flags: GridTemplateDeclaration.Flags)
},
@@ -1356,24 +1567,28 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridAutoColumnsDeclaration.Name, new DeclarationInfo(
name: GridAutoColumnsDeclaration.Name,
converter: GridAutoColumnsDeclaration.Converter,
+ initialValue: GridAutoColumnsDeclaration.InitialValue,
flags: GridAutoColumnsDeclaration.Flags)
},
{
GridAutoRowsDeclaration.Name, new DeclarationInfo(
name: GridAutoRowsDeclaration.Name,
converter: GridAutoRowsDeclaration.Converter,
+ initialValue: GridAutoRowsDeclaration.InitialValue,
flags: GridAutoRowsDeclaration.Flags)
},
{
GridAutoFlowDeclaration.Name, new DeclarationInfo(
name: GridAutoFlowDeclaration.Name,
converter: GridAutoFlowDeclaration.Converter,
+ initialValue: GridAutoFlowDeclaration.InitialValue,
flags: GridAutoFlowDeclaration.Flags)
},
{
GridDeclaration.Name, new DeclarationInfo(
name: GridDeclaration.Name,
converter: GridDeclaration.Converter,
+ initialValue: GridDeclaration.InitialValue,
longhands: GridDeclaration.Longhands,
flags: GridDeclaration.Flags)
},
@@ -1381,6 +1596,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridRowStartDeclaration.Name, new DeclarationInfo(
name: GridRowStartDeclaration.Name,
converter: GridRowStartDeclaration.Converter,
+ initialValue: GridRowStartDeclaration.InitialValue,
shorthands: GridRowStartDeclaration.Shorthands,
flags: GridRowStartDeclaration.Flags)
},
@@ -1388,6 +1604,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridColumnStartDeclaration.Name, new DeclarationInfo(
name: GridColumnStartDeclaration.Name,
converter: GridColumnStartDeclaration.Converter,
+ initialValue: GridColumnStartDeclaration.InitialValue,
shorthands: GridColumnStartDeclaration.Shorthands,
flags: GridColumnStartDeclaration.Flags)
},
@@ -1395,6 +1612,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridRowEndDeclaration.Name, new DeclarationInfo(
name: GridRowEndDeclaration.Name,
converter: GridRowEndDeclaration.Converter,
+ initialValue: GridRowEndDeclaration.InitialValue,
shorthands: GridRowEndDeclaration.Shorthands,
flags: GridRowEndDeclaration.Flags)
},
@@ -1402,6 +1620,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridColumnEndDeclaration.Name, new DeclarationInfo(
name: GridColumnEndDeclaration.Name,
converter: GridColumnEndDeclaration.Converter,
+ initialValue: GridColumnEndDeclaration.InitialValue,
shorthands: GridColumnEndDeclaration.Shorthands,
flags: GridColumnEndDeclaration.Flags)
},
@@ -1409,6 +1628,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridRowDeclaration.Name, new DeclarationInfo(
name: GridRowDeclaration.Name,
converter: GridRowDeclaration.Converter,
+ initialValue: GridRowDeclaration.InitialValue,
longhands: GridRowDeclaration.Longhands,
flags: GridRowDeclaration.Flags)
},
@@ -1416,6 +1636,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridColumnDeclaration.Name, new DeclarationInfo(
name: GridColumnDeclaration.Name,
converter: GridColumnDeclaration.Converter,
+ initialValue: GridColumnDeclaration.InitialValue,
longhands: GridColumnDeclaration.Longhands,
flags: GridColumnDeclaration.Flags)
},
@@ -1423,6 +1644,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridAreaDeclaration.Name, new DeclarationInfo(
name: GridAreaDeclaration.Name,
converter: GridAreaDeclaration.Converter,
+ initialValue: GridAreaDeclaration.InitialValue,
longhands: GridAreaDeclaration.Longhands,
flags: GridAreaDeclaration.Flags)
},
@@ -1430,6 +1652,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridRowGapDeclaration.Name, new DeclarationInfo(
name: GridRowGapDeclaration.Name,
converter: GridRowGapDeclaration.Converter,
+ initialValue: GridRowGapDeclaration.InitialValue,
shorthands: GridRowGapDeclaration.Shorthands,
flags: GridRowGapDeclaration.Flags)
},
@@ -1437,6 +1660,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridColumnGapDeclaration.Name, new DeclarationInfo(
name: GridColumnGapDeclaration.Name,
converter: GridColumnGapDeclaration.Converter,
+ initialValue: GridColumnGapDeclaration.InitialValue,
shorthands: GridColumnGapDeclaration.Shorthands,
flags: GridColumnGapDeclaration.Flags)
},
@@ -1444,6 +1668,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
GridGapDeclaration.Name, new DeclarationInfo(
name: GridGapDeclaration.Name,
converter: GridGapDeclaration.Converter,
+ initialValue: GridGapDeclaration.InitialValue,
longhands: GridGapDeclaration.Longhands,
flags: GridGapDeclaration.Flags)
},
@@ -1455,10 +1680,7 @@ public class DefaultDeclarationFactory : IDeclarationFactory
///
/// The name of the property.
/// The converter to use.
- public void Register(String propertyName, DeclarationInfo converter)
- {
- _declarations.Add(propertyName, converter);
- }
+ public void Register(String propertyName, DeclarationInfo converter) => _declarations.Add(propertyName, converter);
///
/// Unregisters an existing declaration.
@@ -1467,9 +1689,7 @@ public void Register(String propertyName, DeclarationInfo converter)
/// The registered declaration, if any.
public DeclarationInfo Unregister(String propertyName)
{
- var info = default(DeclarationInfo);
-
- if (_declarations.TryGetValue(propertyName, out info))
+ if (_declarations.TryGetValue(propertyName, out DeclarationInfo info))
{
_declarations.Remove(propertyName);
}
diff --git a/src/AngleSharp.Css/DefaultDocumentFunctionFactory.cs b/src/AngleSharp.Css/Factories/DefaultDocumentFunctionFactory.cs
similarity index 98%
rename from src/AngleSharp.Css/DefaultDocumentFunctionFactory.cs
rename to src/AngleSharp.Css/Factories/DefaultDocumentFunctionFactory.cs
index 4cf65d86..cc2ef389 100644
--- a/src/AngleSharp.Css/DefaultDocumentFunctionFactory.cs
+++ b/src/AngleSharp.Css/Factories/DefaultDocumentFunctionFactory.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css
+namespace AngleSharp.Css
{
using AngleSharp.Css.Dom;
using System;
@@ -21,7 +21,7 @@ public class DefaultDocumentFunctionFactory : IDocumentFunctionFactory
{ FunctionNames.Url, str => new UrlFunction(str) },
{ FunctionNames.Domain, str => new DomainFunction(str) },
{ FunctionNames.UrlPrefix, str => new UrlPrefixFunction(str) },
- { FunctionNames.Regexp, str => new RegexpFunction(str) }
+ { FunctionNames.Regexp, str => new RegexpFunction(str) },
};
///
diff --git a/src/AngleSharp.Css/DefaultFeatureValidatorFactory.cs b/src/AngleSharp.Css/Factories/DefaultFeatureValidatorFactory.cs
similarity index 99%
rename from src/AngleSharp.Css/DefaultFeatureValidatorFactory.cs
rename to src/AngleSharp.Css/Factories/DefaultFeatureValidatorFactory.cs
index a0a6a611..13e5cabb 100644
--- a/src/AngleSharp.Css/DefaultFeatureValidatorFactory.cs
+++ b/src/AngleSharp.Css/Factories/DefaultFeatureValidatorFactory.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css
+namespace AngleSharp.Css
{
using AngleSharp.Css.FeatureValidators;
using System;
@@ -56,7 +56,7 @@ public class DefaultFeatureValidatorFactory : IFeatureValidatorFactory
{ FeatureNames.UpdateFrequency, () => new UpdateFrequencyFeatureValidator() },
{ FeatureNames.Scripting, () => new ScanFeatureValidator() },
{ FeatureNames.Pointer, () => new PointerFeatureValidator() },
- { FeatureNames.Hover, () => new HoverFeatureValidator() }
+ { FeatureNames.Hover, () => new HoverFeatureValidator() },
};
///
diff --git a/src/AngleSharp.Css/DefaultPseudoElementFactory.cs b/src/AngleSharp.Css/Factories/DefaultPseudoElementFactory.cs
similarity index 97%
rename from src/AngleSharp.Css/DefaultPseudoElementFactory.cs
rename to src/AngleSharp.Css/Factories/DefaultPseudoElementFactory.cs
index 14f55e25..7daa458b 100644
--- a/src/AngleSharp.Css/DefaultPseudoElementFactory.cs
+++ b/src/AngleSharp.Css/Factories/DefaultPseudoElementFactory.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css
+namespace AngleSharp.Css
{
using AngleSharp.Css.Dom;
using AngleSharp.Dom;
@@ -21,7 +21,7 @@ public class DefaultPseudoElementFactory : IPseudoElementFactory
{
{ PseudoElementNames.Before, element => new PseudoElement(element, PseudoElementNames.Before) },
{ PseudoElementNames.After, element => new PseudoElement(element, PseudoElementNames.After) },
- { PseudoElementNames.Slotted, element => new PseudoElement(element, PseudoElementNames.Slotted) }
+ { PseudoElementNames.Slotted, element => new PseudoElement(element, PseudoElementNames.Slotted) },
};
///
diff --git a/src/AngleSharp.Css/Factory.cs b/src/AngleSharp.Css/Factories/Factory.cs
similarity index 100%
rename from src/AngleSharp.Css/Factory.cs
rename to src/AngleSharp.Css/Factories/Factory.cs
diff --git a/src/AngleSharp.Css/IDeclarationFactory.cs b/src/AngleSharp.Css/Factories/IDeclarationFactory.cs
similarity index 100%
rename from src/AngleSharp.Css/IDeclarationFactory.cs
rename to src/AngleSharp.Css/Factories/IDeclarationFactory.cs
diff --git a/src/AngleSharp.Css/IDocumentFunctionFactory.cs b/src/AngleSharp.Css/Factories/IDocumentFunctionFactory.cs
similarity index 100%
rename from src/AngleSharp.Css/IDocumentFunctionFactory.cs
rename to src/AngleSharp.Css/Factories/IDocumentFunctionFactory.cs
diff --git a/src/AngleSharp.Css/IFeatureValidatorFactory.cs b/src/AngleSharp.Css/Factories/IFeatureValidatorFactory.cs
similarity index 100%
rename from src/AngleSharp.Css/IFeatureValidatorFactory.cs
rename to src/AngleSharp.Css/Factories/IFeatureValidatorFactory.cs
diff --git a/src/AngleSharp.Css/IPseudoElementFactory.cs b/src/AngleSharp.Css/Factories/IPseudoElementFactory.cs
similarity index 100%
rename from src/AngleSharp.Css/IPseudoElementFactory.cs
rename to src/AngleSharp.Css/Factories/IPseudoElementFactory.cs
diff --git a/src/AngleSharp.Css/StyleAttributeObserver.cs b/src/AngleSharp.Css/Factories/StyleAttributeObserver.cs
similarity index 100%
rename from src/AngleSharp.Css/StyleAttributeObserver.cs
rename to src/AngleSharp.Css/Factories/StyleAttributeObserver.cs
diff --git a/src/AngleSharp.Css/FeatureValidators/AspectRatioFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/AspectRatioFeatureValidator.cs
index 5c6f9971..7c98464e 100644
--- a/src/AngleSharp.Css/FeatureValidators/AspectRatioFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/AspectRatioFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (ratio != null)
{
- var desired = ratio.AsNumber();
+ var desired = ratio.AsDouble();
var available = device.ViewPortWidth / (Double)device.ViewPortHeight;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/ColorFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/ColorFeatureValidator.cs
index af14bdf9..ef81d1e1 100644
--- a/src/AngleSharp.Css/FeatureValidators/ColorFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/ColorFeatureValidator.cs
@@ -1,7 +1,8 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
using System;
using static ValueConverters;
@@ -9,12 +10,13 @@ sealed class ColorFeatureValidator : IFeatureValidator
{
public Boolean Validate(IMediaFeature feature, IRenderDevice device)
{
- var converter = feature.IsMinimum || feature.IsMaximum ? PositiveIntegerConverter : PositiveIntegerConverter.Option(1);
+ var defaultValue = new Length(1.0, Length.Unit.None);
+ var converter = feature.IsMinimum || feature.IsMaximum ? PositiveIntegerConverter : PositiveIntegerConverter.Option(defaultValue);
var color = converter.Convert(feature.Value);
if (color != null)
{
- var desired = color.AsInteger();
+ var desired = color.AsInt32();
var available = Math.Pow(device.ColorBits, 2);
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/ColorIndexFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/ColorIndexFeatureValidator.cs
index 074b9440..75e28b39 100644
--- a/src/AngleSharp.Css/FeatureValidators/ColorIndexFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/ColorIndexFeatureValidator.cs
@@ -1,7 +1,8 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
using System;
using static ValueConverters;
@@ -9,12 +10,13 @@ sealed class ColorIndexFeatureValidator : IFeatureValidator
{
public Boolean Validate(IMediaFeature feature, IRenderDevice device)
{
- var converter = feature.IsMinimum || feature.IsMaximum ? NaturalIntegerConverter : NaturalIntegerConverter.Option(1);
+ var defaultValue = new Length(1.0, Length.Unit.None);
+ var converter = feature.IsMinimum || feature.IsMaximum ? NaturalIntegerConverter : NaturalIntegerConverter.Option(defaultValue);
var index = converter.Convert(feature.Value);
if (index != null)
{
- var desired = index.AsInteger();
+ var desired = index.AsInt32();
var available = device.ColorBits;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/DeviceAspectRatioFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/DeviceAspectRatioFeatureValidator.cs
index 829cda29..3b813900 100644
--- a/src/AngleSharp.Css/FeatureValidators/DeviceAspectRatioFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/DeviceAspectRatioFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (ratio != null)
{
- var desired = ratio.AsNumber();
+ var desired = ratio.AsDouble();
var available = device.DeviceWidth / (Double)device.DeviceHeight;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/DeviceHeightFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/DeviceHeightFeatureValidator.cs
index 1ef4f54c..d6b29127 100644
--- a/src/AngleSharp.Css/FeatureValidators/DeviceHeightFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/DeviceHeightFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (length != null)
{
- var desired = length.AsPixel();
+ var desired = length.AsPx();
var available = (Double)device.DeviceHeight;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/DevicePixelRatioFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/DevicePixelRatioFeatureValidator.cs
index 5bca4284..065d5981 100644
--- a/src/AngleSharp.Css/FeatureValidators/DevicePixelRatioFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/DevicePixelRatioFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (value != null)
{
- var desired = value.AsNumber();
+ var desired = value.AsDouble();
var available = device.Resolution / 96f;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/DeviceWidthFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/DeviceWidthFeatureValidator.cs
index 4d9e91ef..1406f114 100644
--- a/src/AngleSharp.Css/FeatureValidators/DeviceWidthFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/DeviceWidthFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (length != null)
{
- var desired = length.AsPixel();
+ var desired = length.AsPx();
var available = (Double)device.DeviceWidth;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/GridFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/GridFeatureValidator.cs
index ede27717..48734c58 100644
--- a/src/AngleSharp.Css/FeatureValidators/GridFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/GridFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/HeightFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/HeightFeatureValidator.cs
index c8a15b35..785cba1c 100644
--- a/src/AngleSharp.Css/FeatureValidators/HeightFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/HeightFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (length != null)
{
- var desired = length.AsPixel();
+ var desired = length.AsPx();
var available = (Double)device.ViewPortHeight;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/HoverFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/HoverFeatureValidator.cs
index b3d91dca..a278d796 100644
--- a/src/AngleSharp.Css/FeatureValidators/HoverFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/HoverFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/MonochromeFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/MonochromeFeatureValidator.cs
index f021155e..df10f95e 100644
--- a/src/AngleSharp.Css/FeatureValidators/MonochromeFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/MonochromeFeatureValidator.cs
@@ -1,7 +1,8 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
+ using AngleSharp.Css.Values;
using System;
using static ValueConverters;
@@ -9,12 +10,13 @@ sealed class MonochromeFeatureValidator : IFeatureValidator
{
public Boolean Validate(IMediaFeature feature, IRenderDevice device)
{
- var converter = feature.IsMinimum || feature.IsMaximum ? NaturalIntegerConverter : NaturalIntegerConverter.Option(1);
+ var defaultValue = new Length(1.0, Length.Unit.None);
+ var converter = feature.IsMinimum || feature.IsMaximum ? NaturalIntegerConverter : NaturalIntegerConverter.Option(defaultValue);
var index = converter.Convert(feature.Value);
if (index != null)
{
- var desired = index.AsInteger();
+ var desired = index.AsInt32();
var available = device.MonochromeBits;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/OrientationFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/OrientationFeatureValidator.cs
index c8c9de39..955b53d8 100644
--- a/src/AngleSharp.Css/FeatureValidators/OrientationFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/OrientationFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/PointerFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/PointerFeatureValidator.cs
index 650dc1ab..9643280e 100644
--- a/src/AngleSharp.Css/FeatureValidators/PointerFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/PointerFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/ResolutionFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/ResolutionFeatureValidator.cs
index 72ce6133..774d495f 100644
--- a/src/AngleSharp.Css/FeatureValidators/ResolutionFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/ResolutionFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (res != null)
{
- var desired = res.AsInteger();
+ var desired = res.AsInt32();
var available = device.Resolution;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/FeatureValidators/ScanFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/ScanFeatureValidator.cs
index 44000697..d1bd80fe 100644
--- a/src/AngleSharp.Css/FeatureValidators/ScanFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/ScanFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/ScriptingFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/ScriptingFeatureValidator.cs
index feeb1428..91bc5a5c 100644
--- a/src/AngleSharp.Css/FeatureValidators/ScriptingFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/ScriptingFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/UnknownFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/UnknownFeatureValidator.cs
index e08d03a9..5c774604 100644
--- a/src/AngleSharp.Css/FeatureValidators/UnknownFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/UnknownFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Dom;
using System;
diff --git a/src/AngleSharp.Css/FeatureValidators/UpdateFrequencyFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/UpdateFrequencyFeatureValidator.cs
index 0f786b39..fd5b9376 100644
--- a/src/AngleSharp.Css/FeatureValidators/UpdateFrequencyFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/UpdateFrequencyFeatureValidator.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.FeatureValidators
+namespace AngleSharp.Css.FeatureValidators
{
using AngleSharp.Css.Converters;
using AngleSharp.Css.Dom;
diff --git a/src/AngleSharp.Css/FeatureValidators/WidthFeatureValidator.cs b/src/AngleSharp.Css/FeatureValidators/WidthFeatureValidator.cs
index df335893..8936ec6a 100644
--- a/src/AngleSharp.Css/FeatureValidators/WidthFeatureValidator.cs
+++ b/src/AngleSharp.Css/FeatureValidators/WidthFeatureValidator.cs
@@ -13,7 +13,7 @@ public Boolean Validate(IMediaFeature feature, IRenderDevice device)
if (length != null)
{
- var desired = length.AsPixel();
+ var desired = length.AsPx();
var available = (Double)device.ViewPortWidth;
if (feature.IsMaximum)
diff --git a/src/AngleSharp.Css/ICssDefaultStyleSheetProvider.cs b/src/AngleSharp.Css/ICssDefaultStyleSheetProvider.cs
new file mode 100644
index 00000000..8515c9d6
--- /dev/null
+++ b/src/AngleSharp.Css/ICssDefaultStyleSheetProvider.cs
@@ -0,0 +1,35 @@
+namespace AngleSharp.Css
+{
+ using AngleSharp.Css.Dom;
+ using System;
+
+ ///
+ /// Handles the presence of a default stylesheet, if any.
+ ///
+ public interface ICssDefaultStyleSheetProvider
+ {
+ ///
+ /// Gets the default stylesheet for some basic styling.
+ ///
+ ICssStyleSheet Default { get; }
+
+ ///
+ /// Sets a new default stylesheet to use.
+ ///
+ /// The default stylesheet to use.
+ void SetDefault(ICssStyleSheet sheet);
+
+ ///
+ /// Sets a new default stylesheet to use.
+ ///
+ /// The source of the default stylesheet.
+ void SetDefault(String source);
+
+ ///
+ /// Sets the default stylesheet to the W3C stylesheet together with
+ /// some custom extensions in form of the given source.
+ ///
+ /// The source of the custom stylesheet part.
+ void AppendDefault(String source);
+ }
+}
diff --git a/src/AngleSharp.Css/IRenderDevice.cs b/src/AngleSharp.Css/IRenderDevice.cs
index 1c4f6031..5c345e0a 100644
--- a/src/AngleSharp.Css/IRenderDevice.cs
+++ b/src/AngleSharp.Css/IRenderDevice.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css
+namespace AngleSharp.Css
{
using System;
@@ -67,10 +67,5 @@ public interface IRenderDevice
/// Gets the category of the device.
///
DeviceCategory Category { get; }
-
- ///
- /// Gets the associated browsing context.
- ///
- IBrowsingContext Context { get; }
}
}
diff --git a/src/AngleSharp.Css/Parser/CssBuilder.cs b/src/AngleSharp.Css/Parser/CssBuilder.cs
index 7c24b29f..fa160c73 100644
--- a/src/AngleSharp.Css/Parser/CssBuilder.cs
+++ b/src/AngleSharp.Css/Parser/CssBuilder.cs
@@ -5,7 +5,6 @@ namespace AngleSharp.Css.Parser
using AngleSharp.Dom;
using AngleSharp.Text;
using System;
- using System.Collections.Generic;
///
/// See http://dev.w3.org/csswg/css-syntax/#parsing for details.
@@ -598,10 +597,7 @@ private void JumpToDeclEnd(ref CssToken current)
}
}
- private CssToken NextToken()
- {
- return _tokenizer.Get();
- }
+ private CssToken NextToken() => _tokenizer.Get();
private void CollectTrivia(ref CssToken token)
{
@@ -625,10 +621,8 @@ private void SkipDeclarations(CssToken token)
JumpToRuleEnd(ref token);
}
- private void RaiseErrorOccurred(CssParseError code, TextPosition position)
- {
+ private void RaiseErrorOccurred(CssParseError code, TextPosition position) =>
_tokenizer.RaiseErrorOccurred(code, position);
- }
#endregion
@@ -636,7 +630,7 @@ private void RaiseErrorOccurred(CssParseError code, TextPosition position)
private String CreateValue(ref CssToken token, out Boolean important)
{
- const String keyword = "!important";
+ var keyword = CssKeywords.BangImportant;
var value = _tokenizer.ContentFrom(token.Position.Position);
important = value.EndsWith(keyword, StringComparison.OrdinalIgnoreCase);
token = NextToken();
diff --git a/src/AngleSharp.Css/Parser/CssParser.cs b/src/AngleSharp.Css/Parser/CssParser.cs
index 63041c3c..5b56e2e8 100644
--- a/src/AngleSharp.Css/Parser/CssParser.cs
+++ b/src/AngleSharp.Css/Parser/CssParser.cs
@@ -102,10 +102,7 @@ public CssParser(CssParserOptions options, IBrowsingContext context)
///
/// Gets the specified options.
///
- public CssParserOptions Options
- {
- get { return _options; }
- }
+ public CssParserOptions Options => _options;
#endregion
diff --git a/src/AngleSharp.Css/Parser/Micro/CalcParser.cs b/src/AngleSharp.Css/Parser/Micro/CalcParser.cs
index 0cd05f07..caff229e 100644
--- a/src/AngleSharp.Css/Parser/Micro/CalcParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/CalcParser.cs
@@ -8,7 +8,7 @@ namespace AngleSharp.Css.Parser
static class CalcParser
{
- public static Calc ParseCalc(this StringSource source)
+ public static CssCalcValue ParseCalc(this StringSource source)
{
var pos = source.Index;
@@ -18,7 +18,7 @@ public static Calc ParseCalc(this StringSource source)
if (expression != null)
{
- return new Calc(expression);
+ return new CssCalcValue(expression);
}
}
@@ -53,7 +53,7 @@ private static ICssValue ParseAddExpression(this StringSource source)
return null;
}
- return new CalcAddExpression(left, right);
+ return new CssCalcAddExpression(left, right);
}
return left;
@@ -73,7 +73,7 @@ private static ICssValue ParseSubExpression(this StringSource source)
return null;
}
- return new CalcSubExpression(left, right);
+ return new CssCalcSubExpression(left, right);
}
return left;
@@ -93,7 +93,7 @@ private static ICssValue ParseMulExpression(this StringSource source)
return null;
}
- return new CalcMulExpression(left, right);
+ return new CssCalcMulExpression(left, right);
}
return left;
@@ -113,7 +113,7 @@ private static ICssValue ParseDivExpression(this StringSource source)
return null;
}
- return new CalcDivExpression(left, right);
+ return new CssCalcDivExpression(left, right);
}
return left;
diff --git a/src/AngleSharp.Css/Parser/Micro/ColorParser.cs b/src/AngleSharp.Css/Parser/Micro/ColorParser.cs
index be311ae6..339f0c9e 100644
--- a/src/AngleSharp.Css/Parser/Micro/ColorParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/ColorParser.cs
@@ -32,10 +32,8 @@ static class ColorParser
return result;
}
- public static Color? ParseCurrentColor(this StringSource source)
- {
- return source.IsIdentifier(CssKeywords.CurrentColor) ? Color.CurrentColor : ColorParser.ParseColor(source);
- }
+ public static Color? ParseCurrentColor(this StringSource source) =>
+ source.IsIdentifier(CssKeywords.CurrentColor) ? Color.CurrentColor : ColorParser.ParseColor(source);
private static Color? Start(StringSource source)
{
diff --git a/src/AngleSharp.Css/Parser/Micro/CompoundParser.cs b/src/AngleSharp.Css/Parser/Micro/CompoundParser.cs
index 2a60f483..687bfcb5 100644
--- a/src/AngleSharp.Css/Parser/Micro/CompoundParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/CompoundParser.cs
@@ -30,7 +30,7 @@ public static CssTupleValue ParseQuotes(this StringSource source)
return new CssTupleValue(quotes.ToArray());
}
- public static BorderImageSlice? ParseBorderImageSlice(this StringSource source)
+ public static CssBorderImageSliceValue ParseBorderImageSlice(this StringSource source)
{
var lengths = new Length[4];
var filled = false;
@@ -67,25 +67,25 @@ public static CssTupleValue ParseQuotes(this StringSource source)
lengths[completed++] = Length.Auto;
}
- return new BorderImageSlice(lengths[0], lengths[1], lengths[2], lengths[3], filled);
+ return new CssBorderImageSliceValue(lengths[0], lengths[1], lengths[2], lengths[3], filled);
}
return null;
}
- public static ImageRepeats? ParseBackgroundRepeat(this StringSource source)
+ public static CssImageRepeatsValue ParseBackgroundRepeat(this StringSource source)
{
if (source.IsIdentifier(CssKeywords.RepeatX))
{
var h = new Constant(CssKeywords.Repeat, BackgroundRepeat.Repeat);
var v = new Constant(CssKeywords.NoRepeat, BackgroundRepeat.NoRepeat);
- return new ImageRepeats(h, v);
+ return new CssImageRepeatsValue(h, v);
}
else if (source.IsIdentifier(CssKeywords.RepeatY))
{
var h = new Constant(CssKeywords.NoRepeat, BackgroundRepeat.NoRepeat);
var v = new Constant(CssKeywords.Repeat, BackgroundRepeat.Repeat);
- return new ImageRepeats(h, v);
+ return new CssImageRepeatsValue(h, v);
}
else
{
@@ -95,18 +95,18 @@ public static CssTupleValue ParseQuotes(this StringSource source)
if (repeatY != null)
{
- return new ImageRepeats(repeatX, repeatY);
+ return new CssImageRepeatsValue(repeatX, repeatY);
}
else if (repeatX != null)
{
- return new ImageRepeats(repeatX, repeatX);
+ return new CssImageRepeatsValue(repeatX, repeatX);
}
}
return null;
}
- public static IImageSource ParseImageSource(this StringSource source)
+ public static ICssImageValue ParseImageSource(this StringSource source)
{
var url = source.ParseUri();
@@ -118,7 +118,7 @@ public static IImageSource ParseImageSource(this StringSource source)
return url;
}
- public static Periodic ParsePeriodic(this StringSource source, Func converter)
+ public static CssPeriodicValue ParsePeriodic(this StringSource source, Func converter)
where T : ICssValue
{
var values = new List(4);
@@ -134,7 +134,7 @@ public static Periodic ParsePeriodic(this StringSource source, Func 0 ? new Periodic(values.ToArray()) : null;
+ return values.Count > 0 ? new CssPeriodicValue(values.ToArray()) : null;
}
}
}
diff --git a/src/AngleSharp.Css/Parser/Micro/ConditionParser.cs b/src/AngleSharp.Css/Parser/Micro/ConditionParser.cs
index 484f4adb..c028a5b1 100644
--- a/src/AngleSharp.Css/Parser/Micro/ConditionParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/ConditionParser.cs
@@ -1,4 +1,4 @@
-namespace AngleSharp.Css.Parser
+namespace AngleSharp.Css.Parser
{
using AngleSharp.Css.Dom;
using AngleSharp.Text;
@@ -7,25 +7,21 @@
static class ConditionParser
{
- public static IConditionFunction Parse(String str)
+ public static IConditionFunction Parse(String str, IBrowsingContext context)
{
var source = new StringSource(str);
source.SkipSpacesAndComments();
- var result = source.ParseConditionFunction();
+ var result = source.ParseConditionFunction(context);
return source.IsDone ? result : null;
}
- public static IConditionFunction ParseConditionFunction(this StringSource source)
- {
- return Condition(source);
- }
+ public static IConditionFunction ParseConditionFunction(this StringSource source, IBrowsingContext context) =>
+ source.Condition(context);
- private static IConditionFunction Condition(StringSource source)
- {
- return Negation(source) ?? ConjunctionOrDisjunction(source);
- }
+ private static IConditionFunction Condition(this StringSource source, IBrowsingContext context) =>
+ source.Negation(context) ?? source.ConjunctionOrDisjunction(context);
- private static IConditionFunction Negation(StringSource source)
+ private static IConditionFunction Negation(this StringSource source, IBrowsingContext context)
{
var pos = source.Index;
var ident = source.ParseIdent();
@@ -33,7 +29,7 @@ private static IConditionFunction Negation(StringSource source)
if (ident != null && ident.Isi(CssKeywords.Not))
{
source.SkipSpacesAndComments();
- var condition = Group(source);
+ var condition = source.Group(context);
if (condition != null)
{
@@ -45,9 +41,9 @@ private static IConditionFunction Negation(StringSource source)
return null;
}
- private static IConditionFunction ConjunctionOrDisjunction(StringSource source)
+ private static IConditionFunction ConjunctionOrDisjunction(this StringSource source, IBrowsingContext context)
{
- var condition = Group(source);
+ var condition = source.Group(context);
source.SkipSpacesAndComments();
var pos = source.Index;
var ident = source.ParseIdent();
@@ -59,7 +55,7 @@ private static IConditionFunction ConjunctionOrDisjunction(StringSource source)
if (isAnd || isOr)
{
- var conditions = Scan(source, ident, condition);
+ var conditions = source.Scan(ident, condition, context);
if (isAnd)
{
@@ -76,7 +72,7 @@ private static IConditionFunction ConjunctionOrDisjunction(StringSource source)
return condition;
}
- private static IConditionFunction Group(StringSource source)
+ private static IConditionFunction Group(this StringSource source, IBrowsingContext context)
{
if (source.Current == Symbols.RoundBracketOpen)
{
@@ -85,7 +81,7 @@ private static IConditionFunction Group(StringSource source)
if (current != Symbols.RoundBracketClose)
{
- condition = Condition(source) ?? Declaration(source);
+ condition = source.Condition(context) ?? source.Declaration(context);
current = source.SkipSpacesAndComments();
if (condition == null)
@@ -104,7 +100,7 @@ private static IConditionFunction Group(StringSource source)
return null;
}
- private static IConditionFunction Declaration(StringSource source)
+ private static IConditionFunction Declaration(this StringSource source, IBrowsingContext context)
{
var name = source.ParseIdent();
var colon = source.SkipSpacesAndComments();
@@ -114,13 +110,13 @@ private static IConditionFunction Declaration(StringSource source)
if (name != null && value != null && colon == Symbols.Colon)
{
- return new DeclarationCondition(name, value);
+ return new DeclarationCondition(context, name, value);
}
return null;
}
- private static IEnumerable Scan(StringSource source, String keyword, IConditionFunction condition)
+ private static IEnumerable Scan(this StringSource source, String keyword, IConditionFunction condition, IBrowsingContext context)
{
var conditions = new List();
var ident = String.Empty;
@@ -129,7 +125,7 @@ private static IEnumerable Scan(StringSource source, String
do
{
source.SkipSpacesAndComments();
- condition = Group(source);
+ condition = source.Group(context);
if (condition == null)
break;
diff --git a/src/AngleSharp.Css/Parser/Micro/CssUriParser.cs b/src/AngleSharp.Css/Parser/Micro/CssUriParser.cs
index 995fa7e3..4b039eda 100644
--- a/src/AngleSharp.Css/Parser/Micro/CssUriParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/CssUriParser.cs
@@ -7,7 +7,7 @@ namespace AngleSharp.Css.Parser
static class CssUriParser
{
- public static UrlReference ParseUri(this StringSource source)
+ public static CssUrlValue ParseUri(this StringSource source)
{
if (source.IsFunction(FunctionNames.Url))
{
@@ -22,10 +22,10 @@ public static UrlReference ParseUri(this StringSource source)
return SingleQuoted(source);
case Symbols.RoundBracketClose:
- return new UrlReference(String.Empty);
+ return new CssUrlValue(String.Empty);
case Symbols.EndOfFile:
- return new UrlReference(String.Empty);
+ return new CssUrlValue(String.Empty);
default:
return Unquoted(source);
@@ -35,7 +35,7 @@ public static UrlReference ParseUri(this StringSource source)
return null;
}
- private static UrlReference DoubleQuoted(StringSource source)
+ private static CssUrlValue DoubleQuoted(StringSource source)
{
var buffer = StringBuilderPool.Obtain();
@@ -49,7 +49,7 @@ private static UrlReference DoubleQuoted(StringSource source)
}
else if (Symbols.EndOfFile == current)
{
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current == Symbols.DoubleQuote)
{
@@ -66,7 +66,7 @@ private static UrlReference DoubleQuoted(StringSource source)
if (current == Symbols.EndOfFile)
{
source.Back();
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current.IsLineBreak())
{
@@ -81,7 +81,7 @@ private static UrlReference DoubleQuoted(StringSource source)
}
}
- private static UrlReference SingleQuoted(StringSource source)
+ private static CssUrlValue SingleQuoted(StringSource source)
{
var buffer = StringBuilderPool.Obtain();
@@ -95,7 +95,7 @@ private static UrlReference SingleQuoted(StringSource source)
}
else if (current == Symbols.EndOfFile)
{
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current == Symbols.SingleQuote)
{
@@ -112,7 +112,7 @@ private static UrlReference SingleQuoted(StringSource source)
if (current == Symbols.EndOfFile)
{
source.Back();
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current.IsLineBreak())
{
@@ -126,7 +126,7 @@ private static UrlReference SingleQuoted(StringSource source)
}
}
- private static UrlReference Unquoted(StringSource source)
+ private static CssUrlValue Unquoted(StringSource source)
{
var buffer = StringBuilderPool.Obtain();
var current = source.Current;
@@ -140,7 +140,7 @@ private static UrlReference Unquoted(StringSource source)
else if (current.IsOneOf(Symbols.RoundBracketClose, Symbols.EndOfFile))
{
source.Next();
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current.IsOneOf(Symbols.DoubleQuote, Symbols.SingleQuote, Symbols.RoundBracketOpen) || current.IsNonPrintable())
{
@@ -163,20 +163,20 @@ private static UrlReference Unquoted(StringSource source)
}
}
- private static UrlReference End(StringSource source, StringBuilder buffer)
+ private static CssUrlValue End(StringSource source, StringBuilder buffer)
{
var current = source.SkipCurrentAndSpaces();
if (current == Symbols.RoundBracketClose)
{
source.Next();
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
return Bad(source, buffer);
}
- private static UrlReference Bad(StringSource source, StringBuilder buffer)
+ private static CssUrlValue Bad(StringSource source, StringBuilder buffer)
{
var current = source.Current;
var curly = 0;
@@ -186,16 +186,16 @@ private static UrlReference Bad(StringSource source, StringBuilder buffer)
{
if (current == Symbols.Semicolon)
{
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current == Symbols.CurlyBracketClose && --curly == -1)
{
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (current == Symbols.RoundBracketClose && --round == 0)
{
source.Next();
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
else if (source.IsValidEscape())
{
@@ -218,7 +218,7 @@ private static UrlReference Bad(StringSource source, StringBuilder buffer)
current = source.Next();
}
- return new UrlReference(buffer.ToPool());
+ return new CssUrlValue(buffer.ToPool());
}
}
}
diff --git a/src/AngleSharp.Css/Parser/Micro/FunctionParser.cs b/src/AngleSharp.Css/Parser/Micro/FunctionParser.cs
index e48fec8f..4c142973 100644
--- a/src/AngleSharp.Css/Parser/Micro/FunctionParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/FunctionParser.cs
@@ -27,11 +27,11 @@ public static String ParseAttr(this StringSource source)
return null;
}
- public static VarReferences ParseVars(this StringSource source)
+ public static CssReferenceValue ParseVars(this StringSource source)
{
var index = source.Index;
var length = FunctionNames.Var.Length;
- var refs = default(List>);
+ var refs = default(List>);
while (!source.IsDone)
{
@@ -56,7 +56,7 @@ public static VarReferences ParseVars(this StringSource source)
if (refs == null)
{
- refs = new List>();
+ refs = new List>();
}
var e = new TextPosition(0, 0, source.Index);
@@ -70,13 +70,13 @@ public static VarReferences ParseVars(this StringSource source)
if (refs != null)
{
- return new VarReferences(source.Content, refs);
+ return new CssReferenceValue(source.Content, refs);
}
return null;
}
- public static VarReference ParseVar(this StringSource source)
+ public static CssVarValue ParseVar(this StringSource source)
{
var name = source.ParseCustomIdent();
var f = source.SkipGetSkip();
@@ -86,11 +86,11 @@ public static VarReference ParseVar(this StringSource source)
switch (f)
{
case Symbols.RoundBracketClose:
- return new VarReference(name);
+ return new CssVarValue(name);
case Symbols.Comma:
var defaultValue = source.TakeUntilClosed();
source.SkipCurrentAndSpaces();
- return new VarReference(name, defaultValue);
+ return new CssVarValue(name, defaultValue);
}
}
diff --git a/src/AngleSharp.Css/Parser/Micro/GradientParser.cs b/src/AngleSharp.Css/Parser/Micro/GradientParser.cs
index fd5b5a9a..651cc915 100644
--- a/src/AngleSharp.Css/Parser/Micro/GradientParser.cs
+++ b/src/AngleSharp.Css/Parser/Micro/GradientParser.cs
@@ -8,7 +8,7 @@ namespace AngleSharp.Css.Parser
static class GradientParser
{
- private static readonly Dictionary> GradientFunctions = new Dictionary>
+ private static readonly Dictionary> GradientFunctions = new Dictionary>
{
{ FunctionNames.LinearGradient, ParseLinearGradient },
{ FunctionNames.RepeatingLinearGradient, ParseRepeatingLinearGradient },
@@ -16,7 +16,7 @@ static class GradientParser
{ FunctionNames.RepeatingRadialGradient, ParseRepeatingRadialGradient },
};
- public static IGradient ParseGradient(this StringSource source)
+ public static ICssGradientFunctionValue ParseGradient(this StringSource source)
{
var pos = source.Index;
var ident = source.ParseIdent();
@@ -25,7 +25,7 @@ public static IGradient ParseGradient(this StringSource source)
{
if (source.Current == Symbols.RoundBracketOpen)
{
- var function = default(Func