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
This commit is contained in:
Hiroyuki Ikezoe 2017-05-31 08:33:03 +09:00
Родитель 121e35f3d5
Коммит 245517d977
1 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -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;
};