зеркало из https://github.com/mozilla/gecko-dev.git
Bug 738007: Minor code cleanup in nsCSSFrameConstructor::FlushAccumulatedBlock. r=bz
This commit is contained in:
Родитель
263497d709
Коммит
eb7905baea
|
@ -3770,24 +3770,26 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
|
||||
if (NS_SUCCEEDED(rv) && (bits & FCDATA_WRAP_KIDS_IN_BLOCKS)) {
|
||||
nsFrameItems newItems;
|
||||
nsFrameItems currentBlock;
|
||||
nsFrameItems currentBlockItems;
|
||||
nsIFrame* f;
|
||||
while ((f = childItems.FirstChild()) != nsnull) {
|
||||
bool wrapFrame = IsInlineFrame(f) || IsFrameSpecial(f);
|
||||
if (!wrapFrame) {
|
||||
rv = FlushAccumulatedBlock(aState, content, newFrame, ¤tBlock, &newItems);
|
||||
rv = FlushAccumulatedBlock(aState, content, newFrame,
|
||||
currentBlockItems, newItems);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
}
|
||||
|
||||
childItems.RemoveFrame(f);
|
||||
if (wrapFrame) {
|
||||
currentBlock.AddChild(f);
|
||||
currentBlockItems.AddChild(f);
|
||||
} else {
|
||||
newItems.AddChild(f);
|
||||
}
|
||||
}
|
||||
rv = FlushAccumulatedBlock(aState, content, newFrame, ¤tBlock, &newItems);
|
||||
rv = FlushAccumulatedBlock(aState, content, newFrame,
|
||||
currentBlockItems, newItems);
|
||||
|
||||
if (childItems.NotEmpty()) {
|
||||
// an error must have occurred, delete unprocessed frames
|
||||
|
@ -4569,39 +4571,42 @@ nsresult
|
|||
nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsFrameItems* aBlockItems,
|
||||
nsFrameItems* aNewItems)
|
||||
nsFrameItems& aBlockItems,
|
||||
nsFrameItems& aNewItems)
|
||||
{
|
||||
if (aBlockItems->IsEmpty()) {
|
||||
if (aBlockItems.IsEmpty()) {
|
||||
// Nothing to do
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAtom* anonPseudo = nsCSSAnonBoxes::mozMathMLAnonymousBlock;
|
||||
|
||||
nsStyleContext* parentContext =
|
||||
nsFrame::CorrectStyleParentFrame(aParentFrame,
|
||||
nsCSSAnonBoxes::mozMathMLAnonymousBlock)->GetStyleContext();
|
||||
nsStyleSet *styleSet = mPresShell->StyleSet();
|
||||
anonPseudo)->GetStyleContext();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
nsRefPtr<nsStyleContext> blockContext;
|
||||
blockContext = styleSet->
|
||||
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozMathMLAnonymousBlock,
|
||||
parentContext);
|
||||
ResolveAnonymousBoxStyle(anonPseudo, parentContext);
|
||||
|
||||
|
||||
// then, create a block frame that will wrap the child frames. Make it a
|
||||
// MathML frame so that Get(Absolute/Float)ContainingBlockFor know that this
|
||||
// is not a suitable block.
|
||||
nsIFrame* blockFrame = NS_NewMathMLmathBlockFrame(mPresShell, blockContext,
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
nsIFrame* blockFrame =
|
||||
NS_NewMathMLmathBlockFrame(mPresShell, blockContext,
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
if (NS_UNLIKELY(!blockFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, blockFrame);
|
||||
ReparentFrames(this, blockFrame, *aBlockItems);
|
||||
ReparentFrames(this, blockFrame, aBlockItems);
|
||||
// abs-pos and floats are disabled in MathML children so we don't have to
|
||||
// worry about messing up those.
|
||||
blockFrame->SetInitialChildList(kPrincipalList, *aBlockItems);
|
||||
NS_ASSERTION(aBlockItems->IsEmpty(), "What happened?");
|
||||
aBlockItems->Clear();
|
||||
aNewItems->AddChild(blockFrame);
|
||||
blockFrame->SetInitialChildList(kPrincipalList, aBlockItems);
|
||||
NS_ASSERTION(aBlockItems.IsEmpty(), "What happened?");
|
||||
aBlockItems.Clear();
|
||||
aNewItems.AddChild(blockFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1308,8 +1308,8 @@ private:
|
|||
nsresult FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsFrameItems* aBlockItems,
|
||||
nsFrameItems* aNewItems);
|
||||
nsFrameItems& aBlockItems,
|
||||
nsFrameItems& aNewItems);
|
||||
|
||||
// Function to find FrameConstructionData for aContent. Will return
|
||||
// null if aContent is not MathML.
|
||||
|
|
Загрузка…
Ссылка в новой задаче