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,32 +28,32 @@
-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)] }
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum T {
% for value in values:
${to_rust_ident(value)},
% endfor
}
impl ToCss for T { #[allow(non_camel_case_types)]
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)]
where W: ::std::fmt::Write, #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
{ pub enum SpecifiedValue {
match *self { % for value in values:
% for value in values: ${to_rust_ident(value)},
T::${to_rust_ident(value)} => dest.write_str("${value}"), % endfor
% endfor }
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
where W: ::std::fmt::Write,
{
match *self {
% for value in values:
SpecifiedValue::${to_rust_ident(value)} => dest.write_str("${value}"),
% endfor
} }
} }
} }
@ -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,18 +405,19 @@ ${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 {
#[derive(Debug, Clone, Copy, PartialEq)] pub use super::SpecifiedValue as T;
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub super::super::overflow_x::computed_value::T);
} }
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub super::overflow_x::SpecifiedValue);
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}
#[inline] #[inline]