Bug 1026033, part 2 - Make StyleRule::mImportantRule into an nsRefPtr. r=bz

This commit is contained in:
Andrew McCreight 2014-06-26 09:29:04 -07:00
Родитель d0c431f013
Коммит 844759f440
2 изменённых файлов: 2 добавлений и 6 удалений

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

@ -1307,7 +1307,6 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector,
: Rule(),
mSelector(aSelector),
mDeclaration(aDeclaration),
mImportantRule(nullptr),
mLineNumber(0),
mColumnNumber(0),
mWasMatched(false)
@ -1320,7 +1319,6 @@ StyleRule::StyleRule(const StyleRule& aCopy)
: Rule(aCopy),
mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nullptr),
mDeclaration(new Declaration(*aCopy.mDeclaration)),
mImportantRule(nullptr),
mLineNumber(aCopy.mLineNumber),
mColumnNumber(aCopy.mColumnNumber),
mWasMatched(false)
@ -1334,7 +1332,6 @@ StyleRule::StyleRule(StyleRule& aCopy,
: Rule(aCopy),
mSelector(aCopy.mSelector),
mDeclaration(aDeclaration),
mImportantRule(nullptr),
mDOMRule(aCopy.mDOMRule.forget()),
mLineNumber(aCopy.mLineNumber),
mColumnNumber(aCopy.mColumnNumber),
@ -1360,7 +1357,6 @@ StyleRule::~StyleRule()
{
delete mSelector;
delete mDeclaration;
NS_IF_RELEASE(mImportantRule);
if (mDOMRule) {
mDOMRule->DOMDeclaration()->DropReference();
}
@ -1390,7 +1386,7 @@ StyleRule::RuleMatched()
mWasMatched = true;
mDeclaration->SetImmutable();
if (mDeclaration->HasImportantData()) {
NS_ADDREF(mImportantRule = new ImportantRule(mDeclaration));
mImportantRule = new ImportantRule(mDeclaration);
}
}
}

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

@ -374,7 +374,7 @@ private:
private:
nsCSSSelectorList* mSelector; // null for style attribute
Declaration* mDeclaration;
ImportantRule* mImportantRule; // initialized by RuleMatched
nsRefPtr<ImportantRule> mImportantRule; // initialized by RuleMatched
nsRefPtr<DOMCSSStyleRule> mDOMRule;
// Keep the same type so that MSVC packs them.
uint32_t mLineNumber;