Skip to content

Commit d898d07

Browse files
tabatkinsastearns
authored andcommitted
[css-shapes-1] Targeted fix of shape serialization section, fix examples. w3c#8695
1 parent 507e39e commit d898d07

File tree

1 file changed

+29
-57
lines changed

1 file changed

+29
-57
lines changed

css-shapes-1/Overview.bs

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -602,75 +602,47 @@ Serialization of Basic Shapes</h3>
602602
To serialize the <<basic-shape>> functions,
603603
serialize as per their individual grammars,
604604
in the order the grammars are written in,
605-
avoiding calc() expressions where possible,
606-
avoiding calc() transformations,
607-
omitting components when possible without changing the meaning,
608605
joining space-separated tokens with a single space,
609606
and following each serialized comma with a single space.
607+
For serializing [=computed values=],
608+
component values are [=computed value|computed=],
609+
and omitted when possible without changing the meaning.
610610

611-
<div class="example">
612611

613-
Since <<position>> keywords stand in for percentages, keywords without an offset turn into percentages.
614-
615-
<pre><code>
616-
circle(at left bottom)
617-
618-
serializes as "circle(at 0% 100%)"
619-
</code></pre>
620-
621-
Omitting components means that some default values do not show up in the serialization. But since <<position>> always uses the 2- or 4-value form, a default <<position>> is not omitted.
622-
623-
<pre><code>
624-
circle(closest-side at center)
625-
626-
serializes as "circle(at 50% 50%)"
627-
</code></pre>
628-
629-
Using grammar order means that <<position>> values always give horizontal components first, then vertical.
630-
631-
<pre><code>
632-
circle(at bottom left)
633-
634-
serializes as "circle(at 0% 100%)"
635-
</code></pre>
636-
637-
Avoiding calc() expressions means that some <<position>> values that could be simplified to the 2-value form must be serialized in 4-value form instead.
638-
639-
<pre><code>
640-
circle(at right 5px bottom 10px)
641-
642-
serializes as "circle(at right 5px bottom 10px)"
643-
644-
not as "circle(at calc(100% - 5px) calc(100% - 10px))"
645-
</code></pre>
646-
647-
Avoiding calc() transformations means that if a specified (or computed) calc() must stay in calc() form, it will be used as-is, not reformulated with a different origin or reduced.
648-
649-
<pre><code>
650-
bottom calc(10% + 5px)
651-
652-
serializes as "bottom calc(10% + 5px)"
612+
<div class="example">
653613

654-
not as "top calc(90% - 5px)" or "calc(90% - 5px)"
655-
</code></pre>
614+
As [=specified value=] serialization of the shape functions are relatively trivial,
615+
here are some examples of [=computed value=] serializations:
656616

657-
Preferring 0% over a zero length comes up when you must supply an omitted offset.
617+
* <<position>> [[css-values-4#position-serialization|serialization rules]] mean that
618+
keywords [=computed value|compute to=] percentages,
619+
and serialize in horizontal-vertical order.
658620

659-
<pre><code>
660-
circle(at right 5px top)
621+
<pre><code>
622+
circle(at bottom left)
623+
/* serializes to */
624+
circle(at 0% 100%)
625+
</code></pre>
661626

662-
serializes as "circle(at right 5px top 0%)"
663-
</code></pre>
627+
* Omitting optional components means that
628+
default values do not show up in the serialization.
664629

665-
Preferring left and top origins means that some percentage offsets will normalize to those origins (when calc can be avoided).
630+
<pre><code>
631+
circle(closest-side at center)
632+
/* serializes to */
633+
circle()
634+
</code></pre>
666635

667-
<pre><code>
668-
circle(at right 5% top 0px)
636+
* Value [[css-cascade-5#computed|computation]] means that
637+
some functions [[#basic-shape-computed-values|canonicalize to a different form]].
669638

670-
serializes as "circle(at 95% 0%)"
671-
</code></pre>
639+
<pre><code>
640+
rect(10px 20px 30px 40px)
641+
/* serializes to */
642+
inset(10px calc(100% - 20px) calc(100% - 30px) 40px)
643+
</code></pre>
644+
</div>
672645

673-
</div>
674646

675647
<h3 id='basic-shape-interpolation'>
676648
Interpolation of Basic Shapes</h3>

0 commit comments

Comments
 (0)