Remove Borrowed<T>/BorrowedMut<T>, use Option<&T> instead.

This commit is contained in:
Manish Goregaokar 2016-10-04 15:01:49 +05:30
parent fc251384a7
commit b416ccfcae
6 changed files with 41 additions and 171 deletions

View file

@ -252,7 +252,7 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
let pseudo = PseudoElement::from_atom_unchecked(atom, /* anon_box = */ true);
let maybe_parent = parent_style_or_null.as_arc_opt();
let maybe_parent = ComputedValues::arc_from_borrowed(&parent_style_or_null);
let new_computed = data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent);
new_computed.map_or(Strong::null(), |c| c.into_strong())
}
@ -309,10 +309,11 @@ pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoCo
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_Inherit(parent_style: ServoComputedValuesBorrowedOrNull)
-> ServoComputedValuesStrong {
let style = if parent_style.is_null() {
Arc::new(ComputedValues::initial_values().clone())
let maybe_arc = ComputedValues::arc_from_borrowed(&parent_style);
let style = if let Some(reference) = maybe_arc.as_ref() {
ComputedValues::inherit_from(reference)
} else {
ComputedValues::inherit_from(parent_style.as_arc())
Arc::new(ComputedValues::initial_values().clone())
};
style.into_strong()
}