mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 898329 patch 1: Remove null-checks on oldContext and newContext and avoid manual reference counting. r=heycam
This commit is contained in:
parent
adc472405b
commit
bf823bc2af
@ -1730,8 +1730,7 @@ RestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
||||
// DO NOT verify the style tree before reparenting. The frame
|
||||
// tree has already been changed, so this check would just fail.
|
||||
nsStyleContext* oldContext = aFrame->StyleContext();
|
||||
// XXXbz can oldContext really ever be null?
|
||||
if (oldContext) {
|
||||
|
||||
nsRefPtr<nsStyleContext> newContext;
|
||||
nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
|
||||
bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
|
||||
@ -1905,7 +1904,7 @@ RestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2049,15 +2048,9 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
||||
// that the frame has the last reference to it, so AddRef it here.
|
||||
|
||||
nsChangeHint assumeDifferenceHint = NS_STYLE_HINT_NONE;
|
||||
// XXXbz oldContext should just be an nsRefPtr
|
||||
nsStyleContext* oldContext = mFrame->StyleContext();
|
||||
nsRefPtr<nsStyleContext> oldContext = mFrame->StyleContext();
|
||||
nsStyleSet* styleSet = mPresContext->StyleSet();
|
||||
|
||||
// XXXbz the nsIFrame constructor takes an nsStyleContext, so how
|
||||
// could oldContext be null?
|
||||
if (oldContext) {
|
||||
oldContext->AddRef();
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
bool wasFrameVisible = nsIPresShell::IsAccessibilityActive() ?
|
||||
oldContext->StyleVisibility()->IsVisible() : false;
|
||||
@ -2259,8 +2252,10 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(newContext, "failed to get new style context");
|
||||
if (newContext) {
|
||||
if (!newContext) {
|
||||
NS_RUNTIMEABORT("couldn't allocate new style context");
|
||||
}
|
||||
|
||||
if (!parentContext) {
|
||||
if (oldContext->RuleNode() == newContext->RuleNode() &&
|
||||
oldContext->IsLinkContext() == newContext->IsLinkContext() &&
|
||||
@ -2287,12 +2282,7 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
||||
mFrame->SetStyleContext(newContext);
|
||||
}
|
||||
}
|
||||
oldContext->Release();
|
||||
}
|
||||
else {
|
||||
NS_ERROR("resolve style context failed");
|
||||
newContext = oldContext; // new context failed, recover...
|
||||
}
|
||||
oldContext = nullptr;
|
||||
|
||||
// do additional contexts
|
||||
// XXXbz might be able to avoid selector matching here in some
|
||||
@ -2620,7 +2610,6 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user