servo: Merge #20584 - style: Add an FFI function to see if an element is display: contents (from emilio:bye-undisplayed-maps); r=bz

Bug: 1303605
Reviewed-by: bz
Source-Repo: https://github.com/servo/servo
Source-Revision: a35c9e71a3d5d9ef87de4cfba542117a280014e1

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 226530d7f19f66bf7d5ee399fce94a29cb0fb9b9
This commit is contained in:
Emilio Cobos Álvarez 2018-04-07 07:54:41 -04:00
Родитель 74a6eccce8
Коммит 295a8f58b3
1 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@ -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);