зеркало из https://github.com/mozilla/gecko-dev.git
No bug - re-use the mode_to_origin function. r=me
MozReview-Commit-ID: AcDR6KcrbWI
This commit is contained in:
Родитель
7063be7e1b
Коммит
a17751eb93
|
@ -1134,15 +1134,19 @@ pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeck
|
|||
data.flags.contains(data::ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetContentsStrong {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let origin = match mode {
|
||||
fn mode_to_origin(mode: SheetParsingMode) -> Origin {
|
||||
match mode {
|
||||
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
||||
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
||||
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
||||
SheetParsingMode::eSafeAgentSheetFeatures => Origin::UserAgent,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetContentsStrong {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let origin = mode_to_origin(mode);
|
||||
let shared_lock = &global_style_data.shared_lock;
|
||||
Arc::new(
|
||||
StylesheetContents::from_str(
|
||||
|
@ -1158,15 +1162,6 @@ pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyl
|
|||
).into_strong()
|
||||
}
|
||||
|
||||
fn mode_to_origin(mode: SheetParsingMode) -> Origin {
|
||||
match mode {
|
||||
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
||||
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
||||
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
||||
SheetParsingMode::eSafeAgentSheetFeatures => Origin::UserAgent,
|
||||
}
|
||||
}
|
||||
|
||||
/// Note: The load_data corresponds to this sheet, and is passed as the parent
|
||||
/// load data for child sheet loads. It may be null for certain cases where we
|
||||
/// know we won't have child loads.
|
||||
|
|
Загрузка…
Ссылка в новой задаче