style: Update font-stretch to css-fonts-4.

These won't "just work", pending changes from bug 1436048 to use a floating
point representation for those.

Bug: 1454883
Reviewed-by: xidorn
MozReview-Commit-ID: Bi5iTdFreMA
This commit is contained in:
Emilio Cobos Álvarez 2018-04-17 16:44:17 +02:00
parent 91be6c31c3
commit f7636e6662
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 267 additions and 124 deletions

View file

@ -81,17 +81,16 @@ ${helpers.predefined_type("font-synthesis",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-synthesis")}
${helpers.single_keyword_system("font-stretch",
"normal ultra-condensed extra-condensed condensed \
semi-condensed semi-expanded expanded extra-expanded \
ultra-expanded",
gecko_ffi_name="mFont.stretch",
gecko_constant_prefix="NS_FONT_STRETCH",
cast_type='i16',
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="ComputedValue",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type(
"font-stretch",
"FontStretch",
initial_value="computed::NonNegativePercentage::hundred()",
initial_specified_value="specified::FontStretch::normal()",
animation_value_type="Percentage",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
servo_restyle_damage="rebuild_and_reflow",
)}
${helpers.single_keyword_system("font-kerning",
"auto none normal",
@ -290,11 +289,11 @@ ${helpers.predefined_type("-x-text-zoom",
-moz-window -moz-document -moz-workspace -moz-desktop
-moz-info -moz-dialog -moz-button -moz-pull-down-menu
-moz-list -moz-field""".split()
kw_font_props = """font_style font_variant_caps font_stretch
kw_font_props = """font_style font_variant_caps
font_kerning font_variant_position font_variant_ligatures
font_variant_east_asian font_variant_numeric
font_optical_sizing""".split()
kw_cast = """font_style font_variant_caps font_stretch
kw_cast = """font_style font_variant_caps
font_kerning font_variant_position
font_optical_sizing""".split()
%>
@ -330,7 +329,9 @@ ${helpers.predefined_type("-x-text-zoom",
use gecko_bindings::bindings;
use gecko_bindings::structs::{LookAndFeel_FontID, nsFont};
use std::mem;
use values::computed::Percentage;
use values::computed::font::{FontSize, FontFamilyList};
use values::generics::NonNegative;
let id = match *self {
% for font in system_fonts:
@ -349,7 +350,8 @@ ${helpers.predefined_type("-x-text-zoom",
cx.device().pres_context()
)
}
let weight = longhands::font_weight::computed_value::T::from_gecko_weight(system.weight);
let font_weight = longhands::font_weight::computed_value::T::from_gecko_weight(system.weight);
let font_stretch = NonNegative(Percentage(system.stretch as f32));
let ret = ComputedSystemFont {
font_family: longhands::font_family::computed_value::T(
FontFamilyList(
@ -360,7 +362,8 @@ ${helpers.predefined_type("-x-text-zoom",
size: Au(system.size).into(),
keyword_info: None
},
font_weight: weight,
font_weight,
font_stretch,
font_size_adjust: longhands::font_size_adjust::computed_value
::T::from_gecko_adjust(system.sizeAdjust),
% for kwprop in kw_font_props: