Hand the already-resolved style directly to servo when creating generated content.

This commit is contained in:
Bobby Holley 2017-06-25 22:16:18 -07:00
parent 8cb8089665
commit 8ab65d1731

View file

@ -1493,6 +1493,20 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
}
}
#[no_mangle]
pub extern "C" fn Servo_SetExplicitStyle(element: RawGeckoElementBorrowed,
style: ServoComputedValuesBorrowed)
{
let element = GeckoElement(element);
let style = ComputedValues::as_arc(&style);
debug!("Servo_SetExplicitStyle: {:?}", element);
// We only support this API for initial styling. There's no reason it couldn't
// work for other things, we just haven't had a reason to do so.
debug_assert!(element.get_data().is_none());
let mut data = unsafe { element.ensure_data() }.borrow_mut();
data.styles.primary = Some(style.clone());
}
#[no_mangle]
pub extern "C" fn Servo_HasAuthorSpecifiedRules(element: RawGeckoElementBorrowed,
rule_type_mask: u32,
@ -1627,6 +1641,14 @@ pub extern "C" fn Servo_ComputedValues_GetVisitedStyle(values: ServoComputedValu
}
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(values: ServoComputedValuesBorrowed)
-> bool {
let values = ComputedValues::as_arc(&values);
let b = values.get_box();
b.specifies_animations() || b.specifies_transitions()
}
/// See the comment in `Device` to see why it's ok to pass an owned reference to
/// the pres context (hint: the context outlives the StyleSet, that holds the
/// device alive).