aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/build_gecko.rs2
-rw-r--r--components/style/gecko/conversions.rs14
-rw-r--r--ports/geckolib/glue.rs16
3 files changed, 30 insertions, 2 deletions
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index 8c97abaddd2..2be69e79861 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -588,6 +588,7 @@ mod bindings {
"RawGeckoElement",
"RawGeckoKeyframeList",
"RawGeckoComputedKeyframeValuesList",
+ "RawGeckoFontFaceRuleList",
"RawGeckoNode",
"RawGeckoAnimationValueList",
"RawServoAnimationValue",
@@ -706,6 +707,7 @@ mod bindings {
"RawGeckoAnimationValueList",
"RawGeckoKeyframeList",
"RawGeckoComputedKeyframeValuesList",
+ "RawGeckoFontFaceRuleList",
];
for &ty in structs_types.iter() {
builder = builder.hide_type(ty)
diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs
index 15a58b65cca..87052c942d0 100644
--- a/components/style/gecko/conversions.rs
+++ b/components/style/gecko/conversions.rs
@@ -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_InitializeImageCropRect;
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 stylesheets::RulesMutateError;
+use stylesheets::{Origin, RulesMutateError};
use values::computed::{CalcLengthOrPercentage, Gradient, Image, LengthOrPercentage, LengthOrPercentageOrAuto};
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,
+ }
+ }
+}
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs
index 318932d82ca..e9f7c92c9e0 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -43,6 +43,7 @@ use style::gecko_bindings::bindings::{nsACString, nsAString};
use style::gecko_bindings::bindings::Gecko_AnimationAppendKeyframe;
use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
+use style::gecko_bindings::bindings::RawGeckoFontFaceRuleListBorrowedMut;
use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowed;
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
@@ -1743,3 +1744,18 @@ pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSet
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();
+ }
+}