diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index abf966ce937..8ccbcc84e71 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1024,8 +1024,13 @@ pub extern "C" fn Servo_Element_GetPseudoComputedValues(element: RawGeckoElement #[no_mangle] pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool { let element = GeckoElement(element); - let data = element.borrow_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element"); - data.styles.is_display_none() + let data = element.get_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element"); + + // This function is hot, so we bypass the AtomicRefCell. It would be nice to also assert that + // we're not in the servo traversal, but this function is called at various intermediate + // checkpoints when managing the traversal on the Gecko side. + debug_assert!(is_main_thread()); + unsafe { &*data.as_ptr() }.styles.is_display_none() } #[no_mangle]