mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Add support for pref-controlled initial values.
Differential Revision: https://phabricator.services.mozilla.com/D67931
This commit is contained in:
parent
3cb019ac1e
commit
53f7e45285
1 changed files with 16 additions and 3 deletions
|
@ -707,7 +707,8 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="single_keyword(name, values, vector=False,
|
<%def name="single_keyword(name, values, vector=False,
|
||||||
extra_specified=None, needs_conversion=False, **kwargs)">
|
extra_specified=None, needs_conversion=False,
|
||||||
|
gecko_pref_controlled_initial_value=None, **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_constant_prefix',
|
||||||
|
@ -724,7 +725,8 @@
|
||||||
]}
|
]}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%def name="inner_body(keyword, extra_specified=None, needs_conversion=False)">
|
<%def name="inner_body(keyword, extra_specified=None, needs_conversion=False,
|
||||||
|
gecko_pref_controlled_initial_value=None)">
|
||||||
<%def name="variants(variants, include_aliases)">
|
<%def name="variants(variants, include_aliases)">
|
||||||
% for variant in variants:
|
% for variant in variants:
|
||||||
% if include_aliases:
|
% if include_aliases:
|
||||||
|
@ -773,10 +775,20 @@
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
pub fn get_initial_value() -> computed_value::T {
|
||||||
|
% if engine == "gecko" and gecko_pref_controlled_initial_value:
|
||||||
|
if static_prefs::pref!("${gecko_pref_controlled_initial_value.split('=')[0]}") {
|
||||||
|
return computed_value::T::${to_camel_case(gecko_pref_controlled_initial_value.split('=')[1])};
|
||||||
|
}
|
||||||
|
% endif
|
||||||
computed_value::T::${to_camel_case(values.split()[0])}
|
computed_value::T::${to_camel_case(values.split()[0])}
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_initial_specified_value() -> SpecifiedValue {
|
pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||||
|
% if engine == "gecko" and gecko_pref_controlled_initial_value:
|
||||||
|
if static_prefs::pref!("${gecko_pref_controlled_initial_value.split('=')[0]}") {
|
||||||
|
return SpecifiedValue::${to_camel_case(gecko_pref_controlled_initial_value.split('=')[1])};
|
||||||
|
}
|
||||||
|
% endif
|
||||||
SpecifiedValue::${to_camel_case(values.split()[0])}
|
SpecifiedValue::${to_camel_case(values.split()[0])}
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -805,7 +817,8 @@
|
||||||
% else:
|
% else:
|
||||||
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
|
||||||
${inner_body(Keyword(name, values, **keyword_kwargs),
|
${inner_body(Keyword(name, values, **keyword_kwargs),
|
||||||
extra_specified=extra_specified, needs_conversion=needs_conversion)}
|
extra_specified=extra_specified, needs_conversion=needs_conversion,
|
||||||
|
gecko_pref_controlled_initial_value=gecko_pref_controlled_initial_value)}
|
||||||
% if caller:
|
% if caller:
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
% endif
|
% endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue