mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Make use of predefined_type for some aliased types
This commit is contained in:
parent
61a17993eb
commit
63965f55f5
8 changed files with 81 additions and 174 deletions
|
@ -8,14 +8,18 @@
|
|||
%>
|
||||
|
||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
|
||||
needs_context=True, vector=False, initial_specified_value=None, **kwargs)">
|
||||
needs_context=True, vector=False, computed_type=None, initial_specified_value=None, **kwargs)">
|
||||
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
|
||||
#[allow(unused_imports)]
|
||||
use app_units::Au;
|
||||
use cssparser::{Color as CSSParserColor, RGBA};
|
||||
pub use values::specified::${type} as SpecifiedValue;
|
||||
pub mod computed_value {
|
||||
% if computed_type:
|
||||
pub use ${computed_type} as T;
|
||||
% else:
|
||||
pub use values::computed::${type} as T;
|
||||
% endif
|
||||
}
|
||||
#[inline] pub fn get_initial_value() -> computed_value::T { ${initial_value} }
|
||||
% if initial_specified_value:
|
||||
|
@ -36,10 +40,16 @@
|
|||
% if vector:
|
||||
<%call expr="vector_longhand(name, predefined_type=type, **kwargs)">
|
||||
${predefined_type_inner(name, type, initial_value, parse_method)}
|
||||
% if caller:
|
||||
${caller.body()}
|
||||
% endif
|
||||
</%call>
|
||||
% else:
|
||||
<%call expr="longhand(name, predefined_type=type, **kwargs)">
|
||||
${predefined_type_inner(name, type, initial_value, parse_method)}
|
||||
% if caller:
|
||||
${caller.body()}
|
||||
% endif
|
||||
</%call>
|
||||
% endif
|
||||
</%def>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue