diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index f83a536166e..a72699d6ca8 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -118,7 +118,7 @@ -${helpers.single_keyword("font-style", "normal italic oblique")} +${helpers.single_keyword("font-style", "normal italic oblique", gecko_constant_prefix="NS_FONT_STYLE")} ${helpers.single_keyword("font-variant", "normal small-caps")} <%helpers:longhand name="font-weight" need_clone="True"> diff --git a/ports/geckolib/gecko_bindings/structs.rs b/ports/geckolib/gecko_bindings/structs.rs index 9d0aeb77ddb..e5e09460faa 100644 --- a/ports/geckolib/gecko_bindings/structs.rs +++ b/ports/geckolib/gecko_bindings/structs.rs @@ -818,6 +818,44 @@ pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0; pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1; pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2; pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3; +pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0; +pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1; +pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2; +pub const NS_FONT_WEIGHT_NORMAL: ::std::os::raw::c_uint = 400; +pub const NS_FONT_WEIGHT_BOLD: ::std::os::raw::c_uint = 700; +pub const NS_FONT_WEIGHT_THIN: ::std::os::raw::c_uint = 100; +pub const NS_FONT_STRETCH_NORMAL: ::std::os::raw::c_uint = 0; +pub const NS_FONT_STRETCH_SEMI_EXPANDED: ::std::os::raw::c_uint = 1; +pub const NS_FONT_STRETCH_EXPANDED: ::std::os::raw::c_uint = 2; +pub const NS_FONT_STRETCH_EXTRA_EXPANDED: ::std::os::raw::c_uint = 3; +pub const NS_FONT_STRETCH_ULTRA_EXPANDED: ::std::os::raw::c_uint = 4; +pub const NS_FONT_SMOOTHING_AUTO: ::std::os::raw::c_uint = 0; +pub const NS_FONT_SMOOTHING_GRAYSCALE: ::std::os::raw::c_uint = 1; +pub const NS_FONT_KERNING_AUTO: ::std::os::raw::c_uint = 0; +pub const NS_FONT_KERNING_NONE: ::std::os::raw::c_uint = 1; +pub const NS_FONT_KERNING_NORMAL: ::std::os::raw::c_uint = 2; +pub const NS_FONT_SYNTHESIS_WEIGHT: ::std::os::raw::c_uint = 1; +pub const NS_FONT_SYNTHESIS_STYLE: ::std::os::raw::c_uint = 2; +pub const NS_FONT_DISPLAY_AUTO: ::std::os::raw::c_uint = 0; +pub const NS_FONT_DISPLAY_BLOCK: ::std::os::raw::c_uint = 1; +pub const NS_FONT_DISPLAY_SWAP: ::std::os::raw::c_uint = 2; +pub const NS_FONT_DISPLAY_FALLBACK: ::std::os::raw::c_uint = 3; +pub const NS_FONT_DISPLAY_OPTIONAL: ::std::os::raw::c_uint = 4; +pub const NS_FONT_VARIANT_CAPS_NORMAL: ::std::os::raw::c_uint = 0; +pub const NS_FONT_VARIANT_CAPS_SMALLCAPS: ::std::os::raw::c_uint = 1; +pub const NS_FONT_VARIANT_CAPS_ALLSMALL: ::std::os::raw::c_uint = 2; +pub const NS_FONT_VARIANT_CAPS_PETITECAPS: ::std::os::raw::c_uint = 3; +pub const NS_FONT_VARIANT_CAPS_ALLPETITE: ::std::os::raw::c_uint = 4; +pub const NS_FONT_VARIANT_CAPS_TITLING: ::std::os::raw::c_uint = 5; +pub const NS_FONT_VARIANT_CAPS_UNICASE: ::std::os::raw::c_uint = 6; +pub const NS_FONT_VARIANT_POSITION_NORMAL: ::std::os::raw::c_uint = 0; +pub const NS_FONT_VARIANT_POSITION_SUPER: ::std::os::raw::c_uint = 1; +pub const NS_FONT_VARIANT_POSITION_SUB: ::std::os::raw::c_uint = 2; +pub const NS_FONT_VARIANT_WIDTH_NORMAL: ::std::os::raw::c_uint = 0; +pub const NS_FONT_VARIANT_WIDTH_FULL: ::std::os::raw::c_uint = 1; +pub const NS_FONT_VARIANT_WIDTH_HALF: ::std::os::raw::c_uint = 2; +pub const NS_FONT_VARIANT_WIDTH_THIRD: ::std::os::raw::c_uint = 3; +pub const NS_FONT_VARIANT_WIDTH_QUARTER: ::std::os::raw::c_uint = 4; pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215; pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint = 16777216; @@ -4178,6 +4216,99 @@ pub struct ArenaRefPtr { } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum gfxFontConstants_h_unnamed_10 { + eFeatureAlternates_historical = 0, + eFeatureAlternates_stylistic = 1, + eFeatureAlternates_styleset = 2, + eFeatureAlternates_character_variant = 3, + eFeatureAlternates_swash = 4, + eFeatureAlternates_ornaments = 5, + eFeatureAlternates_annotation = 6, + eFeatureAlternates_numFeatures = 7, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum gfxFontConstants_h_unnamed_11 { + eFeatureEastAsian_jis78 = 0, + eFeatureEastAsian_jis83 = 1, + eFeatureEastAsian_jis90 = 2, + eFeatureEastAsian_jis04 = 3, + eFeatureEastAsian_simplified = 4, + eFeatureEastAsian_traditional = 5, + eFeatureEastAsian_full_width = 6, + eFeatureEastAsian_prop_width = 7, + eFeatureEastAsian_ruby = 8, + eFeatureEastAsian_numFeatures = 9, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum gfxFontConstants_h_unnamed_12 { + eFeatureLigatures_none = 0, + eFeatureLigatures_common = 1, + eFeatureLigatures_no_common = 2, + eFeatureLigatures_discretionary = 3, + eFeatureLigatures_no_discretionary = 4, + eFeatureLigatures_historical = 5, + eFeatureLigatures_no_historical = 6, + eFeatureLigatures_contextual = 7, + eFeatureLigatures_no_contextual = 8, + eFeatureLigatures_numFeatures = 9, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum gfxFontConstants_h_unnamed_13 { + eFeatureNumeric_lining = 0, + eFeatureNumeric_oldstyle = 1, + eFeatureNumeric_proportional = 2, + eFeatureNumeric_tabular = 3, + eFeatureNumeric_diagonal_fractions = 4, + eFeatureNumeric_stacked_fractions = 5, + eFeatureNumeric_slashedzero = 6, + eFeatureNumeric_ordinal = 7, + eFeatureNumeric_numFeatures = 8, +} +pub const eFontPrefLang_First: eFontPrefLang = + eFontPrefLang::eFontPrefLang_Western; +pub const eFontPrefLang_Last: eFontPrefLang = + eFontPrefLang::eFontPrefLang_Others; +pub const eFontPrefLang_Count: eFontPrefLang = + eFontPrefLang::eFontPrefLang_CJKSet; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub enum eFontPrefLang { + eFontPrefLang_Western = 0, + eFontPrefLang_Japanese = 1, + eFontPrefLang_ChineseTW = 2, + eFontPrefLang_ChineseCN = 3, + eFontPrefLang_ChineseHK = 4, + eFontPrefLang_Korean = 5, + eFontPrefLang_Cyrillic = 6, + eFontPrefLang_Greek = 7, + eFontPrefLang_Thai = 8, + eFontPrefLang_Hebrew = 9, + eFontPrefLang_Arabic = 10, + eFontPrefLang_Devanagari = 11, + eFontPrefLang_Tamil = 12, + eFontPrefLang_Armenian = 13, + eFontPrefLang_Bengali = 14, + eFontPrefLang_Canadian = 15, + eFontPrefLang_Ethiopic = 16, + eFontPrefLang_Georgian = 17, + eFontPrefLang_Gujarati = 18, + eFontPrefLang_Gurmukhi = 19, + eFontPrefLang_Khmer = 20, + eFontPrefLang_Malayalam = 21, + eFontPrefLang_Mathematics = 22, + eFontPrefLang_Oriya = 23, + eFontPrefLang_Telugu = 24, + eFontPrefLang_Kannada = 25, + eFontPrefLang_Sinhala = 26, + eFontPrefLang_Tibetan = 27, + eFontPrefLang_Others = 28, + eFontPrefLang_CJKSet = 29, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum LogicalAxis { eLogicalAxisBlock = 0, eLogicalAxisInline = 1, } #[repr(u32)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] diff --git a/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh b/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh index 900822a5ca7..c1d3bf5006e 100755 --- a/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh +++ b/ports/geckolib/gecko_bindings/tools/regen_style_structs.sh @@ -82,6 +82,7 @@ export RUST_BACKTRACE=1 -match "nsStyleCoord.h" \ -match "RefPtr.h" \ -match "nsISupportsImpl.h" \ + -match "gfxFontConstants.h" \ -match "gfxFontFamilyList.h" \ -match "gfxFontFeatures.h" \ -match "imgRequestProxy.h" \ diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 904181b264d..4622c9639be 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -375,7 +375,7 @@ impl Debug for ${style_struct.gecko_struct_name} { # These live in nsStyleImageLayers in gecko. Need to figure out what to do about that. force_stub += ["background-repeat", "background-attachment", "background-clip", "background-origin"]; # These live in an nsFont member in Gecko. Should be straightforward to do manually. - force_stub += ["font-kerning", "font-stretch", "font-style", "font-variant"] + force_stub += ["font-kerning", "font-stretch", "font-variant"] # These have unusual representations in gecko. force_stub += ["list-style-type", "text-overflow"] # Enum class instead of NS_STYLE_... @@ -589,7 +589,9 @@ fn static_assert() { } -<%self:impl_trait style_struct_name="Font" skip_longhands="font-size font-weight" skip_additionals="*"> +<%self:impl_trait style_struct_name="Font" skip_longhands="font-style font-size font-weight" skip_additionals="*"> + <%call expr="impl_keyword('font_style', 'mFont.style', + data.longhands_by_name['font-style'].keyword, need_clone=False)"> // FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the // actual computed size, and the other of which (mFont.size) is the 'display