From 68c8808711faffe4d782054e02501b07a8da5943 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 26 Jul 2017 10:43:48 -0700 Subject: [PATCH] Get rid of the ForNewlyBoundElement mode. MozReview-Commit-ID: 1IRn2iaPnVc --- components/style/traversal_flags.rs | 3 --- ports/geckolib/glue.rs | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/components/style/traversal_flags.rs b/components/style/traversal_flags.rs index a7e23bd6daf..912e49300fa 100644 --- a/components/style/traversal_flags.rs +++ b/components/style/traversal_flags.rs @@ -20,8 +20,6 @@ bitflags! { const UnstyledChildrenOnly = 1 << 2, /// FIXME(bholley): This will go away. const ForReconstruct = 1 << 3, - /// FIXME(bholley): This will go away. - const ForNewlyBoundElement = 1 << 4, } } @@ -49,7 +47,6 @@ pub fn assert_traversal_flags_match() { ServoTraversalFlags_ForCSSRuleChanges => ForCSSRuleChanges, ServoTraversalFlags_UnstyledChildrenOnly => UnstyledChildrenOnly, ServoTraversalFlags_ForReconstruct => ForReconstruct, - ServoTraversalFlags_ForNewlyBoundElement => ForNewlyBoundElement, } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 2bcb8b68394..8e7b6effc18 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -291,14 +291,6 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, traversal_flags, unsafe { &*snapshots }); - if traversal_flags.contains(traversal_flags::ForNewlyBoundElement) { - // In this mode, we only ever restyle new elements, so there is no - // need for a post-traversal, and the borrow_data().unwrap() call below - // could panic, so we don't bother computing whether a post-traversal - // is required. - return false; - } - element.has_dirty_descendants() || element.has_animation_only_dirty_descendants() || element.borrow_data().unwrap().restyle.contains_restyle_data() @@ -2816,6 +2808,18 @@ pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed, data.styles.primary().clone().into() } +#[no_mangle] +pub extern "C" fn Servo_ResolveStyleAllowStale(element: RawGeckoElementBorrowed) + -> ServoStyleContextStrong +{ + let element = GeckoElement(element); + debug!("Servo_ResolveStyleAllowStale: {:?}", element); + let data = + element.borrow_data().expect("Resolving style on unstyled element"); + assert!(data.has_styles(), "Resolving style on unstyled element"); + data.styles.primary().clone().into() +} + #[no_mangle] pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed, pseudo_type: CSSPseudoElementType,