mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
Auto merge of #17532 - bholley:set_explicit_style, r=emilio
stylo: Attach styles explicitly to generated content https://bugzilla.mozilla.org/show_bug.cgi?id=1376245 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17532) <!-- Reviewable:end -->
This commit is contained in:
commit
12ff92592f
1 changed files with 22 additions and 0 deletions
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue