From 245517d97777c0d18e689ffe2532e42b0912a6f0 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 31 May 2017 08:33:03 +0900 Subject: [PATCH] Bug 1361938 - Introduce a dirty flag that represents DeclarationBlock has been modified but not restyled. r=heycam MozReview-Commit-ID: 757XcVxSvQn --HG-- extra : rebase_source : 5f51f4447ba504e0e5448ef9316b7729f9a52bbd --- layout/style/DeclarationBlock.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/layout/style/DeclarationBlock.h b/layout/style/DeclarationBlock.h index b26b7ddbc18f..6c6118d04106 100644 --- a/layout/style/DeclarationBlock.h +++ b/layout/style/DeclarationBlock.h @@ -32,7 +32,12 @@ class DeclarationBlock { protected: explicit DeclarationBlock(StyleBackendType aType) - : mImmutable(false), mType(aType) { mContainer.mRaw = 0; } + : mImmutable(false) + , mIsDirty(false) + , mType(aType) + { + mContainer.mRaw = 0; + } DeclarationBlock(const DeclarationBlock& aCopy) : DeclarationBlock(aCopy.mType) {} @@ -65,6 +70,21 @@ public: */ void SetImmutable() { mImmutable = true; } + /** + * Return whether |this| has been restyled after modified. + */ + bool IsDirty() const { return mIsDirty; } + + /** + * Mark this declaration as dirty. + */ + void SetDirty() { mIsDirty = true; } + + /** + * Mark this declaration as not dirty. + */ + void UnsetDirty() { mIsDirty = false; } + /** * Copy |this|, if necessary to ensure that it can be modified. */ @@ -136,6 +156,8 @@ private: // set when declaration put in the rule tree; bool mImmutable; + // True if this declaration has not been restyled after modified. + bool mIsDirty; const StyleBackendType mType; };