Auto merge of #11240 - mbrubeck:font-style, r=bholley

Support font-style in geckolib

r? @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11240)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-18 13:12:55 -07:00
commit f02c4c6403
4 changed files with 137 additions and 3 deletions

View file

@ -115,7 +115,7 @@
</%helpers:longhand>
${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">

View file

@ -821,6 +821,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;
@ -4265,6 +4303,99 @@ pub struct ArenaRefPtr<T> {
}
#[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)]

View file

@ -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" \

View file

@ -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>
<%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)"></%call>
// 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