mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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:
parent
8553690088
commit
9b92d0bc3a
1 changed files with 6 additions and 4 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue