Skip to content

Commit

Permalink
stylo: Make Servo_TraverseSubtree return whether a post-traversal is …
Browse files Browse the repository at this point in the history
…required.

MozReview-Commit-ID: 8EWxdt0pZ6W
  • Loading branch information
heycam committed Feb 10, 2017
1 parent 10994ea commit 57e1b25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/style/gecko_bindings/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ extern "C" {
extern "C" {
pub fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
set: RawServoStyleSetBorrowed,
root_behavior: TraversalRootBehavior);
root_behavior: TraversalRootBehavior) -> bool;
}
extern "C" {
pub fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed);
Expand Down
7 changes: 6 additions & 1 deletion ports/geckolib/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,19 @@ fn traverse_subtree(element: GeckoElement, raw_data: RawServoStyleSetBorrowed,
}
}

/// Traverses the subtree rooted at `root` for restyling. Returns whether a
/// Gecko post-traversal (to perform lazy frame construction, or consume any
/// RestyleData, or drop any ElementData) is required.
#[no_mangle]
pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
raw_data: RawServoStyleSetBorrowed,
behavior: structs::TraversalRootBehavior) -> () {
behavior: structs::TraversalRootBehavior) -> bool {
let element = GeckoElement(root);
debug!("Servo_TraverseSubtree: {:?}", element);
traverse_subtree(element, raw_data,
behavior == structs::TraversalRootBehavior::UnstyledChildrenOnly);

element.has_dirty_descendants() || element.mutate_data().unwrap().has_restyle()
}

#[no_mangle]
Expand Down

0 comments on commit 57e1b25

Please sign in to comment.