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
Copy file name to clipboardExpand all lines: cssom/Overview.bs
+23-5Lines changed: 23 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2590,7 +2590,7 @@ depends on the component, as follows:
2590
2590
<li>The string "<code lt>, </code>".
2591
2591
<li>The shortest base-ten serialization of the color's blue component.
2592
2592
<li>The string "<code lt>, </code>".
2593
-
<li>The shortest serialization of the <number> that denotes the color's alpha component.
2593
+
<li>The serialization of the color's alpha component as an <alphavalue>.
2594
2594
<li>The string "<code lt>)</code>".
2595
2595
</ol>
2596
2596
@@ -2637,6 +2637,23 @@ depends on the component, as follows:
2637
2637
<dd>The color is <code lt>rgba(0, 0, 0, 0)</code>.
2638
2638
-->
2639
2639
2640
+
<dt><alphavalue>
2641
+
<dd>
2642
+
If the value is internally represented as an integer between 0 and 255 inclusive (i.e. 8-bit unsigned integer),
2643
+
follow these steps:
2644
+
2645
+
<ol>
2646
+
<li>Let <var>alpha</var> be the given integer.
2647
+
<li>If there exists an integer between 0 and 100 inclusive that,
2648
+
when multiplied with 2.55 and rounded to the closest integer (rounding up if two values are equally close), equals <var>alpha</var>,
2649
+
let <var>rounded</var> be that integer divided by 100.
2650
+
<li>Otherwise, let <var>rounded</var> be <var>alpha</var> divided by 0.255 and rounded to the closest integer (rounding up if two values are equally close),
2651
+
divided by 1000.
2652
+
<li>Return the result of serializing <var>rounded</var> as a <number>.
2653
+
</ol>
2654
+
2655
+
Otherwise, return the result of serializing the given value as a <number>.
2656
+
2640
2657
<dt><counter>
2641
2658
<dd>
2642
2659
The return value of the following algorithm:
@@ -2684,11 +2701,12 @@ depends on the component, as follows:
2684
2701
2685
2702
<dt><number>
2686
2703
<dd>
2687
-
A base-ten number using digits 0-9 (U+0030 to U+0039) in the shortest form possible, using "<code lt>.</code>" to separate decimals (if any), preceded
2688
-
by "<code lt>-</code>" (U+002D) if it is negative.
2704
+
A base-ten number using digits 0-9 (U+0030 to U+0039) in the shortest form possible,
2705
+
using "<code lt>.</code>" to separate decimals (if any),
2706
+
rounding the value if necessary to not produce more than 6 decimals,
2707
+
preceded by "<code lt>-</code>" (U+002D) if it is negative.
2689
2708
2690
-
Note: JavaScript's <code lt>ToString</code> algorithm cannot be used since it can serialize numbers using an exponent, which would not round-trip
2691
-
in CSS.
2709
+
Note: scientific notation is not used.
2692
2710
2693
2711
<dt><percentage>
2694
2712
<dd>The <number> component serialized as per <number> followed
0 commit comments