mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Support possibly-vector keyword properties
This commit is contained in:
parent
57340e4310
commit
ce9640a48e
1 changed files with 20 additions and 6 deletions
|
@ -285,8 +285,11 @@
|
||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="single_keyword(name, values, **kwargs)">
|
<%def name="maybe_vector_longhand(name, maybe, **kwargs)">
|
||||||
<%call expr="single_keyword_computed(name, values, **kwargs)">
|
|
||||||
|
</%def>
|
||||||
|
<%def name="single_keyword(name, values, vector=False, **kwargs)">
|
||||||
|
<%call expr="single_keyword_computed(name, values, vector, **kwargs)">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
use values::NoViewportPercentage;
|
use values::NoViewportPercentage;
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
|
@ -294,16 +297,16 @@
|
||||||
</%call>
|
</%call>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="single_keyword_computed(name, values, **kwargs)">
|
<%def name="single_keyword_computed(name, values, vector=False, **kwargs)">
|
||||||
<%
|
<%
|
||||||
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
|
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
|
||||||
'gecko_constant_prefix', 'gecko_enum_prefix',
|
'gecko_constant_prefix', 'gecko_enum_prefix',
|
||||||
'extra_gecko_values', 'extra_servo_values',
|
'extra_gecko_values', 'extra_servo_values',
|
||||||
]}
|
]}
|
||||||
%>
|
%>
|
||||||
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
|
||||||
|
<%def name="inner_body()">
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
${caller.body()}
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
define_css_keyword_enum! { T:
|
define_css_keyword_enum! { T:
|
||||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||||
|
@ -320,7 +323,18 @@
|
||||||
-> Result<SpecifiedValue, ()> {
|
-> Result<SpecifiedValue, ()> {
|
||||||
computed_value::T::parse(input)
|
computed_value::T::parse(input)
|
||||||
}
|
}
|
||||||
|
</%def>
|
||||||
|
% if vector:
|
||||||
|
<%call expr="vector_longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
||||||
|
${inner_body()}
|
||||||
|
${caller.body()}
|
||||||
</%call>
|
</%call>
|
||||||
|
% else:
|
||||||
|
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
||||||
|
${inner_body()}
|
||||||
|
${caller.body()}
|
||||||
|
</%call>
|
||||||
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="keyword_list(name, values, **kwargs)">
|
<%def name="keyword_list(name, values, **kwargs)">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue