mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
style: Use serde to serialize LengthPercentage and StyleRayFunction.
We need to pass these two types into the compositor, so we need a better way to serialize these rust types. We use serde and bincode to serialize/deserialize them, and use ByteBuf to pass the &[u8] data through IPC. We define StyleVecU8 for FFI usage only. Differential Revision: https://phabricator.services.mozilla.com/D50688
This commit is contained in:
parent
d99606a841
commit
40ede5bacb
8 changed files with 18 additions and 8 deletions
|
@ -78,7 +78,6 @@ extern crate parking_lot;
|
|||
extern crate precomputed_hash;
|
||||
extern crate rayon;
|
||||
extern crate selectors;
|
||||
#[cfg(feature = "servo")]
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
pub extern crate servo_arc;
|
||||
|
|
|
@ -13,16 +13,17 @@ use std::{f32, f64};
|
|||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
/// A computed angle in degrees.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Add,
|
||||
Animate,
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Deserialize,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
Serialize,
|
||||
ToAnimatedZero,
|
||||
ToResolvedValue,
|
||||
)]
|
||||
|
|
|
@ -75,7 +75,9 @@ impl ToComputedValue for specified::Length {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, ToAnimatedZero, ToResolvedValue)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct LengthPercentage {
|
||||
length: Length,
|
||||
|
@ -611,9 +613,11 @@ impl Size {
|
|||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Copy,
|
||||
Deserialize,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
Serialize,
|
||||
ToAnimatedValue,
|
||||
ToAnimatedZero,
|
||||
ToResolvedValue,
|
||||
|
|
|
@ -12,7 +12,6 @@ use std::fmt;
|
|||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
/// A computed percentage.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Animate,
|
||||
Clone,
|
||||
|
@ -20,9 +19,11 @@ use style_traits::{CssWriter, ToCss};
|
|||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Deserialize,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
Serialize,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedValue,
|
||||
ToAnimatedZero,
|
||||
|
|
|
@ -14,9 +14,11 @@ use crate::values::specified::SVGPathData;
|
|||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Deserialize,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
Serialize,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedZero,
|
||||
ToComputedValue,
|
||||
|
@ -41,8 +43,10 @@ pub enum RaySize {
|
|||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Debug,
|
||||
Deserialize,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
Serialize,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedZero,
|
||||
ToComputedValue,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue