Skip to content

Commit 89106d5

Browse files
committed
[cssom] first draft of color serialization rules
1 parent 645a850 commit 89106d5

2 files changed

Lines changed: 84 additions & 4 deletions

File tree

cssom/Overview.html

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h1 id="cssom">CSS Object Model (CSSOM)</h1>
1818

1919
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
2020

21-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 27 September 2012</h2>
21+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 1 October 2012</h2>
2222

2323
<dl>
2424

@@ -83,7 +83,7 @@ <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
8383
can be found in the
8484
<a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
8585

86-
<p class="dontpublish">This is the 27 September 2012 Editor's Draft of CSSOM. Please send comments to
86+
<p class="dontpublish">This is the 1 October 2012 Editor's Draft of CSSOM. Please send comments to
8787
<a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
8888
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
8989
with <samp>[cssom]</samp> at the start of the subject line.
@@ -2072,7 +2072,47 @@ <h4 id="serializing-css-values"><span class="secno">6.6.2 </span>Serializing CSS
20722072
the literal string "<code>deg</code>".</dd>
20732073

20742074
<dt>&lt;color&gt;</dt>
2075-
<dd><p class="issue">preserve system colors, maybe color keywords...</dd>
2075+
<dd>
2076+
<p>If &lt;color&gt; is a component of a resolved or computed value, then
2077+
return the color using the <code>rgb()</code> or <code>rgba()</code> functional
2078+
notation as follows:</p>
2079+
<ol>
2080+
<li>If the alpha component of the color is equal to one, then return the serialization of the
2081+
<code>rgb()</code> functional equivalent of the opaque color.</li>
2082+
<li>If the alpha component of the color is not equal to one, then return the serialization of the
2083+
<code>rgba()</code> functional equivalent of the non-opaque color.</li>
2084+
</ol>
2085+
<p>The serialization of the <code>rgb()</code> functional equivalent is the concatenation of the following:</p>
2086+
<ol>
2087+
<li>The string "<code>rgb(</code>".</li>
2088+
<li>The shortest base-ten integer serialization of the red value.</li>
2089+
<li>The string "<code>, </code>".</li>
2090+
<li>The shortest base-ten serialization of the green value.</li>
2091+
<li>The string "<code>, </code>".</li>
2092+
<li>The shortest base-ten serialization of the blue value.</li>
2093+
<li>The string "<code>)</code>".</li>
2094+
</ol>
2095+
<p>The serialization of the <code>rgba()</code> functional equivalent is the concatenation of the following:</p>
2096+
<ol>
2097+
<li>The string "<code>rgba(</code>".</li>
2098+
<li>The shortest base-ten serialization of the red value.</li>
2099+
<li>The string "<code>, </code>".</li>
2100+
<li>The shortest base-ten serialization of the green value.</li>
2101+
<li>The string "<code>, </code>".</li>
2102+
<li>The shortest base-ten serialization of the blue value.</li>
2103+
<li>The string "<code>, </code>".</li>
2104+
<li>The shortest serialization of the &lt;number&gt; that denotes the alpha value.</li>
2105+
<li>The string "<code>)</code>".</li>
2106+
</ol>
2107+
2108+
<p>If &lt;color&gt; is a component of a specified value, then
2109+
return the color as follows:</p>
2110+
<ol>
2111+
<li>If the color was explicitly specified by the author, then return the original, author specified color value.</li>
2112+
<li>Otherwise, return the value that would be returned if the color were a component of a computed value.</li>
2113+
</ol>
2114+
<p class="issue">Should author specified values be normalized for case? Or should original case be preserved?</p>
2115+
</dd>
20762116
<!--
20772117
<dt>It is a system color</dt>
20782118

cssom/cssom-source

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,47 @@
16281628
the literal string "<code>deg</code>".</p></dd>
16291629

16301630
<dt>&lt;color></dt>
1631-
<dd><p class="issue">preserve system colors, maybe color keywords...</p></dd>
1631+
<dd>
1632+
<p>If &lt;color&gt; is a component of a resolved or computed value, then
1633+
return the color using the <code>rgb()</code> or <code>rgba()</code> functional
1634+
notation as follows:</p>
1635+
<ol>
1636+
<li>If the alpha component of the color is equal to one, then return the serialization of the
1637+
<code>rgb()</code> functional equivalent of the opaque color.</li>
1638+
<li>If the alpha component of the color is not equal to one, then return the serialization of the
1639+
<code>rgba()</code> functional equivalent of the non-opaque color.</li>
1640+
</ol>
1641+
<p>The serialization of the <code>rgb()</code> functional equivalent is the concatenation of the following:</p>
1642+
<ol>
1643+
<li>The string "<code>rgb(</code>".</li>
1644+
<li>The shortest base-ten integer serialization of the red value.</li>
1645+
<li>The string "<code>, </code>".</li>
1646+
<li>The shortest base-ten serialization of the green value.</li>
1647+
<li>The string "<code>, </code>".</li>
1648+
<li>The shortest base-ten serialization of the blue value.</li>
1649+
<li>The string "<code>)</code>".</li>
1650+
</ol>
1651+
<p>The serialization of the <code>rgba()</code> functional equivalent is the concatenation of the following:</p>
1652+
<ol>
1653+
<li>The string "<code>rgba(</code>".</li>
1654+
<li>The shortest base-ten serialization of the red value.</li>
1655+
<li>The string "<code>, </code>".</li>
1656+
<li>The shortest base-ten serialization of the green value.</li>
1657+
<li>The string "<code>, </code>".</li>
1658+
<li>The shortest base-ten serialization of the blue value.</li>
1659+
<li>The string "<code>, </code>".</li>
1660+
<li>The shortest serialization of the &lt;number&gt; that denotes the alpha value.</li>
1661+
<li>The string "<code>)</code>".</li>
1662+
</ol>
1663+
1664+
<p>If &lt;color&gt; is a component of a specified value, then
1665+
return the color as follows:</p>
1666+
<ol>
1667+
<li>If the color was explicitly specified by the author, then return the original, author specified color value.</li>
1668+
<li>Otherwise, return the value that would be returned if the color were a component of a computed value.</li>
1669+
</ol>
1670+
<p class="issue">Should author specified values be normalized for case? Or should original case be preserved?</p>
1671+
</dd>
16321672
<!--
16331673
<dt>It is a system color</dt>
16341674

0 commit comments

Comments
 (0)