geckolib: Make Servo_DeclarationBlock_RemovePropertyById return whether it did remove a property.

This commit is contained in:
Cameron McCormack 2017-10-19 15:49:08 +08:00
parent 89c1892b30
commit 01ed7fe4dd
2 changed files with 13 additions and 8 deletions

View file

@ -2732,7 +2732,7 @@ extern "C" {
pub fn Servo_DeclarationBlock_RemovePropertyById(declarations:
RawServoDeclarationBlockBorrowed,
property:
nsCSSPropertyID);
nsCSSPropertyID) -> bool;
}
extern "C" {
pub fn Servo_DeclarationBlock_HasCSSWideKeyword(declarations:

View file

@ -2606,10 +2606,13 @@ pub unsafe extern "C" fn Servo_DeclarationBlock_SetPropertyById(
)
}
fn remove_property(declarations: RawServoDeclarationBlockBorrowed, property_id: PropertyId) {
fn remove_property(
declarations: RawServoDeclarationBlockBorrowed,
property_id: PropertyId
) -> bool {
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
decls.remove_property(&property_id);
});
decls.remove_property(&property_id)
})
}
#[no_mangle]
@ -2617,13 +2620,15 @@ pub unsafe extern "C" fn Servo_DeclarationBlock_RemoveProperty(
declarations: RawServoDeclarationBlockBorrowed,
property: *const nsACString,
) {
remove_property(declarations, get_property_id_from_property!(property, ()))
remove_property(declarations, get_property_id_from_property!(property, ()));
}
#[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_RemovePropertyById(declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID) {
remove_property(declarations, get_property_id_from_nscsspropertyid!(property, ()))
pub extern "C" fn Servo_DeclarationBlock_RemovePropertyById(
declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID
) -> bool {
remove_property(declarations, get_property_id_from_nscsspropertyid!(property, false))
}
#[no_mangle]