style: Rewrite calc to be cleaner and support arbitrary expressions.

This improves Servo's calc support compliant with[1], and makes it cleaner and
more straight-forward.

[1]: https://github.com/w3c/csswg-drafts/issues/1241
This commit is contained in:
Emilio Cobos Álvarez 2017-05-04 18:51:18 +02:00
parent 36f26148e6
commit 3608dc8088
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 638 additions and 596 deletions

View file

@ -1043,19 +1043,19 @@ mod shorthand_serialization {
#[test]
fn transform_skew() {
validate_serialization(
&SpecifiedOperation::Skew(Angle::from_degrees(42.3), None),
&SpecifiedOperation::Skew(Angle::from_degrees(42.3, false), None),
"skew(42.3deg)");
validate_serialization(
&SpecifiedOperation::Skew(Angle::from_gradians(-50.0), Some(Angle::from_turns(0.73))),
&SpecifiedOperation::Skew(Angle::from_gradians(-50.0, false), Some(Angle::from_turns(0.73, false))),
"skew(-50grad, 0.73turn)");
validate_serialization(
&SpecifiedOperation::SkewX(Angle::from_radians(0.31)), "skewX(0.31rad)");
&SpecifiedOperation::SkewX(Angle::from_radians(0.31, false)), "skewX(0.31rad)");
}
#[test]
fn transform_rotate() {
validate_serialization(
&SpecifiedOperation::Rotate(Angle::from_turns(35.0)),
&SpecifiedOperation::Rotate(Angle::from_turns(35.0, false)),
"rotate(35turn)"
)
}