stylo: Add bindings for fetching font metrics from Gecko

This commit is contained in:
Manish Goregaokar 2017-04-07 15:49:44 -07:00 committed by Manish Goregaokar
parent 80f6160580
commit 1154600dd4
4 changed files with 63 additions and 0 deletions

View file

@ -343,6 +343,7 @@ mod bindings {
"FragmentOrURL",
"FrameRequestCallback",
"GeckoParserExtraData",
"GeckoFontMetrics",
"gfxAlternateValue",
"gfxFontFeature",
"gfxFontVariation",
@ -626,6 +627,7 @@ mod bindings {
"FontFamilyList",
"FontFamilyType",
"FontSizePrefs",
"GeckoFontMetrics",
"Keyframe",
"ServoBundledURI",
"ServoElementSnapshot",

View file

@ -28,6 +28,7 @@ use gecko_bindings::structs::ComputedTimingFunction_BeforeFlag;
use gecko_bindings::structs::FontFamilyList;
use gecko_bindings::structs::FontFamilyType;
use gecko_bindings::structs::FontSizePrefs;
use gecko_bindings::structs::GeckoFontMetrics;
use gecko_bindings::structs::Keyframe;
use gecko_bindings::structs::ServoBundledURI;
use gecko_bindings::structs::ServoElementSnapshot;
@ -1076,6 +1077,12 @@ extern "C" {
extern "C" {
pub fn Gecko_GetBaseSize(lang: *mut nsIAtom) -> FontSizePrefs;
}
extern "C" {
pub fn Gecko_GetFontMetrics(pres_context: RawGeckoPresContextBorrowed,
is_vertical: bool, font: *const nsStyleFont,
font_size: nscoord, use_user_font_set: bool)
-> GeckoFontMetrics;
}
extern "C" {
pub fn Gecko_GetMediaFeatures() -> *const nsMediaFeature;
}

View file

@ -27213,6 +27213,33 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct GeckoFontMetrics {
pub mChSize: root::nscoord,
pub mXSize: root::nscoord,
}
#[test]
fn bindgen_test_layout_GeckoFontMetrics() {
assert_eq!(::std::mem::size_of::<GeckoFontMetrics>() , 8usize , concat
! ( "Size of: " , stringify ! ( GeckoFontMetrics ) ));
assert_eq! (::std::mem::align_of::<GeckoFontMetrics>() , 4usize ,
concat ! (
"Alignment of " , stringify ! ( GeckoFontMetrics ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const GeckoFontMetrics ) ) . mChSize as *
const _ as usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
, "::" , stringify ! ( mChSize ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const GeckoFontMetrics ) ) . mXSize as *
const _ as usize } , 4usize , concat ! (
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
, "::" , stringify ! ( mXSize ) ));
}
impl Clone for GeckoFontMetrics {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nsROCSSPrimitiveValue([u8; 0]);
#[repr(C)]

View file

@ -26554,6 +26554,33 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct GeckoFontMetrics {
pub mChSize: root::nscoord,
pub mXSize: root::nscoord,
}
#[test]
fn bindgen_test_layout_GeckoFontMetrics() {
assert_eq!(::std::mem::size_of::<GeckoFontMetrics>() , 8usize , concat
! ( "Size of: " , stringify ! ( GeckoFontMetrics ) ));
assert_eq! (::std::mem::align_of::<GeckoFontMetrics>() , 4usize ,
concat ! (
"Alignment of " , stringify ! ( GeckoFontMetrics ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const GeckoFontMetrics ) ) . mChSize as *
const _ as usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
, "::" , stringify ! ( mChSize ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const GeckoFontMetrics ) ) . mXSize as *
const _ as usize } , 4usize , concat ! (
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
, "::" , stringify ! ( mXSize ) ));
}
impl Clone for GeckoFontMetrics {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nsROCSSPrimitiveValue([u8; 0]);
#[repr(C)]