- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 10 Oct 2011 23:34:38 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css3-values In directory hutz:/tmp/cvs-serv31988 Modified Files: Overview.html Overview.src.html Log Message: Editorial: Make calc() easier to understand. Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css3-values/Overview.html,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- Overview.html 10 Oct 2011 22:59:28 -0000 1.109 +++ Overview.html 10 Oct 2011 23:34:35 -0000 1.110 @@ -1364,40 +1364,51 @@ ;</pre> </div> - <p>The context of the expression imposes a target type, which is one of - length, frequency, angle, time, or number. NUMBER tokens are of type - number. DIMENSION tokens have types of their units (‘<code - class=property>cm</code>’ is length, ‘<a href="#deg"><code - class=property>deg</code></a>’ is angle etc.); any DIMENSION whose - type does not match the target type causes the ‘<a - href="#calc0"><code class=css>calc()</code></a>’ expression to be - invalid. If percentages are accepted in that context and convertible to - the target type, a PERCENTAGE token in the expression has the target type; - otherwise percentages are likewise invalid. + <p>The expression has a <dfn id=resolved-type>resolved type</dfn>, which is + one of ‘<code class=css><length></code>’, ‘<code + class=css><frequency></code>’, ‘<code + class=css><angle></code>’, ‘<code + class=css><time></code>’, or ‘<code + class=css><number></code>’. The <a + href="#resolved-type"><i>resolved type</i></a> must be valid for where the + expression is placed; otherwise, the expression is invalid. The <a + href="#resolved-type"><i>resolved type</i></a> of the expression is + determined by the types of the values it contains. <a + href="#number"><code>NUMBER</code></a> tokens are of type ‘<code + class=css><number></code>’. A <a + href="#dimension"><code>DIMENSION</code></a> token's type is given by its + unit (‘<code class=css>cm</code>’ is ‘<code + class=css><length></code>’, ‘<a href="#deg"><code + class=css>deg</code></a>’ is ‘<code + class=css><angle></code>’, etc.). If percentages are accepted in + the context in which the expression is placed, a <code>PERCENTAGE</code> + token has the type of the value that percentages are relative to; + otherwise, an expression containing percentages is invalid. - <p>To make expressions simpler, operators have restrictions on the types - they accept. At each operator, the types of the left and right side are be - checked for these restrictions. If compatible, they return roughly as - follows (the following ignores precedence rules on the operators for - simplicity): + <p>Operators form sub-expressions, which gain types based on their + arguments. To make expressions simpler, operators have restrictions on the + types they accept. At each operator, the types of the left and right + argument are checked for these restrictions. If compatible, the type + resolves as described below (the following ignores precedence rules on the + operators for simplicity): <ul> - <li>At ",", "+", "-":<br> - check: both sides have the same type<br> - return: that type + <li>At ‘<code class=css>,</code>’, ‘<code + class=css>+</code>’, or ‘<code class=css>-</code>’, + check that both sides have the same type; resolve to that type. - <li>At "*":<br> - check: at least one side is "number" <br> - return: the type of the other side + <li>At ‘<code class=css>*</code>’, check that at least one + side is ‘<code class=css><number></code>’; resolve to the + type of the other side - <li>At "/":<br> - check: right side is "number"<br> - return: the type of the left side + <li>At ‘<code class=css>/</code>’ or ‘<code + class=css>mod</code>’, check that the right side is ‘<code + class=css><number></code>’; resolve to the type of the left side + </ul> - <p>Division by zero is not allowed. Declarations containing such a - construct are invalid and must be <a - href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. + <p>If an operator does not pass the above checks, the expression is + invalid. Also, division by zero is invalid. <p>The value resulting from an expression must be clamped to the range allowed in the target context. @@ -1420,7 +1431,7 @@ class=property>height</code>’ on table cells and table elements, calc() expressions for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and - fixed layout tables may be treated as if ‘<code + fixed layout tables MAY be treated as if ‘<code class=property>auto</code>’ had been specified. <h3 id=cycle><span class=secno>9.2. </span> Cycling Values: ‘<code @@ -2313,6 +2324,9 @@ <li>rem, <a href="#rem-unit" title=rem><strong>5.1.1.</strong></a> + <li>resolved type, <a href="#resolved-type" + title="resolved type"><strong>9.1.</strong></a> + <li>s, <a href="#s" title=s><strong>6.2.</strong></a> <li>specified value, <a href="#specified-value" Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css3-values/Overview.src.html,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- Overview.src.html 10 Oct 2011 22:59:28 -0000 1.112 +++ Overview.src.html 10 Oct 2011 23:34:35 -0000 1.113 @@ -931,38 +931,39 @@ ;</pre> </div> - <p>The context of the expression imposes a target type, which is one - of length, frequency, angle, time, or number. NUMBER tokens are of - type number. DIMENSION tokens have types of their units ('cm' is - length, 'deg' is angle etc.); any DIMENSION whose type does not match - the target type causes the ''calc()'' expression to be invalid. If - percentages are accepted in that context and convertible to the target - type, a PERCENTAGE token in the expression has the target type; - otherwise percentages are likewise invalid. + <p>The expression has a <dfn>resolved type</dfn>, which is one of + ''<length>'', ''<frequency>'', ''<angle>'', ''<time>'', or + ''<number>''. The <i>resolved type</i> must be valid for where the + expression is placed; otherwise, the expression is invalid. + The <i>resolved type</i> of the expression is determined by the + types of the values it contains. <code>NUMBER</code> tokens + are of type ''<number>''. A <code>DIMENSION</code> token's type is given + by its unit (''cm'' is ''<length>'', ''deg'' is ''<angle>'', etc.). + If percentages are accepted in the context in which the expression + is placed, a <code>PERCENTAGE</code> token has the type of the value that + percentages are relative to; otherwise, an expression containing + percentages is invalid.</p> - <p>To make expressions simpler, operators have restrictions on the + <p>Operators form sub-expressions, which gain types based on their arguments. + To make expressions simpler, operators have restrictions on the types they accept. At each operator, the types of the left and right - side are be checked for these restrictions. If compatible, they - return roughly as follows (the following ignores precedence rules on + argument are checked for these restrictions. If compatible, the type resolves + as described below (the following ignores precedence rules on the operators for simplicity): <ul> - <li>At ",", "+", "-":<br> - check: both sides have the same type<br> - return: that type</li> + <li>At '','', ''+'', or ''-'', check that both sides have the same type; + resolve to that type.</li> - <li>At "*":<br> - check: at least one side is "number" <br> - return: the type of the other side</li> + <li>At ''*'', check that at least one side is ''<number>''; + resolve to the type of the other side</li> - <li>At "/":<br> - check: right side is "number"<br> - return: the type of the left side + <li>At ''/'' or ''mod'', check that the right side is ''<number>''; + resolve to the type of the left side </ul> - <p>Division by zero is not allowed. Declarations containing such a - construct are invalid and must be - <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. + <p>If an operator does not pass the above checks, the expression is invalid. + Also, division by zero is invalid.</p> <p>The value resulting from an expression must be clamped to the range allowed in the target context. @@ -983,7 +984,7 @@ <p>Given the complexities of 'width' and 'height' on table cells and table elements, calc() expressions for widths and heights on table columns, table column groups, table rows, table row groups, and - table cells in both auto and fixed layout tables may be treated as if + table cells in both auto and fixed layout tables MAY be treated as if 'auto' had been specified. <h3 id="cycle">
Received on Monday, 10 October 2011 23:34:40 UTC