W3C home > Mailing lists > Public > public-css-commits@w3.org > October 2011

csswg/css3-values Overview.html,1.109,1.110 Overview.src.html,1.112,1.113

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
Message-Id: <E1RDPMk-0008KP-2V@lionel-hutz.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 (&lsquo;<code
-   class=property>cm</code>&rsquo; is length, &lsquo;<a href="#deg"><code
-   class=property>deg</code></a>&rsquo; is angle etc.); any DIMENSION whose
-   type does not match the target type causes the &lsquo;<a
-   href="#calc0"><code class=css>calc()</code></a>&rsquo; 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 &lsquo;<code class=css>&lt;length></code>&rsquo;, &lsquo;<code
+   class=css>&lt;frequency></code>&rsquo;, &lsquo;<code
+   class=css>&lt;angle></code>&rsquo;, &lsquo;<code
+   class=css>&lt;time></code>&rsquo;, or &lsquo;<code
+   class=css>&lt;number></code>&rsquo;. 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 &lsquo;<code
+   class=css>&lt;number></code>&rsquo;. A <a
+   href="#dimension"><code>DIMENSION</code></a> token's type is given by its
+   unit (&lsquo;<code class=css>cm</code>&rsquo; is &lsquo;<code
+   class=css>&lt;length></code>&rsquo;, &lsquo;<a href="#deg"><code
+   class=css>deg</code></a>&rsquo; is &lsquo;<code
+   class=css>&lt;angle></code>&rsquo;, 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 &lsquo;<code class=css>,</code>&rsquo;, &lsquo;<code
+    class=css>+</code>&rsquo;, or &lsquo;<code class=css>-</code>&rsquo;,
+    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 &lsquo;<code class=css>*</code>&rsquo;, check that at least one
+    side is &lsquo;<code class=css>&lt;number></code>&rsquo;; 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 &lsquo;<code class=css>/</code>&rsquo; or &lsquo;<code
+    class=css>mod</code>&rsquo;, check that the right side is &lsquo;<code
+    class=css>&lt;number></code>&rsquo;; 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>&rsquo; 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 &lsquo;<code
+   fixed layout tables MAY be treated as if &lsquo;<code
    class=property>auto</code>&rsquo; had been specified.
 
   <h3 id=cycle><span class=secno>9.2. </span> Cycling Values: &lsquo;<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
+	''&lt;length>'', ''&lt;frequency>'', ''&lt;angle>'', ''&lt;time>'', or
+	''&lt;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 ''&lt;number>''. A <code>DIMENSION</code> token's type is given 
+	by its unit (''cm'' is ''&lt;length>'', ''deg'' is ''&lt;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 ''&lt;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 ''&lt;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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 10 October 2011 23:34:40 GMT