Make Servo_InheritComputedValues return the default computed values if the passed parent is null.

We could make two separate FFI functions for this, but in practice this is what
the callers are likely to want.
This commit is contained in:
Bobby Holley 2016-08-02 17:58:10 -07:00
parent 8553690088
commit 9b92d0bc3a

View file

@ -355,10 +355,12 @@ pub extern "C" fn Servo_GetComputedValuesForPseudoElement(parent_style: *mut Ser
pub extern "C" fn Servo_InheritComputedValues(parent_style: *mut ServoComputedValues)
-> *mut ServoComputedValues {
type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
Helpers::with(parent_style, |parent| {
let style = ComputedValues::inherit_from(parent);
Helpers::from(style)
})
let style = if parent_style.is_null() {
Arc::new(ComputedValues::initial_values().clone())
} else {
Helpers::with(parent_style, ComputedValues::inherit_from)
};
Helpers::from(style)
}
#[no_mangle]