mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +01:00
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
This commit is contained in:
parent
32d4da8a99
commit
737501153b
9 changed files with 158 additions and 120 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue