Bug 1415940 Part 3: Make StyleSheets clear their MODIFIED_RULES flag when the sheet is reparsed. r=bz
authorBrad Werth <bwerth@mozilla.com>
Thu, 11 Jan 2018 16:43:58 -0800
changeset 454370 e199a8c037689d3ecef2d3b5340ea62cdd1521a6
parent 454369 f76d80e4c6fb7d5c6a0efb90ea5bf6abf0693065
child 454371 544075fc480034ea90a404790688e3666a07181f
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1415940
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415940 Part 3: Make StyleSheets clear their MODIFIED_RULES flag when the sheet is reparsed. r=bz MozReview-Commit-ID: F7g2CstgjT8
layout/style/CSSStyleSheet.cpp
layout/style/ServoStyleSheet.cpp
layout/style/StyleSheet.h
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -925,12 +925,16 @@ CSSStyleSheet::ReparseSheet(const nsAStr
   for (int32_t index = 0; index < Inner()->mOrderedRules.Count(); ++index) {
     RefPtr<css::Rule> rule = Inner()->mOrderedRules.ObjectAt(index);
     if (rule->GetType() == css::Rule::IMPORT_RULE &&
         RuleHasPendingChildSheet(rule)) {
       continue; // notify when loaded (see StyleSheetLoaded)
     }
     RuleAdded(*rule);
   }
+
+  // Our rules are no longer considered modified.
+  ClearModifiedRules();
+
   return NS_OK;
 }
 
 } // namespace mozilla
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -323,16 +323,19 @@ ServoStyleSheet::ReparseSheet(const nsAS
           RuleHasPendingChildSheet(rule)) {
         continue; // notify when loaded (see StyleSheetLoaded)
       }
 
       RuleAdded(*rule);
     }
   }
 
+  // Our rules are no longer considered modified.
+  ClearModifiedRules();
+
   return NS_OK;
 }
 
 // nsICSSLoaderObserver implementation
 NS_IMETHODIMP
 ServoStyleSheet::StyleSheetLoaded(StyleSheet* aSheet,
                                   bool aWasAlternate,
                                   nsresult aStatus)
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -131,16 +131,17 @@ public:
                                              dom::CSSImportRule* aCloneOwnerRule,
                                              nsIDocument* aCloneDocument,
                                              nsINode* aCloneOwningNode) const = 0;
 
   bool HasForcedUniqueInner() const { return mDirtyFlags &
                                              FORCED_UNIQUE_INNER; }
   bool HasModifiedRules() const { return mDirtyFlags &
                                          MODIFIED_RULES; }
+  void ClearModifiedRules() { mDirtyFlags &= ~MODIFIED_RULES; }
 
   inline bool HasUniqueInner() const;
   void EnsureUniqueInner();
 
   // Append all of this sheet's child sheets to aArray.
   void AppendAllChildSheets(nsTArray<StyleSheet*>& aArray);
 
   // style sheet owner info