stylo: Add FFI function to check if a node is dirty.

This commit is contained in:
Cameron McCormack 2016-12-03 14:53:31 +08:00
parent 106a538e7e
commit a079e86820

View file

@ -202,6 +202,23 @@ pub extern "C" fn Servo_Element_ClearData(element: RawGeckoElementBorrowed) -> (
GeckoElement(element).clear_data();
}
#[no_mangle]
pub extern "C" fn Servo_Element_ShouldTraverse(element: RawGeckoElementBorrowed) -> bool {
let element = GeckoElement(element);
if let Some(data) = element.get_data() {
debug_assert!(!element.has_dirty_descendants(),
"only call Servo_Element_ShouldTraverse if you know the element \
does not have dirty descendants");
match *data.borrow() {
ElementData::Initial(None) |
ElementData::Restyle(..) => true,
_ => false,
}
} else {
false
}
}
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetStrong {
let url = ServoUrl::parse("about:blank").unwrap();