Bug 1343078 part 5. Change the restyle manager to handle style contexts with no parent in ReparentStyleContext (by doing nothing with them). r=dbaron

MozReview-Commit-ID: 9a89RV8mKYn

--HG--
extra : rebase_source : 8641a122cd5e8f91589757a2878256a0bd675aff
This commit is contained in:
Boris Zbarsky 2017-03-08 00:18:39 -05:00
parent 71f35d2571
commit 3cfe8ca0d3

View File

@ -866,13 +866,6 @@ GeckoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
newParentContext = providerFrame->StyleContext();
providerChild = providerFrame;
}
NS_ASSERTION(newParentContext, "Reparenting something that has no usable"
" parent? Shouldn't happen!");
// XXX need to do something here to produce the correct style context for
// an IB split whose first inline part is inside a first-line frame.
// Currently the first IB anonymous block's style context takes the first
// part's style context as parent, which is wrong since first-line style
// should not apply to the anonymous block.
#ifdef DEBUG
{
@ -898,6 +891,28 @@ GeckoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
}
#endif
if (!newParentContext && !oldContext->GetParent()) {
// No need to do anything here.
#ifdef DEBUG
// Make sure we have no children, so we really know there is nothing to do.
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
MOZ_ASSERT(lists.CurrentList().IsEmpty(),
"Failing to reparent style context for child of "
"non-inheriting anon box");
}
#endif // DEBUG
return NS_OK;
}
NS_ASSERTION(newParentContext, "Reparenting something that has no usable"
" parent? Shouldn't happen!");
// XXX need to do something here to produce the correct style context for
// an IB split whose first inline part is inside a first-line frame.
// Currently the first IB anonymous block's style context takes the first
// part's style context as parent, which is wrong since first-line style
// should not apply to the anonymous block.
nsIFrame* prevContinuation =
GetPrevContinuationWithPossiblySameStyle(aFrame);
nsStyleContext* prevContinuationContext;