mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Use Serde for SVGOffsetPath.
Differential Revision: https://phabricator.services.mozilla.com/D60087
This commit is contained in:
parent
5ac08e4780
commit
2b3ef3ff37
3 changed files with 35 additions and 1 deletions
|
@ -73,13 +73,16 @@ pub struct RayFunction<Angle> {
|
||||||
/// The offset-path value.
|
/// The offset-path value.
|
||||||
///
|
///
|
||||||
/// https://drafts.fxtf.org/motion-1/#offset-path-property
|
/// https://drafts.fxtf.org/motion-1/#offset-path-property
|
||||||
|
/// cbindgen:private-default-tagged-enum-constructor=false
|
||||||
#[derive(
|
#[derive(
|
||||||
Animate,
|
Animate,
|
||||||
Clone,
|
Clone,
|
||||||
ComputeSquaredDistance,
|
ComputeSquaredDistance,
|
||||||
Debug,
|
Debug,
|
||||||
|
Deserialize,
|
||||||
MallocSizeOf,
|
MallocSizeOf,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
|
Serialize,
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToComputedValue,
|
ToComputedValue,
|
||||||
|
|
|
@ -21,8 +21,10 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone,
|
||||||
Debug,
|
Debug,
|
||||||
|
Deserialize,
|
||||||
MallocSizeOf,
|
MallocSizeOf,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
|
Serialize,
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToComputedValue,
|
ToComputedValue,
|
||||||
|
@ -156,8 +158,10 @@ impl ComputeSquaredDistance for SVGPathData {
|
||||||
ComputeSquaredDistance,
|
ComputeSquaredDistance,
|
||||||
Copy,
|
Copy,
|
||||||
Debug,
|
Debug,
|
||||||
|
Deserialize,
|
||||||
MallocSizeOf,
|
MallocSizeOf,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
|
Serialize,
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToShmem,
|
ToShmem,
|
||||||
|
@ -483,8 +487,10 @@ impl ToCss for PathCommand {
|
||||||
ComputeSquaredDistance,
|
ComputeSquaredDistance,
|
||||||
Copy,
|
Copy,
|
||||||
Debug,
|
Debug,
|
||||||
|
Deserialize,
|
||||||
MallocSizeOf,
|
MallocSizeOf,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
|
Serialize,
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToShmem,
|
ToShmem,
|
||||||
|
@ -511,8 +517,10 @@ impl IsAbsolute {
|
||||||
ComputeSquaredDistance,
|
ComputeSquaredDistance,
|
||||||
Copy,
|
Copy,
|
||||||
Debug,
|
Debug,
|
||||||
|
Deserialize,
|
||||||
MallocSizeOf,
|
MallocSizeOf,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
|
Serialize,
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedZero,
|
ToAnimatedZero,
|
||||||
ToCss,
|
ToCss,
|
||||||
|
@ -530,7 +538,9 @@ impl CoordPair {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The EllipticalArc flag type.
|
/// The EllipticalArc flag type.
|
||||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize, SpecifiedValueInfo, ToShmem,
|
||||||
|
)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct ArcFlag(bool);
|
pub struct ArcFlag(bool);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
//! A thin atomically-reference-counted slice.
|
//! A thin atomically-reference-counted slice.
|
||||||
|
|
||||||
|
use serde::de::{Deserialize, Deserializer};
|
||||||
|
use serde::ser::{Serialize, Serializer};
|
||||||
use servo_arc::ThinArc;
|
use servo_arc::ThinArc;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
@ -60,6 +62,25 @@ impl<T> Default for ArcSlice<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Serialize> Serialize for ArcSlice<T> {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
self.deref().serialize(serializer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de, T: Deserialize<'de>> Deserialize<'de> for ArcSlice<T> {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
let r = Vec::deserialize(deserializer)?;
|
||||||
|
Ok(ArcSlice::from_iter(r.into_iter()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T> ArcSlice<T> {
|
impl<T> ArcSlice<T> {
|
||||||
/// Creates an Arc for a slice using the given iterator to generate the
|
/// Creates an Arc for a slice using the given iterator to generate the
|
||||||
/// slice.
|
/// slice.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue