Bug 852501 part 10. Make ProcessChildren infallible. r=dholbert

This commit is contained in:
Boris Zbarsky 2013-03-19 21:47:51 -04:00
Родитель de2a737b06
Коммит 2dbce7757a
2 изменённых файлов: 31 добавлений и 58 удалений

Просмотреть файл

@ -1910,8 +1910,6 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
nsStyleContext* const styleContext = aItem.mStyleContext;
const uint32_t nameSpaceID = aItem.mNameSpaceID;
nsresult rv = NS_OK;
// create the pseudo SC for the outer table as a child of the inner SC
nsRefPtr<nsStyleContext> outerStyleContext;
outerStyleContext = mPresShell->StyleSet()->
@ -1966,11 +1964,9 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
ConstructFramesFromItemList(aState, aItem.mChildItems,
innerFrame, childItems);
} else {
rv = ProcessChildren(aState, content, styleContext, innerFrame,
true, childItems, false, aItem.mPendingBinding);
ProcessChildren(aState, content, styleContext, innerFrame,
true, childItems, false, aItem.mPendingBinding);
}
// XXXbz what about cleaning up?
if (NS_FAILED(rv)) return rv;
nsFrameItems captionItems;
PullOutCaptionFrames(childItems, captionItems);
@ -1984,7 +1980,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
}
*aNewFrame = newFrame;
return rv;
return NS_OK;
}
nsresult
@ -2010,15 +2006,13 @@ nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState,
InitAndRestoreFrame(aState, content, aParentFrame, nullptr, newFrame);
nsFrameItems childItems;
nsresult rv = NS_OK;
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
childItems);
} else {
rv = ProcessChildren(aState, content, styleContext, newFrame,
true, childItems, false, aItem.mPendingBinding);
ProcessChildren(aState, content, styleContext, newFrame,
true, childItems, false, aItem.mPendingBinding);
}
if (NS_FAILED(rv)) return rv;
newFrame->SetInitialChildList(kPrincipalList, childItems);
aFrameItems.AddChild(newFrame);
@ -2116,7 +2110,6 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
InitAndRestoreFrame(aState, content, newFrame, nullptr, cellInnerFrame);
nsFrameItems childItems;
nsresult rv = NS_OK;
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
// Need to push ourselves as a float containing block.
// XXXbz it might be nice to work on getting the parent
@ -2133,18 +2126,10 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
childItems);
} else {
// Process the child content
rv = ProcessChildren(aState, content, styleContext, cellInnerFrame,
true, childItems, isBlock, aItem.mPendingBinding);
ProcessChildren(aState, content, styleContext, cellInnerFrame,
true, childItems, isBlock, aItem.mPendingBinding);
}
if (NS_FAILED(rv)) {
// Clean up
// XXXbz kids of this stuff need to be cleaned up too!
cellInnerFrame->Destroy();
newFrame->Destroy();
return rv;
}
cellInnerFrame->SetInitialChildList(kPrincipalList, childItems);
SetInitialSingleChild(newFrame, cellInnerFrame);
aFrameItems.AddChild(newFrame);
@ -3703,11 +3688,11 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
childItems);
} else {
// Process the child frames.
rv = ProcessChildren(aState, content, styleContext, newFrame,
!(bits & FCDATA_DISALLOW_GENERATED_CONTENT),
childItems,
(bits & FCDATA_ALLOW_BLOCK_STYLES) != 0,
aItem.mPendingBinding, possiblyLeafFrame);
ProcessChildren(aState, content, styleContext, newFrame,
!(bits & FCDATA_DISALLOW_GENERATED_CONTENT),
childItems,
(bits & FCDATA_ALLOW_BLOCK_STYLES) != 0,
aItem.mPendingBinding, possiblyLeafFrame);
}
#ifdef MOZ_XUL
@ -4691,8 +4676,6 @@ nsCSSFrameConstructor::ConstructOuterSVG(nsFrameConstructorState& aState,
nsIContent* const content = aItem.mContent;
nsStyleContext* const styleContext = aItem.mStyleContext;
nsresult rv = NS_OK;
// Create the nsSVGOuterSVGFrame:
nsIFrame* newFrame = NS_NewSVGOuterSVGFrame(mPresShell, styleContext);
@ -4731,17 +4714,15 @@ nsCSSFrameConstructor::ConstructOuterSVG(nsFrameConstructorState& aState,
ConstructFramesFromItemList(aState, aItem.mChildItems,
innerFrame, childItems);
} else {
rv = ProcessChildren(aState, content, styleContext, innerFrame,
true, childItems, false, aItem.mPendingBinding);
ProcessChildren(aState, content, styleContext, innerFrame,
true, childItems, false, aItem.mPendingBinding);
}
// XXXbz what about cleaning up?
if (NS_FAILED(rv)) return rv;
// Set the inner wrapper frame's initial primary list
innerFrame->SetInitialChildList(kPrincipalList, childItems);
*aNewFrame = newFrame;
return rv;
return NS_OK;
}
// Only outer <svg> elements can be floated or positioned. All other SVG
@ -9909,7 +9890,7 @@ nsCSSFrameConstructor::ConstructFramesFromItemList(nsFrameConstructorState& aSta
"Should have proccessed it by now");
}
nsresult
void
nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
nsIContent* aContent,
nsStyleContext* aStyleContext,
@ -9950,7 +9931,6 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
aPendingBinding);
FrameConstructionItemList itemsToConstruct;
nsresult rv = NS_OK;
// If we have first-letter or first-line style then frames can get
// moved around so don't set these flags.
@ -10107,8 +10087,6 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
aFrame->AddStateBits(NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK);
}
return rv;
}
//----------------------------------------------------------------------
@ -11044,14 +11022,13 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
// Process the child content
nsFrameItems childItems;
nsresult rv;
rv = ProcessChildren(aState, aContent, aStyleContext, blockFrame, true,
childItems, true, aPendingBinding);
ProcessChildren(aState, aContent, aStyleContext, blockFrame, true,
childItems, true, aPendingBinding);
// Set the frame's initial child list
blockFrame->SetInitialChildList(kPrincipalList, childItems);
return rv;
return NS_OK;
}
nsresult
@ -12214,13 +12191,9 @@ nsCSSFrameConstructor::GenerateChildFrames(nsIFrame* aFrame)
// We don't have a parent frame with a pending binding constructor here,
// so no need to worry about ordering of the kids' constructors with it.
// Pass null for the PendingBinding.
nsresult rv = ProcessChildren(state, aFrame->GetContent(), aFrame->StyleContext(),
aFrame, false, childItems, false,
nullptr);
if (NS_FAILED(rv)) {
EndUpdate();
return rv;
}
ProcessChildren(state, aFrame->GetContent(), aFrame->StyleContext(),
aFrame, false, childItems, false,
nullptr);
aFrame->SetInitialChildList(kPrincipalList, childItems);

Просмотреть файл

@ -1450,15 +1450,15 @@ private:
* test and the anonymous content creation. If null, aFrame will be
* used.
*/
nsresult ProcessChildren(nsFrameConstructorState& aState,
nsIContent* aContent,
nsStyleContext* aStyleContext,
nsIFrame* aFrame,
const bool aCanHaveGeneratedContent,
nsFrameItems& aFrameItems,
const bool aAllowBlockStyles,
PendingBinding* aPendingBinding,
nsIFrame* aPossiblyLeafFrame = nullptr);
void ProcessChildren(nsFrameConstructorState& aState,
nsIContent* aContent,
nsStyleContext* aStyleContext,
nsIFrame* aFrame,
const bool aCanHaveGeneratedContent,
nsFrameItems& aFrameItems,
const bool aAllowBlockStyles,
PendingBinding* aPendingBinding,
nsIFrame* aPossiblyLeafFrame = nullptr);
nsIFrame* GetFrameFor(nsIContent* aContent);