Skip to content

Commit 9ccb370

Browse files
andruudAnders Hartvoll Ruud
andauthored
[scroll-animations] Add CSSOM serialization algorithms (w3c#5686)
Co-authored-by: Anders Hartvoll Ruud <andruud@google.com>
1 parent 1b816b3 commit 9ccb370

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

scroll-animations-1/Overview.bs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,109 @@ interface CSSScrollTimelineRule : CSSRule {
10731073
</dd>
10741074
</dl>
10751075

1076+
<div algorithm>
1077+
To <dfn export>serialize a CSSScrollTimelineRule</dfn>,
1078+
return the concatenation of the following:
1079+
1080+
1. The string <code>"@scroll-timeline"</code> followed by a SPACE (U+0020).
1081+
1. The result of performing <a>serialize an identifier</a> on the rule's
1082+
{{CSSScrollTimelineRule/name}}, followed by a SPACE (U+0020).
1083+
1. A single LEFT CURLY BRACKET (U+007B), followed by a SPACE (U+0020).
1084+
1. If the 'source' descriptor is missing, the empty string.
1085+
Otherwise, the concatenation of the following:
1086+
1. The string <code>"source:"</code>, followed by a SPACE (U+0020).
1087+
1. One of the following,
1088+
depending on the value of the 'source' descriptor:
1089+
<dl class=switch>
1090+
: an identifier
1091+
:: The result of performing <a>serialize an identifier</a>
1092+
on that identifier.
1093+
: selector(&lt;id-selector>)
1094+
:: The result of performing
1095+
<a>serialize a selector() function</a>.
1096+
</dl>
1097+
1. A single SEMICOLON (U+003B), followed by a SPACE (U+0020).
1098+
1. If the 'orientation' descriptor is missing, the empty string.
1099+
Otherwise, the concatenation of the following:
1100+
1. The string <code>"orientation:"</code>,
1101+
followed by a SPACE (U+0020).
1102+
1. The result of performing <a>serialize an identifier</a>
1103+
on the value of the 'orientation' descriptor,
1104+
followed by a SEMICOLON (U+003B),
1105+
followed by a SPACE (U+0020).
1106+
1. If the 'start' descriptor is missing, the empty string.
1107+
Otherwise, the concatenation of the following:
1108+
1. The string <code>"start:"</code>,
1109+
followed by a SPACE (U+0020).
1110+
1. The result of performing <a>serialize a scroll timeline offset</a>
1111+
on the rule's 'start' descriptor,
1112+
followed by a SEMICOLON (U+003B),
1113+
followed by a SPACE (U+0020).
1114+
1. If the 'end' descriptor is missing, the empty string.
1115+
Otherwise, the concatenation of the following:
1116+
1. The string <code>"end:"</code>,
1117+
followed by a SPACE (U+0020).
1118+
1. The result of performing <a>serialize a scroll timeline offset</a>
1119+
on the rule's 'end' descriptor,
1120+
followed by a SEMICOLON (U+003B),
1121+
followed by a SPACE (U+0020).
1122+
1. If the 'time-range' descriptor is missing, the empty string.
1123+
Otherwise, the concatenation of the following:
1124+
1. The string <code>"time-range:"</code>,
1125+
followed by a SPACE (U+0020).
1126+
1. One of the following,
1127+
depending on the value of the 'time-range' descriptor:
1128+
<dl class=switch>
1129+
: an identifier
1130+
:: The result of performing <a>serialize an identifier</a>
1131+
on that identifier.
1132+
: &lt;time>
1133+
:: The result of performing <a>serialize a CSS component value</a>
1134+
on that value.
1135+
</dl>
1136+
1. A single SEMICOLON (U+003B), followed by a SPACE (U+0020).
1137+
1. A single RIGHT CURLY BRACKET (U+007D).
1138+
</div>
1139+
1140+
<div algorithm>
1141+
To <dfn export>serialize a scroll timeline offset</dfn>,
1142+
return one the following,
1143+
depending on the value type:
1144+
1145+
<dl class=switch>
1146+
: an identifier
1147+
: &lt;length-percentage>
1148+
:: The result of performing <a>serialize a CSS component value</a>
1149+
on that value.
1150+
: &lt;element-offset>
1151+
:: The concatenation of the following:
1152+
1. The result of performing <a>serialize a selector() function</a>
1153+
on the selector() function associated with the element offset.
1154+
2. If the offset has an associated {{ElementBasedOffset/edge}},
1155+
a single SPACE (U+0020),
1156+
followed by the result of <a>serialize an identifier</a>
1157+
on the value of "edge".
1158+
Otherwise, the empty string.
1159+
3. If the offset has an associated {{ElementBasedOffset/threshold}},
1160+
a single SPACE (U+0020),
1161+
followed by the result of <a>serialize a CSS component value</a>
1162+
on the value of "threshold".
1163+
Otherwise, the empty string.
1164+
</dl>
1165+
1166+
</div>
1167+
1168+
<div algorithm>
1169+
To <dfn export>serialize a selector() function</dfn>,
1170+
return the concatenation of the following:
1171+
1172+
1. The string <code>"selector"</code>,
1173+
followed by LEFT PARENTHESIS (U+0028).
1174+
2. The result of performing <a>serialize a selector</a>
1175+
on the selector() function's argument.
1176+
3. A single RIGHT PARENTHESIS (U+0029).
1177+
</div>
1178+
10761179
## Examples ## {#timeline-examples}
10771180

10781181
<div class="example">

0 commit comments

Comments
 (0)