mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
Provide @font-face rules for stylo backend.
This commit is contained in:
parent
01e986f2e6
commit
0a57dbc110
3 changed files with 30 additions and 2 deletions
|
@ -588,6 +588,7 @@ mod bindings {
|
||||||
"RawGeckoElement",
|
"RawGeckoElement",
|
||||||
"RawGeckoKeyframeList",
|
"RawGeckoKeyframeList",
|
||||||
"RawGeckoComputedKeyframeValuesList",
|
"RawGeckoComputedKeyframeValuesList",
|
||||||
|
"RawGeckoFontFaceRuleList",
|
||||||
"RawGeckoNode",
|
"RawGeckoNode",
|
||||||
"RawGeckoAnimationValueList",
|
"RawGeckoAnimationValueList",
|
||||||
"RawServoAnimationValue",
|
"RawServoAnimationValue",
|
||||||
|
@ -706,6 +707,7 @@ mod bindings {
|
||||||
"RawGeckoAnimationValueList",
|
"RawGeckoAnimationValueList",
|
||||||
"RawGeckoKeyframeList",
|
"RawGeckoKeyframeList",
|
||||||
"RawGeckoComputedKeyframeValuesList",
|
"RawGeckoComputedKeyframeValuesList",
|
||||||
|
"RawGeckoFontFaceRuleList",
|
||||||
];
|
];
|
||||||
for &ty in structs_types.iter() {
|
for &ty in structs_types.iter() {
|
||||||
builder = builder.hide_type(ty)
|
builder = builder.hide_type(ty)
|
||||||
|
|
|
@ -13,9 +13,9 @@ use gecko::values::{convert_rgba_to_nscolor, GeckoStyleCoordConvertible};
|
||||||
use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue, Gecko_SetUrlImageValue};
|
use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue, Gecko_SetUrlImageValue};
|
||||||
use gecko_bindings::bindings::Gecko_InitializeImageCropRect;
|
use gecko_bindings::bindings::Gecko_InitializeImageCropRect;
|
||||||
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nsStyleImage};
|
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nsStyleImage};
|
||||||
use gecko_bindings::structs::nsresult;
|
use gecko_bindings::structs::{nsresult, SheetType};
|
||||||
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordDataMut};
|
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordDataMut};
|
||||||
use stylesheets::RulesMutateError;
|
use stylesheets::{Origin, RulesMutateError};
|
||||||
use values::computed::{CalcLengthOrPercentage, Gradient, Image, LengthOrPercentage, LengthOrPercentageOrAuto};
|
use values::computed::{CalcLengthOrPercentage, Gradient, Image, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||||
|
|
||||||
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
|
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
|
||||||
|
@ -503,3 +503,13 @@ impl From<RulesMutateError> for nsresult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Origin> for SheetType {
|
||||||
|
fn from(other: Origin) -> Self {
|
||||||
|
match other {
|
||||||
|
Origin::UserAgent => SheetType::Agent,
|
||||||
|
Origin::Author => SheetType::Doc,
|
||||||
|
Origin::User => SheetType::User,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ use style::gecko_bindings::bindings::{nsACString, nsAString};
|
||||||
use style::gecko_bindings::bindings::Gecko_AnimationAppendKeyframe;
|
use style::gecko_bindings::bindings::Gecko_AnimationAppendKeyframe;
|
||||||
use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
|
use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
|
||||||
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
|
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
|
||||||
|
use style::gecko_bindings::bindings::RawGeckoFontFaceRuleListBorrowedMut;
|
||||||
use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
|
use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
|
||||||
use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowed;
|
use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowed;
|
||||||
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
|
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
|
||||||
|
@ -1743,3 +1744,18 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn Servo_StyleSet_GetFontFaceRules(raw_data: RawServoStyleSetBorrowed,
|
||||||
|
rules: RawGeckoFontFaceRuleListBorrowedMut) {
|
||||||
|
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
|
debug_assert!(rules.len() == 0);
|
||||||
|
|
||||||
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
|
let guard = global_style_data.shared_lock.read();
|
||||||
|
|
||||||
|
unsafe { rules.set_len(data.font_faces.len() as u32) };
|
||||||
|
for (src, dest) in data.font_faces.iter().zip(rules.iter_mut()) {
|
||||||
|
dest.mRule = src.0.read_with(&guard).clone().forget();
|
||||||
|
dest.mSheetType = src.1.into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue