style: Allow placeholder import sheets.

This is necessary because we can't create GeckoStyleSheets off-main-thread,
so we need a placeholder until it can be filled in.

Bug: 1454030
Reviewed-by: emilio
MozReview-Commit-ID: ssRme4fLYg
This commit is contained in:
Bobby Holley 2018-02-20 15:52:13 -08:00 committed by Emilio Cobos Álvarez
parent 441f1cd231
commit afe484e46b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 152 additions and 71 deletions

View file

@ -2048,7 +2048,7 @@ pub extern "C" fn Servo_ImportRule_GetSheet(
rule: RawServoImportRuleBorrowed,
) -> *const ServoStyleSheet {
read_locked_arc(rule, |rule: &ImportRule| {
rule.stylesheet.0.raw() as *const ServoStyleSheet
rule.stylesheet.as_sheet().unwrap().raw() as *const ServoStyleSheet
})
}

View file

@ -55,9 +55,8 @@ impl StyleStylesheetLoader for StylesheetLoader {
debug_assert!(!child_sheet.is_null(),
"Import rules should always have a strong sheet");
let stylesheet = unsafe {
ImportSheet(GeckoStyleSheet::from_addrefed(child_sheet))
};
let sheet = unsafe { GeckoStyleSheet::from_addrefed(child_sheet) };
let stylesheet = ImportSheet::new(sheet);
Arc::new(lock.wrap(ImportRule { url, source_location, stylesheet }))
}
}