File tree 6 files changed +92
-8
lines changed
6 files changed +92
-8
lines changed Original file line number Diff line number Diff line change @@ -1545,11 +1545,11 @@ public static class CssKeywords
1545
1545
/// <summary>
1546
1546
/// The open keyword.
1547
1547
/// </summary>
1548
- public static readonly String Open ;
1548
+ public static readonly String Open = "open" ;
1549
1549
1550
1550
/// <summary>
1551
1551
/// The closed keyword.
1552
1552
/// </summary>
1553
- public static readonly String Closed ;
1553
+ public static readonly String Closed = "closed" ;
1554
1554
}
1555
1555
}
Original file line number Diff line number Diff line change @@ -256,5 +256,10 @@ public static class FunctionNames
256
256
/// The content function.
257
257
/// </summary>
258
258
public static readonly String Content = "content" ;
259
+
260
+ /// <summary>
261
+ /// The running function.
262
+ /// </summary>
263
+ public static readonly String Running = "running" ;
259
264
}
260
265
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ static class RunningDeclaration
8
8
{
9
9
public static String Name = PropertyNames . Running ;
10
10
11
- public static IValueConverter Converter = Any ;
11
+ public static IValueConverter Converter = IdentifierConverter ;
12
12
13
13
public static ICssValue InitialValue = InitialValues . RunningDecl ;
14
14
Original file line number Diff line number Diff line change @@ -99,12 +99,31 @@ public static CssVarValue ParseVar(this StringSource source)
99
99
100
100
public static CssContentValue ParseContent ( this StringSource source )
101
101
{
102
- var name = source . ParseCustomIdent ( ) ;
103
- var f = source . SkipGetSkip ( ) ;
102
+ if ( source . IsFunction ( FunctionNames . Content ) )
103
+ {
104
+ var name = source . ParseCustomIdent ( ) ;
105
+ var f = source . SkipGetSkip ( ) ;
106
+
107
+ if ( name != null && f == Symbols . RoundBracketClose )
108
+ {
109
+ return new CssContentValue ( name ) ;
110
+ }
111
+ }
104
112
105
- if ( name != null && f == Symbols . RoundBracketClose )
113
+ return null ;
114
+ }
115
+
116
+ public static CssRunningValue ParseRunning ( this StringSource source )
117
+ {
118
+ if ( source . IsFunction ( FunctionNames . Running ) )
106
119
{
107
- return new CssContentValue ( name ) ;
120
+ var name = source . ParseCustomIdent ( ) ;
121
+ var f = source . SkipGetSkip ( ) ;
122
+
123
+ if ( name != null && f == Symbols . RoundBracketClose )
124
+ {
125
+ return new CssRunningValue ( name ) ;
126
+ }
108
127
}
109
128
110
129
return null ;
Original file line number Diff line number Diff line change @@ -240,6 +240,11 @@ static class ValueConverters
240
240
/// </summary>
241
241
public static readonly IValueConverter ContentConverter = FromParser ( FunctionParser . ParseContent ) ;
242
242
243
+ /// <summary>
244
+ /// Creates a converter for the running function.
245
+ /// </summary>
246
+ public static readonly IValueConverter RunningConverter = FromParser ( FunctionParser . ParseRunning ) ;
247
+
243
248
#endregion
244
249
245
250
#region Maps
@@ -388,7 +393,7 @@ static class ValueConverters
388
393
/// <summary>
389
394
/// Represents a converter for the PositionMode enumeration.
390
395
/// </summary>
391
- public static readonly IValueConverter PositionModeConverter = Map . PositionModes . ToConverter ( ) ;
396
+ public static readonly IValueConverter PositionModeConverter = Or ( Map . PositionModes . ToConverter ( ) , RunningConverter ) ;
392
397
393
398
/// <summary>
394
399
/// Represents a converter for the OverflowMode enumeration.
Original file line number Diff line number Diff line change
1
+ namespace AngleSharp . Css . Values
2
+ {
3
+ using AngleSharp . Css . Dom ;
4
+ using AngleSharp . Text ;
5
+ using System ;
6
+
7
+ /// <summary>
8
+ /// Represents a CSS running function call.
9
+ /// </summary>
10
+ sealed class CssRunningValue : ICssFunctionValue
11
+ {
12
+ #region Fields
13
+
14
+ private readonly String _ident ;
15
+
16
+ #endregion
17
+
18
+ #region ctor
19
+
20
+ /// <summary>
21
+ /// Creates a new running function call.
22
+ /// </summary>
23
+ /// <param name="ident">The used identifier argument.</param>
24
+ public CssRunningValue ( String ident )
25
+ {
26
+ _ident = ident ;
27
+ }
28
+
29
+ #endregion
30
+
31
+ #region Properties
32
+
33
+ /// <summary>
34
+ /// Gets the used identifier.
35
+ /// </summary>
36
+ public String Identifier => _ident ;
37
+
38
+ /// <summary>
39
+ /// Gets the name of the function.
40
+ /// </summary>
41
+ public String Name => FunctionNames . Running ;
42
+
43
+ /// <summary>
44
+ /// Gets the arguments.
45
+ /// </summary>
46
+ public ICssValue [ ] Arguments => new ICssValue [ ] { new Identifier ( _ident ) } ;
47
+
48
+ /// <summary>
49
+ /// Gets the CSS text representation.
50
+ /// </summary>
51
+ public String CssText => Name . CssFunction ( _ident ) ;
52
+
53
+ #endregion
54
+ }
55
+ }
You can’t perform that action at this time.
0 commit comments