mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
stylo: Assert our stuff properly.
MozReview-Commit-ID: KBrJtWcoKp8
This commit is contained in:
parent
f9642b36bd
commit
3000326885
1 changed files with 7 additions and 9 deletions
|
@ -2770,20 +2770,18 @@ pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
|
pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
|
||||||
raw_data: RawServoStyleSetBorrowed)
|
_raw_data: RawServoStyleSetBorrowed)
|
||||||
-> ServoComputedValuesStrong
|
-> ServoComputedValuesStrong
|
||||||
{
|
{
|
||||||
let element = GeckoElement(element);
|
let element = GeckoElement(element);
|
||||||
debug!("Servo_ResolveStyle: {:?}", element);
|
debug!("Servo_ResolveStyle: {:?}", element);
|
||||||
let data = unsafe { element.ensure_data() }.borrow();
|
let data =
|
||||||
|
element.borrow_data().expect("Resolving style on unstyled element");
|
||||||
if !element.has_current_styles(&*data) {
|
|
||||||
debug_assert!(false, "Resolving style on element without current styles with lazy \
|
|
||||||
computation forbidden.");
|
|
||||||
let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
|
||||||
return per_doc_data.default_computed_values().clone().into_strong();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO(emilio): Downgrade to debug assertions when close to release.
|
||||||
|
assert!(data.has_styles(), "Resolving style on unstyled element");
|
||||||
|
assert!(element.has_current_styles(&*data),
|
||||||
|
"Resolving style on element without current styles");
|
||||||
data.styles.primary().clone().into_strong()
|
data.styles.primary().clone().into_strong()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue