mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #20584 - emilio:bye-undisplayed-maps, r=bz
style: Add an FFI function to see if an element is display: contents. Bug: 1303605 Reviewed-by: bz <!-- 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/20584) <!-- Reviewable:end -->
This commit is contained in:
commit
a35c9e71a3
1 changed files with 22 additions and 5 deletions
|
@ -1043,17 +1043,34 @@ pub extern "C" fn Servo_Element_GetPseudoComputedValues(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool {
|
||||
pub extern "C" fn Servo_Element_IsDisplayNone(
|
||||
element: RawGeckoElementBorrowed,
|
||||
) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
let data = element.get_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element");
|
||||
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.
|
||||
// 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]
|
||||
pub extern "C" fn Servo_Element_IsDisplayContents(
|
||||
element: RawGeckoElementBorrowed,
|
||||
) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
let data = element.get_data()
|
||||
.expect("Invoking Servo_Element_IsDisplayContents on unstyled element");
|
||||
|
||||
debug_assert!(is_main_thread());
|
||||
unsafe { &*data.as_ptr() }.styles.primary().get_box().clone_display().is_contents()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeckoElementBorrowed) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue