Skip to content

Commit 14cb7bb

Browse files
committed
[css4-images] Remove most of the serialization section in favor of a nice paragraph of rules.
1 parent 9d61693 commit 14cb7bb

2 files changed

Lines changed: 60 additions & 504 deletions

File tree

css4-images/Overview.html

Lines changed: 35 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -286,22 +286,6 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
286286

287287
<li><a href="#serialization"><span class=secno>8. </span>
288288
Serialization</a>
289-
<ul class=toc>
290-
<li><a href="#serializing-image-notation"><span class=secno>8.1. </span>
291-
Serializing the ‘<code class=css>image()</code>’ /
292-
<var>&lt;image-list></var> notation</a>
293-
294-
<li><a href="#serializing-element-notation"><span class=secno>8.2.
295-
</span> Serializing the ‘<code class=css>element()</code>’ /
296-
<var>&lt;element-image></var> notation</a>
297-
298-
<li><a href="#serializing-cross-fade"><span class=secno>8.3. </span>
299-
Serializing the ‘<code class=css>cross-fade()</code>’ /
300-
<var>&lt;image-combination></var> notation</a>
301-
302-
<li><a href="#serializing-gradients"><span class=secno>8.4. </span>
303-
Serializing Gradients</a>
304-
</ul>
305289

306290
<li><a href="#conformance"><span class=secno>9. </span> Conformance</a>
307291
<ul class=toc>
@@ -532,14 +516,14 @@ <h3 id=image-notation><span class=secno>3.2. </span> Image Fallbacks and
532516
<pre class=prod><br><!--
533517
--><dfn
534518
id=image-list-type>&lt;image-list></dfn> = image( <a
535-
href="#image-annotations-type"><var>&lt;image-annotations></var></a>? [ <a
536-
href="#image-decl-type"><var>&lt;image-decl></var></a> , ]* [ <a
537-
href="#image-decl-type"><var>&lt;image-decl></var></a> | <var>&lt;color></var> ] )<br><!--
519+
href="#image-tags-type"><var>&lt;image-tags></var></a>? [ <a
520+
href="#image-src-type"><var>&lt;image-src></var></a> , ]* [ <a
521+
href="#image-src-type"><var>&lt;image-src></var></a> | <var>&lt;color></var> ] )<br><!--
538522
--><dfn
539-
id=image-annotations-type>&lt;image-annotations></dfn> = [ ltr | rtl ]
523+
id=image-tags-type>&lt;image-tags></dfn> = [ ltr | rtl ]
540524
<!--
541525
--><dfn
542-
id=image-decl-type>&lt;image-decl></dfn> = [ <var>&lt;url></var> | <var>&lt;string></var> ]</pre>
526+
id=image-src-type>&lt;image-src></dfn> = [ <var>&lt;url></var> | <var>&lt;string></var> ]</pre>
543527

544528
<p> Each ‘<code class=css>&lt;string></code>’ or ‘<code
545529
class=css>&lt;url></code>’ inside ‘<code class=css>image()</code>
@@ -597,20 +581,20 @@ <h4 id=image-fragments><span class=secno>3.2.1. </span> Image Fragments</h4>
597581

598582
<h4 id=image-fallbacks><span class=secno>3.2.2. </span> Image Fallbacks</h4>
599583

600-
<p> Multiple ‘<a href="#image-decl-type"><code
601-
class=css>&lt;image-decl>s</code></a>’ can be given separated by commas,
584+
<p> Multiple ‘<a href="#image-src-type"><code
585+
class=css>&lt;image-src>s</code></a>’ can be given separated by commas,
602586
in which case the function represents the first image that's not an <a
603587
href="#invalid-image"><i>invalid image</i></a>. The final argument can
604588
specify a ‘<code class=css>&lt;color></code>’ to serve as an ultimate
605589
fallback; this can be used, e.g. for ‘<code
606590
class=property>background-image</code>’, to ensure adequate contrast if
607-
none of the preceding ‘<a href="#image-decl-type"><code
608-
class=css>&lt;image-decl>s</code></a>’ can be used. If the final
609-
argument is a ‘<code class=css>&lt;color></code>’, it represents a
610-
solid-color image of the given color with no <a
591+
none of the preceding ‘<a href="#image-src-type"><code
592+
class=css>&lt;image-src>s</code></a>’ can be used. If the final argument
593+
is a ‘<code class=css>&lt;color></code>’, it represents a solid-color
594+
image of the given color with no <a
611595
href="#intrinsic-dimensions"><i>intrinsic dimensions</i></a>. If all of
612-
the provided ‘<a href="#image-decl-type"><code
613-
class=css>&lt;image-decl>s</code></a>’ are <a
596+
the provided ‘<a href="#image-src-type"><code
597+
class=css>&lt;image-src>s</code></a>’ are <a
614598
href="#invalid-image"><i>invalid images</i></a> and a fallback color was
615599
not provided as the last argument, the entire ‘<code
616600
class=css>image()</code>’ function must be treated as an <a
@@ -690,7 +674,7 @@ <h4 id=color-images><span class=secno>3.2.3. </span> Solid-color Images</h4>
690674
<h4 id=bidi-images><span class=secno>3.2.4. </span> Bidi-sensitive Images</h4>
691675

692676
<p> Before listing any <a
693-
href="#image-decl-type"><code>&lt;image-decl>s</code></a>, the author may
677+
href="#image-src-type"><code>&lt;image-src>s</code></a>, the author may
694678
specify a directionality for the image, similar to adding a
695679
<code>dir</code> attribute to an element in HTML. If a directional image
696680
is used on or in an element with opposite <a
@@ -3660,217 +3644,27 @@ <h2 id=serialization><span class=secno>8. </span> Serialization</h2>
36603644
interfacing with the CSS Object Model <a href="#CSSOM"
36613645
rel=biblioentry>[CSSOM]<!--{{CSSOM}}--></a>.
36623646

3663-
<p> All of these algorithms refer to a variable "s". For each, let s
3664-
initially be the empty string, run the steps described, and then return s.
3665-
3666-
<p class=issue> These descriptions are all old, and need to be updated to
3667-
the current state of the various value types.
3668-
3669-
<h3 id=serializing-image-notation><span class=secno>8.1. </span>
3670-
Serializing the ‘<code class=css>image()</code>’ / <a
3671-
href="#image-list-type"><var>&lt;image-list></var></a> notation</h3>
3672-
3673-
<p> To serialize an <a
3674-
href="#image-list-type"><var>&lt;image-list></var></a>:
3675-
3676-
<ol>
3677-
<li> Append "image(" to s.
3678-
3679-
<li> For each argument, serialize the argument as an <a
3680-
href="#image-decl-type"><var>&lt;image-decl></var></a> or
3681-
<var>&lt;color></var> as appropriate, and append it to s. Then, if it is
3682-
not the final argument, append a comma and a space ", " to s.
3683-
3684-
<li> Append a close parenthesis ")" to s.
3685-
</ol>
3686-
3687-
<p> To serialize an <a
3688-
href="#image-decl-type"><var>&lt;image-decl></var></a>:
3689-
3690-
<ol>
3691-
<li> Serialize the first part of the value (the <var>&lt;string></var>) as
3692-
a string.
3693-
3694-
<li> If a <var>&lt;resolution></var> was provided, append a space " " to
3695-
s. Then serialize the <var>&lt;resolution></var> and append it to s.
3696-
3697-
<li> If the ‘<code class=property>snap</code>’ keyword was provided,
3698-
append a space " " and the literal string "snap" to s.
3699-
3700-
<li> If a directional keyword was provided, append a space " " to s, then
3701-
append the keyword to s.
3702-
</ol>
3703-
3704-
<h3 id=serializing-element-notation><span class=secno>8.2. </span>
3705-
Serializing the ‘<code class=css>element()</code>’ / <a
3706-
href="#element-image-type"><var>&lt;element-image></var></a> notation</h3>
3707-
3708-
<p> To serialize an <a
3709-
href="#element-image-type"><var>&lt;element-image></var></a>:
3710-
3711-
<ol>
3712-
<li> Append "element(" to s.
3713-
3714-
<li> Serialize the argument as a selector or identifier, as appropriate,
3715-
and append it to s.
3716-
3717-
<li> Append a close parenthesis ")" to s.
3718-
</ol>
3719-
3720-
<h3 id=serializing-cross-fade><span class=secno>8.3. </span> Serializing
3721-
the ‘<code class=css>cross-fade()</code>’ / <a
3722-
href="#ltimage-combination"><var>&lt;image-combination></var></a> notation</h3>
3723-
3724-
<p> To serialize an <a
3725-
href="#ltimage-combination"><var>&lt;image-combination></var></a>:
3726-
3727-
<ol>
3728-
<li> Append "cross-fade(" to s.
3729-
3730-
<li> Serialize the first argument to the function as an <a
3731-
href="#image-type"><var>&lt;image></var></a>, and append it to s.
3732-
3733-
<li> Append a comma and a space ", " to s.
3734-
3735-
<li> Serialize the second argument to the function as an <a
3736-
href="#image-type"><var>&lt;image></var></a>, and append it to s.
3737-
3738-
<li> Append a comma and a space ", " to s.
3647+
<p> To serialize any function defined in this module, serialize it per its
3648+
individual grammar, in the order its grammar is written in, omitting
3649+
components when possible without changing the meaning, joining
3650+
space-separated tokens with a single space, and following each serialized
3651+
comma with a single space.
37393652

3740-
<li> Serialize the third argument to the function as a
3741-
<var>&lt;percentage></var>, and append it to s.
3653+
<p> For ‘<code class=css>cross-fade()</code>’, always serialize the
3654+
<var>&lt;percentage></var>.
37423655

3743-
<li> Append a close parenthesis ")" to s.
3744-
</ol>
3745-
3746-
<h3 id=serializing-gradients><span class=secno>8.4. </span> Serializing
3747-
Gradients</h3>
3748-
3749-
<p> To serialize a <a
3750-
href="#linear-gradient-type"><var>&lt;linear-gradient></var></a>:
3751-
3752-
<ol>
3753-
<li> Append "linear-gradient(" to s.
3754-
3755-
<li>
3756-
<ul>
3757-
<li> If the first argument to the gradient function was a single
3758-
keyword, serialize the keyword and append it to s.
3759-
3760-
<li> Otherwise, if the first argument to the gradient function was two
3761-
keywords, serialize the vertical keyword (‘<code
3762-
class=css>top</code>’ or ‘<code class=css>bottom</code>’) and
3763-
append it to s, then append a space " " to s, then serialize the
3764-
horizontal keyword (‘<code class=css>left</code>’ or ‘<code
3765-
class=css>right</code>’) and append it to s.
3766-
3767-
<li> Otherwise, if the first argument to the gradient function was an
3768-
<var>&lt;angle></var>, serialize the <var>&lt;angle></var> and append
3769-
it to s.
3770-
3771-
<li> Otherwise, append "top" to s.
3772-
</ul>
3773-
3774-
<li> Append a comma and a space ", " to s.
3775-
3776-
<li> For each color-stop in the gradient, serialize the color-stop, and
3777-
append it to s. Then, if it is not the final color-stop, append a comma
3778-
and a space ", " to s.
3779-
3780-
<li> Append a close parenthesis ")" to s.
3781-
</ol>
3782-
3783-
<p> To serialize a <a
3784-
href="#radial-gradient-type"><var>&lt;radial-gradient></var></a>:
3785-
3786-
<ol>
3787-
<li> Append "radial-gradient(" to s.
3788-
3789-
<li> If a <a href="#position"><var>&lt;position></var></a> was specified
3790-
in the first argument to the gradient function, serialize it and append
3791-
it to s. Otherwise, append "center" to s.
3792-
3793-
<li> Append a comma and a space ", " to s.
3794-
3795-
<li>
3796-
<ul>
3797-
<li> If a <a href="#shape"><var>&lt;shape></var></a> and/or <a
3798-
href="#size"><var>&lt;size></var></a> was specified in the second
3799-
argument to the gradient function:
3800-
<ol>
3801-
<li> If a <a href="#shape"><var>&lt;shape></var></a> was specified,
3802-
serialize it as a keyword and append it to s. Otherwise, append
3803-
"ellipse" to s.
3804-
3805-
<li> Append a space " " to s.
3806-
3807-
<li> If a <a href="#size"><var>&lt;size></var></a> was specified,
3808-
serialize it as a keyword and append it to s. Otherwise, append
3809-
"cover" to s.
3810-
</ol>
3811-
3812-
<li> Otherwise, if two <a
3813-
href="#radial-size-circle"><var>&lt;length></var></a>s or
3814-
<var>&lt;percentage></var>s were specified in the second argument to
3815-
the gradient function:
3816-
<ol>
3817-
<li> Serialize the first <a
3818-
href="#radial-size-circle"><var>&lt;length></var></a> or
3819-
<var>&lt;percentage></var> and append it to s.
3820-
3821-
<li> Append a space " " to s.
3822-
3823-
<li> Serialize the second <a
3824-
href="#radial-size-circle"><var>&lt;length></var></a> or
3825-
<var>&lt;percentage></var> and append it to s.
3826-
</ol>
3827-
3828-
<li> Otherwise, append "ellipse cover" to s.
3829-
</ul>
3830-
3831-
<li> Append a comma and a space ", " to s.
3832-
3833-
<li> For each color-stop in the gradient, serialize the color-stop, and
3834-
append it to s. Then, if it is not the final color-stop, append a comma
3835-
and a space ", " to s.
3836-
3837-
<li> Append a close parenthesis ")" to s.
3838-
</ol>
3839-
3840-
<p> To serialize a <a
3841-
href="#repeating-linear-gradient-type"><var>&lt;repeating-linear-gradient></var></a>:
3842-
3843-
<ol>
3844-
<li> Append "repeating-linear-gradient(" to s.
3845-
3846-
<li> Follow the steps for serializing a <a
3847-
href="#linear-gradient-type"><var>&lt;linear-gradient></var></a>, except
3848-
skip step 1.
3849-
</ol>
3850-
3851-
<p> To serialize a <a
3852-
href="#repeating-radial-gradient-type"><var>&lt;repeating-radial-gradient></var></a>:
3853-
3854-
<ol>
3855-
<li> Append "repeating-radial-gradient(" to s.
3656+
<div class=example>
3657+
<p> For example, a gradient specified as:
38563658

3857-
<li> Follow the steps for serializing a <a
3858-
href="#radial-gradient-type"><var>&lt;radial-gradient></var></a>, except
3859-
skip step 1.
3860-
</ol>
3659+
<pre>Linear-Gradient( to bottom, red 0%,yellow,black 100px)</pre>
38613660

3862-
<p> To serialize a <a
3863-
href="#color-stop-type"><var>&lt;color-stop></var></a>:
3661+
<p> ...must serialize as:
38643662

3865-
<ol>
3866-
<li> Serialize the <var>&lt;color></var>, and append it to s.
3663+
<pre>linear-gradient(red, yellow, black 100px)</pre>
3664+
</div>
38673665

3868-
<li> If a <a href="#radial-size-circle"><var>&lt;length></var></a> or
3869-
<var>&lt;percentage></var> was specified, append a space " " to s, then
3870-
serialize the <a href="#radial-size-circle"><var>&lt;length></var></a> or
3871-
<var>&lt;percentage></var> and append it to s.
3872-
</ol>
3873-
<!--
3666+
<p class=issue> The serialization of <var>&lt;color></var> is still
3667+
undefined. <!--
38743668
dddddddd
38753669
TTTTTTTTTTTTTTTTTTTTTTThhhhhhh EEEEEEEEEEEEEEEEEEEEEE d::::::d
38763670
T:::::::::::::::::::::Th:::::h E::::::::::::::::::::E d::::::d
@@ -4375,15 +4169,9 @@ <h2 class=no-num id=index>Index</h2>
43754169
<li>&lt;image>, <a href="#image-type"
43764170
title="&lt;image>"><strong>3.</strong></a>
43774171

4378-
<li>&lt;image-annotations>, <a href="#image-annotations-type"
4379-
title="&lt;image-annotations>"><strong>3.2.</strong></a>
4380-
43814172
<li>&lt;image-combination>, <a href="#ltimage-combination"
43824173
title="&lt;image-combination>"><strong>3.5.</strong></a>
43834174

4384-
<li>&lt;image-decl>, <a href="#image-decl-type"
4385-
title="&lt;image-decl>"><strong>3.2.</strong></a>
4386-
43874175
<li>&lt;image-list>, <a href="#image-list-type"
43884176
title="&lt;image-list>"><strong>3.2.</strong></a>
43894177

@@ -4402,6 +4190,12 @@ <h2 class=no-num id=index>Index</h2>
44024190
<li>&lt;image-set-decl>, <a href="#image-set-decl-type"
44034191
title="&lt;image-set-decl>"><strong>3.3.</strong></a>
44044192

4193+
<li>&lt;image-src>, <a href="#image-src-type"
4194+
title="&lt;image-src>"><strong>3.2.</strong></a>
4195+
4196+
<li>&lt;image-tags>, <a href="#image-tags-type"
4197+
title="&lt;image-tags>"><strong>3.2.</strong></a>
4198+
44054199
<li>intrinsic aspect ratio, <a href="#intrinsic-aspect-ratio"
44064200
title="intrinsic aspect ratio"><strong>5.1.</strong></a>
44074201

0 commit comments

Comments
 (0)