style: Add derived ToShmem implementations.

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

View file

@ -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"

View file

@ -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<Impl: SelectorImpl> {
#[shmem(field_bound)]
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
#[shmem(field_bound)]
pub local_name: Impl::LocalName,
pub local_name_lower: Impl::LocalName,
#[shmem(field_bound)]
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
pub never_matches: bool,
}
@ -24,7 +28,7 @@ impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
}
}
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, ToShmem)]
pub enum NamespaceConstraint<NamespaceUrl> {
Any,
@ -32,7 +36,7 @@ pub enum NamespaceConstraint<NamespaceUrl> {
Specific(NamespaceUrl),
}
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, ToShmem)]
pub enum ParsedAttrSelectorOperation<AttrValue> {
Exists,
WithValue {
@ -72,7 +76,7 @@ impl<AttrValue> AttrSelectorOperation<AttrValue> {
}
}
#[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,

View file

@ -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 {

View file

@ -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;

View file

@ -221,8 +221,9 @@ pub trait Parser<'i> {
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SelectorList<Impl: SelectorImpl>(pub SmallVec<[Selector<Impl>; 1]>);
#[derive(Clone, Debug, Eq, PartialEq, ToShmem)]
#[shmem(no_bounds)]
pub struct SelectorList<Impl: SelectorImpl>(#[shmem(field_bound)] pub SmallVec<[Selector<Impl>; 1]>);
impl<Impl: SelectorImpl> SelectorList<Impl> {
/// Parse a comma-separated list of Selectors.
@ -507,8 +508,9 @@ pub fn namespace_empty_string<Impl: SelectorImpl>() -> 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<Impl: SelectorImpl>(ThinArc<SpecificityAndFlags, Component<Impl>>);
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[shmem(no_bounds)]
pub struct Selector<Impl: SelectorImpl>(#[shmem(field_bound)] ThinArc<SpecificityAndFlags, Component<Impl>>);
impl<Impl: SelectorImpl> Selector<Impl> {
#[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<Impl: SelectorImpl> {
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<Impl>),
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<Impl: SelectorImpl> {
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<Impl: SelectorImpl> {
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<Impl: SelectorImpl> {
///
/// See https://github.com/w3c/csswg-drafts/issues/2158
Host(Option<Selector<Impl>>),
PseudoElement(Impl::PseudoElement),
PseudoElement(#[shmem(field_bound)] Impl::PseudoElement),
}
impl<Impl: SelectorImpl> Component<Impl> {
@ -957,8 +962,10 @@ impl<Impl: SelectorImpl> Component<Impl> {
}
}
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[shmem(no_bounds)]
pub struct LocalName<Impl: SelectorImpl> {
#[shmem(field_bound)]
pub name: Impl::LocalName,
pub lower_name: Impl::LocalName,
}

View file

@ -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<u32>,
@ -337,7 +337,7 @@ impl CounterStyleRuleData {
}
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-system>
#[derive(Clone, Debug)]
#[derive(Clone, Debug, ToShmem)]
pub enum System {
/// 'cyclic'
Cyclic,
@ -410,7 +410,7 @@ impl ToCss for System {
/// <https://drafts.csswg.org/css-counter-styles/#typedef-symbol>
#[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(String),
@ -447,7 +447,7 @@ impl Symbol {
}
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-negative>
#[derive(Clone, Debug, ToCss)]
#[derive(Clone, Debug, ToCss, ToShmem)]
pub struct Negative(pub Symbol, pub Option<Symbol>);
impl Parse for Negative {
@ -465,11 +465,11 @@ impl Parse for Negative {
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-range>
///
/// Empty Vec represents 'auto'
#[derive(Clone, Debug)]
#[derive(Clone, Debug, ToShmem)]
pub struct Ranges(pub Vec<Range<CounterBound>>);
/// 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
}
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
#[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 {
}
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-fallback>
#[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 {
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
#[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<Symbol>);
impl Parse for Symbols {
@ -602,7 +602,7 @@ impl Parse for Symbols {
}
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
#[derive(Clone, Debug, ToCss)]
#[derive(Clone, Debug, ToCss, ToShmem)]
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
impl Parse for AdditiveSymbols {
@ -623,7 +623,7 @@ impl Parse for AdditiveSymbols {
}
/// <integer> && <symbol>
#[derive(Clone, Debug, ToCss)]
#[derive(Clone, Debug, ToCss, ToShmem)]
pub struct AdditiveTuple {
/// <integer>
pub weight: Integer,
@ -651,7 +651,7 @@ impl Parse for AdditiveTuple {
}
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as>
#[derive(Clone, Debug, ToCss)]
#[derive(Clone, Debug, ToCss, ToShmem)]
pub enum SpeakAs {
/// auto
Auto,

View file

@ -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,

View file

@ -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 {
///
/// <https://drafts.csswg.org/css-fonts/#src-desc>
#[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.
///
/// <https://drafts.csswg.org/css-fonts/#font-face-rule>
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, ToShmem)]
pub struct FontFaceRuleData {
$(
#[$doc]

View file

@ -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}

View file

@ -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]

View file

@ -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<CssUrlData>);
/// 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 {

View file

@ -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 {

View file

@ -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;

View file

@ -80,6 +80,7 @@ macro_rules! define_keyword_type {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct $name;

View file

@ -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),

View file

@ -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<MediaExpressionValue>,
@ -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),

View file

@ -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)]

View file

@ -16,7 +16,7 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, ToCss};
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
#[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:
/// <https://drafts.csswg.org/mediaqueries/#mq-only>
@ -27,7 +27,7 @@ pub enum Qualifier {
}
/// <https://drafts.csswg.org/mediaqueries/#media-types>
#[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<Qualifier>,
@ -151,7 +151,7 @@ impl MediaQuery {
}
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
pub enum MediaQueryType {
/// A media type that matches every device.
All,

View file

@ -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.
///

View file

@ -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)}

View file

@ -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)},

View file

@ -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<crate::custom_properties::SpecifiedValue>),
@ -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)]

View file

@ -177,7 +177,7 @@ impl<T> PerPseudoElementMap<T> {
/// 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

View file

@ -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<DocumentMatchingFunction>);
impl DocumentCondition {

View file

@ -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<T> {
/// An `<ident>` 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<u32>);
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<u32>);
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

View file

@ -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<KeyframePercentage>);
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,

View file

@ -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<Locked<MediaList>>,

View file

@ -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

View file

@ -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

View file

@ -10,7 +10,7 @@ use std::ops::BitOrAssign;
/// Each style rule has an origin, which determines where it enters the cascade.
///
/// <https://drafts.csswg.org/css-cascade/#cascading-origins>
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
#[repr(u8)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum Origin {

View file

@ -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<Locked<PropertyDeclarationBlock>>,

View file

@ -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<CssRule>);
impl CssRules {

View file

@ -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.

View file

@ -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<SelectorImpl>,

View file

@ -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
///
/// <https://drafts.csswg.org/css-conditional-3/#at-supports>
#[derive(Clone, Debug)]
#[derive(Clone, Debug, ToShmem)]
pub enum SupportsCondition {
/// `not (condition)`
Not(Box<SupportsCondition>),
@ -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);

View file

@ -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.

View file

@ -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.

View file

@ -608,6 +608,7 @@ impl Size {
PartialOrd,
ToAnimatedValue,
ToAnimatedZero,
ToShmem,
)]
#[repr(C)]
pub struct CSSPixelLength(CSSFloat);
@ -809,6 +810,7 @@ pub type NonNegativeLengthOrNumber = GenericLengthOrNumber<NonNegativeLength, No
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(u8)]
pub enum ExtremumLength {

View file

@ -27,6 +27,7 @@ use style_traits::{CssWriter, ToCss};
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct Percentage(pub CSSFloat);

View file

@ -27,6 +27,7 @@ fn width_and_height_are_auto<L>(
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericBackgroundSize<LengthPercent> {

View file

@ -31,6 +31,7 @@ pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, U
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum GeometryBox {
FillBox,
@ -58,6 +59,7 @@ pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, I
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeBox {
MarginBox,
@ -79,6 +81,7 @@ pub enum ShapeBox {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
#[animation(error)]
@ -104,11 +107,24 @@ pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum BasicShape<H, V, LengthPercentage, NonNegativeLengthPercentage> {
Inset(#[css(field_bound)] InsetRect<LengthPercentage, NonNegativeLengthPercentage>),
Circle(#[css(field_bound)] Circle<H, V, NonNegativeLengthPercentage>),
Ellipse(#[css(field_bound)] Ellipse<H, V, NonNegativeLengthPercentage>),
Inset(
#[css(field_bound)]
#[shmem(field_bound)]
InsetRect<LengthPercentage, NonNegativeLengthPercentage>,
),
Circle(
#[css(field_bound)]
#[shmem(field_bound)]
Circle<H, V, NonNegativeLengthPercentage>,
),
Ellipse(
#[css(field_bound)]
#[shmem(field_bound)]
Ellipse<H, V, NonNegativeLengthPercentage>,
),
Polygon(Polygon<LengthPercentage>),
}
@ -125,9 +141,11 @@ pub enum BasicShape<H, V, LengthPercentage, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
pub rect: Rect<LengthPercentage>,
#[shmem(field_bound)]
pub round: BorderRadius<NonNegativeLengthPercentage>,
}
@ -145,6 +163,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct Circle<H, V, NonNegativeLengthPercentage> {
pub position: Position<H, V>,
@ -165,6 +184,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
pub position: Position<H, V>,
@ -186,6 +206,7 @@ pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeRadius<NonNegativeLengthPercentage> {
Length(NonNegativeLengthPercentage),
@ -208,6 +229,7 @@ pub enum ShapeRadius<NonNegativeLengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct Polygon<LengthPercentage> {
/// The filling rule for a polygon.
@ -228,6 +250,7 @@ pub struct Polygon<LengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct PolygonCoord<LengthPercentage>(pub LengthPercentage, pub LengthPercentage);
@ -249,6 +272,7 @@ pub struct PolygonCoord<LengthPercentage>(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.

View file

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

View file

@ -18,6 +18,7 @@ use crate::values::animated::ToAnimatedZero;
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum VerticalAlign<LengthPercentage> {
/// `baseline`
@ -58,7 +59,9 @@ impl<L> ToAnimatedZero for VerticalAlign<L> {
}
/// 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<Number> {
/// A `<number>` value.
Number(Number),
@ -81,6 +84,7 @@ pub enum AnimationIterationCount<Number> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericPerspective<NonNegativeLength> {

View file

@ -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<RGBA> {
/// Numeric RGBA color.
Numeric(RGBA),
@ -90,6 +90,7 @@ impl<RGBA> From<RGBA> for Color<RGBA> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ColorOrAuto<C> {
/// A `<color>

View file

@ -19,6 +19,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ColumnCount<PositiveInteger> {
/// A positive integer.

View file

@ -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<Integer> {
/// The name of the counter.
pub name: CustomIdent,
@ -24,7 +26,15 @@ pub struct CounterPair<Integer> {
/// 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<I>(Counters<I>);
@ -47,7 +57,15 @@ impl<I> Deref for CounterIncrement<I> {
/// 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<I>(Counters<I>);
@ -71,7 +89,9 @@ impl<I> Deref for CounterSetOrReset<I> {
/// 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<I>(#[css(iterable, if_empty = "none")] Box<[CounterPair<I>]>);
impl<I> Default for Counters<I> {
@ -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<ImageUrl> {
/// `normal` reserved keyword.
Normal,
@ -124,7 +146,9 @@ impl<ImageUrl> Content<ImageUrl> {
}
/// 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<ImageUrl> {
/// Literal string content.
String(Box<str>),

View file

@ -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<Integer, Number> {
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")]

View file

@ -16,6 +16,7 @@
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
/// The base shadow.
@ -41,6 +42,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum Filter<Angle, Factor, Length, DropShadow, Url> {
/// `blur(<length>)`
@ -93,6 +95,7 @@ pub enum Filter<Angle, Factor, Length, DropShadow, Url> {
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
/// Color.

View file

@ -19,6 +19,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub enum GenericFlexBasis<S> {

View file

@ -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<Integer> {
/// 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<Number> {
/// A four-character tag, packed into a u32 (one byte per character).
@ -67,7 +70,9 @@ pub struct VariationValue<Number> {
/// 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<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>);
impl<T> FontSettings<T> {
@ -103,7 +108,9 @@ impl<T: Parse> Parse for FontSettings<T> {
/// 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<Length> {
@ -205,6 +213,7 @@ impl<L> SpecifiedValueInfo for KeywordInfo<L> {
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<Angle> {
#[animation(error)]

View file

@ -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<LengthPercentage> {
/// `none`
None,

View file

@ -18,7 +18,9 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
/// A `<grid-line>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)]
pub struct GridLine<Integer> {
/// Flag to check whether it's a `span` keyword.
pub is_span: bool,
@ -162,6 +164,7 @@ impl Parse for GridLine<specified::Integer> {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackKeyword {
Auto,
@ -174,7 +177,15 @@ pub enum TrackKeyword {
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-breadth>
#[derive(
Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Animate,
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackBreadth<L> {
/// The generic type is almost always a non-negative `<length-percentage>`
@ -200,7 +211,7 @@ impl<L> TrackBreadth<L> {
/// generic only to avoid code bloat. It only takes `<length-percentage>`
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
pub enum TrackSize<L> {
/// A flexible `<track-breadth>`
Breadth(TrackBreadth<L>),
@ -358,7 +369,7 @@ where
/// The initial argument of the `repeat` function.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum RepeatCount<Integer> {
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
Number(Integer),
@ -393,7 +404,7 @@ impl Parse for RepeatCount<specified::Integer> {
///
/// 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<L, I> {
/// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`)
@ -482,7 +493,15 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> {
/// Track list values. Can be <track-size> or <track-repeat>
#[derive(
Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Animate,
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackListValue<LengthPercentage, Integer> {
/// A <track-size> value.
@ -494,7 +513,7 @@ pub enum TrackListValue<LengthPercentage, Integer> {
/// The type of a `<track-list>` as determined during parsing.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum TrackListType {
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
///
@ -516,7 +535,7 @@ pub enum TrackListType {
/// A grid `<track-list>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
pub struct TrackList<LengthPercentage, Integer> {
/// The type of this `<track-list>` (auto, explicit or general).
///
@ -589,7 +608,9 @@ impl<L: ToCss, I: ToCss> ToCss for TrackList<L, I> {
///
/// `subgrid [ <line-names> | repeat(<positive-integer> | auto-fill, <line-names>+) ]+`
/// 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 `<line-name-list>`
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<L, I> {
/// `none` value.
@ -704,6 +733,7 @@ pub enum GridTemplateComponent<L, I> {
TrackList(
#[animation(field_bound)]
#[compute(field_bound)]
#[shmem(field_bound)]
TrackList<L, I>,
),
/// A `subgrid <line-name-list>?`

View file

@ -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<Gradient, MozImageRect, ImageUrl> {
/// A `<url()>` image.
Url(ImageUrl),
@ -36,7 +36,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
/// A CSS gradient.
/// <https://drafts.csswg.org/css-images/#gradients>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, Angle> {
/// Gradients can be linear or radial.
pub kind: GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>,
@ -48,7 +48,7 @@ pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, An
pub compat_mode: CompatMode,
}
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
pub enum CompatMode {
/// Modern syntax.
@ -60,7 +60,7 @@ pub enum CompatMode {
}
/// A gradient kind.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle> {
/// A linear gradient.
Linear(LineDirection),
@ -73,7 +73,7 @@ pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>
}
/// 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<Length, LengthPercentage> {
/// A circular gradient.
Circle(Circle<Length>),
@ -82,7 +82,7 @@ pub enum EndingShape<Length, LengthPercentage> {
}
/// A circle shape.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum Circle<Length> {
/// A circle radius.
Radius(Length),
@ -91,7 +91,7 @@ pub enum Circle<Length> {
}
/// An ellipse shape.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum Ellipse<LengthPercentage> {
/// An ellipse pair of radii.
Radii(LengthPercentage, LengthPercentage),
@ -102,7 +102,9 @@ pub enum Ellipse<LengthPercentage> {
/// <https://drafts.csswg.org/css-images/#typedef-extent-keyword>
#[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.
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum GradientItem<Color, LengthPercentage> {
/// A color stop.
ColorStop(ColorStop<Color, LengthPercentage>),
@ -124,7 +126,7 @@ pub enum GradientItem<Color, LengthPercentage> {
/// A color stop.
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub struct ColorStop<Color, LengthPercentage> {
/// The color of this stop.
pub color: Color,
@ -167,7 +169,9 @@ impl ToCss for PaintWorklet {
/// `-moz-image-rect(<uri>, 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<NumberOrPercentage, MozImageRectUrl> {
pub url: MozImageRectUrl,
pub top: NumberOrPercentage,

View file

@ -26,6 +26,7 @@ use style_traits::ParseError;
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericLengthPercentageOrAuto<LengthPercent> {
@ -109,6 +110,7 @@ impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericSize<LengthPercent> {
@ -150,6 +152,7 @@ impl<LengthPercentage> Size<LengthPercentage> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericMaxSize<LengthPercent> {
@ -185,6 +188,7 @@ impl<LengthPercentage> MaxSize<LengthPercentage> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericLengthOrNumber<L, N> {

View file

@ -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 <counter-style> 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<T>(pub T);
@ -210,6 +213,7 @@ impl<T: Zero> Zero for NonNegative<T> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct GreaterThanOrEqualToOne<T>(pub T);
@ -227,6 +231,7 @@ pub struct GreaterThanOrEqualToOne<T>(pub T);
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[css(function = "rect", comma)]
pub struct ClipRect<LengthOrAuto> {

View file

@ -18,6 +18,7 @@
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct GenericPosition<H, V> {
@ -53,6 +54,7 @@ impl<H, V> Position<H, V> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericZIndex<I> {

View file

@ -22,6 +22,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct Rect<T>(pub T, pub T, pub T, pub T);

View file

@ -24,6 +24,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
ToAnimatedZero,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[allow(missing_docs)]
#[repr(C)]

View file

@ -24,6 +24,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct SVGPaint<ColorType, UrlPaintServer> {
/// The paint source
@ -50,6 +51,7 @@ pub struct SVGPaint<ColorType, UrlPaintServer> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGPaintKind<ColorType, UrlPaintServer> {
/// `none`
@ -142,6 +144,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGLength<L> {
/// `<length> | <percentage> | <number>`
@ -162,6 +165,7 @@ pub enum SVGLength<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGStrokeDashArray<L> {
/// `[ <length> | <percentage> | <number> ]#`
@ -186,6 +190,7 @@ pub enum SVGStrokeDashArray<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGOpacity<OpacityType> {
/// `<opacity-value>`

View file

@ -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<Number, Integer> {
/// `normal`
@ -29,7 +37,9 @@ impl<N, I> InitialLetter<N, I> {
}
/// 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<Value> {
/// `normal`
Normal,
@ -81,6 +91,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
SpecifiedValueInfo,
ToAnimatedValue,
ToCss,
ToShmem,
Parse,
)]
#[repr(C, u8)]

View file

@ -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<T> {
@ -35,7 +43,7 @@ pub struct Matrix<T> {
#[cfg_attr(rustfmt, rustfmt_skip)]
#[css(comma, function = "matrix3d")]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToComputedValue, ToCss)]
ToComputedValue, ToCss, ToShmem)]
pub struct Matrix3D<T> {
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<T: Into<f64>> From<Matrix3D<T>> for Transform3D<f64> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericTransformOrigin<H, V, Depth> {
@ -110,7 +119,9 @@ fn is_same<N: PartialEq>(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<Angle, Number, Length, Integer, LengthPercentage>
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<T>(#[css(if_empty = "none", iterable)] pub Vec<T>);
@ -537,7 +550,15 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
}
#[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<Number: ToCss + PartialEq> ToCss for Scale<Number> {
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")]

View file

@ -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<Image> {
/// The parsed images for the cursor.
pub images: Box<[Image]>,
@ -44,7 +44,7 @@ impl<Image: ToCss> ToCss for Cursor<Image> {
}
/// 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<ImageUrl, Number> {
/// The url to parse images from.
pub url: ImageUrl,
@ -84,6 +84,7 @@ impl<ImageUrl: ToCss, Number: ToCss> ToCss for CursorImage<ImageUrl, Number> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ScrollbarColor<Color> {
/// `auto`

View file

@ -18,6 +18,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum UrlOrNone<Url> {
/// `none`

View file

@ -134,6 +134,7 @@ impl Parse for Impossible {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum Either<A, B> {
/// The first value.
@ -152,7 +153,9 @@ impl<A: Debug, B: Debug> Debug for Either<A, B> {
}
/// <https://drafts.csswg.org/css-values-4/#custom-idents>
#[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 {
}
/// <https://drafts.csswg.org/css-animations/#typedef-keyframes-name>
#[derive(Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToShmem)]
pub enum KeyframesName {
/// <custom-ident>
Ident(CustomIdent),

View file

@ -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.
///
/// <https://drafts.csswg.org/css-align/#content-distribution>
#[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.
///
/// <https://drafts.csswg.org/css-align/#propdef-align-content>
#[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<AlignContent> for u16 {
/// Value for the `justify-content` property.
///
/// <https://drafts.csswg.org/css-align/#propdef-justify-content>
#[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<JustifyContent> for u16 {
}
/// <https://drafts.csswg.org/css-align/#self-alignment>
#[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.
///
/// <https://drafts.csswg.org/css-align/#propdef-align-self>
#[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<AlignSelf> for u8 {
/// The specified value of the justify-self property.
///
/// <https://drafts.csswg.org/css-align/#propdef-justify-self>
#[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<JustifySelf> for u8 {
/// Value of the `align-items` property
///
/// <https://drafts.csswg.org/css-align/#propdef-align-items>
#[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
///
/// <https://drafts.csswg.org/css-align/#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 {

View file

@ -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,

View file

@ -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 {

View file

@ -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 {

View file

@ -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<KeyframesName>);
@ -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<NonNegativeLength>;
/// 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 {

View file

@ -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,

View file

@ -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 {

View file

@ -37,7 +37,7 @@ pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow,
pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible, Impossible>;
/// A value for the `<factor>` parts in `Filter`.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub struct Factor(NumberOrPercentage);
impl Factor {

View file

@ -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 {
/// `<font-weight-absolute>`
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 `<number>`, 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<LengthPercentage> 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<FeatureTagValue<Integer>>;
/// 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<FontSynthesis> 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<VariationValue<Number>>;
/// 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<Number> {
}
#[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.
///

View file

@ -96,7 +96,7 @@ pub type GradientKind =
generic::GradientKind<LineDirection, Length, LengthPercentage, GradientPosition, Angle>;
/// 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 <position>.

View file

@ -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.
///
/// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
#[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<AbsoluteLength> for AbsoluteLength {
/// A `<length>` without taking `calc` expressions into account
///
/// <https://drafts.csswg.org/css-values/#lengths>
#[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 `<length>` values.
///
/// <https://drafts.csswg.org/css-values/#lengths>
#[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),

View file

@ -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 {
/// <counter-style> | 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<str>,
@ -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 {

View file

@ -159,7 +159,7 @@ fn parse_number_with_clamping_mode<'i, 't>(
/// A CSS `<number>` 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 `<integer>`, optionally coming from a `calc()` expression.
///
/// <https://drafts.csswg.org/css-values/#integers>
#[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.

View file

@ -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,

View file

@ -22,6 +22,7 @@ use style_traits::ParseError;
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
/// <https://drafts.csswg.org/css-ui/#propdef-outline-style>

View file

@ -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.
///

View file

@ -35,7 +35,7 @@ pub type HorizontalPosition = PositionComponent<X>;
pub type VerticalPosition = PositionComponent<Y>;
/// The specified value of a component of a CSS `<position>`.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub enum PositionComponent<S> {
/// `center`
Center,
@ -58,6 +58,7 @@ pub enum PositionComponent<S> {
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<GridAutoFlow> 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<TemplateAreas>`
#[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<TemplateAreas>);
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 {

View file

@ -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)]

View file

@ -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 {

View file

@ -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);

View file

@ -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 `<col span>` pres attr
pub struct XSpan(#[css(skip)] pub i32);

View file

@ -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 {
/// <fill> <shape>
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>
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<TextEmphasisPosition> 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 {

View file

@ -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,

View file

@ -232,7 +232,7 @@ impl Parse for Transform {
}
/// The specified value of a component of a CSS `<transform-origin>`.
#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub enum OriginComponent<S> {
/// `center`
Center,

View file

@ -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 {

View file

@ -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" }

View file

@ -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")]

View file

@ -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,

View file

@ -80,7 +80,7 @@ impl ToCss for ViewportConstraints {
}
/// <https://drafts.csswg.org/css-device-adapt/#descdef-viewport-zoom>
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, ToShmem)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum Zoom {
/// A number value.