Deep clone ServoStyleSheets.

MozReview-Commit-ID: 6hYIcOa86Y
This commit is contained in:
Brad Werth 2017-05-22 12:55:43 -07:00 committed by Brad Werth
parent bb310efbb9
commit 31584e3c14
9 changed files with 221 additions and 10 deletions

View file

@ -792,6 +792,12 @@ pub extern "C" fn Servo_StyleSheet_GetRules(sheet: RawServoStyleSheetBorrowed) -
Stylesheet::as_arc(&sheet).rules.clone().into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_Clone(raw_sheet: RawServoStyleSheetBorrowed) -> RawServoStyleSheetStrong {
let sheet: &Arc<Stylesheet> = HasArcFFI::as_arc(&raw_sheet);
Arc::new(sheet.as_ref().clone()).into_strong()
}
fn read_locked_arc<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
{