author | Jeremy Chen <jeremychen@mozilla.com> |
Thu, 09 Mar 2017 17:57:15 -0800 | |
changeset 346885 | a45b9c12228379e78b8399c7e9d7126ff8ac3ca7 |
parent 346884 | 70586dbb509c079bbf04f81c5ef3b99063d77194 |
child 346886 | c2d92403096ac66f730998f9f02b4623d5be794b |
push id | 31480 |
push user | cbook@mozilla.com |
push date | Fri, 10 Mar 2017 10:37:06 +0000 |
treeherder | mozilla-central@e18d3dd20e8d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | upsuper |
bugs | 276079, 1343512 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
servo/components/style/properties/longhand/inherited_text.mako.rs | file | annotate | diff | comparison | revisions |
--- a/servo/components/style/properties/longhand/inherited_text.mako.rs +++ b/servo/components/style/properties/longhand/inherited_text.mako.rs @@ -187,28 +187,56 @@ // TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support. ${helpers.single_keyword("word-break", "normal break-all keep-all", gecko_constant_prefix="NS_STYLE_WORDBREAK", animatable=False, spec="https://drafts.csswg.org/css-text/#propdef-word-break")} // TODO(pcwalton): Support `text-justify: distribute`. -${helpers.single_keyword("text-justify", - "auto none inter-word", - products="servo", - animatable=False, - spec="https://drafts.csswg.org/css-text/#propdef-text-justify")} +<%helpers:single_keyword_computed name="text-justify" + values="auto none inter-word" + extra_gecko_values="inter-character" + extra_specified="${'distribute' if product == 'gecko' else ''}" + gecko_enum_prefix="StyleTextJustify" + animatable="False" + spec="https://drafts.csswg.org/css-text/#propdef-text-justify"> + use values::HasViewportPercentage; + no_viewport_percentage!(SpecifiedValue); + + impl ToComputedValue for SpecifiedValue { + type ComputedValue = computed_value::T; -${helpers.single_keyword("text-align-last", - "auto start end left right center justify", - products="gecko", - gecko_constant_prefix="NS_STYLE_TEXT_ALIGN", - animatable=False, - spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")} + #[inline] + fn to_computed_value(&self, _: &Context) -> computed_value::T { + 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 <%helpers:longhand name="text-align" animatable="False" spec="https://drafts.csswg.org/css-text/#propdef-text-align"> pub use self::computed_value::T as SpecifiedValue; use values::computed::ComputedValueAsSpecified; use values::HasViewportPercentage; impl ComputedValueAsSpecified for SpecifiedValue {} no_viewport_percentage!(SpecifiedValue);