mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Remove Mako helper: keyword_list
This commit is contained in:
parent
c51db9f5f1
commit
b5bc2a1f53
1 changed files with 0 additions and 73 deletions
|
@ -367,79 +367,6 @@
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="keyword_list(name, values, **kwargs)">
|
|
||||||
<%
|
|
||||||
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
|
|
||||||
'gecko_constant_prefix', 'gecko_enum_prefix',
|
|
||||||
'extra_gecko_values', 'extra_servo_values',
|
|
||||||
]}
|
|
||||||
%>
|
|
||||||
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
|
||||||
use values::NoViewportPercentage;
|
|
||||||
impl NoViewportPercentage for SpecifiedValue {}
|
|
||||||
pub mod computed_value {
|
|
||||||
use std::fmt;
|
|
||||||
use style_traits::ToCss;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
|
||||||
pub struct T(pub Vec<${to_camel_case(name)}>);
|
|
||||||
|
|
||||||
impl ToCss for T {
|
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
|
||||||
debug_assert!(!self.0.is_empty(), "Always parses at least one");
|
|
||||||
|
|
||||||
for (index, item) in self.0.iter().enumerate() {
|
|
||||||
if index != 0 {
|
|
||||||
try!(dest.write_str(", "));
|
|
||||||
}
|
|
||||||
|
|
||||||
try!(item.to_css(dest));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub use self::${to_camel_case(name)} as SingleComputedValue;
|
|
||||||
|
|
||||||
define_css_keyword_enum! { ${to_camel_case(name)}:
|
|
||||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
|
||||||
"${value}" => ${to_rust_ident(value)},
|
|
||||||
% endfor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub use self::computed_value::${to_camel_case(name)} as SingleSpecifiedValue;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn parse_one(input: &mut Parser) -> Result<SingleSpecifiedValue, ()> {
|
|
||||||
SingleSpecifiedValue::parse(input)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
|
||||||
computed_value::T(vec![get_initial_single_value()])
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn get_initial_single_value() -> SingleSpecifiedValue {
|
|
||||||
SingleSpecifiedValue::${to_rust_ident(values.split()[0])}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn parse(_context: &ParserContext, input: &mut Parser)
|
|
||||||
-> Result<SpecifiedValue, ()> {
|
|
||||||
Ok(SpecifiedValue(try!(
|
|
||||||
input.parse_comma_separated(computed_value::${to_camel_case(name)}::parse))))
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
</%call>
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
<%def name="shorthand(name, sub_properties, experimental=False, **kwargs)">
|
<%def name="shorthand(name, sub_properties, experimental=False, **kwargs)">
|
||||||
<%
|
<%
|
||||||
shorthand = data.declare_shorthand(name, sub_properties.split(), experimental=experimental,
|
shorthand = data.declare_shorthand(name, sub_properties.split(), experimental=experimental,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue