style: Use Serde for rotate, scale, and translate properties.

The only drawback is: we resolve LengthPercentage value before passing
translate property through IPC, so its percentage part is redundant.
However, this makes us easier to maintain the Rust type.

Differential Revision: https://phabricator.services.mozilla.com/D60044
This commit is contained in:
Boris Chiou 2020-01-22 20:18:31 +00:00 committed by Emilio Cobos Álvarez
parent 5043695c78
commit 238e9ca2fb
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -611,8 +611,10 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
Clone,
Copy,
Debug,
Deserialize,
MallocSizeOf,
PartialEq,
Serialize,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
@ -623,6 +625,7 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
/// A value of the `Rotate` property
///
/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
/// cbindgen:private-default-tagged-enum-constructor=false
pub enum GenericRotate<Number, Angle> {
/// 'none'
None,
@ -685,8 +688,10 @@ where
Clone,
Copy,
Debug,
Deserialize,
MallocSizeOf,
PartialEq,
Serialize,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
@ -697,6 +702,7 @@ where
/// A value of the `Scale` property
///
/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
/// cbindgen:private-default-tagged-enum-constructor=false
pub enum GenericScale<Number> {
/// 'none'
None,
@ -749,8 +755,10 @@ fn y_axis_and_z_axis_are_zero<LengthPercentage: Zero, Length: Zero>(
#[derive(
Clone,
Debug,
Deserialize,
MallocSizeOf,
PartialEq,
Serialize,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
@ -772,6 +780,7 @@ fn y_axis_and_z_axis_are_zero<LengthPercentage: Zero, Length: Zero>(
/// https://github.com/w3c/csswg-drafts/issues/3305
///
/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
/// cbindgen:private-default-tagged-enum-constructor=false
pub enum GenericTranslate<LengthPercentage, Length>
where
LengthPercentage: Zero,