Bug 1188721 - Part 17: Remove unused nsStyleContext::ClearCachedInheritedStyleData. r?dbaron draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 23 Mar 2016 17:36:00 +1100
changeset 343767 200210f1b5893cb08dba7ae490bb501c9d7454b3
parent 343766 311b3583c49ce79fccc5a22d9bd16600bb0c0a53
child 343768 9209a7d7ddce3c20e3eabbfc4961a4f09ae6c19f
push id13680
push usercmccormack@mozilla.com
push dateWed, 23 Mar 2016 06:36:18 +0000
reviewersdbaron
bugs1188721
milestone48.0a1
Bug 1188721 - Part 17: Remove unused nsStyleContext::ClearCachedInheritedStyleData. r?dbaron MozReview-Commit-ID: 65B2fxsFo12
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -1382,80 +1382,16 @@ nsStyleContext::LookupStruct(const nsACS
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
   else
     return false;
   return true;
 }
 #endif
 
-void
-nsStyleContext::ClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs)
-{
-  if (mChild) {
-    nsStyleContext* child = mChild;
-    do {
-      child->DoClearCachedInheritedStyleDataOnDescendants(aStructs);
-      child = child->mNextSibling;
-    } while (mChild != child);
-  }
-  if (mEmptyChild) {
-    nsStyleContext* child = mEmptyChild;
-    do {
-      child->DoClearCachedInheritedStyleDataOnDescendants(aStructs);
-      child = child->mNextSibling;
-    } while (mEmptyChild != child);
-  }
-}
-
-void
-nsStyleContext::DoClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs)
-{
-  NS_ASSERTION(mFrameRefCnt == 0, "frame still referencing style context");
-  for (nsStyleStructID i = nsStyleStructID_Inherited_Start;
-       i < nsStyleStructID_Inherited_Start + nsStyleStructID_Inherited_Count;
-       i = nsStyleStructID(i + 1)) {
-    uint32_t bit = nsCachedStyleData::GetBitForSID(i);
-    if (aStructs & bit) {
-      nsStyleStruct* data = mCachedInheritedData.GetStyleData(i);
-      if (!(mBits & bit) && data) {
-        aStructs &= ~bit;
-      } else {
-        if (mCachedInheritedData.ClearStyleData(i)) {
-          nsStyleStruct::Destroy(data, i, mRuleNode->PresContext());
-        }
-      }
-    }
-  }
-
-  if (mCachedResetData) {
-    for (nsStyleStructID i = nsStyleStructID_Reset_Start;
-         i < nsStyleStructID_Reset_Start + nsStyleStructID_Reset_Count;
-         i = nsStyleStructID(i + 1)) {
-      uint32_t bit = nsCachedStyleData::GetBitForSID(i);
-      if (aStructs & bit) {
-        nsStyleStruct* data = mCachedResetData->GetStyleData(i);
-        if (!(mBits & bit) && data) {
-          aStructs &= ~bit;
-        } else {
-          if (mCachedResetData->ClearStyleData(i)) {
-            nsStyleStruct::Destroy(data, i, mRuleNode->PresContext());
-          }
-        }
-      }
-    }
-  }
-
-  if (aStructs == 0) {
-    return;
-  }
-
-  ClearCachedInheritedStyleDataOnDescendants(aStructs);
-}
-
 #ifdef RESTYLE_LOGGING
 nsCString
 nsStyleContext::GetCachedStyleDataAsString(uint32_t aStructs)
 {
   nsCString structs;
   for (nsStyleStructID i = nsStyleStructID(0);
        i < nsStyleStructID_Length;
        i = nsStyleStructID(i + 1)) {
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -389,22 +389,16 @@ public:
    * Moves this style context to a new parent.
    *
    * This function violates style context tree immutability, and
    * is a very low-level function and should only be used after verifying
    * many conditions that make it safe to call.
    */
   void MoveTo(nsStyleContext* aNewParent);
 
-  /**
-   * On each descendant of this style context, clears out any cached inherited
-   * structs indicated in aStructs.
-   */
-  void ClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs);
-
 #ifdef DEBUG
   void List(FILE* out, int32_t aIndent, bool aListDescendants = true);
   static void AssertStyleStructMaxDifferenceValid();
   static const char* StructName(nsStyleStructID aSID);
   static bool LookupStruct(const nsACString& aName, nsStyleStructID& aResult);
 #endif
 
 #ifdef RESTYLE_LOGGING
@@ -512,19 +506,16 @@ private:
       /* Have the rulenode deal */                                      \
       AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_);                      \
       return mRuleNode->GetStyle##name_<aComputeData>(this);            \
     }
   #include "nsStyleStructList.h"
   #undef STYLE_STRUCT_RESET
   #undef STYLE_STRUCT_INHERITED
 
-  // Helper for ClearCachedInheritedStyleDataOnDescendants.
-  void DoClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs);
-
 #ifdef DEBUG
   void AssertStructsNotUsedElsewhere(nsStyleContext* aDestroyingContext,
                                      int32_t aLevels) const;
 #endif
 
 #ifdef RESTYLE_LOGGING
   void LogStyleContextTree(bool aFirst, uint32_t aStructs);