Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-08-17 01:23:14 +02:00 committed by Martin Robinson
parent dcafbde256
commit 105050d46d
9 changed files with 72 additions and 88 deletions

View file

@ -21,10 +21,9 @@ use servo_atoms::Atom;
use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::{
FamilyName, FontFamily, FontFamilyList, FontFamilyNameSyntax, FontSize, FontStretch,
FamilyName, FontFamily, FontFamilyList, FontFamilyNameSyntax, FontSize, FontStretch, FontStyle,
FontWeight, SingleFontFamily,
};
use style::values::generics::font::FontStyle;
use webrender_api::{FontInstanceKey, FontKey, IdNamespace};
struct TestFontSource {
@ -95,7 +94,7 @@ impl FontSource for TestFontSource {
fn style() -> FontStyleStruct {
let mut style = FontStyleStruct {
font_family: FontFamily::serif(),
font_style: FontStyle::Normal,
font_style: FontStyle::NORMAL,
font_variant_caps: FontVariantCaps::Normal,
font_weight: FontWeight::normal(),
font_size: FontSize::medium(),
@ -134,7 +133,7 @@ fn test_font_group_is_cached_by_style() {
let style1 = style();
let mut style2 = style();
style2.set_font_style(FontStyle::Italic);
style2.set_font_style(FontStyle::ITALIC);
assert_eq!(
context.font_group(Arc::new(style1.clone())).as_ptr(),
@ -231,7 +230,7 @@ fn test_font_template_is_cached() {
template_descriptor: FontTemplateDescriptor {
weight: FontWeight::normal(),
stretch: FontStretch::hundred(),
style: FontStyle::Normal,
style: FontStyle::normal(),
},
variant: FontVariantCaps::Normal,
pt_size: Au(10),

View file

@ -13,10 +13,7 @@ fn test_font_template_descriptor() {
use gfx::font_context::FontContextHandle;
use gfx::font_template::{FontTemplate, FontTemplateDescriptor};
use servo_atoms::Atom;
use style::values::computed::font::{FontStretch, FontWeight};
use style::values::computed::Percentage;
use style::values::generics::font::FontStyle;
use style::values::generics::NonNegative;
use style::values::computed::font::{FontStretch, FontStyle, FontWeight};
fn descriptor(filename: &str) -> FontTemplateDescriptor {
let mut path: PathBuf = [
@ -46,36 +43,36 @@ fn test_font_template_descriptor() {
assert_eq!(
descriptor("DejaVuSans"),
FontTemplateDescriptor {
weight: FontWeight::normal(),
weight: FontWeight::NORMAL,
stretch: FontStretch::hundred(),
style: FontStyle::Normal,
style: FontStyle::NORMAL,
}
);
assert_eq!(
descriptor("DejaVuSans-Bold"),
FontTemplateDescriptor {
weight: FontWeight::bold(),
weight: FontWeight::BOLD,
stretch: FontStretch::hundred(),
style: FontStyle::Normal,
style: FontStyle::NORMAL,
}
);
assert_eq!(
descriptor("DejaVuSans-Oblique"),
FontTemplateDescriptor {
weight: FontWeight::normal(),
weight: FontWeight::NORMAL,
stretch: FontStretch::hundred(),
style: FontStyle::Italic,
style: FontStyle::ITALIC,
}
);
assert_eq!(
descriptor("DejaVuSansCondensed-BoldOblique"),
FontTemplateDescriptor {
weight: FontWeight::bold(),
stretch: FontStretch(NonNegative(Percentage(0.875))),
style: FontStyle::Italic,
weight: FontWeight::BOLD,
stretch: FontStretch::from_percentage(0.875),
style: FontStyle::ITALIC,
}
);
}