Skip to content

Commit 04aa429

Browse files
committed
[css-typed-om] Add CSSAngleValue.
Also specify that when a CSSRotation is constructed with a double then the double is in degrees. (w3c#80)
1 parent 9c8f864 commit 04aa429

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

css-typed-om/Overview.bs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,28 @@ The following methods are defined for {{CSSLengthValue}} objects:
408408
:: Constructs a {{CSSCalcLength}} with units and values as defined by the provided
409409
dictionary.
410410

411+
{{CSSAngleValue}} objects {#anglevalue-objects}
412+
----------------------------------------------
413+
414+
<pre class='idl'>
415+
enum CSSAngleUnit {
416+
"deg", "rad", "grad", "turn"
417+
};
418+
419+
[Constructor(double value, CSSAngleUnit unit)]
420+
interface CSSAngleValue : CSSStyleValue {
421+
readonly attribute double degrees;
422+
readonly attribute double radians;
423+
readonly attribute double gradians;
424+
readonly attribute double turns;
425+
};
426+
</pre>
427+
428+
{{CSSAngleValue}} objects represent CSS angles. Once constructed, a
429+
CSSAngleValue provides attributes that reflect the size of the angle in each of the
430+
CSS angle units represented by the {{CSSAngleUnit}} enum.
431+
432+
411433
{{CSSTransformValue}} objects {#transformvalue-objects}
412434
-----------------------------------------------------------
413435

@@ -434,8 +456,10 @@ interface CSSTranslation : CSSTransformComponent {
434456
readonly attribute CSSLengthValue z;
435457
};
436458

437-
[Constructor(double angle),
438-
Constructor(double angle, double x, double y, double z)]
459+
[Constructor(double degrees),
460+
Constructor(CSSAngleValue angle),
461+
Constructor(double degrees, double x, double y, double z),
462+
Constructor(CSSAngleValue angle, double x, double y, double z)]
439463
interface CSSRotation : CSSTransformComponent {
440464
readonly attribute double angle;
441465
readonly attribute double x;
@@ -490,6 +514,17 @@ and y &amp; z values of 0 could be:
490514

491515
</div>
492516

517+
When a {{CSSRotation}} is constructed with a double (as opposed to a
518+
{{CSSAngleValue}}), the angle is taken to be in degrees.
519+
520+
<div class=note>
521+
The following two CSSRotations are equivalent:
522+
<pre class='lang-javascript'>
523+
CSSRotation(angle);
524+
CSSRotation(CSSAngleValue(angle, "deg"));
525+
</pre>
526+
</div>
527+
493528
When a {{CSSTransformValue}} is read from a {{StylePropertyMap}}, each
494529
{{CSSTransformComponent}} will maintain the relevant transform function in
495530
its <code>cssText</code> attribute. However, newly constructed {{CSSTransformValue}}s

0 commit comments

Comments
 (0)