From 40248ae5fdc2e768862a1865b43e0a23e588b303 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sat, 30 Mar 2019 00:16:25 +0000 Subject: [PATCH] style: Add derived ToShmem implementations. Differential Revision: https://phabricator.services.mozilla.com/D17197 --- components/selectors/Cargo.toml | 2 + components/selectors/attr.rs | 14 ++-- components/selectors/builder.rs | 2 +- components/selectors/lib.rs | 3 + components/selectors/parser.rs | 33 +++++---- components/style/counter_style/mod.rs | 24 +++---- components/style/custom_properties.rs | 2 +- components/style/font_face.rs | 16 +++-- .../gecko/pseudo_element_definition.mako.rs | 2 +- components/style/gecko/selector_parser.rs | 2 +- components/style/gecko/url.rs | 8 +-- .../style/gecko_string_cache/namespace.rs | 2 +- components/style/lib.rs | 1 + components/style/macros.rs | 1 + .../style/media_queries/media_condition.rs | 4 +- .../media_queries/media_feature_expression.rs | 12 ++-- components/style/media_queries/media_list.rs | 2 +- components/style/media_queries/media_query.rs | 8 +-- .../style/properties/declaration_block.rs | 2 +- components/style/properties/helpers.mako.rs | 10 +-- .../style/properties/longhands/font.mako.rs | 2 +- .../style/properties/properties.mako.rs | 17 ++--- components/style/selector_parser.rs | 2 +- components/style/stylesheets/document_rule.rs | 8 +-- .../stylesheets/font_feature_values_rule.rs | 10 +-- .../style/stylesheets/keyframes_rule.rs | 8 +-- components/style/stylesheets/media_rule.rs | 2 +- components/style/stylesheets/mod.rs | 2 +- .../style/stylesheets/namespace_rule.rs | 2 +- components/style/stylesheets/origin.rs | 2 +- components/style/stylesheets/page_rule.rs | 2 +- components/style/stylesheets/rule_list.rs | 2 +- components/style/stylesheets/rule_parser.rs | 2 +- components/style/stylesheets/style_rule.rs | 2 +- components/style/stylesheets/supports_rule.rs | 8 +-- components/style/stylesheets/viewport_rule.rs | 8 +-- components/style/values/computed/font.rs | 4 +- components/style/values/computed/length.rs | 2 + .../style/values/computed/percentage.rs | 1 + .../style/values/generics/background.rs | 1 + .../style/values/generics/basic_shape.rs | 31 ++++++++- components/style/values/generics/border.rs | 28 ++++++-- components/style/values/generics/box.rs | 6 +- components/style/values/generics/color.rs | 5 +- components/style/values/generics/column.rs | 1 + components/style/values/generics/counters.rs | 36 ++++++++-- components/style/values/generics/easing.rs | 15 ++++- components/style/values/generics/effects.rs | 3 + components/style/values/generics/flex.rs | 1 + components/style/values/generics/font.rs | 16 ++++- components/style/values/generics/gecko.rs | 2 +- components/style/values/generics/grid.rs | 50 +++++++++++--- components/style/values/generics/image.rs | 26 ++++--- components/style/values/generics/length.rs | 4 ++ components/style/values/generics/mod.rs | 9 ++- components/style/values/generics/position.rs | 2 + components/style/values/generics/rect.rs | 1 + components/style/values/generics/size.rs | 1 + components/style/values/generics/svg.rs | 5 ++ components/style/values/generics/text.rs | 15 ++++- components/style/values/generics/transform.rs | 53 +++++++++++++-- components/style/values/generics/ui.rs | 5 +- components/style/values/generics/url.rs | 1 + components/style/values/mod.rs | 7 +- components/style/values/specified/align.rs | 18 ++--- components/style/values/specified/angle.rs | 4 +- .../style/values/specified/background.rs | 3 +- components/style/values/specified/border.rs | 11 ++- components/style/values/specified/box.rs | 67 ++++++++++++++++--- components/style/values/specified/calc.rs | 2 +- components/style/values/specified/color.rs | 8 +-- components/style/values/specified/effects.rs | 2 +- components/style/values/specified/font.rs | 66 +++++++++++------- components/style/values/specified/image.rs | 4 +- components/style/values/specified/length.rs | 14 ++-- components/style/values/specified/list.rs | 13 +++- components/style/values/specified/mod.rs | 14 ++-- components/style/values/specified/motion.rs | 1 + components/style/values/specified/outline.rs | 1 + .../style/values/specified/percentage.rs | 2 +- components/style/values/specified/position.rs | 34 ++++++++-- .../style/values/specified/resolution.rs | 2 +- components/style/values/specified/svg.rs | 8 ++- components/style/values/specified/svg_path.rs | 14 +++- components/style/values/specified/table.rs | 10 ++- components/style/values/specified/text.rs | 35 +++++++--- components/style/values/specified/time.rs | 4 +- .../style/values/specified/transform.rs | 2 +- components/style/values/specified/ui.rs | 6 +- components/style_traits/Cargo.toml | 2 + components/style_traits/lib.rs | 3 + components/style_traits/values.rs | 4 +- components/style_traits/viewport.rs | 2 +- 93 files changed, 649 insertions(+), 267 deletions(-) diff --git a/components/selectors/Cargo.toml b/components/selectors/Cargo.toml index bb8e5d7f81b..ed34c9084d2 100644 --- a/components/selectors/Cargo.toml +++ b/components/selectors/Cargo.toml @@ -31,6 +31,8 @@ precomputed-hash = "0.1" servo_arc = { version = "0.1", path = "../servo_arc" } smallvec = "0.6" thin-slice = "0.1.0" +to_shmem = { path = "../to_shmem" } +to_shmem_derive = { path = "../to_shmem_derive" } [build-dependencies] phf_codegen = "0.7.18" diff --git a/components/selectors/attr.rs b/components/selectors/attr.rs index 36d31e11345..96abbe1c132 100644 --- a/components/selectors/attr.rs +++ b/components/selectors/attr.rs @@ -6,11 +6,15 @@ use crate::parser::SelectorImpl; use cssparser::ToCss; use std::fmt; -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, ToShmem)] +#[shmem(no_bounds)] pub struct AttrSelectorWithOptionalNamespace { + #[shmem(field_bound)] pub namespace: Option>, + #[shmem(field_bound)] pub local_name: Impl::LocalName, pub local_name_lower: Impl::LocalName, + #[shmem(field_bound)] pub operation: ParsedAttrSelectorOperation, pub never_matches: bool, } @@ -24,7 +28,7 @@ impl AttrSelectorWithOptionalNamespace { } } -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, ToShmem)] pub enum NamespaceConstraint { Any, @@ -32,7 +36,7 @@ pub enum NamespaceConstraint { Specific(NamespaceUrl), } -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, ToShmem)] pub enum ParsedAttrSelectorOperation { Exists, WithValue { @@ -72,7 +76,7 @@ impl AttrSelectorOperation { } } -#[derive(Clone, Copy, Eq, PartialEq)] +#[derive(Clone, Copy, Eq, PartialEq, ToShmem)] pub enum AttrSelectorOperator { Equal, Includes, @@ -132,7 +136,7 @@ impl AttrSelectorOperator { /// The definition of whitespace per CSS Selectors Level 3 § 4. pub static SELECTOR_WHITESPACE: &'static [char] = &[' ', '\t', '\n', '\r', '\x0C']; -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)] pub enum ParsedCaseSensitivity { // 's' was specified. ExplicitCaseSensitive, diff --git a/components/selectors/builder.rs b/components/selectors/builder.rs index 80e8457cfc8..72404de1084 100644 --- a/components/selectors/builder.rs +++ b/components/selectors/builder.rs @@ -199,7 +199,7 @@ pub const HAS_SLOTTED_BIT: u32 = 1 << 31; /// We use ten bits for each specificity kind (id, class, element), and the two /// high bits for the pseudo and slotted flags. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)] pub struct SpecificityAndFlags(pub u32); impl SpecificityAndFlags { diff --git a/components/selectors/lib.rs b/components/selectors/lib.rs index 1d9bf58edb3..e8d8062dff7 100644 --- a/components/selectors/lib.rs +++ b/components/selectors/lib.rs @@ -21,6 +21,9 @@ extern crate precomputed_hash; extern crate servo_arc; extern crate smallvec; extern crate thin_slice; +extern crate to_shmem; +#[macro_use] +extern crate to_shmem_derive; pub mod attr; pub mod bloom; diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index 488628cd712..765c0d842c1 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -221,8 +221,9 @@ pub trait Parser<'i> { } } -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct SelectorList(pub SmallVec<[Selector; 1]>); +#[derive(Clone, Debug, Eq, PartialEq, ToShmem)] +#[shmem(no_bounds)] +pub struct SelectorList(#[shmem(field_bound)] pub SmallVec<[Selector; 1]>); impl SelectorList { /// Parse a comma-separated list of Selectors. @@ -507,8 +508,9 @@ pub fn namespace_empty_string() -> Impl::NamespaceUrl { /// /// This reordering doesn't change the semantics of selector matching, and we /// handle it in to_css to make it invisible to serialization. -#[derive(Clone, Eq, PartialEq)] -pub struct Selector(ThinArc>); +#[derive(Clone, Eq, PartialEq, ToShmem)] +#[shmem(no_bounds)] +pub struct Selector(#[shmem(field_bound)] ThinArc>); impl Selector { #[inline] @@ -776,7 +778,7 @@ impl<'a, Impl: SelectorImpl> Iterator for AncestorIter<'a, Impl> { } } -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)] pub enum Combinator { Child, // > Descendant, // space @@ -824,22 +826,24 @@ impl Combinator { /// optimal packing and cache performance, see [1]. /// /// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1357973 -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, ToShmem)] +#[shmem(no_bounds)] pub enum Component { Combinator(Combinator), ExplicitAnyNamespace, ExplicitNoNamespace, - DefaultNamespace(Impl::NamespaceUrl), - Namespace(Impl::NamespacePrefix, Impl::NamespaceUrl), + DefaultNamespace(#[shmem(field_bound)] Impl::NamespaceUrl), + Namespace(#[shmem(field_bound)] Impl::NamespacePrefix, #[shmem(field_bound)] Impl::NamespaceUrl), ExplicitUniversalType, LocalName(LocalName), - ID(Impl::Identifier), - Class(Impl::ClassName), + ID(#[shmem(field_bound)] Impl::Identifier), + Class(#[shmem(field_bound)] Impl::ClassName), AttributeInNoNamespaceExists { + #[shmem(field_bound)] local_name: Impl::LocalName, local_name_lower: Impl::LocalName, }, @@ -847,6 +851,7 @@ pub enum Component { AttributeInNoNamespace { local_name: Impl::LocalName, operator: AttrSelectorOperator, + #[shmem(field_bound)] value: Impl::AttrValue, case_sensitivity: ParsedCaseSensitivity, never_matches: bool, @@ -878,7 +883,7 @@ pub enum Component { FirstOfType, LastOfType, OnlyOfType, - NonTSPseudoClass(Impl::NonTSPseudoClass), + NonTSPseudoClass(#[shmem(field_bound)] Impl::NonTSPseudoClass), /// The ::slotted() pseudo-element (which isn't actually a pseudo-element, /// and probably should be a pseudo-class): /// @@ -902,7 +907,7 @@ pub enum Component { /// /// See https://github.com/w3c/csswg-drafts/issues/2158 Host(Option>), - PseudoElement(Impl::PseudoElement), + PseudoElement(#[shmem(field_bound)] Impl::PseudoElement), } impl Component { @@ -957,8 +962,10 @@ impl Component { } } -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, ToShmem)] +#[shmem(no_bounds)] pub struct LocalName { + #[shmem(field_bound)] pub name: Impl::LocalName, pub lower_name: Impl::LocalName, } diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 0daa0632739..77de5f52d2b 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -164,7 +164,7 @@ macro_rules! counter_style_descriptors { $( #[$doc: meta] $name: tt $ident: ident / $setter: ident [$checker: tt]: $ty: ty, )+ ) => { /// An @counter-style rule - #[derive(Clone, Debug)] + #[derive(Clone, Debug, ToShmem)] pub struct CounterStyleRuleData { name: CustomIdent, generation: Wrapping, @@ -337,7 +337,7 @@ impl CounterStyleRuleData { } /// -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] pub enum System { /// 'cyclic' Cyclic, @@ -410,7 +410,7 @@ impl ToCss for System { /// #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum Symbol { /// String(String), @@ -447,7 +447,7 @@ impl Symbol { } /// -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct Negative(pub Symbol, pub Option); impl Parse for Negative { @@ -465,11 +465,11 @@ impl Parse for Negative { /// /// /// Empty Vec represents 'auto' -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] pub struct Ranges(pub Vec>); /// A bound found in `Ranges`. -#[derive(Clone, Copy, Debug, ToCss)] +#[derive(Clone, Copy, Debug, ToCss, ToShmem)] pub enum CounterBound { /// An integer bound. Integer(Integer), @@ -548,7 +548,7 @@ where } /// -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct Pad(pub Integer, pub Symbol); impl Parse for Pad { @@ -564,7 +564,7 @@ impl Parse for Pad { } /// -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct Fallback(pub CustomIdent); impl Parse for Fallback { @@ -578,7 +578,7 @@ impl Parse for Fallback { /// #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct Symbols(#[css(iterable)] pub Vec); impl Parse for Symbols { @@ -602,7 +602,7 @@ impl Parse for Symbols { } /// -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct AdditiveSymbols(pub Vec); impl Parse for AdditiveSymbols { @@ -623,7 +623,7 @@ impl Parse for AdditiveSymbols { } /// && -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct AdditiveTuple { /// pub weight: Integer, @@ -651,7 +651,7 @@ impl Parse for AdditiveTuple { } /// -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub enum SpeakAs { /// auto Auto, diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 0dbd611820d..639d32a97a9 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -96,7 +96,7 @@ pub fn parse_name(s: &str) -> Result<&str, ()> { /// /// We preserve the original CSS for serialization, and also the variable /// references to other custom property names. -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub struct VariableValue { css: String, diff --git a/components/style/font_face.rs b/components/style/font_face.rs index 12ebe3b9864..655c8846f76 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -34,7 +34,7 @@ use style_traits::{StyleParseErrorKind, ToCss}; /// A source for a font-face rule. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Debug, Eq, PartialEq, ToCss)] +#[derive(Clone, Debug, Eq, PartialEq, ToCss, ToShmem)] pub enum Source { /// A `url()` source. Url(UrlSource), @@ -68,7 +68,7 @@ pub enum FontFaceSourceListComponent { /// /// #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq, ToShmem)] pub struct UrlSource { /// The specified url. pub url: SpecifiedUrl, @@ -101,7 +101,9 @@ impl ToCss for UrlSource { /// on whether and when it is downloaded and ready to use. #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem, +)] #[repr(u8)] pub enum FontDisplay { Auto, @@ -144,7 +146,7 @@ macro_rules! impl_range { /// The font-weight descriptor: /// /// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-weight -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] pub struct FontWeightRange(pub AbsoluteFontWeight, pub AbsoluteFontWeight); impl_range!(FontWeightRange, AbsoluteFontWeight); @@ -176,7 +178,7 @@ impl FontWeightRange { /// The font-stretch descriptor: /// /// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-stretch -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] pub struct FontStretchRange(pub FontStretch, pub FontStretch); impl_range!(FontStretchRange, FontStretch); @@ -205,7 +207,7 @@ impl FontStretchRange { /// The font-style descriptor: /// /// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-style -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] #[allow(missing_docs)] pub enum FontStyle { Normal, @@ -435,7 +437,7 @@ macro_rules! font_face_descriptors_common { /// Data inside a `@font-face` rule. /// /// - #[derive(Clone, Debug, PartialEq)] + #[derive(Clone, Debug, PartialEq, ToShmem)] pub struct FontFaceRuleData { $( #[$doc] diff --git a/components/style/gecko/pseudo_element_definition.mako.rs b/components/style/gecko/pseudo_element_definition.mako.rs index e2dffcbdd74..a752d84c481 100644 --- a/components/style/gecko/pseudo_element_definition.mako.rs +++ b/components/style/gecko/pseudo_element_definition.mako.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /// Gecko's pseudo-element definition. -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] pub enum PseudoElement { % for pseudo in PSEUDOS: /// ${pseudo.value} diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index b00cb4f909e..41de05c33b9 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -44,7 +44,7 @@ pub type Lang = Atom; macro_rules! pseudo_class_name { ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => { /// Our representation of a non tree-structural pseudo-class. - #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)] + #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum NonTSPseudoClass { $( #[doc = $css] diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index a0bf3ff0829..2c61ab4db0b 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -26,11 +26,11 @@ use to_shmem::{SharedMemoryBuilder, ToShmem}; /// A CSS url() value for gecko. #[css(function = "url")] -#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct CssUrl(pub Arc); /// Data shared between CssUrls. -#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct CssUrlData { /// The URL in unresolved string form. serialization: String, @@ -150,7 +150,7 @@ impl ToShmem for URLValueSource { } /// A specified non-image `url()` value. -#[derive(Clone, Debug, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, SpecifiedValueInfo, ToCss, ToShmem)] pub struct SpecifiedUrl { /// The specified url value. pub url: CssUrl, @@ -276,7 +276,7 @@ impl ToComputedValue for SpecifiedUrl { } /// A specified image `url()` value. -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct SpecifiedImageUrl(pub SpecifiedUrl); impl SpecifiedImageUrl { diff --git a/components/style/gecko_string_cache/namespace.rs b/components/style/gecko_string_cache/namespace.rs index 725e1da2169..33883e66941 100644 --- a/components/style/gecko_string_cache/namespace.rs +++ b/components/style/gecko_string_cache/namespace.rs @@ -24,7 +24,7 @@ macro_rules! ns { } /// A Gecko namespace is just a wrapped atom. -#[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] pub struct Namespace(pub Atom); impl PrecomputedHash for Namespace { diff --git a/components/style/lib.rs b/components/style/lib.rs index cb73df55fcf..bd33dbeafe4 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -100,6 +100,7 @@ extern crate style_traits; extern crate thin_slice; extern crate time; extern crate to_shmem; +#[macro_use] extern crate to_shmem_derive; extern crate uluru; extern crate unicode_bidi; diff --git a/components/style/macros.rs b/components/style/macros.rs index fb189837181..654053c140f 100644 --- a/components/style/macros.rs +++ b/components/style/macros.rs @@ -80,6 +80,7 @@ macro_rules! define_keyword_type { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub struct $name; diff --git a/components/style/media_queries/media_condition.rs b/components/style/media_queries/media_condition.rs index 7fed56bee85..19e20105819 100644 --- a/components/style/media_queries/media_condition.rs +++ b/components/style/media_queries/media_condition.rs @@ -14,7 +14,7 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// A binary `and` or `or` operator. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] #[allow(missing_docs)] pub enum Operator { And, @@ -29,7 +29,7 @@ enum AllowOr { } /// Represents a media condition. -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub enum MediaCondition { /// A simple media feature expression, implicitly parenthesized. Feature(MediaFeatureExpression), diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs index 53e24ae5b17..3f8eefbfab5 100644 --- a/components/style/media_queries/media_feature_expression.rs +++ b/components/style/media_queries/media_feature_expression.rs @@ -27,7 +27,7 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// An aspect ratio, with a numerator and denominator. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub struct AspectRatio(pub u32, pub u32); impl ToCss for AspectRatio { @@ -51,7 +51,7 @@ impl PartialOrd for AspectRatio { } /// The kind of matching that should be performed on a media feature value. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum Range { /// At least the specified value. Min, @@ -60,7 +60,7 @@ pub enum Range { } /// The operator that was specified in this media feature. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum Operator { /// = Equal, @@ -93,7 +93,7 @@ impl ToCss for Operator { /// /// Ranged media features are not allowed with operations (that'd make no /// sense). -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum RangeOrOperator { /// A `Range`. Range(Range), @@ -151,7 +151,7 @@ impl RangeOrOperator { /// A feature expression contains a reference to the media feature, the value /// the media query contained, and the range to evaluate. -#[derive(Clone, Debug, MallocSizeOf)] +#[derive(Clone, Debug, MallocSizeOf, ToShmem)] pub struct MediaFeatureExpression { feature_index: usize, value: Option, @@ -467,7 +467,7 @@ impl MediaFeatureExpression { /// If the first, this would need to store the relevant values. /// /// See: https://github.com/w3c/csswg-drafts/issues/1968 -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub enum MediaExpressionValue { /// A length. Length(Length), diff --git a/components/style/media_queries/media_list.rs b/components/style/media_queries/media_list.rs index 0acf4f1bdf9..5d150f7db99 100644 --- a/components/style/media_queries/media_list.rs +++ b/components/style/media_queries/media_list.rs @@ -15,7 +15,7 @@ use cssparser::{ParserInput, Token}; /// A type that encapsulates a media query list. #[css(comma, derive_debug)] -#[derive(Clone, MallocSizeOf, ToCss)] +#[derive(Clone, MallocSizeOf, ToCss, ToShmem)] pub struct MediaList { /// The list of media queries. #[css(iterable)] diff --git a/components/style/media_queries/media_query.rs b/components/style/media_queries/media_query.rs index f61ac6191fb..1768053dbce 100644 --- a/components/style/media_queries/media_query.rs +++ b/components/style/media_queries/media_query.rs @@ -16,7 +16,7 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, ToCss}; /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] pub enum Qualifier { /// Hide a media query from legacy UAs: /// @@ -27,7 +27,7 @@ pub enum Qualifier { } /// -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub struct MediaType(pub CustomIdent); impl MediaType { @@ -58,7 +58,7 @@ impl MediaType { /// A [media query][mq]. /// /// [mq]: https://drafts.csswg.org/mediaqueries/ -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub struct MediaQuery { /// The qualifier for this query. pub qualifier: Option, @@ -151,7 +151,7 @@ impl MediaQuery { } /// -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum MediaQueryType { /// A media type that matches every device. All, diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 5a2fd6f2236..c86f5bac9ee 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -90,7 +90,7 @@ impl Importance { /// Overridden declarations are skipped. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone)] +#[derive(Clone, ToShmem)] pub struct PropertyDeclarationBlock { /// The group of declarations, along with their importance. /// diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index b48f0afbf00..06ffc2ebc41 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -205,7 +205,7 @@ % if separator == "Comma": #[css(comma)] % endif - #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] + #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct SpecifiedValue( % if not allow_empty: #[css(iterable)] @@ -426,7 +426,7 @@ pub mod computed_value { #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, - PartialEq, SpecifiedValueInfo, ToCss)] + PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum T { % for value in keyword.values_for(product): ${to_camel_case(value)}, @@ -437,7 +437,7 @@ } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] - #[derive(Clone, Copy, Debug, Eq, PartialEq, SpecifiedValueInfo, ToCss)] + #[derive(Clone, Copy, Debug, Eq, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum SpecifiedValue { Keyword(computed_value::T), #[css(skip)] @@ -589,7 +589,7 @@ % if extra_specified: #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, - SpecifiedValueInfo, ToCss)] + SpecifiedValueInfo, ToCss, ToShmem)] pub enum SpecifiedValue { ${variants(keyword.values_for(product) + extra_specified.split(), bool(extra_specified))} } @@ -600,7 +600,7 @@ #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)] % if not extra_specified: - #[derive(Parse, SpecifiedValueInfo, ToComputedValue)] + #[derive(Parse, SpecifiedValueInfo, ToComputedValue, ToShmem)] % endif pub enum T { ${variants(data.longhands_by_name[name].keyword.values_for(product), not extra_specified)} diff --git a/components/style/properties/longhands/font.mako.rs b/components/style/properties/longhands/font.mako.rs index 466a4471608..a2eb9c3dcff 100644 --- a/components/style/properties/longhands/font.mako.rs +++ b/components/style/properties/longhands/font.mako.rs @@ -346,7 +346,7 @@ ${helpers.predefined_type( font_optical_sizing""".split() %> #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToCss)] + SpecifiedValueInfo, ToCss, ToShmem)] pub enum SystemFont { % for font in system_fonts: ${to_camel_case(font)}, diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 2f1760ada9c..db9fb9fbd3b 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -257,6 +257,7 @@ pub mod shorthands { %> /// Servo's representation for a property declaration. +#[derive(ToShmem)] #[repr(u16)] pub enum PropertyDeclaration { % for variant in variants: @@ -896,7 +897,7 @@ impl LonghandIdSet { /// An enum to represent a CSS Wide keyword. #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToCss)] + ToCss, ToShmem)] pub enum CSSWideKeyword { /// The `initial` keyword. Initial, @@ -996,7 +997,7 @@ pub enum LogicalGroup { } /// An identifier for a given longhand property. -#[derive(Clone, Copy, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] #[repr(u16)] pub enum LonghandId { % for i, property in enumerate(data.longhands): @@ -1338,7 +1339,7 @@ where } /// An identifier for a given shorthand property. -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] #[repr(u16)] pub enum ShorthandId { % for i, property in enumerate(data.shorthands): @@ -1536,7 +1537,7 @@ impl ShorthandId { } /// An unparsed property value that contains `var()` functions. -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq, ToShmem)] pub struct UnparsedValue { /// The css serialization for this value. css: String, @@ -1957,7 +1958,7 @@ impl PropertyId { /// A declaration using a CSS-wide keyword. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, PartialEq, ToCss)] +#[derive(Clone, PartialEq, ToCss, ToShmem)] pub struct WideKeywordDeclaration { #[css(skip)] id: LonghandId, @@ -1966,7 +1967,7 @@ pub struct WideKeywordDeclaration { /// An unparsed declaration that contains `var()` functions. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, PartialEq, ToCss)] +#[derive(Clone, PartialEq, ToCss, ToShmem)] pub struct VariableDeclaration { #[css(skip)] id: LonghandId, @@ -1976,7 +1977,7 @@ pub struct VariableDeclaration { /// A custom property declaration value is either an unparsed value or a CSS /// wide-keyword. -#[derive(Clone, PartialEq, ToCss)] +#[derive(Clone, PartialEq, ToCss, ToShmem)] pub enum CustomDeclarationValue { /// A value. Value(Arc), @@ -1986,7 +1987,7 @@ pub enum CustomDeclarationValue { /// A custom property declaration with the property name and the declared value. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, PartialEq, ToCss)] +#[derive(Clone, PartialEq, ToCss, ToShmem)] pub struct CustomDeclaration { /// The name of the custom property. #[css(skip)] diff --git a/components/style/selector_parser.rs b/components/style/selector_parser.rs index 827c6dea284..a8b5c3bc33e 100644 --- a/components/style/selector_parser.rs +++ b/components/style/selector_parser.rs @@ -177,7 +177,7 @@ impl PerPseudoElementMap { /// Values for the :dir() pseudo class /// /// "ltr" and "rtl" values are normalized to lowercase. -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub struct Direction(pub Atom); /// Horizontal values for the :dir() pseudo class diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs index c73b96bcd9d..8dd4306c179 100644 --- a/components/style/stylesheets/document_rule.rs +++ b/components/style/stylesheets/document_rule.rs @@ -20,7 +20,7 @@ use servo_arc::Arc; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -#[derive(Debug)] +#[derive(Debug, ToShmem)] /// A @-moz-document rule pub struct DocumentRule { /// The parsed condition @@ -72,7 +72,7 @@ impl DeepCloneWithLock for DocumentRule { } /// The kind of media document that the rule will match. -#[derive(Clone, Copy, Debug, Parse, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, Parse, PartialEq, ToCss, ToShmem)] #[allow(missing_docs)] pub enum MediaDocumentKind { All, @@ -82,7 +82,7 @@ pub enum MediaDocumentKind { } /// A matching function for a `@document` rule's condition. -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub enum DocumentMatchingFunction { /// Exact URL matching function. It evaluates to true whenever the /// URL of the document being styled is exactly the URL given. @@ -216,7 +216,7 @@ impl DocumentMatchingFunction { /// URL matching functions, and the condition evaluates to true whenever any /// one of those functions evaluates to true. #[css(comma)] -#[derive(Clone, Debug, ToCss)] +#[derive(Clone, Debug, ToCss, ToShmem)] pub struct DocumentCondition(#[css(iterable)] Vec); impl DocumentCondition { diff --git a/components/style/stylesheets/font_feature_values_rule.rs b/components/style/stylesheets/font_feature_values_rule.rs index a93ed43d475..74900f96baf 100644 --- a/components/style/stylesheets/font_feature_values_rule.rs +++ b/components/style/stylesheets/font_feature_values_rule.rs @@ -30,7 +30,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// - `SingleValue` is to keep just one unsigned integer value. /// - `PairValues` is to keep one or two unsigned integer values. /// - `VectorValues` is to keep a list of unsigned integer values. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] pub struct FFVDeclaration { /// An `` for declaration name. pub name: Atom, @@ -58,7 +58,7 @@ pub trait ToGeckoFontFeatureValues { } /// A @font-feature-values block declaration value that keeps one value. -#[derive(Clone, Debug, PartialEq, ToCss)] +#[derive(Clone, Debug, PartialEq, ToCss, ToShmem)] pub struct SingleValue(pub u32); impl Parse for SingleValue { @@ -87,7 +87,7 @@ impl ToGeckoFontFeatureValues for SingleValue { } /// A @font-feature-values block declaration value that keeps one or two values. -#[derive(Clone, Debug, PartialEq, ToCss)] +#[derive(Clone, Debug, PartialEq, ToCss, ToShmem)] pub struct PairValues(pub u32, pub Option); impl Parse for PairValues { @@ -131,7 +131,7 @@ impl ToGeckoFontFeatureValues for PairValues { } /// A @font-feature-values block declaration value that keeps a list of values. -#[derive(Clone, Debug, PartialEq, ToCss)] +#[derive(Clone, Debug, PartialEq, ToCss, ToShmem)] pub struct VectorValues(#[css(iterable)] pub Vec); impl Parse for VectorValues { @@ -225,7 +225,7 @@ macro_rules! font_feature_values_blocks { /// The [`@font-feature-values`][font-feature-values] at-rule. /// /// [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule - #[derive(Clone, Debug, PartialEq)] + #[derive(Clone, Debug, PartialEq, ToShmem)] pub struct FontFeatureValuesRule { /// Font family list for @font-feature-values rule. /// Family names cannot contain generic families. FamilyName diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs index 662bc9ae481..9efd7f39ccc 100644 --- a/components/style/stylesheets/keyframes_rule.rs +++ b/components/style/stylesheets/keyframes_rule.rs @@ -26,7 +26,7 @@ use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCs /// A [`@keyframes`][keyframes] rule. /// /// [keyframes]: https://drafts.csswg.org/css-animations/#keyframes -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct KeyframesRule { /// The name of the current animation. pub name: KeyframesName, @@ -99,7 +99,7 @@ impl DeepCloneWithLock for KeyframesRule { /// A number from 0 to 1, indicating the percentage of the animation when this /// keyframe should run. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToShmem)] pub struct KeyframePercentage(pub f32); impl ::std::cmp::Ord for KeyframePercentage { @@ -150,7 +150,7 @@ impl KeyframePercentage { /// A keyframes selector is a list of percentages or from/to symbols, which are /// converted at parse time to percentages. #[css(comma)] -#[derive(Clone, Debug, Eq, PartialEq, ToCss)] +#[derive(Clone, Debug, Eq, PartialEq, ToCss, ToShmem)] pub struct KeyframeSelector(#[css(iterable)] Vec); impl KeyframeSelector { @@ -174,7 +174,7 @@ impl KeyframeSelector { } /// A keyframe. -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct Keyframe { /// The selector this keyframe was specified from. pub selector: KeyframeSelector, diff --git a/components/style/stylesheets/media_rule.rs b/components/style/stylesheets/media_rule.rs index 4266b4c2c10..ea7441a5c09 100644 --- a/components/style/stylesheets/media_rule.rs +++ b/components/style/stylesheets/media_rule.rs @@ -21,7 +21,7 @@ use style_traits::{CssWriter, ToCss}; /// An [`@media`][media] urle. /// /// [media]: https://drafts.csswg.org/css-conditional/#at-ruledef-media -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct MediaRule { /// The list of media queries used by this media rule. pub media_queries: Arc>, diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 3dfc4a02727..133b84fa52f 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -204,7 +204,7 @@ impl Eq for UrlExtraData {} /// A CSS rule. /// /// TODO(emilio): Lots of spec links should be around. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] #[allow(missing_docs)] pub enum CssRule { // No Charset here, CSSCharsetRule has been removed from CSSOM diff --git a/components/style/stylesheets/namespace_rule.rs b/components/style/stylesheets/namespace_rule.rs index ea20cfe1a05..81a92f1c300 100644 --- a/components/style/stylesheets/namespace_rule.rs +++ b/components/style/stylesheets/namespace_rule.rs @@ -11,7 +11,7 @@ use cssparser::SourceLocation; use std::fmt::{self, Write}; /// A `@namespace` rule. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] #[allow(missing_docs)] pub struct NamespaceRule { /// The namespace prefix, and `None` if it's the default Namespace diff --git a/components/style/stylesheets/origin.rs b/components/style/stylesheets/origin.rs index fc89260abd2..783b8f26a8b 100644 --- a/components/style/stylesheets/origin.rs +++ b/components/style/stylesheets/origin.rs @@ -10,7 +10,7 @@ use std::ops::BitOrAssign; /// Each style rule has an origin, which determines where it enters the cascade. /// /// -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)] #[repr(u8)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] pub enum Origin { diff --git a/components/style/stylesheets/page_rule.rs b/components/style/stylesheets/page_rule.rs index ccb689c1699..3edf562258f 100644 --- a/components/style/stylesheets/page_rule.rs +++ b/components/style/stylesheets/page_rule.rs @@ -25,7 +25,7 @@ use std::fmt::{self, Write}; /// /// [page]: https://drafts.csswg.org/css2/page.html#page-box /// [page-selectors]: https://drafts.csswg.org/css2/page.html#page-selectors -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct PageRule { /// The declaration block this page rule contains. pub block: Arc>, diff --git a/components/style/stylesheets/rule_list.rs b/components/style/stylesheets/rule_list.rs index c4bf0007bb6..ee2b5347c1e 100644 --- a/components/style/stylesheets/rule_list.rs +++ b/components/style/stylesheets/rule_list.rs @@ -17,7 +17,7 @@ use servo_arc::{Arc, RawOffsetArc}; use std::fmt::{self, Write}; /// A list of CSS rules. -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct CssRules(pub Vec); impl CssRules { diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs index 8f4cb088cf0..33190c578b4 100644 --- a/components/style/stylesheets/rule_parser.rs +++ b/components/style/stylesheets/rule_parser.rs @@ -133,7 +133,7 @@ pub enum State { Body = 4, } -#[derive(Clone, Debug, MallocSizeOf)] +#[derive(Clone, Debug, MallocSizeOf, ToShmem)] /// Vendor prefix. pub enum VendorPrefix { /// -moz prefix. diff --git a/components/style/stylesheets/style_rule.rs b/components/style/stylesheets/style_rule.rs index f762d154ad8..905e067f730 100644 --- a/components/style/stylesheets/style_rule.rs +++ b/components/style/stylesheets/style_rule.rs @@ -19,7 +19,7 @@ use servo_arc::Arc; use std::fmt::{self, Write}; /// A style rule, with selectors and declarations. -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct StyleRule { /// The list of selectors in this rule. pub selectors: SelectorList, diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index 3ed0595aa44..a22acad1aa0 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -26,7 +26,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// An [`@supports`][supports] rule. /// /// [supports]: https://drafts.csswg.org/css-conditional-3/#at-supports -#[derive(Debug)] +#[derive(Debug, ToShmem)] pub struct SupportsRule { /// The parsed condition pub condition: SupportsCondition, @@ -76,7 +76,7 @@ impl DeepCloneWithLock for SupportsRule { /// An @supports condition /// /// -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] pub enum SupportsCondition { /// `not (condition)` Not(Box), @@ -305,7 +305,7 @@ impl ToCss for SupportsCondition { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] /// A possibly-invalid CSS selector. pub struct RawSelector(pub String); @@ -367,7 +367,7 @@ impl RawSelector { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, ToShmem)] /// A possibly-invalid property declaration pub struct Declaration(pub String); diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 02be35261db..e845930bfbd 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -80,7 +80,7 @@ macro_rules! declare_viewport_descriptor_inner { [ ] $number_of_variants: expr ) => { - #[derive(Clone, Debug, PartialEq)] + #[derive(Clone, Debug, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] #[allow(missing_docs)] pub enum ViewportDescriptor { @@ -147,7 +147,7 @@ trait FromMeta: Sized { /// * http://dev.w3.org/csswg/css-device-adapt/#extend-to-zoom #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] -#[derive(Clone, Debug, PartialEq, ToCss)] +#[derive(Clone, Debug, PartialEq, ToCss, ToShmem)] pub enum ViewportLength { Specified(NonNegativeLengthPercentageOrAuto), ExtendToZoom, @@ -225,7 +225,7 @@ struct ViewportRuleParser<'a, 'b: 'a> { context: &'a ParserContext<'b>, } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] #[allow(missing_docs)] pub struct ViewportDescriptorDeclaration { @@ -335,7 +335,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> { } /// A `@viewport` rule. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] pub struct ViewportRule { /// The declarations contained in this @viewport rule. diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index b9b5d5bb6e1..6bd8cae445b 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -225,7 +225,7 @@ impl ToCss for FontFamily { } } -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] /// The name of a font family of choice pub struct FamilyName { @@ -268,7 +268,7 @@ impl ToCss for FamilyName { } } -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] /// Font family names must either be given quoted as strings, /// or unquoted as a sequence of one or more identifiers. diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index 1262e4dd1d5..0587dc46791 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -608,6 +608,7 @@ impl Size { PartialOrd, ToAnimatedValue, ToAnimatedZero, + ToShmem, )] #[repr(C)] pub struct CSSPixelLength(CSSFloat); @@ -809,6 +810,7 @@ pub type NonNegativeLengthOrNumber = GenericLengthOrNumber( ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericBackgroundSize { diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs index 975fbdb797d..2258ce11ade 100644 --- a/components/style/values/generics/basic_shape.rs +++ b/components/style/values/generics/basic_shape.rs @@ -31,6 +31,7 @@ pub type ClippingShape = ShapeSource = ShapeSource { #[animation(error)] @@ -104,11 +107,24 @@ pub enum ShapeSource { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub enum BasicShape { - Inset(#[css(field_bound)] InsetRect), - Circle(#[css(field_bound)] Circle), - Ellipse(#[css(field_bound)] Ellipse), + Inset( + #[css(field_bound)] + #[shmem(field_bound)] + InsetRect, + ), + Circle( + #[css(field_bound)] + #[shmem(field_bound)] + Circle, + ), + Ellipse( + #[css(field_bound)] + #[shmem(field_bound)] + Ellipse, + ), Polygon(Polygon), } @@ -125,9 +141,11 @@ pub enum BasicShape { SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, + ToShmem, )] pub struct InsetRect { pub rect: Rect, + #[shmem(field_bound)] pub round: BorderRadius, } @@ -145,6 +163,7 @@ pub struct InsetRect { SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, + ToShmem, )] pub struct Circle { pub position: Position, @@ -165,6 +184,7 @@ pub struct Circle { SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, + ToShmem, )] pub struct Ellipse { pub position: Position, @@ -186,6 +206,7 @@ pub struct Ellipse { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub enum ShapeRadius { Length(NonNegativeLengthPercentage), @@ -208,6 +229,7 @@ pub enum ShapeRadius { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub struct Polygon { /// The filling rule for a polygon. @@ -228,6 +250,7 @@ pub struct Polygon { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub struct PolygonCoord(pub LengthPercentage, pub LengthPercentage); @@ -249,6 +272,7 @@ pub struct PolygonCoord(pub LengthPercentage, pub LengthPercen ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum FillRule { @@ -270,6 +294,7 @@ pub enum FillRule { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub struct Path { /// The filling rule for the svg path. diff --git a/components/style/values/generics/border.rs b/components/style/values/generics/border.rs index df6427e888f..4652ce5ec85 100644 --- a/components/style/values/generics/border.rs +++ b/components/style/values/generics/border.rs @@ -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 { /// `` @@ -25,7 +33,15 @@ pub enum BorderImageSideWidth { /// 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 { @@ -53,9 +69,10 @@ pub use self::GenericBorderImageSlice as BorderImageSlice; ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C)] -pub struct GenericBorderCornerRadius(#[css(field_bound)] pub Size2D); +pub struct GenericBorderCornerRadius(#[css(field_bound)] #[shmem(field_bound)] pub Size2D); pub use self::GenericBorderCornerRadius as BorderCornerRadius; @@ -90,9 +107,10 @@ impl Zero for BorderCornerRadius { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(transparent)] -pub struct BorderSpacing(#[css(field_bound)] pub Size2D); +pub struct BorderSpacing(#[css(field_bound)] #[shmem(field_bound)] pub Size2D); impl BorderSpacing { /// Trivially create a `BorderCornerRadius`. @@ -115,10 +133,12 @@ impl BorderSpacing { SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, + ToShmem, )] #[repr(C)] pub struct GenericBorderRadius { /// The top left radius. + #[shmem(field_bound)] pub top_left: GenericBorderCornerRadius, /// The top right radius. pub top_right: GenericBorderCornerRadius, diff --git a/components/style/values/generics/box.rs b/components/style/values/generics/box.rs index f49cba4c2e1..91f7cf31828 100644 --- a/components/style/values/generics/box.rs +++ b/components/style/values/generics/box.rs @@ -18,6 +18,7 @@ use crate::values::animated::ToAnimatedZero; SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] pub enum VerticalAlign { /// `baseline` @@ -58,7 +59,9 @@ impl ToAnimatedZero for VerticalAlign { } /// https://drafts.csswg.org/css-animations/#animation-iteration-count -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub enum AnimationIterationCount { /// A `` value. Number(Number), @@ -81,6 +84,7 @@ pub enum AnimationIterationCount { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericPerspective { diff --git a/components/style/values/generics/color.rs b/components/style/values/generics/color.rs index 58e4e9fa97c..34b8f0608f8 100644 --- a/components/style/values/generics/color.rs +++ b/components/style/values/generics/color.rs @@ -6,7 +6,7 @@ /// Ratios representing the contribution of color and currentcolor to /// the final color value. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue, ToShmem)] pub struct ComplexColorRatios { /// Numeric color contribution. pub bg: f32, @@ -23,7 +23,7 @@ impl ComplexColorRatios { /// This enum represents a combined color from a numeric color and /// the current foreground color (currentcolor keyword). -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue, ToShmem)] pub enum Color { /// Numeric RGBA color. Numeric(RGBA), @@ -90,6 +90,7 @@ impl From for Color { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum ColorOrAuto { /// A ` diff --git a/components/style/values/generics/column.rs b/components/style/values/generics/column.rs index 6f8c9daef5b..a70d9942ac4 100644 --- a/components/style/values/generics/column.rs +++ b/components/style/values/generics/column.rs @@ -19,6 +19,7 @@ ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum ColumnCount { /// A positive integer. diff --git a/components/style/values/generics/counters.rs b/components/style/values/generics/counters.rs index 7bab3c4bbc5..4ca5361520d 100644 --- a/components/style/values/generics/counters.rs +++ b/components/style/values/generics/counters.rs @@ -14,7 +14,9 @@ use crate::values::CustomIdent; use std::ops::Deref; /// A name / value pair for counters. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct CounterPair { /// The name of the counter. pub name: CustomIdent, @@ -24,7 +26,15 @@ pub struct CounterPair { /// A generic value for the `counter-increment` property. #[derive( - Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Debug, + Default, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub struct CounterIncrement(Counters); @@ -47,7 +57,15 @@ impl Deref for CounterIncrement { /// A generic value for the `counter-set` and `counter-reset` properties. #[derive( - Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Debug, + Default, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub struct CounterSetOrReset(Counters); @@ -71,7 +89,9 @@ impl Deref for CounterSetOrReset { /// A generic value for lists of counters. /// /// Keyword `none` is represented by an empty vector. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct Counters(#[css(iterable, if_empty = "none")] Box<[CounterPair]>); impl Default for Counters { @@ -102,7 +122,9 @@ fn is_decimal(counter_type: &CounterStyleType) -> bool { /// The specified value for the `content` property. /// /// https://drafts.csswg.org/css-content/#propdef-content -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub enum Content { /// `normal` reserved keyword. Normal, @@ -124,7 +146,9 @@ impl Content { } /// Items for the `content` property. -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub enum ContentItem { /// Literal string content. String(Box), diff --git a/components/style/values/generics/easing.rs b/components/style/values/generics/easing.rs index ff4a5a39b5b..90ad530a98a 100644 --- a/components/style/values/generics/easing.rs +++ b/components/style/values/generics/easing.rs @@ -10,7 +10,15 @@ use crate::values::CSSFloat; /// A generic easing function. #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] #[value_info(ty = "TIMING_FUNCTION")] #[repr(u8, C)] @@ -46,6 +54,7 @@ pub enum TimingFunction { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum TimingKeyword { @@ -69,7 +78,9 @@ fn step_position_jump_enabled(_context: &ParserContext) -> bool { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem, +)] #[repr(u8)] pub enum StepPosition { #[parse(condition = "step_position_jump_enabled")] diff --git a/components/style/values/generics/effects.rs b/components/style/values/generics/effects.rs index 5b755ca3906..744f8ac1fe7 100644 --- a/components/style/values/generics/effects.rs +++ b/components/style/values/generics/effects.rs @@ -16,6 +16,7 @@ ToAnimatedValue, ToAnimatedZero, ToCss, + ToShmem, )] pub struct BoxShadow { /// The base shadow. @@ -41,6 +42,7 @@ pub struct BoxShadow { ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub enum Filter { /// `blur()` @@ -93,6 +95,7 @@ pub enum Filter { ToAnimatedValue, ToAnimatedZero, ToCss, + ToShmem, )] pub struct SimpleShadow { /// Color. diff --git a/components/style/values/generics/flex.rs b/components/style/values/generics/flex.rs index de67b56e35b..11b2b737902 100644 --- a/components/style/values/generics/flex.rs +++ b/components/style/values/generics/flex.rs @@ -19,6 +19,7 @@ ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C)] pub enum GenericFlexBasis { diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs index ee14e15bfe5..cb1ec77e781 100644 --- a/components/style/values/generics/font.rs +++ b/components/style/values/generics/font.rs @@ -15,7 +15,9 @@ use style_traits::{CssWriter, KeywordsCollectFn, ParseError}; use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; /// https://drafts.csswg.org/css-fonts-4/#feature-tag-value -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct FeatureTagValue { /// A four-character tag, packed into a u32 (one byte per character). pub tag: FontTag, @@ -56,6 +58,7 @@ where SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] pub struct VariationValue { /// A four-character tag, packed into a u32 (one byte per character). @@ -67,7 +70,9 @@ pub struct VariationValue { /// A value both for font-variation-settings and font-feature-settings. #[css(comma)] -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct FontSettings(#[css(if_empty = "normal", iterable)] pub Box<[T]>); impl FontSettings { @@ -103,7 +108,9 @@ impl Parse for FontSettings { /// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def /// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-feature-settings /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct FontTag(pub u32); impl ToCss for FontTag { @@ -149,6 +156,7 @@ impl Parse for FontTag { ToAnimatedValue, ToAnimatedZero, ToCss, + ToShmem, )] /// Additional information for keyword-derived font sizes. pub struct KeywordInfo { @@ -205,6 +213,7 @@ impl SpecifiedValueInfo for KeywordInfo { ToAnimatedValue, ToAnimatedZero, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum KeywordSize { @@ -254,6 +263,7 @@ impl Default for KeywordSize { SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, + ToShmem, )] pub enum FontStyle { #[animation(error)] diff --git a/components/style/values/generics/gecko.rs b/components/style/values/generics/gecko.rs index fb84fdf4acc..5a91f2e14f4 100644 --- a/components/style/values/generics/gecko.rs +++ b/components/style/values/generics/gecko.rs @@ -7,7 +7,7 @@ /// A generic value for scroll snap points. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem)] pub enum ScrollSnapPoint { /// `none` None, diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 6650996c794..a3a94d3eaf5 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -18,7 +18,9 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// A `` type. /// /// -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct GridLine { /// Flag to check whether it's a `span` keyword. pub is_span: bool, @@ -162,6 +164,7 @@ impl Parse for GridLine { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] pub enum TrackKeyword { Auto, @@ -174,7 +177,15 @@ pub enum TrackKeyword { /// /// #[derive( - Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub enum TrackBreadth { /// The generic type is almost always a non-negative `` @@ -200,7 +211,7 @@ impl TrackBreadth { /// generic only to avoid code bloat. It only takes `` /// /// -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)] pub enum TrackSize { /// A flexible `` Breadth(TrackBreadth), @@ -358,7 +369,7 @@ where /// The initial argument of the `repeat` function. /// /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum RepeatCount { /// A positive integer. This is allowed only for `` and `` Number(Integer), @@ -393,7 +404,7 @@ impl Parse for RepeatCount { /// /// It can also hold `repeat()` function parameters, which expands into the respective /// values in its computed form. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)] #[css(function = "repeat")] pub struct TrackRepeat { /// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`) @@ -482,7 +493,15 @@ impl TrackRepeat { /// Track list values. Can be or #[derive( - Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub enum TrackListValue { /// A value. @@ -494,7 +513,7 @@ pub enum TrackListValue { /// The type of a `` as determined during parsing. /// /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)] pub enum TrackListType { /// [``](https://drafts.csswg.org/css-grid/#typedef-auto-track-list) /// @@ -516,7 +535,7 @@ pub enum TrackListType { /// A grid `` type. /// /// -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)] pub struct TrackList { /// The type of this `` (auto, explicit or general). /// @@ -589,7 +608,9 @@ impl ToCss for TrackList { /// /// `subgrid [ | repeat( | auto-fill, +) ]+` /// Old spec: https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-line-name-list -#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct LineNameList { /// The optional `` pub names: Box<[Box<[CustomIdent]>]>, @@ -695,7 +716,15 @@ impl ToCss for LineNameList { /// Subgrid deferred to Level 2 spec due to lack of implementation. /// But it's implemented in gecko, so we have to as well. #[derive( - Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub enum GridTemplateComponent { /// `none` value. @@ -704,6 +733,7 @@ pub enum GridTemplateComponent { TrackList( #[animation(field_bound)] #[compute(field_bound)] + #[shmem(field_bound)] TrackList, ), /// A `subgrid ?` diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index 44ff903b4f4..3f8b4f76f58 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -16,7 +16,7 @@ use style_traits::{CssWriter, ToCss}; /// An [image]. /// /// [image]: https://drafts.csswg.org/css-images/#image-values -#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)] pub enum Image { /// A `` image. Url(ImageUrl), @@ -36,7 +36,7 @@ pub enum Image { /// A CSS gradient. /// -#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)] pub struct Gradient { /// Gradients can be linear or radial. pub kind: GradientKind, @@ -48,7 +48,7 @@ pub struct Gradient { /// A linear gradient. Linear(LineDirection), @@ -73,7 +73,7 @@ pub enum GradientKind } /// A radial gradient's ending shape. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum EndingShape { /// A circular gradient. Circle(Circle), @@ -82,7 +82,7 @@ pub enum EndingShape { } /// A circle shape. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)] pub enum Circle { /// A circle radius. Radius(Length), @@ -91,7 +91,7 @@ pub enum Circle { } /// An ellipse shape. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum Ellipse { /// An ellipse pair of radii. Radii(LengthPercentage, LengthPercentage), @@ -102,7 +102,9 @@ pub enum Ellipse { /// #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem, +)] pub enum ShapeExtent { ClosestSide, FarthestSide, @@ -114,7 +116,7 @@ pub enum ShapeExtent { /// A gradient item. /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum GradientItem { /// A color stop. ColorStop(ColorStop), @@ -124,7 +126,7 @@ pub enum GradientItem { /// A color stop. /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct ColorStop { /// The color of this stop. pub color: Color, @@ -167,7 +169,9 @@ impl ToCss for PaintWorklet { /// `-moz-image-rect(, top, right, bottom, left);` #[allow(missing_docs)] #[css(comma, function)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct MozImageRect { pub url: MozImageRectUrl, pub top: NumberOrPercentage, diff --git a/components/style/values/generics/length.rs b/components/style/values/generics/length.rs index 076a02a4a0f..e805c1b0cd7 100644 --- a/components/style/values/generics/length.rs +++ b/components/style/values/generics/length.rs @@ -26,6 +26,7 @@ use style_traits::ParseError; ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericLengthPercentageOrAuto { @@ -109,6 +110,7 @@ impl Parse for LengthPercentageOrAuto ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericSize { @@ -150,6 +152,7 @@ impl Size { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericMaxSize { @@ -185,6 +188,7 @@ impl MaxSize { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericLengthOrNumber { diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index e054db7281f..44b85931661 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -43,7 +43,9 @@ pub mod url; // https://drafts.csswg.org/css-counter-styles/#typedef-symbols-type #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem, +)] pub enum SymbolsType { Cyclic, Numeric, @@ -85,7 +87,7 @@ impl SymbolsType { /// Since wherever is used, 'none' is a valid value as /// well, we combine them into one type to make code simpler. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss, ToShmem)] pub enum CounterStyleOrNone { /// `none` None, @@ -173,6 +175,7 @@ impl SpecifiedValueInfo for CounterStyleOrNone { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(transparent)] pub struct NonNegative(pub T); @@ -210,6 +213,7 @@ impl Zero for NonNegative { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub struct GreaterThanOrEqualToOne(pub T); @@ -227,6 +231,7 @@ pub struct GreaterThanOrEqualToOne(pub T); ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[css(function = "rect", comma)] pub struct ClipRect { diff --git a/components/style/values/generics/position.rs b/components/style/values/generics/position.rs index 34034b7d5b7..59a86c4b43f 100644 --- a/components/style/values/generics/position.rs +++ b/components/style/values/generics/position.rs @@ -18,6 +18,7 @@ ToAnimatedValue, ToAnimatedZero, ToComputedValue, + ToShmem, )] #[repr(C)] pub struct GenericPosition { @@ -53,6 +54,7 @@ impl Position { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] pub enum GenericZIndex { diff --git a/components/style/values/generics/rect.rs b/components/style/values/generics/rect.rs index de7237e694d..43f7b34bb06 100644 --- a/components/style/values/generics/rect.rs +++ b/components/style/values/generics/rect.rs @@ -22,6 +22,7 @@ use style_traits::{CssWriter, ParseError, ToCss}; SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, + ToShmem, )] #[repr(C)] pub struct Rect(pub T, pub T, pub T, pub T); diff --git a/components/style/values/generics/size.rs b/components/style/values/generics/size.rs index 96e0003128f..99cf966de73 100644 --- a/components/style/values/generics/size.rs +++ b/components/style/values/generics/size.rs @@ -24,6 +24,7 @@ use style_traits::{CssWriter, ParseError, ToCss}; ToAnimatedZero, ToAnimatedValue, ToComputedValue, + ToShmem, )] #[allow(missing_docs)] #[repr(C)] diff --git a/components/style/values/generics/svg.rs b/components/style/values/generics/svg.rs index 6a4d2411e76..d385b570291 100644 --- a/components/style/values/generics/svg.rs +++ b/components/style/values/generics/svg.rs @@ -24,6 +24,7 @@ use style_traits::{ParseError, StyleParseErrorKind}; ToAnimatedValue, ToComputedValue, ToCss, + ToShmem, )] pub struct SVGPaint { /// The paint source @@ -50,6 +51,7 @@ pub struct SVGPaint { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum SVGPaintKind { /// `none` @@ -142,6 +144,7 @@ impl Parse for SVGPaint { /// ` | | ` @@ -162,6 +165,7 @@ pub enum SVGLength { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum SVGStrokeDashArray { /// `[ | | ]#` @@ -186,6 +190,7 @@ pub enum SVGStrokeDashArray { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum SVGOpacity { /// `` diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs index 509491c8624..47abc958e65 100644 --- a/components/style/values/generics/text.rs +++ b/components/style/values/generics/text.rs @@ -11,7 +11,15 @@ use style_traits::ParseError; /// A generic value for the `initial-letter` property. #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub enum InitialLetter { /// `normal` @@ -29,7 +37,9 @@ impl InitialLetter { } /// A generic spacing value for the `letter-spacing` and `word-spacing` properties. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, +)] pub enum Spacing { /// `normal` Normal, @@ -81,6 +91,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool { SpecifiedValueInfo, ToAnimatedValue, ToCss, + ToShmem, Parse, )] #[repr(C, u8)] diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index 3e091162b2e..530f2b996ca 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -19,7 +19,15 @@ use style_traits::{CssWriter, ToCss}; /// A generic 2D transformation matrix. #[allow(missing_docs)] #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] #[css(comma, function)] pub struct Matrix { @@ -35,7 +43,7 @@ pub struct Matrix { #[cfg_attr(rustfmt, rustfmt_skip)] #[css(comma, function = "matrix3d")] #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, - ToComputedValue, ToCss)] + ToComputedValue, ToCss, ToShmem)] pub struct Matrix3D { pub m11: T, pub m12: T, pub m13: T, pub m14: T, pub m21: T, pub m22: T, pub m23: T, pub m24: T, @@ -82,6 +90,7 @@ impl> From> for Transform3D { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] #[repr(C)] pub struct GenericTransformOrigin { @@ -110,7 +119,9 @@ fn is_same(x: &N, y: &N) -> bool { x == y } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] /// A single operation in the list of a `transform` value pub enum TransformOperation where @@ -215,7 +226,9 @@ where }, } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] /// A value of the `transform` property pub struct Transform(#[css(if_empty = "none", iterable)] pub Vec); @@ -537,7 +550,15 @@ pub fn get_normalized_vector_and_angle( } #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToShmem, )] /// A value of the `Rotate` property /// @@ -599,7 +620,15 @@ where } #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToShmem, )] /// A value of the `Scale` property /// @@ -648,6 +677,7 @@ impl ToCss for Scale { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] /// A value of the `translate` property /// @@ -680,7 +710,16 @@ where #[allow(missing_docs)] #[derive( - Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub enum TransformStyle { #[cfg(feature = "servo")] diff --git a/components/style/values/generics/ui.rs b/components/style/values/generics/ui.rs index 2a984b915a0..e6eed9afaa5 100644 --- a/components/style/values/generics/ui.rs +++ b/components/style/values/generics/ui.rs @@ -11,7 +11,7 @@ use values::specified::ui::CursorKind; /// A generic value for the `cursor` property. /// /// https://drafts.csswg.org/css-ui/#cursor -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)] pub struct Cursor { /// The parsed images for the cursor. pub images: Box<[Image]>, @@ -44,7 +44,7 @@ impl ToCss for Cursor { } /// A generic value for item of `image cursors`. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)] pub struct CursorImage { /// The url to parse images from. pub url: ImageUrl, @@ -84,6 +84,7 @@ impl ToCss for CursorImage { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum ScrollbarColor { /// `auto` diff --git a/components/style/values/generics/url.rs b/components/style/values/generics/url.rs index 80fa48ba882..d86800dbcd4 100644 --- a/components/style/values/generics/url.rs +++ b/components/style/values/generics/url.rs @@ -18,6 +18,7 @@ ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum UrlOrNone { /// `none` diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index b555598317b..4665257a0c6 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -134,6 +134,7 @@ impl Parse for Impossible { ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum Either { /// The first value. @@ -152,7 +153,9 @@ impl Debug for Either { } /// -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct CustomIdent(pub Atom); impl CustomIdent { @@ -189,7 +192,7 @@ impl ToCss for CustomIdent { } /// -#[derive(Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToShmem)] pub enum KeyframesName { /// Ident(CustomIdent), diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index befeaa2ee6f..e6ba57b6322 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -16,7 +16,7 @@ bitflags! { /// Constants shared by multiple CSS Box Alignment properties /// /// These constants match Gecko's `NS_STYLE_ALIGN_*` constants. - #[derive(MallocSizeOf, ToComputedValue)] + #[derive(MallocSizeOf, ToComputedValue, ToShmem)] pub struct AlignFlags: u8 { // Enumeration stored in the lower 5 bits: /// 'auto' @@ -134,7 +134,7 @@ pub enum AxisDirection { /// Shared value for the `align-content` and `justify-content` properties. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] pub struct ContentDistribution { primary: AlignFlags, @@ -247,7 +247,7 @@ impl ContentDistribution { /// Value for the `align-content` property. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct AlignContent(pub ContentDistribution); impl Parse for AlignContent { @@ -287,7 +287,7 @@ impl From for u16 { /// Value for the `justify-content` property. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct JustifyContent(pub ContentDistribution); impl Parse for JustifyContent { @@ -325,7 +325,7 @@ impl From for u16 { } /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct SelfAlignment(pub AlignFlags); impl SelfAlignment { @@ -385,7 +385,7 @@ impl SelfAlignment { /// The specified value of the align-self property. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct AlignSelf(pub SelfAlignment); impl Parse for AlignSelf { @@ -423,7 +423,7 @@ impl From for u8 { /// The specified value of the justify-self property. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct JustifySelf(pub SelfAlignment); impl Parse for JustifySelf { @@ -461,7 +461,7 @@ impl From for u8 { /// Value of the `align-items` property /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)] pub struct AlignItems(pub AlignFlags); impl AlignItems { @@ -512,7 +512,7 @@ impl SpecifiedValueInfo for AlignItems { /// Value of the `justify-items` property /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub struct JustifyItems(pub AlignFlags); impl JustifyItems { diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs index 01eb58368b9..47c1a60772b 100644 --- a/components/style/values/specified/angle.rs +++ b/components/style/values/specified/angle.rs @@ -17,7 +17,7 @@ use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss}; /// A specified angle dimension. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToCss, ToShmem)] pub enum AngleDimension { /// An angle with degree unit. #[css(dimension)] @@ -68,7 +68,7 @@ impl AngleDimension { /// A specified Angle value, which is just the angle dimension, plus whether it /// was specified as `calc()` or not. #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToShmem)] pub struct Angle { value: AngleDimension, was_calc: bool, diff --git a/components/style/values/specified/background.rs b/components/style/values/specified/background.rs index a1605e977eb..6982326b945 100644 --- a/components/style/values/specified/background.rs +++ b/components/style/values/specified/background.rs @@ -47,6 +47,7 @@ impl Parse for BackgroundSize { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] #[value_info(other_values = "repeat-x,repeat-y")] @@ -62,7 +63,7 @@ pub enum BackgroundRepeatKeyword { /// axes. /// /// https://drafts.csswg.org/css-backgrounds/#the-background-repeat -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)] pub struct BackgroundRepeat(pub BackgroundRepeatKeyword, pub BackgroundRepeatKeyword); impl BackgroundRepeat { diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index d0ef8126482..415c104a12d 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -40,6 +40,7 @@ use style_traits::{CssWriter, ParseError, ToCss}; SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum BorderStyle { @@ -64,7 +65,7 @@ impl BorderStyle { } /// A specified value for a single side of the `border-width` property. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum BorderSideWidth { /// `thin` Thin, @@ -249,7 +250,9 @@ impl Parse for BorderSpacing { /// A single border-image-repeat keyword. #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, +)] pub enum BorderImageRepeatKeyword { Stretch, Repeat, @@ -260,7 +263,9 @@ pub enum BorderImageRepeatKeyword { /// The specified value for the `border-image-repeat` property. /// /// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub BorderImageRepeatKeyword); impl ToCss for BorderImageRepeat { diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 11ab02f045f..6d69c453845 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -61,6 +61,7 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[repr(u8)] @@ -324,7 +325,9 @@ impl AnimationIterationCount { } /// A value for the `animation-name` property. -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] #[value_info(other_values = "none")] pub struct AnimationName(pub Option); @@ -379,6 +382,7 @@ impl Parse for AnimationName { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum ScrollSnapType { @@ -402,6 +406,7 @@ pub enum ScrollSnapType { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum ScrollSnapAlignKeyword { @@ -413,7 +418,9 @@ pub enum ScrollSnapAlignKeyword { /// https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] #[repr(C)] pub struct ScrollSnapAlign { block: ScrollSnapAlignKeyword, @@ -470,6 +477,7 @@ impl ToCss for ScrollSnapAlign { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum OverscrollBehavior { @@ -491,6 +499,7 @@ pub enum OverscrollBehavior { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum OverflowAnchor { @@ -511,6 +520,7 @@ pub enum OverflowAnchor { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum OverflowClipBox { @@ -518,7 +528,9 @@ pub enum OverflowClipBox { ContentBox, } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] /// Provides a rendering hint to the user agent, /// stating what kinds of changes the author expects /// to perform on the element @@ -550,7 +562,7 @@ impl WillChange { bitflags! { /// The change bits that we care about. - #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue)] + #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToShmem)] #[repr(C)] pub struct WillChangeBits: u8 { /// Whether the stacking context will change. @@ -646,7 +658,8 @@ impl Parse for WillChange { bitflags! { /// Values for the `touch-action` property. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] - #[derive(SpecifiedValueInfo, ToComputedValue)] + #[derive(SpecifiedValueInfo, ToComputedValue, ToShmem)] + /// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants. #[value_info(other_values = "auto,none,manipulation,pan-x,pan-y")] #[repr(C)] pub struct TouchAction: u8 { @@ -718,7 +731,7 @@ impl Parse for TouchAction { } bitflags! { - #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue)] + #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToShmem)] #[value_info(other_values = "none,strict,content,size,layout,paint")] #[repr(C)] /// Constants for contain: https://drafts.csswg.org/css-contain/#contain-property @@ -820,7 +833,7 @@ pub type Perspective = GenericPerspective; /// A given transition property, that is either `All`, a longhand or shorthand /// property, or an unsupported or custom property. -#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)] pub enum TransitionProperty { /// A shorthand. Shorthand(ShorthandId), @@ -915,7 +928,17 @@ impl TransitionProperty { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, + ToShmem, )] /// https://drafts.csswg.org/css-box/#propdef-float pub enum Float { @@ -930,7 +953,17 @@ pub enum Float { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, + ToShmem, )] /// https://drafts.csswg.org/css-box/#propdef-clear pub enum Clear { @@ -947,7 +980,17 @@ pub enum Clear { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( - Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToCss, + ToShmem, )] pub enum Resize { None, @@ -975,6 +1018,7 @@ pub enum Resize { SpecifiedValueInfo, ToCss, ToComputedValue, + ToShmem, )] #[repr(u8)] pub enum Appearance { @@ -1326,6 +1370,7 @@ pub enum Appearance { SpecifiedValueInfo, ToCss, ToComputedValue, + ToShmem, )] #[repr(u8)] pub enum BreakBetween { @@ -1397,6 +1442,7 @@ impl BreakBetween { SpecifiedValueInfo, ToCss, ToComputedValue, + ToShmem, )] #[repr(u8)] pub enum BreakWithin { @@ -1418,6 +1464,7 @@ pub enum BreakWithin { SpecifiedValueInfo, ToCss, ToComputedValue, + ToShmem, )] #[repr(u8)] pub enum Overflow { diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index 48389ce5782..b101cd69de7 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -65,7 +65,7 @@ pub enum CalcUnit { /// relative lengths, and to_computed_pixel_length_without_context() handles /// this case. Therefore, if you want to add a new field, please make sure this /// function work properly. -#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq, ToShmem)] #[allow(missing_docs)] pub struct CalcLengthPercentage { pub clamping_mode: AllowedNumericType, diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 9ef9ab57f0a..526ed260dbd 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -22,7 +22,7 @@ use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError, StyleParse use style_traits::{SpecifiedValueInfo, ToCss, ValueParseErrorKind}; /// Specified color value -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub enum Color { /// The 'currentColor' keyword CurrentColor, @@ -49,7 +49,7 @@ pub enum Color { #[cfg(feature = "gecko")] mod gecko { - #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss)] + #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] pub enum SpecialColorKeyword { MozDefaultColor, MozDefaultBackgroundColor, @@ -395,7 +395,7 @@ impl ToComputedValue for Color { /// Specified color value, but resolved to just RGBA for computed value /// with value from color property at the same context. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct RGBAColor(pub Color); impl Parse for RGBAColor { @@ -443,7 +443,7 @@ impl SpecifiedValueInfo for Color { /// Specified value for the "color" property, which resolves the `currentcolor` /// keyword to the parent color instead of self's color. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct ColorPropertyValue(pub Color); impl ToComputedValue for ColorPropertyValue { diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index 38a53749605..d8c378a8a7b 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -37,7 +37,7 @@ pub type Filter = GenericFilter; /// A value for the `` parts in `Filter`. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub struct Factor(NumberOrPercentage); impl Factor { diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index baae46aed2f..fb4fa805212 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -81,7 +81,7 @@ pub const MAX_FONT_WEIGHT: f32 = 1000.; /// A specified font-weight value. /// /// https://drafts.csswg.org/css-fonts-4/#propdef-font-weight -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum FontWeight { /// `` Absolute(AbsoluteFontWeight), @@ -143,7 +143,7 @@ impl ToComputedValue for FontWeight { /// An absolute font-weight value for a @font-face rule. /// /// https://drafts.csswg.org/css-fonts-4/#font-weight-absolute-values -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum AbsoluteFontWeight { /// A ``, with the additional constraints specified in: /// @@ -319,7 +319,7 @@ impl SpecifiedFontStyle { } /// The specified value of the `font-style` property. -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] #[allow(missing_docs)] pub enum FontStyle { Specified(SpecifiedFontStyle), @@ -358,7 +358,7 @@ impl ToComputedValue for FontStyle { /// /// TODO(emilio): We could derive Parse if we had NonNegativePercentage. #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] #[repr(u8)] pub enum FontStretch { Stretch(Percentage), @@ -368,7 +368,9 @@ pub enum FontStretch { } /// A keyword value for `font-stretch`. -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, +)] #[allow(missing_docs)] pub enum FontStretchKeyword { Normal, @@ -481,7 +483,7 @@ impl ToComputedValue for FontStretch { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// A specified font-size value pub enum FontSize { /// A length; e.g. 10px. @@ -513,7 +515,7 @@ impl From for FontSize { } /// Specifies a prioritized list of font family names or generic family names. -#[derive(Clone, Debug, Eq, Hash, PartialEq, ToCss)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, ToCss, ToShmem)] pub enum FontFamily { /// List of `font-family` #[css(comma)] @@ -612,7 +614,7 @@ impl Parse for FamilyName { } } -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Preserve the readability of text when font fallback occurs pub enum FontSizeAdjust { /// None variant @@ -1002,7 +1004,7 @@ bitflags! { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Set of variant alternates pub enum VariantAlternates { /// Enables display of stylistic alternates @@ -1027,7 +1029,7 @@ pub enum VariantAlternates { HistoricalForms, } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// List of Variant Alternates pub struct VariantAlternatesList( #[css(if_empty = "normal", iterable)] pub Box<[VariantAlternates]>, @@ -1048,7 +1050,7 @@ impl VariantAlternatesList { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Control over the selection of these alternate glyphs pub enum FontVariantAlternates { /// Use alternative glyph from value @@ -1195,7 +1197,7 @@ macro_rules! impl_variant_east_asian { )+ } => { bitflags! { - #[derive(MallocSizeOf)] + #[derive(MallocSizeOf, ToShmem)] /// Vairants for east asian variant pub struct VariantEastAsian: u16 { /// None of the features @@ -1284,7 +1286,7 @@ impl VariantEastAsian { impl_gecko_keyword_conversions!(VariantEastAsian, u16); #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Allows control of glyph substitution and sizing in East Asian text. pub enum FontVariantEastAsian { /// Value variant with `variant-east-asian` @@ -1402,7 +1404,7 @@ macro_rules! impl_variant_ligatures { )+ } => { bitflags! { - #[derive(MallocSizeOf)] + #[derive(MallocSizeOf, ToShmem)] /// Variants of ligatures pub struct VariantLigatures: u16 { /// Specifies that common default features are enabled @@ -1495,7 +1497,7 @@ impl VariantLigatures { impl_gecko_keyword_conversions!(VariantLigatures, u16); #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Ligatures and contextual forms are ways of combining glyphs /// to produce more harmonized forms pub enum FontVariantLigatures { @@ -1624,7 +1626,7 @@ macro_rules! impl_variant_numeric { )+ } => { bitflags! { - #[derive(MallocSizeOf)] + #[derive(MallocSizeOf, ToShmem)] /// Vairants of numeric values pub struct VariantNumeric: u8 { /// None of other variants are enabled. @@ -1711,7 +1713,7 @@ impl VariantNumeric { impl_gecko_keyword_conversions!(VariantNumeric, u8); #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Specifies control over numerical forms. pub enum FontVariantNumeric { /// Value variant with `variant-numeric` @@ -1820,7 +1822,7 @@ pub type SpecifiedFontFeatureSettings = FontSettings>; /// Define initial settings that apply when the font defined by an @font-face /// rule is rendered. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum FontFeatureSettings { /// Value of `FontSettings` Value(SpecifiedFontFeatureSettings), @@ -1864,7 +1866,9 @@ impl Parse for FontFeatureSettings { } } -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] /// Whether user agents are allowed to synthesize bold or oblique font faces /// when a font family lacks bold or italic faces pub struct FontSynthesis { @@ -1964,7 +1968,7 @@ impl From for u8 { } } -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Allows authors to explicitly specify the language system of the font, /// overriding the language system implied by the content language pub enum FontLanguageOverride { @@ -2068,7 +2072,7 @@ pub type SpecifiedFontVariationSettings = FontSettings>; /// Define initial settings that apply when the font defined by an @font-face /// rule is rendered. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum FontVariationSettings { /// Value of `FontSettings` Value(SpecifiedFontVariationSettings), @@ -2155,7 +2159,15 @@ impl Parse for VariationValue { } #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] /// text-zoom. Enable if true, disable if false pub struct XTextZoom(#[css(skip)] pub bool); @@ -2173,7 +2185,9 @@ impl Parse for XTextZoom { } } -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] /// Internal property that reflects the lang attribute pub struct XLang(#[css(skip)] pub Atom); @@ -2199,7 +2213,7 @@ impl Parse for XLang { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Specifies the minimum font size allowed due to changes in scriptlevel. /// Ref: https://wiki.mozilla.org/MathML:mstyle pub struct MozScriptMinSize(pub NoCalcLength); @@ -2226,7 +2240,7 @@ impl Parse for MozScriptMinSize { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// Changes the scriptlevel in effect for the children. /// Ref: https://wiki.mozilla.org/MathML:mstyle /// @@ -2261,7 +2275,7 @@ impl Parse for MozScriptLevel { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem)] /// Specifies the multiplier to be used to adjust font size /// due to changes in scriptlevel. /// diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index c9d0f10215d..572db0ca1eb 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -96,7 +96,7 @@ pub type GradientKind = generic::GradientKind; /// A specified gradient line direction. -#[derive(Clone, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub enum LineDirection { /// An angular direction. Angle(Angle), @@ -115,7 +115,7 @@ pub enum LineDirection { } /// A binary enum to hold either Position or LegacyPosition. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] #[cfg(feature = "gecko")] pub enum GradientPosition { /// 1, 2, 3, 4-valued . diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 631de5c87ec..fcbae0aa2d6 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -56,7 +56,7 @@ pub fn au_to_int_px(au: f32) -> i32 { } /// A font relative length. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub enum FontRelativeLength { /// A "em" value: https://drafts.csswg.org/css-values/#em #[css(dimension)] @@ -236,7 +236,7 @@ impl FontRelativeLength { /// A viewport-relative length. /// /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub enum ViewportPercentageLength { /// A vw unit: https://drafts.csswg.org/css-values/#vw #[css(dimension)] @@ -285,7 +285,7 @@ impl ViewportPercentageLength { } /// HTML5 "character width", as defined in HTML5 § 14.5.4. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub struct CharacterWidth(pub i32); impl CharacterWidth { @@ -303,7 +303,7 @@ impl CharacterWidth { } /// Represents an absolute length with its unit -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub enum AbsoluteLength { /// An absolute length in pixels (px) #[css(dimension)] @@ -409,7 +409,7 @@ impl Add for AbsoluteLength { /// A `` without taking `calc` expressions into account /// /// -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub enum NoCalcLength { /// An absolute length /// @@ -522,7 +522,7 @@ impl Zero for NoCalcLength { /// This is commonly used for the `` values. /// /// -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum Length { /// The internal length type that cannot parse `calc` NoCalc(NoCalcLength), @@ -742,7 +742,7 @@ impl NonNegativeLength { /// /// https://drafts.csswg.org/css-values-4/#typedef-length-percentage #[allow(missing_docs)] -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum LengthPercentage { Length(NoCalcLength), Percentage(computed::Percentage), diff --git a/components/style/values/specified/list.rs b/components/style/values/specified/list.rs index dffce9a3001..bf1a17799b2 100644 --- a/components/style/values/specified/list.rs +++ b/components/style/values/specified/list.rs @@ -15,7 +15,9 @@ use style_traits::{ParseError, StyleParseErrorKind}; /// Specified and computed `list-style-type` property. #[cfg(feature = "gecko")] -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub enum ListStyleType { /// | none CounterStyle(CounterStyleOrNone), @@ -74,7 +76,9 @@ impl Parse for ListStyleType { } /// A quote pair. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct QuotePair { /// The opening quote. pub opening: Box, @@ -84,7 +88,9 @@ pub struct QuotePair { } /// Specified and computed `quotes` property. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct Quotes( #[css(iterable, if_empty = "none")] #[ignore_malloc_size_of = "Arc"] @@ -137,6 +143,7 @@ impl Parse for Quotes { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum MozListReversed { diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 919cb0cb341..30f80fd44c2 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -159,7 +159,7 @@ fn parse_number_with_clamping_mode<'i, 't>( /// A CSS `` specified value. /// /// https://drafts.csswg.org/css-values-3/#number-value -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToShmem)] pub struct Number { /// The numeric value itself. value: CSSFloat, @@ -346,7 +346,7 @@ impl Parse for GreaterThanOrEqualToOneNumber { /// /// FIXME(emilio): Should probably use Either. #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum NumberOrPercentage { Percentage(Percentage), Number(Number), @@ -406,7 +406,9 @@ impl Parse for NonNegativeNumberOrPercentage { } #[allow(missing_docs)] -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo, ToCss, ToShmem, +)] pub struct Opacity(Number); impl Parse for Opacity { @@ -442,7 +444,7 @@ impl ToComputedValue for Opacity { /// A specified ``, optionally coming from a `calc()` expression. /// /// -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, PartialOrd, ToShmem)] pub struct Integer { value: CSSInteger, was_calc: bool, @@ -706,7 +708,9 @@ impl AllowQuirks { /// An attr(...) rule /// /// `[namespace? `|`]? ident` -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] #[css(function)] pub struct Attr { /// Optional namespace prefix and URL. diff --git a/components/style/values/specified/motion.rs b/components/style/values/specified/motion.rs index aec168ac740..d9d104bf9c8 100644 --- a/components/style/values/specified/motion.rs +++ b/components/style/values/specified/motion.rs @@ -23,6 +23,7 @@ use style_traits::{ParseError, StyleParseErrorKind}; ToAnimatedZero, ToComputedValue, ToCss, + ToShmem, )] pub enum OffsetPath { // We could merge SVGPathData into ShapeSource, so we could reuse them. However, diff --git a/components/style/values/specified/outline.rs b/components/style/values/specified/outline.rs index 398315cbf93..709c3a94773 100644 --- a/components/style/values/specified/outline.rs +++ b/components/style/values/specified/outline.rs @@ -22,6 +22,7 @@ use style_traits::ParseError; SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(C, u8)] /// diff --git a/components/style/values/specified/percentage.rs b/components/style/values/specified/percentage.rs index 10fecc3a216..acfa6db64af 100644 --- a/components/style/values/specified/percentage.rs +++ b/components/style/values/specified/percentage.rs @@ -15,7 +15,7 @@ use style_traits::values::specified::AllowedNumericType; use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss}; /// A percentage value. -#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq, ToShmem)] pub struct Percentage { /// The percentage value as a float. /// diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index f60767f1656..43f5b2e4ae2 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -35,7 +35,7 @@ pub type HorizontalPosition = PositionComponent; pub type VerticalPosition = PositionComponent; /// The specified value of a component of a CSS ``. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum PositionComponent { /// `center` Center, @@ -58,6 +58,7 @@ pub enum PositionComponent { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum X { @@ -78,6 +79,7 @@ pub enum X { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum Y { @@ -434,7 +436,16 @@ impl ToCss for LegacyPosition { } #[derive( - Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] /// Auto-placement algorithm Option pub enum AutoFlow { @@ -447,7 +458,16 @@ pub enum AutoFlow { } #[derive( - Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] /// Controls how the auto-placement algorithm works /// specifying exactly how auto-placed items get flowed into the grid @@ -548,7 +568,7 @@ impl From for u8 { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem)] /// https://drafts.csswg.org/css-grid/#named-grid-area pub struct TemplateAreas { /// `named area` containing for each template area @@ -654,7 +674,9 @@ impl Parse for TemplateAreas { } /// Arc type for `Arc` -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct TemplateAreasArc(#[ignore_malloc_size_of = "Arc"] pub Arc); impl Parse for TemplateAreasArc { @@ -669,7 +691,7 @@ impl Parse for TemplateAreasArc { } #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo)] +#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToShmem)] /// Not associated with any particular grid item, but can /// be referenced from the grid-placement properties. pub struct NamedArea { diff --git a/components/style/values/specified/resolution.rs b/components/style/values/specified/resolution.rs index d0d12dd7bba..f8854226b53 100644 --- a/components/style/values/specified/resolution.rs +++ b/components/style/values/specified/resolution.rs @@ -12,7 +12,7 @@ use cssparser::{Parser, Token}; use style_traits::{ParseError, StyleParseErrorKind}; /// A specified resolution. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)] pub enum Resolution { /// Dots per inch. #[css(dimension)] diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index 556e995c02f..c5fe3fe2543 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -128,7 +128,9 @@ const PAINT_ORDER_MASK: u8 = 0b11; /// /// Higher priority values, i.e. the values specified first, /// will be painted first (and may be covered by paintings of lower priority) -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct SVGPaintOrder(pub u8); impl SVGPaintOrder { @@ -235,7 +237,9 @@ impl ToCss for SVGPaintOrder { /// Specified MozContextProperties value. /// Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties) -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem, +)] pub struct MozContextProperties(pub CustomIdent); impl Parse for MozContextProperties { diff --git a/components/style/values/specified/svg_path.rs b/components/style/values/specified/svg_path.rs index 86059c9ab2a..38c743ab756 100644 --- a/components/style/values/specified/svg_path.rs +++ b/components/style/values/specified/svg_path.rs @@ -19,7 +19,14 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// /// https://www.w3.org/TR/SVG11/paths.html#PathData #[derive( - Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedZero, + ToComputedValue, + ToShmem, )] pub struct SVGPathData(Box<[PathCommand]>); @@ -147,6 +154,7 @@ impl ComputeSquaredDistance for SVGPathData { PartialEq, SpecifiedValueInfo, ToAnimatedZero, + ToShmem, )] #[allow(missing_docs)] #[repr(C, u8)] @@ -473,6 +481,7 @@ impl ToCss for PathCommand { PartialEq, SpecifiedValueInfo, ToAnimatedZero, + ToShmem, )] #[repr(u8)] pub enum IsAbsolute { @@ -501,6 +510,7 @@ impl IsAbsolute { SpecifiedValueInfo, ToAnimatedZero, ToCss, + ToShmem, )] #[repr(C)] pub struct CoordPair(CSSFloat, CSSFloat); @@ -514,7 +524,7 @@ impl CoordPair { } /// The EllipticalArc flag type. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)] #[repr(C)] pub struct ArcFlag(bool); diff --git a/components/style/values/specified/table.rs b/components/style/values/specified/table.rs index b746f572740..54680c40d5e 100644 --- a/components/style/values/specified/table.rs +++ b/components/style/values/specified/table.rs @@ -9,7 +9,15 @@ use cssparser::Parser; use style_traits::{ParseError, StyleParseErrorKind}; #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] /// span. for `` pres attr pub struct XSpan(#[css(skip)] pub i32); diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 1c2f8499af5..75a731d449f 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -134,7 +134,7 @@ impl ToComputedValue for LineHeight { } /// A generic value for the `text-overflow` property. -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum TextOverflowSide { /// Clip inline content. Clip, @@ -168,7 +168,7 @@ impl Parse for TextOverflowSide { } } -#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// text-overflow. Specifies rendering when inline content overflows its line box edge. pub struct TextOverflow { /// First value. Applies to end line box edge if no second is supplied; line-left edge otherwise. @@ -228,7 +228,7 @@ impl ToComputedValue for TextOverflow { } bitflags! { - #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue)] + #[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToShmem)] #[value_info(other_values = "none,underline,overline,line-through,blink")] #[repr(C)] /// Specified keyword values for the text-decoration-line property. @@ -365,6 +365,7 @@ impl TextDecorationLine { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum TextAlignKeyword { @@ -393,7 +394,7 @@ pub enum TextAlignKeyword { /// Specified value of text-align property. #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Copy, Debug, Eq, Hash, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Copy, Debug, Eq, Hash, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum TextAlign { /// Keyword value of text-align property. Keyword(TextAlignKeyword), @@ -470,7 +471,7 @@ impl ToComputedValue for TextAlign { } /// Specified value of text-emphasis-style property. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum TextEmphasisStyle { /// Keyword(TextEmphasisKeywordValue), @@ -481,7 +482,7 @@ pub enum TextEmphasisStyle { } /// Keyword value for the text-emphasis-style property -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum TextEmphasisKeywordValue { /// Fill(TextEmphasisFillMode), @@ -510,7 +511,9 @@ impl TextEmphasisKeywordValue { } /// Fill mode for the text-emphasis-style property -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, +)] pub enum TextEmphasisFillMode { /// `filled` Filled, @@ -519,7 +522,9 @@ pub enum TextEmphasisFillMode { } /// Shape keyword for the text-emphasis-style property -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive( + Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem, +)] pub enum TextEmphasisShapeKeyword { /// `dot` Dot, @@ -669,6 +674,7 @@ impl Parse for TextEmphasisStyle { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] pub enum TextEmphasisHorizontalWritingModeValue { /// Draw marks over the text in horizontal writing mode. @@ -689,6 +695,7 @@ pub enum TextEmphasisHorizontalWritingModeValue { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] pub enum TextEmphasisVerticalWritingModeValue { /// Draws marks to the right of the text in vertical writing mode. @@ -699,7 +706,15 @@ pub enum TextEmphasisVerticalWritingModeValue { /// Specified value of `text-emphasis-position` property. #[derive( - Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, + Clone, + Copy, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, + ToShmem, )] pub struct TextEmphasisPosition( pub TextEmphasisHorizontalWritingModeValue, @@ -800,6 +815,7 @@ impl From for u8 { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum WordBreak { @@ -827,6 +843,7 @@ pub enum WordBreak { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[allow(missing_docs)] pub enum OverflowWrap { diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs index 9f2aa6f3580..f46925bc5c1 100644 --- a/components/style/values/specified/time.rs +++ b/components/style/values/specified/time.rs @@ -15,7 +15,7 @@ use style_traits::values::specified::AllowedNumericType; use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss}; /// A time value according to CSS-VALUES § 6.2. -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToShmem)] pub struct Time { seconds: CSSFloat, unit: TimeUnit, @@ -23,7 +23,7 @@ pub struct Time { } /// A time unit. -#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)] pub enum TimeUnit { /// `s` Second, diff --git a/components/style/values/specified/transform.rs b/components/style/values/specified/transform.rs index 92ca953159f..a4dc87d3217 100644 --- a/components/style/values/specified/transform.rs +++ b/components/style/values/specified/transform.rs @@ -232,7 +232,7 @@ impl Parse for Transform { } /// The specified value of a component of a CSS ``. -#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] pub enum OriginComponent { /// `center` Center, diff --git a/components/style/values/specified/ui.rs b/components/style/values/specified/ui.rs index 0ccca5d359e..cac8e49309a 100644 --- a/components/style/values/specified/ui.rs +++ b/components/style/values/specified/ui.rs @@ -56,7 +56,9 @@ impl Parse for CursorImage { } /// Specified value of `-moz-force-broken-image-icon` -#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] +#[derive( + Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem, +)] pub struct MozForceBrokenImageIcon(pub bool); impl MozForceBrokenImageIcon { @@ -139,6 +141,7 @@ impl Parse for ScrollbarColor { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum UserSelect { @@ -166,6 +169,7 @@ pub enum UserSelect { SpecifiedValueInfo, ToComputedValue, ToCss, + ToShmem, )] #[repr(u8)] pub enum CursorKind { diff --git a/components/style_traits/Cargo.toml b/components/style_traits/Cargo.toml index 53d3baf8845..846579d462c 100644 --- a/components/style_traits/Cargo.toml +++ b/components/style_traits/Cargo.toml @@ -26,3 +26,5 @@ webrender_api = {git = "https://github.com/servo/webrender", optional = true} servo_atoms = {path = "../atoms", optional = true} servo_arc = { path = "../servo_arc" } servo_url = { path = "../url", optional = true } +to_shmem = { path = "../to_shmem" } +to_shmem_derive = { path = "../to_shmem_derive" } diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs index 3df0f6a24e5..bce0a507f75 100644 --- a/components/style_traits/lib.rs +++ b/components/style_traits/lib.rs @@ -28,6 +28,9 @@ extern crate servo_arc; extern crate servo_atoms; #[cfg(feature = "servo")] extern crate servo_url; +extern crate to_shmem; +#[macro_use] +extern crate to_shmem_derive; #[cfg(feature = "servo")] extern crate webrender_api; #[cfg(feature = "servo")] diff --git a/components/style_traits/values.rs b/components/style_traits/values.rs index 46751541319..5c3f3ab255d 100644 --- a/components/style_traits/values.rs +++ b/components/style_traits/values.rs @@ -441,7 +441,7 @@ macro_rules! define_css_keyword_enum { (pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] - #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)] + #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)] pub enum $name { $($variant),+ } @@ -497,7 +497,7 @@ pub mod specified { /// Whether to allow negative lengths or not. #[repr(u8)] - #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, PartialOrd)] + #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, PartialOrd, ToShmem)] pub enum AllowedNumericType { /// Allow all kind of numeric values. All, diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs index f1aa18412e3..fb10345c1b2 100644 --- a/components/style_traits/viewport.rs +++ b/components/style_traits/viewport.rs @@ -80,7 +80,7 @@ impl ToCss for ViewportConstraints { } /// -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, ToShmem)] #[cfg_attr(feature = "servo", derive(MallocSizeOf))] pub enum Zoom { /// A number value.