You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[css-counter-styles-3] Make all algorithms capable of rendering negatives. Describe how to handle the 'width' descriptor. Make all the descriptors use <symbol> rather than <string>.
Copy file name to clipboardExpand all lines: css-counter-styles-3/Overview.src.html
+24-25Lines changed: 24 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -145,12 +145,23 @@ <h2 id='counter-styles'>
145
145
<ol>
146
146
<li>
147
147
If the counter value is outside the <ititle='counter-range'>range</i> of the counter style,
148
-
exit this algorithm and instead <ititle='generate-a-counter'>generate a counter representation</i>
148
+
exit this algorithm and instead <i>generate a counter representation</i>
149
149
using the counter style's fallback style and the same counter value.
150
150
151
151
<li>
152
152
Using the counter value and the <ititle='counter-algorithm'>counter algorithm</i> for the counter style,
153
153
generate an initial representation for the counter value.
154
+
If the counter value is negative,
155
+
instead generate an initial representation using the absolute value of it.
156
+
157
+
<li>
158
+
If the representation uses less symbols than specified in the counter style's 'width' descriptor,
159
+
prepend symbols to the representation as specified in the 'width' descriptor.
160
+
161
+
<li>
162
+
If the counter value is negative,
163
+
wrap the representation in the counter style's <ititle='counter-negative'>negative sign</i>
164
+
as specified in the 'negative' descriptor.
154
165
155
166
<li>
156
167
Return the representation.
@@ -557,15 +568,12 @@ <h4 id="numeric-system">
557
568
Let <var>N</var> be the length of the list of <i>counter symbols</i>,
558
569
<var>value</var> initially be the counter value,
559
570
<var>S</var> initially be the empty string,
560
-
<var>negative</var> be a boolean flag that is initially false,
561
571
and <var>symbol(n)</var> be the nth <i>counter symbol</i> in the list of <i>counter symbols</i> (0-indexed).
562
572
563
573
<ol>
564
574
<li>If <var>value</var> is 0, append <var>symbol(0)</var> to
565
575
<var>S</var> and return <var>S</var>.
566
576
567
-
<li>If <var>value</var> is negative, run the next step of this algorithm with <var>value</var> being the absolute value of <var>value</var> instead.
568
-
569
577
<li>While <var>value</var> is not equal to 0:
570
578
571
579
<ol>
@@ -574,9 +582,6 @@ <h4 id="numeric-system">
574
582
575
583
<li>Set <var>value</var> to <code>floor( <var>value</var> / <var>N</var> )</code>.
576
584
</ol>
577
-
578
-
579
-
<li>If <var>value</var> was originally negative, wrap <var>S</var> in the counter style's <ititle='counter-negative'>negative sign</i>, as specified in the section for the <ahref='#counter-style-negative'>negative descriptor</a>.
580
585
581
586
<li>Return <var>S</var>.
582
587
</ol>
@@ -635,8 +640,6 @@ <h4 id="additive-system">
635
640
<ol>
636
641
<li>If <var>value</var> is initially 0, and there is an <i>additive tuple</i> with a weight of 0, append that tuple's <i>counter symbol</i> to S and return S.
637
642
638
-
<li>If <var>value</var> is negative, run the next step of this algorithm with <var>value</var> being the absolute value of <var>value</var> instead.
639
-
640
643
<li>While <var>value</var> is greater than 0 and there are elements left in the <var>symbol list</var>:
641
644
642
645
<ol>
@@ -651,9 +654,6 @@ <h4 id="additive-system">
651
654
by the number of times the <i>current tuple</i> was appended to <var>S</var>
652
655
in the previous step.
653
656
</ol>
654
-
655
-
656
-
<li>If <var>value</var> was originally negative, wrap <var>S</var> in the counter style's <ititle='counter-negative'>negative sign</i>, as specified in the section for the <ahref='#counter-style-negative'>negative descriptor</a>.
657
657
658
658
<li>If the loop ended because <var>value</var> is 0, return S. Otherwise, the given counter value cannot be represented by this counter style, and must instead be represented by the fallback counter style.
0 commit comments