diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-04-19 21:23:31 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-04-28 10:26:05 +0200 |
commit | 737501153b894d460fd7a2862865cb7c36a55ba0 (patch) | |
tree | ed166d02e8344e95f4585d066c5a72bf887217f9 /ports/geckolib | |
parent | 32d4da8a9907acca3087caf474e75b2b95f1a129 (diff) | |
download | servo-737501153b894d460fd7a2862865cb7c36a55ba0.tar.gz servo-737501153b894d460fd7a2862865cb7c36a55ba0.zip |
style: Use a generic type in preparation to fix animation.
Apart from a bit more code reuse.
Bug: 1455358
Reviewed-by: xidorn
MozReview-Commit-ID: 2BNOK6v30lX
Diffstat (limited to 'ports/geckolib')
-rw-r--r-- | ports/geckolib/glue.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 6d701316e28..7c0aacb8c14 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -5408,7 +5408,8 @@ pub extern "C" fn Servo_ParseFontShorthandForMatching( weight: nsCSSValueBorrowedMut ) -> bool { use style::properties::shorthands::font; - use style::values::specified::font::{FontFamily, FontWeight, FontStyle}; + use style::values::generics::font::FontStyle as GenericFontStyle; + use style::values::specified::font::{FontFamily, FontWeight, FontStyle, SpecifiedFontStyle}; let string = unsafe { (*value).to_string() }; let mut input = ParserInput::new(&string); @@ -5433,15 +5434,19 @@ pub extern "C" fn Servo_ParseFontShorthandForMatching( FontFamily::Values(list) => family.set_move(list.0), FontFamily::System(_) => return false, } - match font.font_style { - FontStyle::Normal => style.set_normal(), - FontStyle::Italic => style.set_enum(structs::NS_FONT_STYLE_ITALIC as i32), - FontStyle::Oblique(ref angle) => { - style.set_angle(FontStyle::compute_angle(angle)) - } + let specified_font_style = match font.font_style { + FontStyle::Specified(ref s) => s, FontStyle::System(_) => return false, }; + match *specified_font_style { + GenericFontStyle::Normal => style.set_normal(), + GenericFontStyle::Italic => style.set_enum(structs::NS_FONT_STYLE_ITALIC as i32), + GenericFontStyle::Oblique(ref angle) => { + style.set_angle(SpecifiedFontStyle::compute_angle(angle)) + } + } + if font.font_stretch.get_system().is_some() { return false; } |