mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Bug 1325878: Support deep-cloning of ServoMediaLists. r=xidorn
MozReview-Commit-ID: K7NFe1tKrAZ Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
2999222436
commit
27ca9e0a46
2 changed files with 10 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue