Bug 1464060: Remove a bunch of unused style bits. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 24 May 2018 15:03:17 +0200
changeset 800035 6801f794b87735a993e8d49dbbf99529ce023eb2
parent 800034 bfee6972f362a8f5aa5fad57415a2c5fe3daa6d6
child 800036 f45c68fefaa86056ac315413657884aea392131c
push id111238
push userbmo:emilio@crisal.io
push dateFri, 25 May 2018 19:10:29 +0000
reviewersxidorn
bugs1464060
milestone62.0a1
Bug 1464060: Remove a bunch of unused style bits. r?xidorn MozReview-Commit-ID: FLACqfSHfSO
layout/style/ComputedStyle.h
servo/components/layout/construct.rs
servo/components/style/properties/computed_value_flags.rs
servo/components/style/properties/properties.mako.rs
servo/components/style/style_adjuster.rs
servo/ports/geckolib/glue.rs
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -41,35 +41,20 @@
 // See ComputedStyle::HasTextDecorationLines
 #define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
 // See ComputedStyle::HasPseudoElementData.
 #define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA   0x002000000
 // See ComputedStyle::RelevantLinkIsVisited
 #define NS_STYLE_RELEVANT_LINK_VISITED     0x004000000
 // See ComputedStyle::IsStyleIfVisited
 #define NS_STYLE_IS_STYLE_IF_VISITED       0x008000000
-// See ComputedStyle::HasChildThatUsesGrandancestorStyle
-#define NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE 0x010000000
-// See ComputedStyle::IsShared
-#define NS_STYLE_IS_SHARED                 0x020000000
-// See ComputedStyle::AssertStructsNotUsedElsewhere
-// (This bit is currently only used in #ifdef DEBUG code.)
-#define NS_STYLE_IS_GOING_AWAY             0x040000000
 // See ComputedStyle::ShouldSuppressLineBreak
 #define NS_STYLE_SUPPRESS_LINEBREAK        0x080000000
-// See ComputedStyle::IsInDisplayNoneSubtree
-#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE   0x100000000
-// See ComputedStyle::FindChildWithRules
-#define NS_STYLE_INELIGIBLE_FOR_SHARING    0x200000000
-// See ComputedStyle::HasChildThatUsesResetStyle
-#define NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE 0x400000000
 // See ComputedStyle::IsTextCombined
 #define NS_STYLE_IS_TEXT_COMBINED          0x800000000
-// Whether a ComputedStyle is a Gecko or Servo context
-#define NS_STYLE_CONTEXT_IS_GECKO          0x1000000000
 // See ComputedStyle::GetPseudoEnum
 #define NS_STYLE_CONTEXT_TYPE_SHIFT        37
 
 class nsAtom;
 enum nsChangeHint : uint32_t;
 class nsIPresShell;
 class nsPresContext;
 class nsWindowSizes;
@@ -181,17 +166,16 @@ public:
   }
 
   bool IsAnonBox() const {
     return IsInheritingAnonBox() || IsNonInheritingAnonBox();
   }
 
   bool IsPseudoElement() const { return mPseudoTag && !IsAnonBox(); }
 
-
   // Does this ComputedStyle or any of its ancestors have text
   // decoration lines?
   // Differs from nsStyleTextReset::HasTextDecorationLines, which tests
   // only the data for a single context.
   bool HasTextDecorationLines() const
     { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATION_LINES); }
 
   // Whether any line break inside should be suppressed? If this returns
@@ -199,74 +183,39 @@ public:
   // as if nowrap is set, <br> is suppressed, and blocks are inlinized.
   // This bit is propogated to all children of line partitipants. It is
   // currently used by ruby to make its content frames unbreakable.
   // NOTE: for nsTextFrame, use nsTextFrame::ShouldSuppressLineBreak()
   // instead of this method.
   bool ShouldSuppressLineBreak() const
     { return !!(mBits & NS_STYLE_SUPPRESS_LINEBREAK); }
 
-  // Does this ComputedStyle or any of its ancestors have display:none set?
-  bool IsInDisplayNoneSubtree() const
-    { return !!(mBits & NS_STYLE_IN_DISPLAY_NONE_SUBTREE); }
-
   // Is this horizontal-in-vertical (tate-chu-yoko) text? This flag is
   // only set on ComputedStyles whose pseudo is nsCSSAnonBoxes::mozText.
   bool IsTextCombined() const
     { return !!(mBits & NS_STYLE_IS_TEXT_COMBINED); }
 
   // Does this ComputedStyle represent the style for a pseudo-element or
   // inherit data from such a ComputedStyle?  Whether this returns true
   // is equivalent to whether it or any of its ancestors returns
   // non-null for IsPseudoElement().
   bool HasPseudoElementData() const
     { return !!(mBits & NS_STYLE_HAS_PSEUDO_ELEMENT_DATA); }
 
-  bool HasChildThatUsesResetStyle() const
-    { return mBits & NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE; }
-
   // Is the only link whose visitedness is allowed to influence the
   // style of the node this ComputedStyle is for (which is that element
   // or its nearest ancestor that is a link) visited?
   bool RelevantLinkVisited() const
     { return !!(mBits & NS_STYLE_RELEVANT_LINK_VISITED); }
 
-  // Is this a ComputedStyle for a link?
-  inline bool IsLinkContext() const;
-
   // Is this ComputedStyle the GetStyleIfVisited() for some other style
   // context?
   bool IsStyleIfVisited() const
     { return !!(mBits & NS_STYLE_IS_STYLE_IF_VISITED); }
 
-  // Tells this ComputedStyle that it should return true from
-  // IsStyleIfVisited.
-  void SetIsStyleIfVisited()
-    { mBits |= NS_STYLE_IS_STYLE_IF_VISITED; }
-
-  // Does any descendant of this ComputedStyle have any style values
-  // that were computed based on this ComputedStyle's ancestors?
-  bool HasChildThatUsesGrandancestorStyle() const
-    { return !!(mBits & NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE); }
-
-  // Is this ComputedStyle shared with a sibling or cousin?
-  // (See nsStyleSet::GetContext.)
-  bool IsShared() const
-    { return !!(mBits & NS_STYLE_IS_SHARED); }
-
-  /**
-   * Returns whether this ComputedStyle has cached style data for a
-   * given style struct and it does NOT own that struct.  This can
-   * happen because it was inherited from the parent ComputedStyle, or
-   * because it was stored conditionally on the rule node.
-   */
-  bool HasCachedDependentStyleData(nsStyleStructID aSID) {
-    return mBits & GetBitForSID(aSID);
-  }
-
   ComputedStyle* GetCachedInheritingAnonBoxStyle(nsAtom* aAnonBox) const
   {
     MOZ_ASSERT(nsCSSAnonBoxes::IsInheritingAnonBox(aAnonBox));
     return mCachedInheritingStyles.Lookup(aAnonBox);
   }
 
   void SetCachedInheritedAnonBoxStyle(nsAtom* aAnonBox, ComputedStyle* aStyle)
   {
--- a/servo/components/layout/construct.rs
+++ b/servo/components/layout/construct.rs
@@ -1528,18 +1528,21 @@ impl<'a, ConcreteThreadSafeLayoutNode> P
     //
     // TODO: This should actually consult the table in that section to get the
     // final computed value for 'display'.
     fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) {
         node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
 
         let style = node.style(self.style_context());
 
-        // Bail out if this node has an ancestor with display: none.
-        if style.is_in_display_none_subtree() {
+        // Bail out if this node has display: none.
+        //
+        // We shouldn't try to construct flows for nodes in this subtree, the
+        // style system guarantees this.
+        if style.get_box().display.is_none() {
             self.set_flow_construction_result(node, ConstructionResult::None);
             return;
         }
 
         // Get the `display` property for this node, and determine whether this node is floated.
         let (display, float, positioning) = match node.type_id() {
             None => {
                 // Pseudo-element.
--- a/servo/components/style/properties/computed_value_flags.rs
+++ b/servo/components/style/properties/computed_value_flags.rs
@@ -36,20 +36,16 @@ bitflags! {
 
         /// A flag used to mark styles under a relevant link that is also
         /// visited.
         const IS_RELEVANT_LINK_VISITED = 1 << 3;
 
         /// A flag used to mark styles which are a pseudo-element or under one.
         const IS_IN_PSEUDO_ELEMENT_SUBTREE = 1 << 4;
 
-        /// A flag used to mark styles which are in a display: none subtree, or
-        /// under one.
-        const IS_IN_DISPLAY_NONE_SUBTREE = 1 << 5;
-
         /// Whether this style inherits the `display` property.
         ///
         /// This is important because it may affect our optimizations to avoid
         /// computing the style of pseudo-elements, given whether the
         /// pseudo-element is generated depends on the `display` value.
         const INHERITS_DISPLAY = 1 << 6;
 
         /// Whether this style inherits the `content` property.
@@ -72,17 +68,16 @@ bitflags! {
 
 impl ComputedValueFlags {
     /// Flags that are unconditionally propagated to descendants.
     #[inline]
     fn inherited_flags() -> Self {
         ComputedValueFlags::IS_STYLE_IF_VISITED |
         ComputedValueFlags::IS_RELEVANT_LINK_VISITED |
         ComputedValueFlags::CAN_BE_FRAGMENTED |
-        ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE |
         ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE |
         ComputedValueFlags::HAS_TEXT_DECORATION_LINES
     }
 
     /// Flags that may be propagated to descendants.
     #[inline]
     fn maybe_inherited_flags() -> Self {
         Self::inherited_flags() | ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -2532,23 +2532,16 @@ impl ComputedValues {
         self.visited_style.as_ref().map(|s| &**s)
     }
 
     /// Returns the visited rules, if applicable.
     pub fn visited_rules(&self) -> Option<<&StrongRuleNode> {
         self.visited_style.as_ref().and_then(|s| s.rules.as_ref())
     }
 
-    /// Returns whether we're in a display: none subtree.
-    pub fn is_in_display_none_subtree(&self) -> bool {
-        use properties::computed_value_flags::ComputedValueFlags;
-
-        self.flags.contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE)
-    }
-
     /// Gets a reference to the custom properties map (if one exists).
     pub fn custom_properties(&self) -> Option<<&Arc<::custom_properties::CustomPropertiesMap>> {
         self.custom_properties.as_ref()
     }
 }
 
 #[cfg(feature = "servo")]
 impl ComputedValues {
--- a/servo/components/style/style_adjuster.rs
+++ b/servo/components/style/style_adjuster.rs
@@ -199,22 +199,16 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
                 .clone_text_decoration_line()
                 .is_empty()
         {
             self.style
                 .flags
                 .insert(ComputedValueFlags::HAS_TEXT_DECORATION_LINES);
         }
 
-        if display == Display::None {
-            self.style
-                .flags
-                .insert(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE);
-        }
-
         if self.style.is_pseudo_element() {
             self.style
                 .flags
                 .insert(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE);
         }
 
         #[cfg(feature = "servo")]
         {
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -3112,19 +3112,16 @@ pub extern "C" fn Servo_ComputedValues_G
         result |= structs::NS_STYLE_SUPPRESS_LINEBREAK as u64;
     }
     if flags.contains(ComputedValueFlags::IS_TEXT_COMBINED) {
         result |= structs::NS_STYLE_IS_TEXT_COMBINED as u64;
     }
     if flags.contains(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE) {
         result |= structs::NS_STYLE_HAS_PSEUDO_ELEMENT_DATA as u64;
     }
-    if flags.contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE) {
-        result |= structs::NS_STYLE_IN_DISPLAY_NONE_SUBTREE as u64;
-    }
     result
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
     values: ComputedStyleBorrowed,
 ) -> bool {
     let b = values.get_box();