Skip to content

Commit 48d27b5

Browse files
committed
[css-transforms] scale function and property %
Allow percentages inside the scale functions, and the scale property. resolves w3c#3399
1 parent 1511ec2 commit 48d27b5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

css-transforms-1/Overview.bs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ When used in this specification, terms have the meanings assigned in this sectio
150150
: <dfn export>user coordinate system</dfn>
151151
: <dfn export>local coordinate system</dfn>
152152
:: In general, a coordinate system defines locations and distances on the current canvas. The current local coordinate system (also user coordinate system) is the coordinate system that is currently active and which is used to define how coordinates and lengths are located and computed, respectively, on the current canvas.
153-
The current user coordinate system has its origin at the top-left of a [=reference box=] specified by the 'transform-box' property. Percentage values are relative to the dimension of this reference box. One unit equals one CSS pixel.
153+
The current user coordinate system has its origin at the top-left of a [=reference box=] specified by the 'transform-box' property.
154+
Percentage values (except in scale functions) are relative to the dimension of this reference box.
155+
One unit equals one CSS pixel.
156+
In scale functions, a <<percentage>> is equivalent to a <<number>>, for example ''transform: scale(100%);'' is equivalent to ''transform: scale(1);''.
154157

155158
: <dfn>transformation matrix</dfn>
156159
:: A matrix that defines the mathematical mapping from one coordinate system into another. It is computed from the values of the 'transform' and 'transform-origin' properties as described <a href="#transformation-matrix-computation">below</a>.
@@ -374,7 +377,7 @@ Value: none | <<transform-list>>
374377
Initial: none
375378
Applies to: [=transformable elements=]
376379
Inherited: no
377-
Percentages: refer to the size of [=reference box=]
380+
Percentages: refer to the size of [=reference box=] (scale functions excluded)
378381
Computed value: as specified, but with lengths made absolute
379382
Animation type: transform list, see <a href="#interpolation-of-transforms">interpolation rules</a>
380383
</pre>
@@ -913,13 +916,13 @@ A percentage for vertical translations is relative to the height of the [=refere
913916
: <span class='prod'><dfn>translateY()</dfn> = translateY( <<length-percentage>> )</span>
914917
:: specifies a <a href="#TranslateDefined">translation</a> by the given amount in the Y direction.
915918

916-
: <span class='prod'><dfn>scale()</dfn> = scale( <<number>> , <<number>>? )</span>
919+
: <span class='prod'><dfn>scale()</dfn> = scale( <<number>> | <<percentage>> , [ <<number>> | <<percentage>> ]? )</span>
917920
:: specifies a <a href="#ScaleDefined">2D scale</a> operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it takes a value equal to the first. For example, scale(1, 1) would leave an element unchanged, while scale(2, 2) would cause it to appear twice as long in both the X and Y axes, or four times its typical geometric size.
918921

919-
: <span class='prod'><dfn>scaleX()</dfn> = scaleX( <<number>> )</span>
922+
: <span class='prod'><dfn>scaleX()</dfn> = scaleX( <<number>> | <<percentage>> )</span>
920923
:: specifies a <a href="#ScaleDefined">2D scale</a> operation using the [sx,1] scaling vector, where sx is given as the parameter.
921924

922-
: <span class='prod'><dfn>scaleY()</dfn> = scaleY( <<number>> )</span>
925+
: <span class='prod'><dfn>scaleY()</dfn> = scaleY( <<number>> | <<percentage>> )</span>
923926
:: specifies a <a href="#ScaleDefined">2D scale</a> operation using the [1,sy] scaling vector, where sy is given as the parameter.
924927

925928
: <span class='prod'><dfn>rotate()</dfn> = rotate( [ <<angle>> | <<zero>> ] )</span>

css-transforms-2/Overview.bs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ which can have additional side-effects in UAs.
605605

606606
<pre class="propdef">
607607
Name: scale
608-
Value: none | <<number>>{1,3}
608+
Value: none | [ <<number>> | <<percentage>> ]{1,3}
609609
Initial: none
610610
Applies to: <a>transformable elements</a>
611611
Inherited: no
@@ -627,6 +627,8 @@ If three values are given,
627627
this specifies a 3d scaling,
628628
equivalent to the ''scale3d()'' function.
629629

630+
A <<percentage>> is equivalent to a <<number>>,
631+
for example ''scale: 100%;'' is equivalent to ''scale: 1;''.
630632
----
631633

632634
All three properties accept
@@ -892,9 +894,9 @@ In the following <dfn export>3d transform functions</dfn>, a <<zero>> behaves th
892894
:: specifies a <a href="#Translate3dDefined">3D translation</a> by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively.
893895
: <span class='prod'><dfn>translateZ()</dfn> = translateZ( <<length>> )</span>
894896
:: specifies a <a href="#Translate3dDefined">3D translation</a> by the vector [0,0,tz] with the given amount in the Z direction.
895-
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( <<number>> , <<number>>, <<number>> )</span>
897+
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( <<number>> | <<percentage>>, <<number>> | <<percentage>>, <<number>> | <<percentage>> )</span>
896898
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation by the [sx,sy,sz] scaling vector described by the 3 parameters.
897-
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( <<number>> )</span>
899+
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( <<number>> | <<percentage>> )</span>
898900
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation using the [1,1,sz] scaling vector, where sz is given as the parameter.
899901
: <span class='prod'><dfn>rotate3d()</dfn> = rotate3d( <<number>> , <<number>> , <<number>> , [ <<angle>> | <<zero>> ] )</span>
900902
:: 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.

0 commit comments

Comments
 (0)