style: Get rid of ComputedValueAsSpecified in inherited_text.rs

This commit is contained in:
Emilio Cobos Álvarez 2017-09-09 14:49:27 +02:00
parent a3bfa5db3e
commit d1a3cb6d94
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 10 additions and 19 deletions

View file

@ -268,10 +268,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
spec="Nonstandard (Internal-only)" spec="Nonstandard (Internal-only)"
allow_empty="True"> allow_empty="True">
use values::CustomIdent; use values::CustomIdent;
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue { }
pub type SpecifiedValue = CustomIdent; pub type SpecifiedValue = CustomIdent;

View file

@ -255,9 +255,8 @@ ${helpers.single_keyword("text-align-last",
} }
} }
% else: % else:
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
pub use self::computed_value::T as SpecifiedValue; pub use self::computed_value::T as SpecifiedValue;
add_impls_for_keyword_enum!(SpecifiedValue);
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>) pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> { -> Result<SpecifiedValue, ParseError<'i>> {
computed_value::T::parse(input) computed_value::T::parse(input)
@ -287,9 +286,6 @@ ${helpers.predefined_type("word-spacing",
use cssparser::RGBA; use cssparser::RGBA;
use std::fmt; use std::fmt;
use style_traits::ToCss; use style_traits::ToCss;
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@ -299,6 +295,8 @@ ${helpers.predefined_type("word-spacing",
pub line_through: Option<RGBA>, pub line_through: Option<RGBA>,
} }
trivial_to_computed_value!(SpecifiedValue);
pub mod computed_value { pub mod computed_value {
pub type T = super::SpecifiedValue; pub type T = super::SpecifiedValue;
} }
@ -374,9 +372,7 @@ ${helpers.predefined_type("word-spacing",
// !important. // !important.
flags="APPLIES_TO_PLACEHOLDER" flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-white-space"> spec="https://drafts.csswg.org/css-text/#propdef-white-space">
use values::computed::ComputedValueAsSpecified; trivial_to_computed_value!(SpecifiedValue);
impl ComputedValueAsSpecified for SpecifiedValue {}
% if product != "gecko": % if product != "gecko":
impl SpecifiedValue { impl SpecifiedValue {
pub fn allow_wrap(&self) -> bool { pub fn allow_wrap(&self) -> bool {
@ -433,8 +429,8 @@ ${helpers.predefined_type(
pub mod computed_value { pub mod computed_value {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)] #[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, ToComputedValue))]
pub enum T { pub enum T {
Keyword(KeywordValue), Keyword(KeywordValue),
None, None,
@ -449,8 +445,8 @@ ${helpers.predefined_type(
} }
} }
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)] #[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Keyword(KeywordValue), Keyword(KeywordValue),
None, None,
@ -614,26 +610,25 @@ ${helpers.predefined_type(
<%helpers:longhand name="text-emphasis-position" animation_value_type="discrete" products="gecko" <%helpers:longhand name="text-emphasis-position" animation_value_type="discrete" products="gecko"
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-position"> spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-position">
use values::computed::ComputedValueAsSpecified;
use style_traits::ToCss; use style_traits::ToCss;
define_css_keyword_enum!(HorizontalWritingModeValue: define_css_keyword_enum!(HorizontalWritingModeValue:
"over" => Over, "over" => Over,
"under" => Under); "under" => Under);
add_impls_for_keyword_enum!(VerticalWritingModeValue);
define_css_keyword_enum!(VerticalWritingModeValue: define_css_keyword_enum!(VerticalWritingModeValue:
"right" => Right, "right" => Right,
"left" => Left); "left" => Left);
add_impls_for_keyword_enum!(HorizontalWritingModeValue);
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)] #[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
pub struct SpecifiedValue(pub HorizontalWritingModeValue, pub VerticalWritingModeValue); pub struct SpecifiedValue(pub HorizontalWritingModeValue, pub VerticalWritingModeValue);
pub mod computed_value { pub mod computed_value {
pub type T = super::SpecifiedValue; pub type T = super::SpecifiedValue;
} }
impl ComputedValueAsSpecified for SpecifiedValue {}
pub fn get_initial_value() -> computed_value::T { pub fn get_initial_value() -> computed_value::T {
SpecifiedValue(HorizontalWritingModeValue::Over, VerticalWritingModeValue::Right) SpecifiedValue(HorizontalWritingModeValue::Over, VerticalWritingModeValue::Right)
} }

View file

@ -98,7 +98,7 @@ impl<A: Parse, B: Parse> Parse for Either<A, B> {
} }
/// https://drafts.csswg.org/css-values-4/#custom-idents /// https://drafts.csswg.org/css-values-4/#custom-idents
#[derive(Clone, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CustomIdent(pub Atom); pub struct CustomIdent(pub Atom);