mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Add support for the CSS font-variant-emoji property to the style system
Differential Revision: https://phabricator.services.mozilla.com/D147494
This commit is contained in:
parent
14eece6f5a
commit
8149cd4a0c
2 changed files with 47 additions and 13 deletions
|
@ -130,6 +130,18 @@ ${helpers.predefined_type(
|
||||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-east-asian",
|
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-east-asian",
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
${helpers.single_keyword(
|
||||||
|
"font-variant-emoji",
|
||||||
|
"normal text emoji unicode",
|
||||||
|
engines="gecko",
|
||||||
|
gecko_pref="layout.css.font-variant-emoji.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
|
gecko_enum_prefix="StyleFontVariantEmoji",
|
||||||
|
gecko_ffi_name="mFont.variantEmoji",
|
||||||
|
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-emoji",
|
||||||
|
animation_value_type="discrete",
|
||||||
|
)}
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"font-variant-ligatures",
|
"font-variant-ligatures",
|
||||||
"FontVariantLigatures",
|
"FontVariantLigatures",
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
${'font-optical-sizing' if engine == 'gecko' else ''}
|
${'font-optical-sizing' if engine == 'gecko' else ''}
|
||||||
${'font-variant-alternates' if engine == 'gecko' else ''}
|
${'font-variant-alternates' if engine == 'gecko' else ''}
|
||||||
${'font-variant-east-asian' if engine == 'gecko' else ''}
|
${'font-variant-east-asian' if engine == 'gecko' else ''}
|
||||||
|
${'font-variant-emoji' if engine == 'gecko' else ''}
|
||||||
${'font-variant-ligatures' if engine == 'gecko' else ''}
|
${'font-variant-ligatures' if engine == 'gecko' else ''}
|
||||||
${'font-variant-numeric' if engine == 'gecko' else ''}
|
${'font-variant-numeric' if engine == 'gecko' else ''}
|
||||||
${'font-variant-position' if engine == 'gecko' else ''}
|
${'font-variant-position' if engine == 'gecko' else ''}
|
||||||
|
@ -45,10 +46,10 @@
|
||||||
<%
|
<%
|
||||||
gecko_sub_properties = "kerning language_override size_adjust \
|
gecko_sub_properties = "kerning language_override size_adjust \
|
||||||
variant_alternates variant_east_asian \
|
variant_alternates variant_east_asian \
|
||||||
variant_ligatures variant_numeric \
|
variant_emoji variant_ligatures \
|
||||||
variant_position feature_settings \
|
variant_numeric variant_position \
|
||||||
variation_settings optical_sizing \
|
feature_settings variation_settings \
|
||||||
palette".split()
|
optical_sizing palette".split()
|
||||||
%>
|
%>
|
||||||
% if engine == "gecko":
|
% if engine == "gecko":
|
||||||
% for prop in gecko_sub_properties:
|
% for prop in gecko_sub_properties:
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
// line-height and palette are just reset to initial
|
// line-height and palette are just reset to initial
|
||||||
line_height: LineHeight::normal(),
|
line_height: LineHeight::normal(),
|
||||||
font_palette: FontPalette::normal(),
|
font_palette: FontPalette::normal(),
|
||||||
|
font_variant_emoji: font_variant_emoji::get_initial_specified_value(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
% endif
|
% endif
|
||||||
|
@ -194,9 +196,14 @@
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(v) = self.font_variant_emoji {
|
||||||
|
if v != &font_variant_emoji::get_initial_specified_value() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
% for name in gecko_sub_properties:
|
% for name in gecko_sub_properties:
|
||||||
% if name != "optical_sizing" and name != "variation_settings" and name != "palette":
|
% if name != "optical_sizing" and name != "variation_settings" and name != "palette" and name != "variant_emoji":
|
||||||
if self.font_${name} != &font_${name}::get_initial_specified_value() {
|
if self.font_${name} != &font_${name}::get_initial_specified_value() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
@ -323,11 +330,12 @@
|
||||||
sub_properties="font-variant-caps
|
sub_properties="font-variant-caps
|
||||||
${'font-variant-alternates' if engine == 'gecko' else ''}
|
${'font-variant-alternates' if engine == 'gecko' else ''}
|
||||||
${'font-variant-east-asian' if engine == 'gecko' else ''}
|
${'font-variant-east-asian' if engine == 'gecko' else ''}
|
||||||
|
${'font-variant-emoji' if engine == 'gecko' else ''}
|
||||||
${'font-variant-ligatures' if engine == 'gecko' else ''}
|
${'font-variant-ligatures' if engine == 'gecko' else ''}
|
||||||
${'font-variant-numeric' if engine == 'gecko' else ''}
|
${'font-variant-numeric' if engine == 'gecko' else ''}
|
||||||
${'font-variant-position' if engine == 'gecko' else ''}"
|
${'font-variant-position' if engine == 'gecko' else ''}"
|
||||||
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-variant">
|
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-variant">
|
||||||
<% gecko_sub_properties = "alternates east_asian ligatures numeric position".split() %>
|
<% gecko_sub_properties = "alternates east_asian emoji ligatures numeric position".split() %>
|
||||||
<%
|
<%
|
||||||
sub_properties = ["caps"]
|
sub_properties = ["caps"]
|
||||||
if engine == "gecko":
|
if engine == "gecko":
|
||||||
|
@ -402,8 +410,15 @@
|
||||||
const TOTAL_SUBPROPS: usize = ${len(sub_properties)};
|
const TOTAL_SUBPROPS: usize = ${len(sub_properties)};
|
||||||
let mut nb_normals = 0;
|
let mut nb_normals = 0;
|
||||||
% for prop in sub_properties:
|
% for prop in sub_properties:
|
||||||
if self.font_variant_${prop} == &font_variant_${prop}::get_initial_specified_value() {
|
% if prop == "emoji":
|
||||||
nb_normals += 1;
|
if let Some(value) = self.font_variant_${prop} {
|
||||||
|
% else:
|
||||||
|
{
|
||||||
|
let value = self.font_variant_${prop};
|
||||||
|
% endif
|
||||||
|
if value == &font_variant_${prop}::get_initial_specified_value() {
|
||||||
|
nb_normals += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
@ -421,12 +436,19 @@
|
||||||
} else {
|
} else {
|
||||||
let mut has_any = false;
|
let mut has_any = false;
|
||||||
% for prop in sub_properties:
|
% for prop in sub_properties:
|
||||||
if self.font_variant_${prop} != &font_variant_${prop}::get_initial_specified_value() {
|
% if prop == "emoji":
|
||||||
if has_any {
|
if let Some(value) = self.font_variant_${prop} {
|
||||||
dest.write_str(" ")?;
|
% else:
|
||||||
|
{
|
||||||
|
let value = self.font_variant_${prop};
|
||||||
|
% endif
|
||||||
|
if value != &font_variant_${prop}::get_initial_specified_value() {
|
||||||
|
if has_any {
|
||||||
|
dest.write_str(" ")?;
|
||||||
|
}
|
||||||
|
has_any = true;
|
||||||
|
value.to_css(dest)?;
|
||||||
}
|
}
|
||||||
has_any = true;
|
|
||||||
self.font_variant_${prop}.to_css(dest)?;
|
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue