style: Add derived ToShmem implementations.

Differential Revision: https://phabricator.services.mozilla.com/D17197
This commit is contained in:
Cameron McCormack 2019-03-30 00:16:25 +00:00 committed by Emilio Cobos Álvarez
parent 128c6ae94a
commit 40248ae5fd
93 changed files with 649 additions and 267 deletions

View file

@ -12,7 +12,15 @@ use style_traits::{CssWriter, ToCss};
/// A generic value for a single side of a `border-image-width` property.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum BorderImageSideWidth<LengthPercentage, Number> {
/// `<length-or-percentage>`
@ -25,7 +33,15 @@ pub enum BorderImageSideWidth<LengthPercentage, Number> {
/// A generic value for the `border-image-slice` property.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderImageSlice<NumberOrPercentage> {
@ -53,9 +69,10 @@ pub use self::GenericBorderImageSlice as BorderImageSlice;
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderCornerRadius<L>(#[css(field_bound)] pub Size2D<L>);
pub struct GenericBorderCornerRadius<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
pub use self::GenericBorderCornerRadius as BorderCornerRadius;
@ -90,9 +107,10 @@ impl<L: Zero> Zero for BorderCornerRadius<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(transparent)]
pub struct BorderSpacing<L>(#[css(field_bound)] pub Size2D<L>);
pub struct BorderSpacing<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
impl<L> BorderSpacing<L> {
/// Trivially create a `BorderCornerRadius`.
@ -115,10 +133,12 @@ impl<L> BorderSpacing<L> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderRadius<LengthPercentage> {
/// The top left radius.
#[shmem(field_bound)]
pub top_left: GenericBorderCornerRadius<LengthPercentage>,
/// The top right radius.
pub top_right: GenericBorderCornerRadius<LengthPercentage>,