--- a/servo/components/style/properties/helpers.mako.rs
+++ b/servo/components/style/properties/helpers.mako.rs
@@ -391,29 +391,29 @@
]}
keyword = keyword=Keyword(name, values, **keyword_kwargs)
%>
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
use properties::longhands::system_font::SystemFont;
pub mod computed_value {
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
- #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse)]
- #[derive(PartialEq, ToCss)]
+ #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse,
+ PartialEq, SpecifiedValueInfo, ToCss)]
pub enum T {
% for value in keyword.values_for(product):
${to_camel_case(value)},
% endfor
}
${gecko_keyword_conversion(keyword, keyword.values_for(product), type="T", cast_to="i32")}
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
- #[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
+ #[derive(Clone, Copy, Debug, Eq, PartialEq, SpecifiedValueInfo, ToCss)]
pub enum SpecifiedValue {
Keyword(computed_value::T),
#[css(skip)]
System(SystemFont),
}
pub fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<SpecifiedValue, ParseError<'i>> {
Ok(SpecifiedValue::Keyword(computed_value::T::parse(input)?))
@@ -454,18 +454,16 @@
pub fn get_system(&self) -> Option<SystemFont> {
if let SpecifiedValue::System(s) = *self {
Some(s)
} else {
None
}
}
}
-
- impl ::style_traits::SpecifiedValueInfo for SpecifiedValue {}
</%call>
</%def>
<%def name="gecko_keyword_conversion(keyword, values=None, type='SpecifiedValue', cast_to=None)">
<%
if not values:
values = keyword.values_for(product)
maybe_cast = "as %s" % cast_to if cast_to else ""
@@ -556,28 +554,29 @@
#[css(aliases = "${','.join(aliases)}")]
% endif
% endif
${to_camel_case(variant)},
% endfor
</%def>
% if extra_specified:
#[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 SpecifiedValue {
${variants(keyword.values_for(product) + extra_specified.split(), bool(extra_specified))}
}
% else:
pub use self::computed_value::T as SpecifiedValue;
% endif
pub mod computed_value {
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
% if not extra_specified:
- #[derive(Parse, ToComputedValue)]
+ #[derive(Parse, SpecifiedValueInfo, ToComputedValue)]
% endif
pub enum T {
${variants(data.longhands_by_name[name].keyword.values_for(product), not extra_specified)}
}
}
#[inline]
pub fn get_initial_value() -> computed_value::T {
computed_value::T::${to_camel_case(values.split()[0])}
@@ -586,17 +585,16 @@
pub fn get_initial_specified_value() -> SpecifiedValue {
SpecifiedValue::${to_camel_case(values.split()[0])}
}
#[inline]
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
SpecifiedValue::parse(input)
}
- impl ::style_traits::SpecifiedValueInfo for SpecifiedValue {}
% if needs_conversion:
<%
conversion_values = keyword.values_for(product)
if extra_specified:
conversion_values += extra_specified.split()
conversion_values += keyword.aliases_for(product).keys()
%>