Skip to content

Commit b79645c

Browse files
authored
[css-transforms-2] Don't maintain state for whether individual transform property values are 2D or 3D. (#6147)
The group resolved in #3305 that individual transform properties do not distinguish between values specified using 2D syntax and values specified using 3D syntax that produce the same matrices. Fixes the individual transforms part of #3305.
1 parent 3679160 commit b79645c

File tree

1 file changed

+55
-51
lines changed

1 file changed

+55
-51
lines changed

css-transforms-2/Overview.bs

+55-51
Original file line numberDiff line numberDiff line change
@@ -594,21 +594,20 @@ Initial: none
594594
Applies to: <a>transformable elements</a>
595595
Inherited: no
596596
Percentages: relative to the width of the <a>reference box</a> (for the first value) or the height (for the second value)
597-
Computed Value: the keyword ''translate/none'' or a pair of computed <<length-percentage>> values and optionally an absolute length
598-
Animation type: by computed value, adding a third ''0'' value if needed to match components, but see below for ''translate/none''
597+
Computed Value: the keyword ''translate/none'' or a pair of computed <<length-percentage>> values and an absolute length
598+
Animation type: by computed value, but see below for ''translate/none''
599599
</pre>
600600

601601
The 'translate' property accepts 1-3 values,
602602
each specifying a translation against one axis,
603603
in the order X, Y, then Z.
604+
When the second or third values are missing,
605+
they default to ''0px''.
604606

605-
If only one or two values are given,
607+
If the third value is omitted or zero,
606608
this specifies a 2d translation,
607609
equivalent to the ''translate()'' function.
608-
If the second value is missing,
609-
it defaults to ''0px''.
610-
611-
If three values are given,
610+
Otherwise,
612611
this specifies a 3d translation,
613612
equivalent to the ''translate3d()'' function.
614613

@@ -623,60 +622,70 @@ Value: none | <<angle>> | [ x | y | z | <<number>>{3} ] && <<angle>>
623622
Initial: none
624623
Applies to: <a>transformable elements</a>
625624
Inherited: no
626-
Computed value: the keyword ''rotate/none'', or an <<angle>> with an optional axis consisting of a list of three <<number>>s
625+
Computed value: the keyword ''rotate/none'', or an <<angle>> with an axis consisting of a list of three <<number>>s
627626
Animation type: as SLERP, but see below for ''rotate/none''
628627
</pre>
629628

630629
The 'rotate' property accepts an angle to rotate an element,
631630
and optionally an axis to rotate it around.
632631

633-
If the axis is omitted, this specifies a 2d rotation,
634-
equivalent to the ''rotate()'' function.
635-
636-
Otherwise, it specifies a 3d rotation:
637-
if <dfn value for=rotate>x</dfn>,
632+
The axis can be specified with either the
633+
<dfn value for=rotate>x</dfn>,
638634
<dfn value for=rotate>y</dfn>,
639-
or <dfn value for=rotate>z</dfn> is given,
640-
it specifies a rotation around that axis,
641-
equivalent to the ''rotateX()''/etc 3d transform functions.
635+
or <dfn value for=rotate>z</dfn> keywords,
636+
which specify a rotation around that axis,
637+
equivalent to the ''rotateX()'', ''rotateY()'',
638+
and ''rotateZ()'' transform functions.
642639
Alternately, the axis can be specified explicitly
643640
by giving three numbers
644641
representing the x, y, and z components of an origin-centered vector,
645642
equivalent to the ''rotate3d()'' function.
646643

647-
Note: While ''rotate: 30deg;'' and ''rotate: z 30deg;'' technically specify the same rotation,
648-
the first declaration is a 2d transform equivalent to ''transform: rotate(30deg);'',
649-
while the second is a 3d transform equivalent to ''transform: rotateZ(30deg);'',
650-
which can have additional side-effects in UAs.
644+
There is no difference in behavior between
645+
a rotation specified as an <<angle>> alone
646+
and a rotation specified as being around the z-axis
647+
(whether by the ''z'' keyword or
648+
by a vector whose first two components are zero
649+
and third component is positive);
650+
they are all 2d rotations equivalent to the ''rotate()'' function.
651+
For example, ''rotate: 30deg'', ''rotate: z 30deg'', and
652+
''rotate: 0 0 1 30deg'' are equivalent.
651653

652654
<pre class="propdef">
653655
Name: scale
654656
Value: none | [ <<number>> | <<percentage>> ]{1,3}
655657
Initial: none
656658
Applies to: <a>transformable elements</a>
657659
Inherited: no
658-
Computed value: the keyword ''scale/none'', or a list of 2 or 3 <<number>>s
660+
Computed value: the keyword ''scale/none'', or a list of 3 <<number>>s
659661
Animation type: by computed value, but see below for ''scale/none''
660662
</pre>
661663

662664
The 'scale' property accepts 1-3 values,
663665
each specifying a scale along one axis,
664666
in order X, Y, then Z.
665667

666-
If only the X value is given,
667-
the Y value defaults to the same value.
668+
If the Y value is not given,
669+
then it defaults to being the same as the X value.
668670

669-
If one or two values are given,
671+
If the Z value is not given,
672+
then it defaults to ''1''.
673+
674+
If the third value is omitted, ''1'', or ''100%'',
670675
this specifies a 2d scaling,
671676
equivalent to the ''scale()'' function.
672-
If three values are given,
677+
Otherwise,
673678
this specifies a 3d scaling,
674679
equivalent to the ''scale3d()'' function.
675680

681+
There is no difference in behavior between the third value being omitted
682+
and the third value being ''1'' or ''100%''.
683+
676684
A <<percentage>> is equivalent to a <<number>>,
677-
for example ''scale: 100%;'' is equivalent to ''scale: 1;''.
685+
for example ''scale: 100%'' is equivalent to ''scale: 1''.
678686
Numbers are used during serialization of specified and computed values.
679687

688+
680689
----
681690

682691
All three properties accept
@@ -697,54 +706,49 @@ value (''0px'' for translate, ''0deg'' for rotate, ''1'' for scale).
697706
Serialization {#individual-transform-serialization}
698707
---------------------------------------------------
699708

700-
Because these properties have three distinct modes of behavior
701-
(no transform, 2d transform, or 3d transform),
709+
Because these properties have two distinct modes of behavior
710+
(no transform versus transform),
702711
serialization must take this into account:
703712

704713
: for 'translate'
705-
:: If a 2d translation is specified,
706-
the property must serialize with only one or two values
707-
(per usual, if the second value is ''0px'', the default,
708-
it must be omitted when serializing).
709-
710-
If a 3d translation is specified,
711-
all three values must be serialized.
714+
:: If a translation is specified,
715+
the property must serialize with one through three values.
716+
(As usual, if the second and third values are ''0px'', the default,
717+
or if only the third value is ''0px'',
718+
then those ''0px'' values must be omitted when serializing).
712719

713720
It must serialize as the keyword ''translate/none''
714721
if and only if ''translate/none'' was originally specified.
715722
(An identity transform does not count;
716-
it must serialize as the 2d or 3d version,
717-
as appropriate.)
723+
it must serialize as ''0px''.)
718724

719725
: for 'rotate'
720-
:: If a 2d rotation is specified,
726+
:: If a rotation about the z axis (that is, in 2D) is specified,
721727
the property must serialize as just an <<angle>>.
722728

723-
If a 3d rotation is specified,
729+
If any other rotation is specified,
724730
the property must serialize with an axis specified.
725-
If the axis is parallel with the x, y, or z axises,
731+
If the axis is parallel with the x or y axes,
726732
it must serialize as the appropriate keyword.
727733

728734
It must serialize as the keyword ''rotate/none''
729735
if and only if ''rotate/none'' was originally specified.
730736
(An identity transform does not count;
731-
it must serialize as the 2d or 3d version,
732-
as appropriate.)
737+
it must serialize as ''0deg''.)
733738

734739
: for 'scale'
735-
:: If a 2d scale is specified,
736-
the property must serialize with only one or two values
737-
(per usual, if the second value is the same as the first, the default,
738-
it must be omitted when serializing).
739-
740-
If a 3d scale is specified,
741-
all three values must be serialized.
740+
:: If a scale is specified,
741+
the property must serialize with only one through three values.
742+
As usual, if the third value is 1, the default,
743+
then it is omitted when serializing.
744+
If the third value is omitted
745+
and the second value is the same as the first (the default),
746+
then the second value is also omitted when serializing.
742747

743748
It must serialize as the keyword ''scale/none''
744749
if and only if ''scale/none'' was originally specified.
745750
(An identity transform does not count;
746-
it must serialize as the 2d or 3d version,
747-
as appropriate.)
751+
it must serialize as ''1''.)
748752

749753
Current Transformation Matrix {#ctm}
750754
====================================

0 commit comments

Comments
 (0)