Bug 1415940 Part 2: Give StyleSheet a dirty flag of MODIFIED_RULES, and a method to test it.
MozReview-Commit-ID: D52NghCopH2
--- 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;