mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Integrate font-variation-settings descriptor with stylo
This commit is contained in:
parent
4c3f1756da
commit
6ffa888dd6
6 changed files with 82 additions and 18 deletions
|
@ -1471,6 +1471,9 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Gecko_CSSValue_SetInt(css_value: nsCSSValueBorrowedMut, integer: i32, unit: nsCSSUnit);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CSSValue_SetFloat(css_value: nsCSSValueBorrowedMut, value: f32, unit: nsCSSUnit);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CSSValue_SetPair(
|
||||
css_value: nsCSSValueBorrowedMut,
|
||||
|
|
|
@ -10230,6 +10230,10 @@ pub mod root {
|
|||
#[link_name = "\u{1}_ZN7mozilla10StylePrefs32sGridTemplateSubgridValueEnabledE"]
|
||||
pub static mut StylePrefs_sGridTemplateSubgridValueEnabled: bool;
|
||||
}
|
||||
extern "C" {
|
||||
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sFontVariationsEnabledE"]
|
||||
pub static mut StylePrefs_sFontVariationsEnabled: bool;
|
||||
}
|
||||
extern "C" {
|
||||
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sEmulateMozBoxWithFlexE"]
|
||||
pub static mut StylePrefs_sEmulateMozBoxWithFlex: bool;
|
||||
|
@ -11885,6 +11889,7 @@ pub mod root {
|
|||
pub mSrc: root::nsCSSValue,
|
||||
pub mUnicodeRange: root::nsCSSValue,
|
||||
pub mFontFeatureSettings: root::nsCSSValue,
|
||||
pub mFontVariationSettings: root::nsCSSValue,
|
||||
pub mFontLanguageOverride: root::nsCSSValue,
|
||||
pub mDisplay: root::nsCSSValue,
|
||||
}
|
||||
|
@ -11896,7 +11901,7 @@ pub mod root {
|
|||
fn bindgen_test_layout_CSSFontFaceDescriptors() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<CSSFontFaceDescriptors>(),
|
||||
144usize,
|
||||
160usize,
|
||||
concat!("Size of: ", stringify!(CSSFontFaceDescriptors))
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -11992,10 +11997,23 @@ pub mod root {
|
|||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<CSSFontFaceDescriptors>())).mFontLanguageOverride
|
||||
&(*(::std::ptr::null::<CSSFontFaceDescriptors>())).mFontVariationSettings
|
||||
as *const _ as usize
|
||||
},
|
||||
112usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(CSSFontFaceDescriptors),
|
||||
"::",
|
||||
stringify!(mFontVariationSettings)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<CSSFontFaceDescriptors>())).mFontLanguageOverride
|
||||
as *const _ as usize
|
||||
},
|
||||
128usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(CSSFontFaceDescriptors),
|
||||
|
@ -12007,7 +12025,7 @@ pub mod root {
|
|||
unsafe {
|
||||
&(*(::std::ptr::null::<CSSFontFaceDescriptors>())).mDisplay as *const _ as usize
|
||||
},
|
||||
128usize,
|
||||
144usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(CSSFontFaceDescriptors),
|
||||
|
@ -21749,9 +21767,10 @@ pub mod root {
|
|||
eCSSFontDesc_Src = 4,
|
||||
eCSSFontDesc_UnicodeRange = 5,
|
||||
eCSSFontDesc_FontFeatureSettings = 6,
|
||||
eCSSFontDesc_FontLanguageOverride = 7,
|
||||
eCSSFontDesc_Display = 8,
|
||||
eCSSFontDesc_COUNT = 9,
|
||||
eCSSFontDesc_FontVariationSettings = 7,
|
||||
eCSSFontDesc_FontLanguageOverride = 8,
|
||||
eCSSFontDesc_Display = 9,
|
||||
eCSSFontDesc_COUNT = 10,
|
||||
}
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -37537,7 +37556,7 @@ pub mod root {
|
|||
fn bindgen_test_layout_nsCSSFontFaceStyleDecl() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<nsCSSFontFaceStyleDecl>(),
|
||||
176usize,
|
||||
192usize,
|
||||
concat!("Size of: ", stringify!(nsCSSFontFaceStyleDecl))
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -37599,7 +37618,7 @@ pub mod root {
|
|||
fn bindgen_test_layout_nsCSSFontFaceRule() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<nsCSSFontFaceRule>(),
|
||||
240usize,
|
||||
256usize,
|
||||
concat!("Size of: ", stringify!(nsCSSFontFaceRule))
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
|
@ -21,7 +21,7 @@ use std::fmt::{self, Write};
|
|||
use std::str;
|
||||
use str::CssStringWriter;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::specified::font::SpecifiedFontFeatureSettings;
|
||||
use values::specified::font::{FontTag, FontVariationSettings, SpecifiedFontFeatureSettings};
|
||||
|
||||
/// A @font-face rule
|
||||
pub type FontFaceRule = RefPtr<nsCSSFontFaceRule>;
|
||||
|
@ -50,6 +50,14 @@ impl ToNsCssValue for FontWeight {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToNsCssValue for FontTag {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
let mut raw = [0u8; 4];
|
||||
(&mut raw[..]).write_u32::<BigEndian>(self.0).unwrap();
|
||||
nscssvalue.set_string(str::from_utf8(&raw).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
impl ToNsCssValue for SpecifiedFontFeatureSettings {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
if self.0.is_empty() {
|
||||
|
@ -58,15 +66,24 @@ impl ToNsCssValue for SpecifiedFontFeatureSettings {
|
|||
}
|
||||
|
||||
nscssvalue.set_pair_list(self.0.into_iter().map(|entry| {
|
||||
let mut feature = nsCSSValue::null();
|
||||
let mut raw = [0u8; 4];
|
||||
(&mut raw[..]).write_u32::<BigEndian>(entry.tag.0).unwrap();
|
||||
feature.set_string(str::from_utf8(&raw).unwrap());
|
||||
|
||||
let mut index = nsCSSValue::null();
|
||||
index.set_integer(entry.value.value());
|
||||
(entry.tag.into(), index)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
(feature, index)
|
||||
impl ToNsCssValue for FontVariationSettings {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
if self.0.is_empty() {
|
||||
nscssvalue.set_normal();
|
||||
return;
|
||||
}
|
||||
|
||||
nscssvalue.set_pair_list(self.0.into_iter().map(|entry| {
|
||||
let mut value = nsCSSValue::null();
|
||||
value.set_number(entry.value.into());
|
||||
(entry.tag.into(), value)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue