Skip to content

Commit

Permalink
style: Use Serde for rotate, scale, and translate properties.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BorisChiou authored and emilio committed Feb 12, 2020
1 parent 5043695 commit 238e9ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/style/values/generics/transform.rs
Expand Up @@ -611,8 +611,10 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
Clone,
Copy,
Debug,
Deserialize,
MallocSizeOf,
PartialEq,
Serialize,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
Expand All @@ -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,
Expand Down Expand Up @@ -685,8 +688,10 @@ where
Clone,
Copy,
Debug,
Deserialize,
MallocSizeOf,
PartialEq,
Serialize,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 238e9ca

Please sign in to comment.