mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #14446 - heycam:should-traverse, r=bholley
stylo: Add FFI function to check if a node is dirty. <!-- Please describe your changes on the following line: --> This is the Servo-side change from https://bugzilla.mozilla.org/show_bug.cgi?id=1321284, which has already been reviewed by bholley. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14446) <!-- Reviewable:end -->
This commit is contained in:
commit
c974b61d7f
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();
|
||||
}
|
||||
|
||||
#[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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue