Re-export SpecifiedValue instead of computed_value::T on other longhands

This commit is contained in:
Nazım Can Altınova 2017-01-08 00:05:51 +03:00
parent 227737c685
commit f1693013b2

View file

@ -28,35 +28,35 @@
-moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck -moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck
-moz-popup -moz-groupbox""".split() -moz-popup -moz-groupbox""".split()
%> %>
pub use self::computed_value::T as SpecifiedValue;
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
use style_traits::ToCss; use style_traits::ToCss;
use values::NoViewportPercentage; use values::NoViewportPercentage;
impl NoViewportPercentage for SpecifiedValue {} impl NoViewportPercentage for SpecifiedValue {}
pub mod computed_value { pub mod computed_value {
use style_traits::ToCss; pub use super::SpecifiedValue as T;
}
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)] #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum T { pub enum SpecifiedValue {
% for value in values: % for value in values:
${to_rust_ident(value)}, ${to_rust_ident(value)},
% endfor % endfor
} }
impl ToCss for T { impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
where W: ::std::fmt::Write, where W: ::std::fmt::Write,
{ {
match *self { match *self {
% for value in values: % for value in values:
T::${to_rust_ident(value)} => dest.write_str("${value}"), SpecifiedValue::${to_rust_ident(value)} => dest.write_str("${value}"),
% endfor % endfor
} }
} }
} }
}
/// The initial display value. /// The initial display value.
#[inline] #[inline]
@ -397,8 +397,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
use values::NoViewportPercentage; use values::NoViewportPercentage;
pub use self::computed_value::T as SpecifiedValue;
impl NoViewportPercentage for SpecifiedValue {} impl NoViewportPercentage for SpecifiedValue {}
impl ToCss for SpecifiedValue { impl ToCss for SpecifiedValue {
@ -407,17 +405,18 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
} }
} }
/// The specified and computed value for overflow-y is a wrapper on top of /// The specified and computed value for overflow-y is a wrapper on top of
/// `overflow-x`, so we re-use the logic, but prevent errors from mistakenly /// `overflow-x`, so we re-use the logic, but prevent errors from mistakenly
/// assign one to other. /// assign one to other.
/// ///
/// TODO(Manishearth, emilio): We may want to just use the same value. /// TODO(Manishearth, emilio): We may want to just use the same value.
pub mod computed_value { pub mod computed_value {
pub use super::SpecifiedValue as T;
}
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub super::super::overflow_x::computed_value::T); pub struct SpecifiedValue(pub super::overflow_x::SpecifiedValue);
}
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}