mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
style: Make 'font' shorthand reset the 'font-variation-settings' property.
As required by the spec: https://drafts.csswg.org/css-fonts-4/#font-prop See https://bugzilla.mozilla.org/show_bug.cgi?id=1435983 Basically, make font-variation-settings work in the same way as font-feature-settings already does.
This commit is contained in:
parent
b59a8afd0f
commit
33ead015b1
7 changed files with 86 additions and 13 deletions
|
@ -19,7 +19,8 @@ SYSTEM_FONT_LONGHANDS = """font_family font_size font_style
|
|||
font_size_adjust font_variant_alternates
|
||||
font_variant_ligatures font_variant_east_asian
|
||||
font_variant_numeric font_language_override
|
||||
font_feature_settings font_optical_sizing""".split()
|
||||
font_feature_settings font_variation_settings
|
||||
font_optical_sizing""".split()
|
||||
|
||||
|
||||
def maybe_moz_logical_alias(product, side, prop):
|
||||
|
|
|
@ -167,6 +167,7 @@ ${helpers.predefined_type("font-variation-settings",
|
|||
products="gecko",
|
||||
gecko_pref="layout.css.font-variations.enabled",
|
||||
initial_value="computed::FontVariationSettings::normal()",
|
||||
initial_specified_value="specified::FontVariationSettings::normal()",
|
||||
animation_value_type="ComputedValue",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="${variation_spec}")}
|
||||
|
@ -371,6 +372,7 @@ ${helpers.predefined_type("-x-text-zoom",
|
|||
font_language_override: longhands::font_language_override::computed_value
|
||||
::T(system.languageOverride),
|
||||
font_feature_settings: longhands::font_feature_settings::get_initial_value(),
|
||||
font_variation_settings: longhands::font_variation_settings::get_initial_value(),
|
||||
font_variant_alternates: longhands::font_variant_alternates::get_initial_value(),
|
||||
system_font: *self,
|
||||
default_font_type: system.fontlist.mDefaultFontType,
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
${'font-variant-numeric' if product == 'gecko' else ''}
|
||||
${'font-variant-position' if product == 'gecko' else ''}
|
||||
${'font-language-override' if product == 'gecko' else ''}
|
||||
${'font-feature-settings' if product == 'gecko' else ''}"
|
||||
${'font-feature-settings' if product == 'gecko' else ''}
|
||||
${'font-variation-settings' if product == 'gecko' else ''}"
|
||||
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font">
|
||||
use parser::Parse;
|
||||
use properties::longhands::{font_family, font_style, font_weight, font_stretch};
|
||||
|
@ -32,7 +33,7 @@
|
|||
variant_alternates variant_east_asian \
|
||||
variant_ligatures variant_numeric \
|
||||
variant_position feature_settings \
|
||||
optical_sizing".split()
|
||||
variation_settings optical_sizing".split()
|
||||
%>
|
||||
% if product == "gecko":
|
||||
% for prop in gecko_sub_properties:
|
||||
|
@ -162,9 +163,14 @@
|
|||
return Ok(());
|
||||
}
|
||||
}
|
||||
if let Some(v) = self.font_variation_settings {
|
||||
if v != &font_variation_settings::get_initial_specified_value() {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
% for name in gecko_sub_properties:
|
||||
% if name != "optical_sizing":
|
||||
% if name != "optical_sizing" and name != "variation_settings":
|
||||
if self.font_${name} != &font_${name}::get_initial_specified_value() {
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -203,7 +209,7 @@
|
|||
let mut all = true;
|
||||
|
||||
% for prop in SYSTEM_FONT_LONGHANDS:
|
||||
% if prop == "font_optical_sizing":
|
||||
% if prop == "font_optical_sizing" or prop == "font_variation_settings":
|
||||
if let Some(value) = self.${prop} {
|
||||
% else:
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue