Skip to content

Commit

Permalink
stylo: Add FFI function to check if a node is dirty.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Dec 3, 2016
1 parent 106a538 commit a079e86
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -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();
Expand Down

0 comments on commit a079e86

Please sign in to comment.