Skip to content

Commit 2fac18e

Browse files
committed
Enable font-variant-ligatures in stylo
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
1 parent 71c42fd commit 2fac18e

4 files changed

Lines changed: 18 additions & 28 deletions

File tree

style/properties/longhands.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,6 @@ affects = "layout"
991991
type = "FontVariantLigatures"
992992
initial = "computed::FontVariantLigatures::empty()"
993993
struct = "font"
994-
engine = "gecko"
995994
animation_type = "discrete"
996995
gecko_ffi_name = "mFont.variantLigatures"
997996
spec = "https://drafts.csswg.org/css-fonts/#propdef-font-variant-ligatures"

style/properties/shorthands.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,11 +2519,11 @@ pub mod font {
25192519
use crate::properties::longhands::{
25202520
font_family, font_feature_settings, font_language_override, font_size,
25212521
font_size_adjust, font_variant_alternates, font_variant_east_asian, font_variant_emoji,
2522-
font_variant_ligatures, font_variant_numeric, font_variant_position,
2522+
font_variant_numeric, font_variant_position,
25232523
};
25242524
use crate::properties::longhands::{
2525-
font_kerning, font_optical_sizing, font_stretch, font_style, font_variant_caps, font_variation_settings,
2526-
font_weight,
2525+
font_kerning, font_variant_ligatures, font_optical_sizing, font_stretch, font_style, font_variant_caps,
2526+
font_variation_settings, font_weight,
25272527
};
25282528
#[cfg(feature = "gecko")]
25292529
use crate::values::specified::font::SystemFont;
@@ -2634,7 +2634,6 @@ pub mod font {
26342634
font_variant_east_asian: font_variant_east_asian::get_initial_specified_value(),
26352635
#[cfg(feature = "gecko")]
26362636
font_variant_emoji: font_variant_emoji::get_initial_specified_value(),
2637-
#[cfg(feature = "gecko")]
26382637
font_variant_ligatures: font_variant_ligatures::get_initial_specified_value(),
26392638
#[cfg(feature = "gecko")]
26402639
font_variant_numeric: font_variant_numeric::get_initial_specified_value(),
@@ -2705,7 +2704,6 @@ pub mod font {
27052704
{
27062705
return Ok(());
27072706
}
2708-
#[cfg(feature = "gecko")]
27092707
if self.font_variant_ligatures != &font_variant_ligatures::get_initial_specified_value()
27102708
{
27112709
return Ok(());
@@ -2843,20 +2841,18 @@ pub mod font_variant {
28432841
pub use crate::properties::generated::shorthands::font_variant::*;
28442842

28452843
use super::*;
2846-
use crate::properties::longhands::font_variant_caps;
2844+
use crate::properties::longhands::{font_variant_caps, font_variant_ligatures};
28472845
#[cfg(feature = "gecko")]
28482846
use crate::properties::longhands::{
28492847
font_variant_alternates, font_variant_east_asian, font_variant_emoji,
2850-
font_variant_ligatures, font_variant_numeric, font_variant_position,
2848+
font_variant_numeric, font_variant_position,
28512849
};
2852-
#[allow(unused_imports)]
28532850
use crate::values::specified::FontVariantLigatures;
28542851

28552852
pub fn parse_value<'i, 't>(
28562853
context: &ParserContext,
28572854
input: &mut Parser<'i, 't>,
28582855
) -> Result<Longhands, ParseError<'i>> {
2859-
#[cfg(feature = "gecko")]
28602856
let mut ligatures = None;
28612857
let mut caps = None;
28622858
#[cfg(feature = "gecko")]
@@ -2878,7 +2874,6 @@ pub mod font_variant {
28782874
.try_parse(|input| input.expect_ident_matching("none"))
28792875
.is_ok()
28802876
{
2881-
#[cfg(feature = "gecko")]
28822877
{
28832878
ligatures = Some(FontVariantLigatures::NONE);
28842879
}
@@ -2895,7 +2890,6 @@ pub mod font_variant {
28952890
{
28962891
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
28972892
}
2898-
#[cfg(feature = "gecko")]
28992893
try_parse_one!(context, input, ligatures, font_variant_ligatures::parse);
29002894
try_parse_one!(context, input, caps, font_variant_caps::parse);
29012895
#[cfg(feature = "gecko")]
@@ -2929,6 +2923,7 @@ pub mod font_variant {
29292923
});
29302924
#[cfg(feature = "servo")]
29312925
return Ok(expanded! {
2926+
font_variant_ligatures: unwrap_or_initial!(font_variant_ligatures, ligatures),
29322927
font_variant_caps: unwrap_or_initial!(font_variant_caps, caps),
29332928
});
29342929
}
@@ -2939,15 +2934,12 @@ pub mod font_variant {
29392934
where
29402935
W: fmt::Write,
29412936
{
2942-
#[cfg(feature = "gecko")]
29432937
let has_none_ligatures = self.font_variant_ligatures == &FontVariantLigatures::NONE;
2944-
#[cfg(feature = "servo")]
2945-
let has_none_ligatures = false;
29462938

29472939
#[cfg(feature = "gecko")]
29482940
const TOTAL_SUBPROPS: usize = 7;
29492941
#[cfg(feature = "servo")]
2950-
const TOTAL_SUBPROPS: usize = 1;
2942+
const TOTAL_SUBPROPS: usize = 2;
29512943
let mut nb_normals = 0;
29522944
macro_rules! count_normal {
29532945
($e: expr, $p: ident) => {
@@ -2959,7 +2951,6 @@ pub mod font_variant {
29592951
count_normal!(self.$v, $v);
29602952
};
29612953
}
2962-
#[cfg(feature = "gecko")]
29632954
count_normal!(font_variant_ligatures);
29642955
count_normal!(font_variant_caps);
29652956
#[cfg(feature = "gecko")]
@@ -3001,7 +2992,6 @@ pub mod font_variant {
30012992
};
30022993
}
30032994

3004-
#[cfg(feature = "gecko")]
30052995
write!(font_variant_ligatures);
30062996
write!(font_variant_caps);
30072997
#[cfg(feature = "gecko")]

style/properties/shorthands.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -430,23 +430,23 @@ spec = "https://drafts.csswg.org/css-text-decor/#propdef-text-decoration"
430430

431431
[font]
432432
sub_properties = [
433-
"font-style",
434-
"font-variant-caps",
435-
"font-weight",
436-
"font-stretch",
437-
"font-size",
438-
"line-height",
439433
"font-family",
434+
"font-kerning",
440435
"font-optical-sizing",
436+
"font-size",
437+
"font-stretch",
438+
"font-style",
439+
"font-variant-caps",
440+
"font-variant-ligatures",
441441
"font-variation-settings",
442-
"font-kerning"
442+
"font-weight",
443+
"line-height"
443444
]
444445
extra_gecko_sub_properties = [
445446
"font-size-adjust",
446447
"font-variant-alternates",
447448
"font-variant-east-asian",
448449
"font-variant-emoji",
449-
"font-variant-ligatures",
450450
"font-variant-numeric",
451451
"font-variant-position",
452452
"font-language-override",
@@ -456,8 +456,8 @@ spec = "https://drafts.csswg.org/css-fonts-3/#propdef-font"
456456
derive_value_info = false
457457

458458
[font-variant]
459-
sub_properties = ["font-variant-caps"]
460-
extra_gecko_sub_properties = ["font-variant-alternates", "font-variant-east-asian", "font-variant-emoji", "font-variant-ligatures", "font-variant-numeric", "font-variant-position"]
459+
sub_properties = ["font-variant-caps", "font-variant-ligatures"]
460+
extra_gecko_sub_properties = ["font-variant-alternates", "font-variant-east-asian", "font-variant-emoji", "font-variant-numeric", "font-variant-position"]
461461
spec = "https://drafts.csswg.org/css-fonts-3/#propdef-font-variant"
462462

463463
[font-synthesis]

style/values/specified/font.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ impl FontVariantEastAsian {
13751375
ToShmem,
13761376
ToTyped,
13771377
)]
1378+
#[cfg_attr(feature = "servo", derive(Deserialize, Hash, Serialize))]
13781379
#[css(bitflags(
13791380
single = "normal,none",
13801381
mixed = "common-ligatures,no-common-ligatures,discretionary-ligatures,no-discretionary-ligatures,historical-ligatures,no-historical-ligatures,contextual,no-contextual",

0 commit comments

Comments
 (0)