style: Remove Options from TransformOperation.

This may or may not be part of the plan to get rid of nsCSSValue ;)

Option is not usable via FFI, and they should not be needed (we should be
following the shortest serialization principle instead). These patches also do
that, which matches the other transform properties. I think that slight change
is fine, if we can make it work, and consistent with other properties.

Alternative is adding more TransformOperation variants or such, which I rather
not do.

Differential Revision: https://phabricator.services.mozilla.com/D21862
This commit is contained in:
Emilio Cobos Álvarez 2019-03-03 11:31:54 +00:00
parent 1418ddc685
commit c16e88d229
6 changed files with 78 additions and 100 deletions

View file

@ -109,9 +109,9 @@ impl Transform {
let sx = specified::LengthPercentage::parse(context, input)?;
if input.try(|input| input.expect_comma()).is_ok() {
let sy = specified::LengthPercentage::parse(context, input)?;
Ok(generic::TransformOperation::Translate(sx, Some(sy)))
Ok(generic::TransformOperation::Translate(sx, sy))
} else {
Ok(generic::TransformOperation::Translate(sx, None))
Ok(generic::TransformOperation::Translate(sx, Zero::zero()))
}
},
"translatex" => {
@ -138,9 +138,9 @@ impl Transform {
let sx = Number::parse(context, input)?;
if input.try(|input| input.expect_comma()).is_ok() {
let sy = Number::parse(context, input)?;
Ok(generic::TransformOperation::Scale(sx, Some(sy)))
Ok(generic::TransformOperation::Scale(sx, sy))
} else {
Ok(generic::TransformOperation::Scale(sx, None))
Ok(generic::TransformOperation::Scale(sx, sx))
}
},
"scalex" => {
@ -194,9 +194,9 @@ impl Transform {
let ax = specified::Angle::parse_with_unitless(context, input)?;
if input.try(|input| input.expect_comma()).is_ok() {
let ay = specified::Angle::parse_with_unitless(context, input)?;
Ok(generic::TransformOperation::Skew(ax, Some(ay)))
Ok(generic::TransformOperation::Skew(ax, ay))
} else {
Ok(generic::TransformOperation::Skew(ax, None))
Ok(generic::TransformOperation::Skew(ax, Zero::zero()))
}
},
"skewx" => {