Bug 1415940 Part 2: Give StyleSheet a dirty flag of MODIFIED_RULES, and a method to test it. r=bz
authorBrad Werth <bwerth@mozilla.com>
Wed, 03 Jan 2018 15:02:43 -0800
changeset 454369 f76d80e4c6fb7d5c6a0efb90ea5bf6abf0693065
parent 454368 307642e5b5f4d2205ee2237bde0f8c79f18bc817
child 454370 e199a8c037689d3ecef2d3b5340ea62cdd1521a6
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 2: Give StyleSheet a dirty flag of MODIFIED_RULES, and a method to test it. r=bz MozReview-Commit-ID: D52NghCopH2
layout/style/StyleSheet.cpp
layout/style/StyleSheet.h
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -553,38 +553,41 @@ StyleSheet::DeleteRuleFromGroup(css::Gro
     current = current->mParent;                           \
   } while (current);                                      \
 } while (0)
 
 void
 StyleSheet::RuleAdded(css::Rule& aRule)
 {
   DidDirty();
+  mDirtyFlags |= MODIFIED_RULES;
   NOTIFY_STYLE_SETS(RuleAdded, (*this, aRule));
 
   if (mDocument) {
     mDocument->StyleRuleAdded(this, &aRule);
   }
 }
 
 void
 StyleSheet::RuleRemoved(css::Rule& aRule)
 {
   DidDirty();
+  mDirtyFlags |= MODIFIED_RULES;
   NOTIFY_STYLE_SETS(RuleRemoved, (*this, aRule));
 
   if (mDocument) {
     mDocument->StyleRuleRemoved(this, &aRule);
   }
 }
 
 void
 StyleSheet::RuleChanged(css::Rule* aRule)
 {
   DidDirty();
+  mDirtyFlags |= MODIFIED_RULES;
   NOTIFY_STYLE_SETS(RuleChanged, (*this, aRule));
 
   if (mDocument) {
     mDocument->StyleRuleChanged(this, aRule);
   }
 }
 
 nsresult
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -129,16 +129,18 @@ public:
 
   virtual already_AddRefed<StyleSheet> Clone(StyleSheet* aCloneParent,
                                              dom::CSSImportRule* aCloneOwnerRule,
                                              nsIDocument* aCloneDocument,
                                              nsINode* aCloneOwningNode) const = 0;
 
   bool HasForcedUniqueInner() const { return mDirtyFlags &
                                              FORCED_UNIQUE_INNER; }
+  bool HasModifiedRules() const { return 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
@@ -336,16 +338,17 @@ protected:
   // and/or useful in user sheets.
   css::SheetParsingMode mParsingMode;
 
   const StyleBackendType mType;
   bool                  mDisabled;
 
   enum dirtyFlagAttributes {
     FORCED_UNIQUE_INNER = 0x1,
+    MODIFIED_RULES = 0x2,
   };
   uint8_t mDirtyFlags; // has been modified
 
   // mDocumentAssociationMode determines whether mDocument directly owns us (in
   // the sense that if it's known-live then we're known-live).  Always
   // NotOwnedByDocument when mDocument is null.
   DocumentAssociationMode mDocumentAssociationMode;