mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
stylo: Add FFI function to check if a node is dirty.
This commit is contained in:
parent
106a538e7e
commit
a079e86820
1 changed files with 17 additions and 0 deletions
|
@ -202,6 +202,23 @@ pub extern "C" fn Servo_Element_ClearData(element: RawGeckoElementBorrowed) -> (
|
||||||
GeckoElement(element).clear_data();
|
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]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetStrong {
|
pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetStrong {
|
||||||
let url = ServoUrl::parse("about:blank").unwrap();
|
let url = ServoUrl::parse("about:blank").unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue