mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Add a ValueInfo trait for exposing types needed by devtools.
Most of types just derive it using proc_macro directly. Some of value types need manual impl. In my current plan, this new trait will be used in bug 1434130 to expose values as well. Bug: 1455576 Reviewed-by: emilio MozReview-Commit-ID: LI7fy45VkRw
This commit is contained in:
parent
276fb7e04b
commit
7fe7b2ffb1
66 changed files with 615 additions and 249 deletions
|
@ -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, SpecifiedValueInfo, ToComputedValue)]
|
||||
pub struct AlignFlags: u8 {
|
||||
// Enumeration stored in the lower 5 bits:
|
||||
/// 'auto'
|
||||
|
@ -135,7 +135,8 @@ 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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct ContentDistribution {
|
||||
primary: AlignFlags,
|
||||
|
@ -232,7 +233,8 @@ 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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for AlignContent {
|
||||
|
@ -264,7 +266,8 @@ impl From<AlignContent> for u16 {
|
|||
/// Value for the `justify-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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct JustifyContent(pub ContentDistribution);
|
||||
|
||||
impl Parse for JustifyContent {
|
||||
|
@ -294,7 +297,8 @@ 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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct SelfAlignment(pub AlignFlags);
|
||||
|
||||
impl SelfAlignment {
|
||||
|
@ -344,7 +348,8 @@ 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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignSelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for AlignSelf {
|
||||
|
@ -374,7 +379,8 @@ 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, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct JustifySelf(pub SelfAlignment);
|
||||
|
||||
impl Parse for JustifySelf {
|
||||
|
@ -404,7 +410,8 @@ impl From<JustifySelf> for u8 {
|
|||
/// Value of the `align-items` property
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct AlignItems(pub AlignFlags);
|
||||
|
||||
impl AlignItems {
|
||||
|
@ -443,7 +450,8 @@ impl Parse 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, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub struct JustifyItems(pub AlignFlags);
|
||||
|
||||
impl JustifyItems {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss};
|
||||
use values::CSSFloat;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::computed::angle::Angle as ComputedAngle;
|
||||
|
@ -203,3 +203,5 @@ impl Angle {
|
|||
}.map_err(|()| input.new_unexpected_token_error(token.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Angle {}
|
||||
|
|
|
@ -48,7 +48,8 @@ impl BackgroundSize {
|
|||
}
|
||||
|
||||
/// One of the keywords for `background-repeat`.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum BackgroundRepeatKeyword {
|
||||
Repeat,
|
||||
|
@ -60,7 +61,8 @@ pub enum BackgroundRepeatKeyword {
|
|||
/// The specified value for the `background-repeat` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-backgrounds/#the-background-repeat
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub enum BackgroundRepeat {
|
||||
/// `repeat-x`
|
||||
RepeatX,
|
||||
|
|
|
@ -20,7 +20,7 @@ use values::specified::{AllowQuirks, Number, NumberOrPercentage};
|
|||
use values::specified::length::{Length, LengthOrPercentage, NonNegativeLength};
|
||||
|
||||
/// A specified value for a single side of the `border-width` property.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum BorderSideWidth {
|
||||
/// `thin`
|
||||
Thin,
|
||||
|
@ -189,7 +189,8 @@ 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, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToCss)]
|
||||
pub enum BorderImageRepeatKeyword {
|
||||
Stretch,
|
||||
Repeat,
|
||||
|
@ -200,7 +201,8 @@ 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, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub BorderImageRepeatKeyword);
|
||||
|
||||
impl ToCss for BorderImageRepeat {
|
||||
|
|
|
@ -9,9 +9,8 @@ use cssparser::Parser;
|
|||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::KeyframesName;
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||
use values::{CustomIdent, KeyframesName};
|
||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use values::generics::box_::Perspective as GenericPerspective;
|
||||
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
|
@ -19,7 +18,8 @@ use values::specified::{AllowQuirks, Number};
|
|||
use values::specified::length::{LengthOrPercentage, NonNegativeLength};
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
/// Defines an element’s display type, which consists of
|
||||
/// the two basic qualities of how an element generates boxes
|
||||
|
@ -296,7 +296,8 @@ impl AnimationIterationCount {
|
|||
}
|
||||
|
||||
/// A value for the `animation-name` property.
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct AnimationName(pub Option<KeyframesName>);
|
||||
|
||||
impl AnimationName {
|
||||
|
@ -339,7 +340,8 @@ impl Parse for AnimationName {
|
|||
|
||||
#[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,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum ScrollSnapType {
|
||||
None,
|
||||
Mandatory,
|
||||
|
@ -348,7 +350,8 @@ pub enum ScrollSnapType {
|
|||
|
||||
#[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,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum OverscrollBehavior {
|
||||
Auto,
|
||||
Contain,
|
||||
|
@ -357,13 +360,15 @@ pub enum OverscrollBehavior {
|
|||
|
||||
#[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,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum OverflowClipBox {
|
||||
PaddingBox,
|
||||
ContentBox,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
/// Provides a rendering hint to the user agent,
|
||||
/// stating what kinds of changes the author expects
|
||||
/// to perform on the element
|
||||
|
@ -488,6 +493,8 @@ impl Parse for TouchAction {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for TouchAction {}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_bitflags_conversions!(TouchAction);
|
||||
|
||||
|
@ -598,6 +605,8 @@ impl Parse for Contain {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Contain {}
|
||||
|
||||
/// A specified value for the `perspective` property.
|
||||
pub type Perspective = GenericPerspective<NonNegativeLength>;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
use cssparser::{AngleOrNumber, NumberOrPercentage, Parser, Token};
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::{CSSFloat, CSSInteger};
|
||||
use values::computed;
|
||||
|
@ -150,6 +150,8 @@ impl ToCss for CalcLengthOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for CalcLengthOrPercentage {}
|
||||
|
||||
impl CalcNode {
|
||||
/// Tries to parse a single element in the expression, that is, a
|
||||
/// `<length>`, `<angle>`, `<time>`, `<percentage>`, according to
|
||||
|
|
|
@ -14,7 +14,8 @@ use parser::{Parse, ParserContext};
|
|||
use properties::longhands::system_colors::SystemColor;
|
||||
use std::fmt::{self, Write};
|
||||
use std::io::Write as IoWrite;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss, ValueParseErrorKind};
|
||||
use style_traits::{CssType, CssWriter, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{SpecifiedValueInfo, ToCss, ValueParseErrorKind};
|
||||
use super::AllowQuirks;
|
||||
use values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
||||
use values::specified::calc::CalcNode;
|
||||
|
@ -394,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, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub struct RGBAColor(pub Color);
|
||||
|
||||
impl Parse for RGBAColor {
|
||||
|
@ -426,10 +427,14 @@ impl From<Color> for RGBAColor {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Color {
|
||||
const SUPPORTED_TYPES: u8 = CssType::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, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub struct ColorPropertyValue(pub Color);
|
||||
|
||||
impl ToComputedValue for ColorPropertyValue {
|
||||
|
|
|
@ -99,7 +99,8 @@ 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, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub enum Content {
|
||||
/// `normal` reserved keyword.
|
||||
Normal,
|
||||
|
@ -113,7 +114,8 @@ pub enum Content {
|
|||
}
|
||||
|
||||
/// Items for the `content` property.
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub enum ContentItem {
|
||||
/// Literal string content.
|
||||
String(Box<str>),
|
||||
|
|
|
@ -35,7 +35,7 @@ pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow>;
|
|||
pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible>;
|
||||
|
||||
/// A value for the `<factor>` parts in `Filter`.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub struct Factor(NumberOrPercentage);
|
||||
|
||||
impl Factor {
|
||||
|
|
|
@ -77,7 +77,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, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum FontWeight {
|
||||
/// `<font-weight-absolute>`
|
||||
Absolute(AbsoluteFontWeight),
|
||||
|
@ -154,7 +154,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, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum AbsoluteFontWeight {
|
||||
/// A `<number>`, with the additional constraints specified in:
|
||||
///
|
||||
|
@ -333,7 +333,8 @@ impl SpecifiedFontStyle {
|
|||
}
|
||||
|
||||
/// The specified value of the `font-style` property.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum FontStyle {
|
||||
Specified(SpecifiedFontStyle),
|
||||
|
@ -378,7 +379,8 @@ impl Parse for FontStyle {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-fonts-4/#font-stretch-prop
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub enum FontStretch {
|
||||
Stretch(Percentage),
|
||||
Keyword(FontStretchKeyword),
|
||||
|
@ -386,7 +388,8 @@ pub enum FontStretch {
|
|||
}
|
||||
|
||||
/// A keyword value for `font-stretch`.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum FontStretchKeyword {
|
||||
Normal,
|
||||
|
@ -501,7 +504,7 @@ impl ToComputedValue for FontStretch {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// A specified font-size value
|
||||
pub enum FontSize {
|
||||
/// A length; e.g. 10px.
|
||||
|
@ -602,6 +605,8 @@ impl Parse for FontFamily {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for FontFamily {}
|
||||
|
||||
/// `FamilyName::parse` is based on `SingleFontFamily::parse` and not the other way around
|
||||
/// because we want the former to exclude generic family keywords.
|
||||
impl Parse for FamilyName {
|
||||
|
@ -619,7 +624,7 @@ impl Parse for FamilyName {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Preserve the readability of text when font fallback occurs
|
||||
pub enum FontSizeAdjust {
|
||||
/// None variant
|
||||
|
@ -1079,7 +1084,7 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Set of variant alternates
|
||||
pub enum VariantAlternates {
|
||||
/// Enables display of stylistic alternates
|
||||
|
@ -1104,7 +1109,7 @@ pub enum VariantAlternates {
|
|||
HistoricalForms,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// List of Variant Alternates
|
||||
pub struct VariantAlternatesList(
|
||||
#[css(if_empty = "normal", iterable)] pub Box<[VariantAlternates]>,
|
||||
|
@ -1125,7 +1130,7 @@ impl VariantAlternatesList {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Control over the selection of these alternate glyphs
|
||||
pub enum FontVariantAlternates {
|
||||
/// Use alternative glyph from value
|
||||
|
@ -1346,6 +1351,8 @@ impl ToCss for VariantEastAsian {
|
|||
#[cfg(feature = "gecko")]
|
||||
impl_gecko_keyword_conversions!(VariantEastAsian, u16);
|
||||
|
||||
impl SpecifiedValueInfo for VariantEastAsian {}
|
||||
|
||||
/// Asserts that all variant-east-asian matches its NS_FONT_VARIANT_EAST_ASIAN_* value.
|
||||
#[cfg(feature = "gecko")]
|
||||
#[inline]
|
||||
|
@ -1376,7 +1383,7 @@ pub fn assert_variant_east_asian_matches() {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Allows control of glyph substitution and sizing in East Asian text.
|
||||
pub enum FontVariantEastAsian {
|
||||
/// Value variant with `variant-east-asian`
|
||||
|
@ -1568,6 +1575,8 @@ impl ToCss for VariantLigatures {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for VariantLigatures {}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_gecko_keyword_conversions!(VariantLigatures, u16);
|
||||
|
||||
|
@ -1601,7 +1610,7 @@ pub fn assert_variant_ligatures_matches() {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Ligatures and contextual forms are ways of combining glyphs
|
||||
/// to produce more harmonized forms
|
||||
pub enum FontVariantLigatures {
|
||||
|
@ -1798,6 +1807,8 @@ impl ToCss for VariantNumeric {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for VariantNumeric {}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl_gecko_keyword_conversions!(VariantNumeric, u8);
|
||||
|
||||
|
@ -1830,7 +1841,7 @@ pub fn assert_variant_numeric_matches() {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Specifies control over numerical forms.
|
||||
pub enum FontVariantNumeric {
|
||||
/// Value variant with `variant-numeric`
|
||||
|
@ -1938,7 +1949,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, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum FontFeatureSettings {
|
||||
/// Value of `FontSettings`
|
||||
Value(SpecifiedFontFeatureSettings),
|
||||
|
@ -1981,7 +1992,8 @@ impl Parse for FontFeatureSettings {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
/// Whether user agents are allowed to synthesize bold or oblique font faces
|
||||
/// when a font family lacks bold or italic faces
|
||||
pub struct FontSynthesis {
|
||||
|
@ -2079,7 +2091,7 @@ impl From<FontSynthesis> for u8 {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Allows authors to explicitly specify the language system of the font,
|
||||
/// overriding the language system implied by the content language
|
||||
pub enum FontLanguageOverride {
|
||||
|
@ -2169,7 +2181,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, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum FontVariationSettings {
|
||||
/// Value of `FontSettings`
|
||||
Value(SpecifiedFontVariationSettings),
|
||||
|
@ -2254,7 +2266,8 @@ impl Parse for VariationValue<Number> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
/// text-zoom. Enable if true, disable if false
|
||||
pub struct XTextZoom(#[css(skip)] pub bool);
|
||||
|
||||
|
@ -2271,7 +2284,8 @@ impl Parse for XTextZoom {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
/// Internal property that reflects the lang attribute
|
||||
pub struct XLang(#[css(skip)] pub Atom);
|
||||
|
||||
|
@ -2297,7 +2311,7 @@ impl Parse for XLang {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Specifies the minimum font size allowed due to changes in scriptlevel.
|
||||
/// Ref: https://wiki.mozilla.org/MathML:mstyle
|
||||
pub struct MozScriptMinSize(pub NoCalcLength);
|
||||
|
@ -2324,7 +2338,7 @@ impl Parse for MozScriptMinSize {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// Changes the scriptlevel in effect for the children.
|
||||
/// Ref: https://wiki.mozilla.org/MathML:mstyle
|
||||
///
|
||||
|
@ -2359,7 +2373,8 @@ impl Parse for MozScriptLevel {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue,
|
||||
ToCss)]
|
||||
/// Specifies the multiplier to be used to adjust font size
|
||||
/// due to changes in scriptlevel.
|
||||
///
|
||||
|
|
|
@ -104,7 +104,7 @@ pub fn parse_line_names<'i, 't>(
|
|||
/// The type of `repeat` function (only used in parsing).
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo)]
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
enum RepeatType {
|
||||
/// [`<auto-repeat>`](https://drafts.csswg.org/css-grid/#typedef-auto-repeat)
|
||||
|
|
|
@ -17,7 +17,8 @@ use servo_url::ServoUrl;
|
|||
use std::cmp::Ordering;
|
||||
use std::f32::consts::PI;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::{CssType, CssWriter, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{SpecifiedValueInfo, ToCss};
|
||||
use values::{Either, None_};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::{Context, Position as ComputedPosition, ToComputedValue};
|
||||
|
@ -54,6 +55,10 @@ pub type Gradient = generic::Gradient<
|
|||
Angle,
|
||||
>;
|
||||
|
||||
impl SpecifiedValueInfo for Gradient {
|
||||
const SUPPORTED_TYPES: u8 = CssType::GRADIENT;
|
||||
}
|
||||
|
||||
/// A specified gradient kind.
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
pub type GradientKind =
|
||||
|
|
|
@ -15,7 +15,7 @@ use values::specified::Angle;
|
|||
|
||||
/// The specified value of the `image-orientation` property.
|
||||
/// https://drafts.csswg.org/css-images/#propdef-image-orientation
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
|
||||
pub struct ImageOrientation {
|
||||
/// The angle specified, if any
|
||||
pub angle: Option<Angle>,
|
||||
|
|
|
@ -13,7 +13,7 @@ use font_metrics::FontMetricsQueryResult;
|
|||
use parser::{Parse, ParserContext};
|
||||
use std::cmp;
|
||||
use std::ops::{Add, Mul};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use style_traits::{ParseError, SpecifiedValueInfo, StyleParseErrorKind};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{AllowQuirks, Number, Percentage, ToComputedValue};
|
||||
use values::{Auto, CSSFloat, Either, Normal};
|
||||
|
@ -494,11 +494,13 @@ impl NoCalcLength {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for NoCalcLength {}
|
||||
|
||||
/// An extension to `NoCalcLength` to parse `calc` expressions.
|
||||
/// This is commonly used for the `<length>` values.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-values/#lengths>
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum Length {
|
||||
/// The internal length type that cannot parse `calc`
|
||||
NoCalc(NoCalcLength),
|
||||
|
@ -699,7 +701,7 @@ pub type NonNegativeLengthOrAuto = Either<NonNegativeLength, Auto>;
|
|||
|
||||
/// A length or a percentage value.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum LengthOrPercentage {
|
||||
Length(NoCalcLength),
|
||||
Percentage(computed::Percentage),
|
||||
|
@ -845,7 +847,7 @@ impl LengthOrPercentage {
|
|||
|
||||
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum LengthOrPercentageOrAuto {
|
||||
Length(NoCalcLength),
|
||||
Percentage(computed::Percentage),
|
||||
|
@ -1015,7 +1017,7 @@ impl Parse for NonNegativeLengthOrPercentageOrAuto {
|
|||
}
|
||||
|
||||
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum LengthOrPercentageOrNone {
|
||||
Length(NoCalcLength),
|
||||
|
@ -1195,7 +1197,7 @@ impl LengthOrNumber {
|
|||
///
|
||||
/// Note that it only accepts non-negative values.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum MozLength {
|
||||
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
@ -1252,7 +1254,7 @@ impl MozLength {
|
|||
|
||||
/// A value suitable for a `max-width` or `max-height` property.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum MaxLength {
|
||||
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
|
|
@ -15,7 +15,8 @@ use values::generics::CounterStyleOrNone;
|
|||
|
||||
/// Specified and computed `list-style-type` property.
|
||||
#[cfg(feature = "gecko")]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub enum ListStyleType {
|
||||
/// <counter-style> | none
|
||||
CounterStyle(CounterStyleOrNone),
|
||||
|
@ -77,7 +78,8 @@ impl Parse for ListStyleType {
|
|||
///
|
||||
/// FIXME(emilio): It's a shame that this allocates all the time it's computed,
|
||||
/// probably should just be refcounted.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct Quotes(pub Box<[(Box<str>, Box<str>)]>);
|
||||
|
||||
impl ToCss for Quotes {
|
||||
|
|
|
@ -13,7 +13,7 @@ use num_traits::One;
|
|||
use parser::{Parse, ParserContext};
|
||||
use std::f32;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{Auto, CSSFloat, CSSInteger, Either};
|
||||
use super::computed::{Context, ToComputedValue};
|
||||
|
@ -149,8 +149,8 @@ fn parse_number_with_clamping_mode<'i, 't>(
|
|||
// FIXME(emilio): Should move to border.rs
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, Parse, PartialEq, PartialOrd,
|
||||
ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, Parse, PartialEq,
|
||||
PartialOrd, SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum BorderStyle {
|
||||
None = -1,
|
||||
Solid = 6,
|
||||
|
@ -273,6 +273,8 @@ impl ToCss for Number {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Number {}
|
||||
|
||||
impl From<Number> for f32 {
|
||||
#[inline]
|
||||
fn from(n: Number) -> Self {
|
||||
|
@ -326,7 +328,8 @@ impl Parse for GreaterThanOrEqualToOneNumber {
|
|||
///
|
||||
/// FIXME(emilio): Should probably use Either.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub enum NumberOrPercentage {
|
||||
Percentage(Percentage),
|
||||
Number(Number),
|
||||
|
@ -364,7 +367,8 @@ impl Parse for NumberOrPercentage {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd,
|
||||
SpecifiedValueInfo, ToCss)]
|
||||
pub struct Opacity(Number);
|
||||
|
||||
impl Parse for Opacity {
|
||||
|
@ -533,6 +537,8 @@ impl ToCss for Integer {
|
|||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Integer {}
|
||||
|
||||
/// A wrapper of Integer, with value >= 1.
|
||||
pub type PositiveInteger = GreaterThanOrEqualToOne<Integer>;
|
||||
|
||||
|
@ -562,7 +568,7 @@ pub type GridLine = GenericGridLine<Integer>;
|
|||
/// `<grid-template-rows> | <grid-template-columns>`
|
||||
pub type GridTemplateComponent = GenericGridTemplateComponent<LengthOrPercentage, Integer>;
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
|
||||
/// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region
|
||||
pub struct ClipRect {
|
||||
/// <top> (<length> | <auto>)
|
||||
|
@ -846,3 +852,5 @@ impl ToCss for Attr {
|
|||
dest.write_str(")")
|
||||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Attr {}
|
||||
|
|
|
@ -10,8 +10,8 @@ use selectors::parser::SelectorParseErrorKind;
|
|||
use style_traits::ParseError;
|
||||
use values::specified::BorderStyle;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd, ToComputedValue,
|
||||
ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
/// <https://drafts.csswg.org/css-ui/#propdef-outline-style>
|
||||
pub enum OutlineStyle {
|
||||
/// auto
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::{serialize_percentage, CSSFloat};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
@ -158,3 +158,5 @@ impl ToComputedValue for Percentage {
|
|||
Percentage::new(computed.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Percentage {}
|
||||
|
|
|
@ -34,7 +34,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, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum PositionComponent<S> {
|
||||
/// `center`
|
||||
Center,
|
||||
|
@ -45,7 +45,8 @@ pub enum PositionComponent<S> {
|
|||
}
|
||||
|
||||
/// A keyword for the X direction.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum X {
|
||||
Left,
|
||||
|
@ -53,7 +54,8 @@ pub enum X {
|
|||
}
|
||||
|
||||
/// A keyword for the Y direction.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Y {
|
||||
Top,
|
||||
|
@ -409,7 +411,8 @@ impl ToCss for LegacyPosition {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
/// Auto-placement algorithm Option
|
||||
pub enum AutoFlow {
|
||||
/// The auto-placement algorithm places items by filling each row in turn,
|
||||
|
@ -420,7 +423,8 @@ pub enum AutoFlow {
|
|||
Column,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
/// Controls how the auto-placement algorithm works
|
||||
/// specifying exactly how auto-placed items get flowed into the grid
|
||||
pub struct GridAutoFlow {
|
||||
|
@ -533,7 +537,7 @@ impl From<GridAutoFlow> for u8 {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
/// https://drafts.csswg.org/css-grid/#named-grid-area
|
||||
pub struct TemplateAreas {
|
||||
/// `named area` containing for each template area
|
||||
|
@ -639,7 +643,8 @@ impl Parse for TemplateAreas {
|
|||
}
|
||||
|
||||
/// Arc type for `Arc<TemplateAreas>`
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct TemplateAreasArc(#[ignore_malloc_size_of = "Arc"] pub Arc<TemplateAreas>);
|
||||
|
||||
impl Parse for TemplateAreasArc {
|
||||
|
@ -654,7 +659,7 @@ impl Parse for TemplateAreasArc {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo)]
|
||||
/// Not associated with any particular grid item, but can
|
||||
/// be referenced from the grid-placement properties.
|
||||
pub struct NamedArea {
|
||||
|
|
|
@ -173,7 +173,8 @@ 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, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct SVGPaintOrder(pub u8);
|
||||
|
||||
impl SVGPaintOrder {
|
||||
|
@ -280,7 +281,8 @@ 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, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct MozContextProperties(pub CustomIdent);
|
||||
|
||||
impl Parse for MozContextProperties {
|
||||
|
|
|
@ -8,7 +8,8 @@ use cssparser::Parser;
|
|||
use parser::{Parse, ParserContext};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
/// span. for `<col span>` pres attr
|
||||
pub struct XSpan(#[css(skip)] pub i32);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ impl ToComputedValue for LineHeight {
|
|||
}
|
||||
|
||||
/// A generic value for the `text-overflow` property.
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum TextOverflowSide {
|
||||
/// Clip inline content.
|
||||
Clip,
|
||||
|
@ -192,7 +192,7 @@ impl Parse for TextOverflowSide {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
/// 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.
|
||||
|
@ -252,7 +252,7 @@ impl ToComputedValue for TextOverflow {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue)]
|
||||
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue)]
|
||||
/// Specified keyword values for the text-decoration-line property.
|
||||
pub struct TextDecorationLine: u8 {
|
||||
/// No text decoration line is specified
|
||||
|
@ -357,7 +357,8 @@ impl Parse for TextDecorationLine {
|
|||
macro_rules! define_text_align_keyword {
|
||||
($($name: ident => $discriminant: expr,)+) => {
|
||||
/// Specified value of text-align keyword value.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum TextAlignKeyword {
|
||||
$(
|
||||
|
@ -417,7 +418,7 @@ impl TextAlignKeyword {
|
|||
|
||||
/// Specified value of text-align property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, SpecifiedValueInfo)]
|
||||
pub enum TextAlign {
|
||||
/// Keyword value of text-align property.
|
||||
Keyword(TextAlignKeyword),
|
||||
|
@ -534,7 +535,7 @@ impl ToComputedValue for TextAlign {
|
|||
}
|
||||
|
||||
/// Specified value of text-emphasis-style property.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum TextEmphasisStyle {
|
||||
/// <fill> <shape>
|
||||
Keyword(TextEmphasisKeywordValue),
|
||||
|
@ -545,7 +546,7 @@ pub enum TextEmphasisStyle {
|
|||
}
|
||||
|
||||
/// Keyword value for the text-emphasis-style property
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum TextEmphasisKeywordValue {
|
||||
/// <fill>
|
||||
Fill(TextEmphasisFillMode),
|
||||
|
@ -574,7 +575,8 @@ impl TextEmphasisKeywordValue {
|
|||
}
|
||||
|
||||
/// Fill mode for the text-emphasis-style property
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
pub enum TextEmphasisFillMode {
|
||||
/// `filled`
|
||||
Filled,
|
||||
|
@ -583,7 +585,8 @@ pub enum TextEmphasisFillMode {
|
|||
}
|
||||
|
||||
/// Shape keyword for the text-emphasis-style property
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToCss)]
|
||||
pub enum TextEmphasisShapeKeyword {
|
||||
/// `dot`
|
||||
Dot,
|
||||
|
@ -709,7 +712,8 @@ impl Parse for TextEmphasisStyle {
|
|||
}
|
||||
|
||||
/// The allowed horizontal values for the `text-emphasis-position` property.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum TextEmphasisHorizontalWritingModeValue {
|
||||
/// Draw marks over the text in horizontal writing mode.
|
||||
Over,
|
||||
|
@ -718,7 +722,8 @@ pub enum TextEmphasisHorizontalWritingModeValue {
|
|||
}
|
||||
|
||||
/// The allowed vertical values for the `text-emphasis-position` property.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum TextEmphasisVerticalWritingModeValue {
|
||||
/// Draws marks to the right of the text in vertical writing mode.
|
||||
Right,
|
||||
|
@ -727,7 +732,8 @@ pub enum TextEmphasisVerticalWritingModeValue {
|
|||
}
|
||||
|
||||
/// Specified value of `text-emphasis-position` property.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
pub struct TextEmphasisPosition(
|
||||
pub TextEmphasisHorizontalWritingModeValue,
|
||||
pub TextEmphasisVerticalWritingModeValue,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use cssparser::{Parser, Token};
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::CSSFloat;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
@ -165,3 +165,5 @@ impl ToCss for Time {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl SpecifiedValueInfo for Time {}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use style_traits::{CssType, ParseError, SpecifiedValueInfo, StyleParseErrorKind};
|
||||
use values::computed::{Context, LengthOrPercentage as ComputedLengthOrPercentage};
|
||||
use values::computed::{Percentage as ComputedPercentage, ToComputedValue};
|
||||
use values::computed::transform::TimingFunction as ComputedTimingFunction;
|
||||
|
@ -233,7 +233,7 @@ impl Parse for Transform {
|
|||
}
|
||||
|
||||
/// The specified value of a component of a CSS `<transform-origin>`.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||
pub enum OriginComponent<S> {
|
||||
/// `center`
|
||||
Center,
|
||||
|
@ -246,6 +246,10 @@ pub enum OriginComponent<S> {
|
|||
/// A specified timing function.
|
||||
pub type TimingFunction = generic::TimingFunction<Integer, Number>;
|
||||
|
||||
impl SpecifiedValueInfo for TimingFunction {
|
||||
const SUPPORTED_TYPES: u8 = CssType::TIMING_FUNCTION;
|
||||
}
|
||||
|
||||
impl Parse for TransformOrigin {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
|
|
|
@ -10,7 +10,8 @@ use std::fmt::{self, Write};
|
|||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
/// Specified value of `-moz-force-broken-image-icon`
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct MozForceBrokenImageIcon(pub bool);
|
||||
|
||||
impl MozForceBrokenImageIcon {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue