style: Remove unnecessary TraversalFlags::FOR_DEFAULT_STYLES. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 10 Jul 2017 14:31:44 +0200
changeset 606879 cc041d32e158ca22446e1cf27a03222e6b8476d3
parent 606878 b7978e7869a4f215f172654cf97bfc670ef7fe96
child 606880 5fbf3ecf37903a7f61dd352ba636146140ed0412
push id67817
push userbmo:emilio+bugs@crisal.io
push dateTue, 11 Jul 2017 14:32:38 +0000
milestone56.0a1
style: Remove unnecessary TraversalFlags::FOR_DEFAULT_STYLES. Yay MozReview-Commit-ID: JiWTEz63AlE
servo/components/style/traversal.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/traversal.rs
+++ b/servo/components/style/traversal.rs
@@ -37,18 +37,16 @@ bitflags! {
         const ANIMATION_ONLY = 0x02,
         /// Traverse without generating any change hints.
         const FOR_RECONSTRUCT = 0x04,
         /// Traverse triggered by CSS rule changes.
         ///
         /// Traverse and update all elements with CSS animations since
         /// @keyframes rules may have changed
         const FOR_CSS_RULE_CHANGES = 0x08,
-        /// Only include user agent style sheets when selector matching.
-        const FOR_DEFAULT_STYLES = 0x10,
     }
 }
 
 impl TraversalFlags {
     /// Returns true if the traversal is for animation-only restyles.
     pub fn for_animation_only(&self) -> bool {
         self.contains(ANIMATION_ONLY)
     }
@@ -62,22 +60,16 @@ impl TraversalFlags {
     pub fn for_reconstruct(&self) -> bool {
         self.contains(FOR_RECONSTRUCT)
     }
 
     /// Returns true if the traversal is triggered by CSS rule changes.
     pub fn for_css_rule_changes(&self) -> bool {
         self.contains(FOR_CSS_RULE_CHANGES)
     }
-
-    /// Returns true if the traversal is to compute the default computed styles
-    /// for an element.
-    pub fn for_default_styles(&self) -> bool {
-        self.contains(FOR_DEFAULT_STYLES)
-    }
 }
 
 /// This structure exists to enforce that callers invoke pre_traverse, and also
 /// to pass information from the pre-traversal into the primary traversal.
 pub struct PreTraverseToken {
     traverse: bool,
     unstyled_children_only: bool,
 }
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -108,17 +108,17 @@ use style::stylesheets::{NamespaceRule, 
 use style::stylesheets::StylesheetContents;
 use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
 use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
 use style::stylesheets::supports_rule::parse_condition_or_declaration;
 use style::stylist::RuleInclusion;
 use style::thread_state;
 use style::timer::Timer;
 use style::traversal::{ANIMATION_ONLY, DomTraversal, FOR_CSS_RULE_CHANGES, FOR_RECONSTRUCT};
-use style::traversal::{FOR_DEFAULT_STYLES, TraversalDriver, TraversalFlags, UNSTYLED_CHILDREN_ONLY};
+use style::traversal::{TraversalDriver, TraversalFlags, UNSTYLED_CHILDREN_ONLY};
 use style::traversal::resolve_style;
 use style::values::{CustomIdent, KeyframesName};
 use style::values::computed::Context;
 use style_traits::{PARSING_MODE_DEFAULT, ToCss};
 use super::error_reporter::ErrorReporter;
 use super::stylesheet_loader::StylesheetLoader;
 
 /*
@@ -2792,26 +2792,21 @@ pub extern "C" fn Servo_ResolveStyleLazi
                 None
             }
         });
         if let Some(result) = styles {
             return result.into_strong();
         }
     }
 
-    let traversal_flags = match rule_inclusion {
-        RuleInclusion::All => TraversalFlags::empty(),
-        RuleInclusion::DefaultOnly => FOR_DEFAULT_STYLES,
-    };
-
     // We don't have the style ready. Go ahead and compute it as necessary.
     let shared = create_shared_context(&global_style_data,
                                        &guard,
                                        &data,
-                                       traversal_flags,
+                                       TraversalFlags::empty(),
                                        unsafe { &*snapshots });
     let mut tlc = ThreadLocalStyleContext::new(&shared);
     let mut context = StyleContext {
         shared: &shared,
         thread_local: &mut tlc,
     };
 
     let styles = resolve_style(&mut context, element, rule_inclusion);