mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
Hand the already-resolved style directly to servo when creating generated content.
This commit is contained in:
parent
8cb8089665
commit
8ab65d1731
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]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_HasAuthorSpecifiedRules(element: RawGeckoElementBorrowed,
|
pub extern "C" fn Servo_HasAuthorSpecifiedRules(element: RawGeckoElementBorrowed,
|
||||||
rule_type_mask: u32,
|
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
|
/// 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
|
/// the pres context (hint: the context outlives the StyleSet, that holds the
|
||||||
/// device alive).
|
/// device alive).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue