diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index d92dd324f99..9409b464f15 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -20,7 +20,7 @@ pub use servo::media_queries::{Device, Expression}; pub use gecko::media_queries::{Device, Expression}; /// A type that encapsulates a media query list. -#[derive(Debug)] +#[derive(Debug, Clone)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct MediaList { /// The list of media queries. diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 4ef2f0ac43e..97f519cf0f7 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1194,11 +1194,19 @@ pub extern "C" fn Servo_DeclarationBlock_RemovePropertyById(declarations: RawSer #[no_mangle] pub extern "C" fn Servo_MediaList_Create() -> RawServoMediaListStrong { - let global_style_data = &*GLOBAL_STYLE_DATA; Arc::new(global_style_data.shared_lock.wrap(MediaList::default())).into_strong() } +#[no_mangle] +pub extern "C" fn Servo_MediaList_DeepClone(list: RawServoMediaListBorrowed) -> RawServoMediaListStrong { + let global_style_data = &*GLOBAL_STYLE_DATA; + read_locked_arc(list, |list: &MediaList| { + Arc::new(global_style_data.shared_lock.wrap(list.clone())) + .into_strong() + }) +} + #[no_mangle] pub extern "C" fn Servo_MediaList_Matches(list: RawServoMediaListBorrowed, raw_data: RawServoStyleSetBorrowed)