Loading layout/style/nsStyleContext.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,16 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent, mRuleNode->AddRef(); mRuleNode->SetUsedDirectly(); // before ApplyStyleFixups()! if (!mParent) { // Add as a root before ApplyStyleFixups, since ApplyStyleFixups // can trigger rule tree GC. nsStyleSet* styleSet = mRuleNode->PresContext()->PresShell()->StyleSet()->GetAsGecko(); if (styleSet) { styleSet->AddStyleContextRoot(this); } } ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup); #define eStyleStruct_LastItem (nsStyleStructID_Length - 1) Loading layout/style/nsStyleSet.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -973,9 +973,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, NS_NewStyleContext(parentIfVisited, aPseudoTag, aPseudoType, aVisitedRuleNode, aFlags & eSkipParentDisplayBasedStyleFixup); if (!parentIfVisited) { mRoots.AppendElement(resultIfVisited); } resultIfVisited->SetIsStyleIfVisited(); result->SetStyleIfVisited(resultIfVisited.forget()); Loading @@ -983,9 +980,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, result->AddStyleBit(NS_STYLE_RELEVANT_LINK_VISITED); } } if (!aParentContext) { mRoots.AppendElement(result); } } else { NS_ASSERTION(result->GetPseudoType() == aPseudoType, "Unexpected type"); Loading Loading @@ -2224,6 +2218,16 @@ nsStyleSet::Shutdown() static const uint32_t kGCInterval = 300; // Notification that a style context with a null parent has been created. void nsStyleSet::AddStyleContextRoot(nsStyleContext* aStyleContext) { // aStyleContext has not been fully initialized, but its parent and // rule node are correct. MOZ_ASSERT(!aStyleContext->GetParent()); mRoots.AppendElement(aStyleContext); } void nsStyleSet::NotifyStyleContextDestroyed(nsStyleContext* aStyleContext) { Loading layout/style/nsStyleSet.h +5 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,11 @@ class nsStyleSet final // Free all of the data associated with this style set. void Shutdown(); // Notification that a style context with a null parent has been created. // The argument is a style context that has not been fully initialized, // but its parent and rule node are correct. void AddStyleContextRoot(nsStyleContext* aStyleContext); // Notification that a style context is being destroyed. void NotifyStyleContextDestroyed(nsStyleContext* aStyleContext); Loading Loading
layout/style/nsStyleContext.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,16 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent, mRuleNode->AddRef(); mRuleNode->SetUsedDirectly(); // before ApplyStyleFixups()! if (!mParent) { // Add as a root before ApplyStyleFixups, since ApplyStyleFixups // can trigger rule tree GC. nsStyleSet* styleSet = mRuleNode->PresContext()->PresShell()->StyleSet()->GetAsGecko(); if (styleSet) { styleSet->AddStyleContextRoot(this); } } ApplyStyleFixups(aSkipParentDisplayBasedStyleFixup); #define eStyleStruct_LastItem (nsStyleStructID_Length - 1) Loading
layout/style/nsStyleSet.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -973,9 +973,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, NS_NewStyleContext(parentIfVisited, aPseudoTag, aPseudoType, aVisitedRuleNode, aFlags & eSkipParentDisplayBasedStyleFixup); if (!parentIfVisited) { mRoots.AppendElement(resultIfVisited); } resultIfVisited->SetIsStyleIfVisited(); result->SetStyleIfVisited(resultIfVisited.forget()); Loading @@ -983,9 +980,6 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, result->AddStyleBit(NS_STYLE_RELEVANT_LINK_VISITED); } } if (!aParentContext) { mRoots.AppendElement(result); } } else { NS_ASSERTION(result->GetPseudoType() == aPseudoType, "Unexpected type"); Loading Loading @@ -2224,6 +2218,16 @@ nsStyleSet::Shutdown() static const uint32_t kGCInterval = 300; // Notification that a style context with a null parent has been created. void nsStyleSet::AddStyleContextRoot(nsStyleContext* aStyleContext) { // aStyleContext has not been fully initialized, but its parent and // rule node are correct. MOZ_ASSERT(!aStyleContext->GetParent()); mRoots.AppendElement(aStyleContext); } void nsStyleSet::NotifyStyleContextDestroyed(nsStyleContext* aStyleContext) { Loading
layout/style/nsStyleSet.h +5 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,11 @@ class nsStyleSet final // Free all of the data associated with this style set. void Shutdown(); // Notification that a style context with a null parent has been created. // The argument is a style context that has not been fully initialized, // but its parent and rule node are correct. void AddStyleContextRoot(nsStyleContext* aStyleContext); // Notification that a style context is being destroyed. void NotifyStyleContextDestroyed(nsStyleContext* aStyleContext); Loading