Skip to content

Commit 6027891

Browse files
committed
[various] Revert generic unitless-0 <angle>, spec <zero> in V&U, make Images and Transforms use it to handle their legacy unitless-0 angles.
1 parent 58081a1 commit 6027891

File tree

4 files changed

+43
-18
lines changed

4 files changed

+43
-18
lines changed

css-images/Overview.bs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ The linear gradient syntax is:
325325

326326
<pre class=prod>
327327
<dfn>linear-gradient()</dfn> = linear-gradient(
328-
[ <<angle>> | to <<side-or-corner>> ]? ,
328+
[ <<zero>> | <<angle>> | to <<side-or-corner>> ]? ,
329329
<<color-stop-list>>
330330
)
331331
<dfn>&lt;side-or-corner></dfn> = [left | right] || [top | bottom]
@@ -338,12 +338,15 @@ The linear gradient syntax is:
338338

339339
The <a>gradient line's</a> direction may be specified in two ways:
340340

341-
: using angles
341+
: using <<angle>>
342+
: using <<zero>>
342343
:: For the purpose of this argument,
343344
''0deg'' points upward,
344345
and positive angles represent clockwise rotation,
345346
so ''90deg'' point toward the right.
346347

348+
<<zero>> points upward (same as ''0deg'').
349+
347350
: using keywords
348351
:: If the argument is ''to top'', ''to right'', ''to bottom'', or ''to left'',
349352
the angle of the <a>gradient line</a> is ''0deg'', ''90deg'', ''180deg'', or ''270deg'', respectively.
@@ -1744,9 +1747,12 @@ Interpolating <<gradient>> {#interpolating-gradients}
17441747
1. Convert both the start and end gradients to their explicit forms:
17451748

17461749
: For linear gradients:
1747-
:: * If the direction is specified as an <<angle>>,
1750+
:: * If the direction is specified as an <<angle>>,
17481751
it is already in its explicit form.
17491752

1753+
* If the direction is specified as a <<zero>>,
1754+
change its direction to ''0deg''.
1755+
17501756
* Otherwise,
17511757
change its direction to an <<angle>> in [''0deg'',''360deg'')
17521758
that would produce an equivalent rendering.
@@ -1858,7 +1864,7 @@ Thanks to the Webkit team, Brad Kemper, Brian Manthos, and Alan Gresley
18581864

18591865
Major changes include:
18601866

1861-
1867+
18621868
- The ''element()'' feature has been
18631869
deferred to Level 4.
18641870
- The directional images feature (''ltr''/''rtl''
@@ -1874,7 +1880,7 @@ Thanks to the Webkit team, Brad Kemper, Brian Manthos, and Alan Gresley
18741880

18751881
Significant details updated:
18761882

1877-
1883+
18781884
- There is now a definition for <a href="#invalid-image"><i>invalid
18791885
images</i></a>, which trigger fallback in the ''image()'' notation.
18801886
- Clarified that media fragments are only required to be supported
@@ -1889,7 +1895,7 @@ Thanks to the Webkit team, Brad Kemper, Brian Manthos, and Alan Gresley
18891895
be aliased to 'image-fit' and 'image-position'. A future
18901896
edition of the <a href="http://www.w3.org/TR/css-print/">CSS Print
18911897
Profile</a> may allow this for printer implementations, however.
1892-
1898+
18931899

18941900
There were also many clarifications and several sections were rearranged
18951901
to make them easier to read.

css-transforms-2/Overview.bs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,9 @@ The value of the 'transform' property is a list of <dfn>&lt;transform-function><
778778
3D Transform Functions {#three-d-transform-functions}
779779
----------------------
780780

781+
In the following functions, a <<zero>> behaves the same as ''0deg''.
782+
("Unitless 0" angles are preserved for legacy compat reasons.)
783+
781784

782785
: <span class='prod'><dfn>matrix3d()</dfn> = matrix3d( <<number>> [, <<number>> ]{15,15} )</span>
783786
:: specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order.
@@ -789,16 +792,16 @@ The value of the 'transform' property is a list of <dfn>&lt;transform-function><
789792
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation by the [sx,sy,sz] scaling vector described by the 3 parameters.
790793
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( <<number>> )</span>
791794
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation using the [1,1,sz] scaling vector, where sz is given as the parameter.
792-
: <span class='prod'><dfn>rotate3d()</dfn> = rotate3d( <<number>> , <<number>> , <<number>> , <<angle>> )</span>
795+
: <span class='prod'><dfn>rotate3d()</dfn> = rotate3d( <<number>> , <<number>> , <<number>> , [ <<angle>> | <<zero>> ] )</span>
793796
:: specifies a <a href="#Rotate3dDefined">3D rotation</a> by the angle specified in last parameter about the [x,y,z] direction vector described by the first three parameters. A direction vector that cannot be normalized, such as [0,0,0], will cause the rotation to not be applied.
794797

795798
Note: the rotation is clockwise as one looks from the end of the vector toward the origin.
796799

797-
: <span class='prod'><dfn>rotateX()</dfn> = rotateX( <<angle>> )</span>
800+
: <span class='prod'><dfn>rotateX()</dfn> = rotateX( [ <<angle>> | <<zero>> ] )</span>
798801
:: same as ''rotate3d(1, 0, 0, &lt;angle>)''.
799-
: <span class='prod'><dfn>rotateY()</dfn> = rotateY( <<angle>> )</span>
802+
: <span class='prod'><dfn>rotateY()</dfn> = rotateY( [ <<angle>> | <<zero>> ] )</span>
800803
:: same as ''rotate3d(0, 1, 0, &lt;angle>)''.
801-
: <span class='prod'><dfn>rotateZ()</dfn> = rotateZ( <<angle>> )</span>
804+
: <span class='prod'><dfn>rotateZ()</dfn> = rotateZ( [ <<angle>> | <<zero>> ] )</span>
802805
:: same as ''rotate3d(0, 0, 1, &lt;angle>)'', which is also the same as ''rotate(&lt;angle>)''.
803806
: <span class='prod'><dfn>perspective()</dfn> = perspective( <<length>> )</span>
804807
:: specifies a <a href="#PerspectiveDefined">perspective projection matrix</a>. This matrix scales points in X and Y based on their Z value, scaling points with positive Z values away from the origin, and those with negative Z values towards the origin. Points on the z=0 plane are unchanged. The parameter represents the distance of the z=0 plane from the viewer. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect. For example, a value of 1000px gives a moderate amount of foreshortening and a value of 200px gives an extreme amount. The value for depth must be greater than zero, otherwise the function is invalid.

css-transforms/Overview.bs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,13 @@ The <{linearGradient}> element specifies the <{linearGradient/gradientTransform}
591591
The Transform Functions {#transform-functions}
592592
==============================================
593593

594-
The value of the 'transform' property is a list of <dfn>&lt;transform-function></dfn>. The set of allowed transform functions is given below. Wherever <<angle>> is used in this specification, a <<number>> that is equal to zero is also allowed, which is treated the same as an angle of zero degrees. A percentage for horizontal translations is relative to the width of the 'reference box. A percentage for vertical translations is relative to the height of the [=reference box=].
594+
The value of the 'transform' property is a list of <dfn>&lt;transform-function></dfn>.
595+
The set of allowed transform functions is given below.
596+
In the following functions,
597+
a <<zero>> behaves the same as ''0deg''
598+
("unitless 0" angles are preserved for legacy compat).
599+
A percentage for horizontal translations is relative to the width of the [=reference box=].
600+
A percentage for vertical translations is relative to the height of the [=reference box=].
595601

596602
2D Transform Functions {#two-d-transform-functions}
597603
----------------------
@@ -618,17 +624,17 @@ The value of the 'transform' property is a list of <dfn>&lt;transform-function><
618624
: <span class='prod'><dfn>scaleY()</dfn> = scaleY( <<number>> )</span>
619625
:: specifies a <a href="#ScaleDefined">2D scale</a> operation using the [1,sy] scaling vector, where sy is given as the parameter.
620626

621-
: <span class='prod'><dfn>rotate()</dfn> = rotate( <<angle>> )</span>
627+
: <span class='prod'><dfn>rotate()</dfn> = rotate( [ <<angle>> | <<zero>> ] )</span>
622628
:: specifies a <a href="#RotateDefined">2D rotation</a> by the angle specified in the parameter about the origin of the element, as defined by the 'transform-origin' property. For example, ''rotate(90deg)'' would cause elements to appear rotated one-quarter of a turn in the clockwise direction.
623629

624-
: <span class='prod'><dfn>skew()</dfn> = skew( <<angle>> [, <<angle>> ]? )</span>
630+
: <span class='prod'><dfn>skew()</dfn> = skew( [ <<angle>> | <<zero>> ] [, [ <<angle>> | <<zero>> ] ]? )</span>
625631
:: specifies a <a href="#SkewDefined">2D skew</a> by [ax,ay] for X and Y. If the second parameter is not provided, it has a zero value.
626632
<p class="note">Note that the behavior of ''skew()'' is different from multiplying ''skewX()'' with ''skewY()''. Implementations must support this function for compatibility with legacy content.
627633

628-
: <span class='prod'><dfn>skewX()</dfn> = skewX( <<angle>> )</span>
634+
: <span class='prod'><dfn>skewX()</dfn> = skewX( [ <<angle>> | <<zero>> ] )</span>
629635
:: specifies a <a href="#SkewXDefined">2D skew transformation along the X axis</a> by the given angle.
630636

631-
: <span class='prod'><dfn>skewY()</dfn> = skewY( <<angle>> )</span>
637+
: <span class='prod'><dfn>skewY()</dfn> = skewY( [ <<angle>> | <<zero>> ] )</span>
632638
:: specifies a <a href="#SkewYDefined">2D skew transformation along the Y axis</a> by the given angle.
633639

634640
</dl>

css-values/Overview.bs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,13 @@ Real Numbers: the <<number>> type</h3>
709709
As with integers, the first character of a number may be immediately preceded by ''-'' or ''+''
710710
to indicate the number's sign.
711711

712+
The value <dfn id=zero-value>&lt;zero></dfn> represents a literal <a>number</a>
713+
with the value 0.
714+
Expressions that merely evaluate to a <<number>> with the value 0
715+
(for example, ''calc(0)'')
716+
do not match <<zero>>;
717+
only literal <<number-token>>s do.
718+
712719
<!--
713720
█████ ██
714721
██ ██ ██
@@ -1273,8 +1280,6 @@ Other Quantities</h2>
12731280
Angle Units: the <<angle>> type and ''deg'', ''grad'', ''rad'', ''turn'' units</h3>
12741281

12751282
Angle values are <<dimension>>s denoted by <dfn id="angle-value">&lt;angle></dfn>.
1276-
However, for zero angles the unit identifier is optional
1277-
(i.e. can be syntactically represented as the <a>number</a> ''0'').
12781283
The angle unit identifiers are:
12791284

12801285
<dl export dfn-type=value dfn-for="<angle>">
@@ -1315,6 +1320,11 @@ Angle Units: the <<angle>> type and ''deg'', ''grad'', ''rad'', ''turn'' units</
13151320
is interpreted as a bearing angle.
13161321
</div>
13171322

1323+
Note: For legacy reasons,
1324+
some uses of <<angle>> allow a bare ''0'' to mean ''0deg''.
1325+
This is not true in general, however,
1326+
and will not occur in future uses of the <<angle>> type.
1327+
13181328
<!--
13191329
████████ ████ ██ ██ ████████
13201330
██ ██ ███ ███ ██
@@ -1670,7 +1680,7 @@ Type Checking</h4>
16701680
An ''attr()'' expression's type is given by its <<type-or-unit>> argument.
16711681

16721682
Note: Because <<number-token>>s are always interpreted as <<number>>s or <<integer>>s,
1673-
"unitless 0" <<length>>s or <<angle>>s aren't supported in ''calc()''.
1683+
"unitless 0" <<length>>s aren't supported in ''calc()''.
16741684
That is, ''width: calc(0 + 5px);'' is invalid,
16751685
even though both ''width: 0;''
16761686
and ''width: 5px;''

0 commit comments

Comments
 (0)