mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Clean up text-justify, and make distribute a parse-time alias
Since it's simpler, as discussed in the CSSWG issue. Differential Revision: https://phabricator.services.mozilla.com/D111346
This commit is contained in:
parent
bbc03a2577
commit
b40f4b6fec
7 changed files with 48 additions and 76 deletions
|
@ -96,45 +96,16 @@ ${helpers.predefined_type(
|
|||
servo_restyle_damage="rebuild_and_reflow",
|
||||
)}
|
||||
|
||||
// TODO(pcwalton): Support `text-justify: distribute`.
|
||||
<%helpers:single_keyword
|
||||
name="text-justify"
|
||||
values="auto none inter-word"
|
||||
${helpers.predefined_type(
|
||||
"text-justify",
|
||||
"TextJustify",
|
||||
"computed::TextJustify::Auto",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
extra_gecko_values="inter-character"
|
||||
extra_specified="${'distribute' if engine == 'gecko' else ''}"
|
||||
gecko_enum_prefix="StyleTextJustify"
|
||||
animation_value_type="discrete"
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-justify"
|
||||
servo_restyle_damage="rebuild_and_reflow"
|
||||
>
|
||||
% if engine == 'gecko':
|
||||
impl ToComputedValue for SpecifiedValue {
|
||||
type ComputedValue = computed_value::T;
|
||||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, _: &Context) -> computed_value::T {
|
||||
match *self {
|
||||
% for value in "Auto None InterCharacter InterWord".split():
|
||||
SpecifiedValue::${value} => computed_value::T::${value},
|
||||
% endfor
|
||||
// https://drafts.csswg.org/css-text-3/#valdef-text-justify-distribute
|
||||
SpecifiedValue::Distribute => computed_value::T::InterCharacter,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
|
||||
match *computed {
|
||||
% for value in "Auto None InterCharacter InterWord".split():
|
||||
computed_value::T::${value} => SpecifiedValue::${value},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
}
|
||||
% endif
|
||||
</%helpers:single_keyword>
|
||||
animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-justify",
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
)}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"text-align-last",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue