зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1258017 - Use a RefPtr to hold onto the parent style context. r=dbaron
This commit is contained in:
Родитель
175d2d488e
Коммит
101992426a
|
@ -106,7 +106,6 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
|||
mNextSibling = this;
|
||||
mPrevSibling = this;
|
||||
if (mParent) {
|
||||
mParent->AddRef();
|
||||
mParent->AddChild(this);
|
||||
#ifdef DEBUG
|
||||
nsRuleNode *r1 = mParent->RuleNode(), *r2 = aRuleNode;
|
||||
|
@ -177,7 +176,6 @@ nsStyleContext::~nsStyleContext()
|
|||
|
||||
if (mParent) {
|
||||
mParent->RemoveChild(this);
|
||||
mParent->Release();
|
||||
}
|
||||
|
||||
// Free up our data structs.
|
||||
|
@ -335,25 +333,18 @@ nsStyleContext::MoveTo(nsStyleContext* aNewParent)
|
|||
MOZ_ASSERT(!aNewParent->IsStyleIfVisited());
|
||||
MOZ_ASSERT(!mStyleIfVisited || mStyleIfVisited->mParent == mParent);
|
||||
|
||||
nsStyleContext* oldParent = mParent;
|
||||
|
||||
if (oldParent->HasChildThatUsesResetStyle()) {
|
||||
if (mParent->HasChildThatUsesResetStyle()) {
|
||||
aNewParent->AddStyleBit(NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE);
|
||||
}
|
||||
|
||||
aNewParent->AddRef();
|
||||
mParent->RemoveChild(this);
|
||||
mParent = aNewParent;
|
||||
mParent->AddChild(this);
|
||||
oldParent->Release();
|
||||
|
||||
if (mStyleIfVisited) {
|
||||
oldParent = mStyleIfVisited->mParent;
|
||||
aNewParent->AddRef();
|
||||
mStyleIfVisited->mParent->RemoveChild(mStyleIfVisited);
|
||||
mStyleIfVisited->mParent = aNewParent;
|
||||
mStyleIfVisited->mParent->AddChild(mStyleIfVisited);
|
||||
oldParent->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1570,7 +1561,7 @@ nsStyleContext::LogStyleContextTree(bool aFirst, uint32_t aStructs)
|
|||
|
||||
nsCString parent;
|
||||
if (aFirst) {
|
||||
parent.AppendPrintf("parent=%p ", mParent);
|
||||
parent.AppendPrintf("parent=%p ", mParent.get());
|
||||
}
|
||||
|
||||
LOG_RESTYLE("%p(%d) %s%s%s%s",
|
||||
|
|
|
@ -560,7 +560,7 @@ private:
|
|||
bool ShouldLogRestyle() { return true; }
|
||||
#endif
|
||||
|
||||
nsStyleContext* mParent; // STRONG
|
||||
RefPtr<nsStyleContext> mParent;
|
||||
|
||||
// Children are kept in two circularly-linked lists. The list anchor
|
||||
// is not part of the list (null for empty), and we point to the first
|
||||
|
|
Загрузка…
Ссылка в новой задаче