Stylo - gecko glue code for text-justify

This commit is contained in:
Jeremy Chen 2017-03-06 23:08:20 +08:00
parent c62973b77b
commit 6ff62b1c36

View file

@ -192,18 +192,46 @@ ${helpers.single_keyword("word-break",
spec="https://drafts.csswg.org/css-text/#propdef-word-break")} spec="https://drafts.csswg.org/css-text/#propdef-word-break")}
// TODO(pcwalton): Support `text-justify: distribute`. // TODO(pcwalton): Support `text-justify: distribute`.
${helpers.single_keyword("text-justify", <%helpers:single_keyword_computed name="text-justify"
"auto none inter-word", values="auto none inter-word"
products="servo", extra_gecko_values="inter-character"
animatable=False, extra_specified="${'distribute' if product == 'gecko' else ''}"
spec="https://drafts.csswg.org/css-text/#propdef-text-justify")} gecko_enum_prefix="StyleTextJustify"
animatable="False"
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
use values::HasViewportPercentage;
no_viewport_percentage!(SpecifiedValue);
${helpers.single_keyword("text-align-last", impl ToComputedValue for SpecifiedValue {
"auto start end left right center justify", type ComputedValue = computed_value::T;
products="gecko",
gecko_constant_prefix="NS_STYLE_TEXT_ALIGN", #[inline]
animatable=False, fn to_computed_value(&self, _: &Context) -> computed_value::T {
spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")} match *self {
% for value in "auto none inter_word".split():
SpecifiedValue::${value} => computed_value::T::${value},
% endfor
% if product == "gecko":
SpecifiedValue::inter_character => computed_value::T::inter_character,
// https://drafts.csswg.org/css-text-3/#valdef-text-justify-distribute
SpecifiedValue::distribute => computed_value::T::inter_character,
% endif
}
}
#[inline]
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
match *computed {
% for value in "auto none inter_word".split():
computed_value::T::${value} => SpecifiedValue::${value},
% endfor
% if product == "gecko":
computed_value::T::inter_character => SpecifiedValue::inter_character,
% endif
}
}
}
</%helpers:single_keyword_computed>
// TODO make this a shorthand and implement text-align-last/text-align-all // TODO make this a shorthand and implement text-align-last/text-align-all
<%helpers:longhand name="text-align" animatable="False" spec="https://drafts.csswg.org/css-text/#propdef-text-align"> <%helpers:longhand name="text-align" animatable="False" spec="https://drafts.csswg.org/css-text/#propdef-text-align">