Skip to content

Commit 564abc3

Browse files
committed
x
1 parent 2599be2 commit 564abc3

1 file changed

Lines changed: 34 additions & 33 deletions

File tree

css3-values/Overview.html

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
<h1 id=css3-template>CSS3 Values and Units</h1>
2727

28-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 9 August 2010</h2>
28+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 10 August 2010</h2>
2929

3030
<dl>
3131
<dt>This version:
3232

3333
<dd><a
34-
href="http://www.w3.org/TR/2010/ED-css3-values-20100809">http://www.w3.org/TR/2010/ED-css3-values-20100809</a>
34+
href="http://www.w3.org/TR/2010/ED-css3-values-20100810">http://www.w3.org/TR/2010/ED-css3-values-20100810</a>
3535

3636
<dt>Latest version:
3737

@@ -860,57 +860,58 @@ <h4 id=the-calc-min-and-max-functions><span class=secno>6.3.3. </span>The
860860
<pre>
861861
S : calc | min | max;
862862
calc : "calc(" S* sum ")" S*;
863-
min : "min(" S* sum [ "," S* sum ]* )"" S*;
864-
max : "max(" S* sum [ "," S* sum ]* ")" S*;
865-
sum : product [ S+ [ "+" | "-" ] S+ product ]*;
866-
product : unit [[ "*" S* unit ] | [ "/" S* NUMBER ]] *;
867-
unit : ["+"|"-"]? [ NUMBER S* | DIMENSION S* | PERCENTAGE S* |
868-
min | max | "(" S* sum ")" S* ];
869-
</pre>
870-
<!--
871-
<pre>
872-
S : calc | min | max;
873-
calc : "calc(" S* sum ")" S*;
874-
min : "min(" S* sum [ "," S* sum ]* )"" S*;
863+
min : "min(" S* sum [ "," S* sum ]* ")" S*;
875864
max : "max(" S* sum [ "," S* sum ]* ")" S*;
876865
sum : product [ [ "+" | "-" ] S* product ]*;
877866
product : unit [ [ "*" | "/" | "mod" ] S* unit ]*;
878867
unit : ["+"|"-"]? [ NUMBER S* | DIMENSION S* | PERCENTAGE S* |
879868
min | max | "(" S* sum ")" S* ];
880869
</pre>
881-
-->
882870

883-
<p>Division by zero is a parse error. <!--
884-
<p>Values inside a calc() expression must all be either (a)
885-
numbers or (b) legal values for the property, or values that
886-
would be legal if it weren't for range restrictions (such
887-
as the restriction that &lsquo;<code class=property>width</code>&rsquo; accepts only positive values).
888-
-->
889-
890-
891-
<p>The semantic constraints are as follows: The context of the expression
892-
imposes a <em>target type</em>, which is one of length, frequency, angle,
893-
time, or number. Any PERCENTAGE token in the expression has the target
894-
type. The NUMBER tokens are of type number, and the DIMENSION tokens have
895-
types of their units (&lsquo;<code class=property>cm</code>&rsquo; is
896-
length, &lsquo;<code class=property>deg</code>&rsquo; is angle etc.). At
897-
each operator, the types of the left and right side have to be compared
898-
and, if compatible, they yield a <em>result type</em>, roughly as follows
899-
(the following ignores precedence rules on the operators for simplicity):
871+
<p>The context of the expression imposes a target type, which is one of
872+
length, frequency, angle, time, or number. NUMBER tokens are of type
873+
number. DIMENSION tokens have types of their units (&lsquo;<code
874+
class=property>cm</code>&rsquo; is length, &lsquo;<code
875+
class=property>deg</code>&rsquo; is angle etc.); any DIMENSION whose type
876+
does not match the target type is not allowed and must be a parse error.
877+
If percentages are accepted in that context and convertible to the target
878+
type, a PERCENTAGE token in the expression has the target type; otherwise
879+
percentages are not allowed and must be a parse error.
880+
881+
<p>To make expressions simpler, operators have restriction on the types
882+
they accept. At each operator, the types of the left and right side have
883+
to be checked for these restrictions. If compatible, they return roughly
884+
as follows (the following ignores precedence rules on the operators for
885+
simplicity):
900886

901887
<ol>
902888
<li>At ",", "+", "-":<br>
903889
check: both sides have the same type<br>
904890
return: that type
905891

906892
<li>At "*":<br>
907-
check: at least one side is "number" return: the type of the other side
893+
check: at least one side is "number" <br>
894+
return: the type of the other side
908895

909896
<li>At "/":<br>
910897
check: right side is "number"<br>
911898
return: the type of the left side
912899
</ol>
913900

901+
<p>Division by zero is a parse error.
902+
903+
<p>The value resulting from an expression must be clamped to the range
904+
allowed in the target context.
905+
906+
<div class=example> These two are equivalentequivalent to &lsquo;<code
907+
class=css>width: 0px</code>&rsquo; since widths smaller than 0px are not
908+
allowed.
909+
<pre>
910+
width: calc(5px - 10px);
911+
width: 0px;
912+
</pre>
913+
</div>
914+
914915
<p>Given the complexities of &lsquo;<code
915916
class=property>width</code>&rsquo; and &lsquo;<code
916917
class=property>height</code>&rsquo; on table cells and table elements,

0 commit comments

Comments
 (0)