forked from AngleSharp/AngleSharp.Css
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd83c45
commit bbfba7d
Showing
12 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace AngleSharp.Css.Converters | ||
{ | ||
using AngleSharp.Css.Dom; | ||
using AngleSharp.Css.Parser; | ||
using AngleSharp.Text; | ||
using System; | ||
|
||
sealed class SeparatedEnumsConverter : IValueConverter | ||
{ | ||
private readonly IValueConverter[] _converters; | ||
private readonly Char _seperator; | ||
|
||
public SeparatedEnumsConverter(IValueConverter[] converters, Char seperator) | ||
{ | ||
_converters = converters; | ||
_seperator = seperator; | ||
} | ||
public ICssValue Convert(StringSource source) | ||
{ | ||
var value = _converters[0].Convert(source); | ||
|
||
if (value != null) | ||
{ | ||
var c = source.SkipSpacesAndComments(); | ||
|
||
if (!source.IsDone) | ||
{ | ||
if (c == _seperator) | ||
{ | ||
source.SkipCurrentAndSpaces(); | ||
} | ||
else | ||
{ | ||
value = null; | ||
} | ||
} | ||
} | ||
|
||
return value; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/AngleSharp.Css/Declarations/ScrollSnapTypeDeclaration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace AngleSharp.Css.Declarations | ||
{ | ||
using AngleSharp.Css.Converters; | ||
using AngleSharp.Css.Dom; | ||
using AngleSharp.Css.Values; | ||
using System; | ||
using static ValueConverters; | ||
|
||
/// <summary> | ||
/// For more information, see: | ||
/// https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type | ||
/// </summary> | ||
static class ScrollSnapTypeDeclaration | ||
{ | ||
private static readonly ICssValue defaultStrictness = new Constant<ScrollSnapStrictness>(CssKeywords.Proximity, ScrollSnapStrictness.Proximity); | ||
|
||
public static String Name = PropertyNames.ScrollSnapType; | ||
|
||
public static IValueConverter Converter = Or(None, WithOrder(ScrollSnapAxisConverter, ScrollSnapStrictnessConverter.Option(defaultStrictness))); | ||
|
||
public static ICssValue InitialValue = InitialValues.ScrollSnapTypeDecl; | ||
|
||
public static PropertyFlags Flags = PropertyFlags.None; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace AngleSharp.Css.Dom | ||
{ | ||
/// <summary> | ||
/// An enumeration with all possible scroll snap align options. | ||
/// </summary> | ||
public enum ScrollSnapAlign : byte | ||
{ | ||
/// <summary> | ||
/// This box does not define a snap position in the specified axis | ||
/// </summary> | ||
None, | ||
/// <summary> | ||
/// Start alignment of this box’s scroll snap area within the scroll container’s snapport is a snap position in the specified axis | ||
/// </summary> | ||
Start, | ||
/// <summary> | ||
/// End alignment of this box’s scroll snap area within the scroll container’s snapport is a snap position in the specified axis | ||
/// </summary> | ||
End, | ||
/// <summary> | ||
/// Center alignment of this box’s scroll snap area within the scroll container’s snapport is a snap position in the specified axis | ||
/// </summary> | ||
Center, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace AngleSharp.Css.Dom | ||
{ | ||
/// <summary> | ||
/// An enumeration with all possible scroll snap axis options. | ||
/// </summary> | ||
public enum ScrollSnapAxis : byte | ||
{ | ||
/// <summary> | ||
/// The scroll container snaps to snap positions in its horizontal axis only | ||
/// </summary> | ||
X, | ||
/// <summary> | ||
/// The scroll container snaps to snap positions in its horizontal axis only | ||
/// </summary> | ||
Y, | ||
/// <summary> | ||
/// The scroll container snaps to snap positions in its block axis only | ||
/// </summary> | ||
Block, | ||
/// <summary> | ||
/// The scroll container snaps to snap positions in its inline axis only | ||
/// </summary> | ||
Inline, | ||
/// <summary> | ||
/// The scroll container snaps to snap positions in its inline axis only | ||
/// </summary> | ||
Both, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace AngleSharp.Css.Dom | ||
{ | ||
/// <summary> | ||
/// An enumeration with all possible scroll snap strictness options. | ||
/// </summary> | ||
public enum ScrollSnapStrictness : byte | ||
{ | ||
/// <summary> | ||
/// If specified on a scroll container, the scroll container is required to be snapped | ||
/// to a snap position when there are no active scrolling operations. | ||
/// If a valid snap position exists then the scroll container must snap | ||
/// at the termination of a scroll (if none exist then no snapping occurs) | ||
/// </summary> | ||
Mandatory, | ||
/// <summary> | ||
/// If specified on a scroll container, the scroll container may snap to a snap position | ||
/// at the termination of a scroll, at the discretion of the UA given the parameters of the scroll | ||
/// </summary> | ||
Proximity, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters