Bug 233463, patch 5 - Remove nsFrameList(nsIFrame*) ctor. r=bzbarsky

This commit is contained in:
Mats Palmgren
2009-09-18 13:09:36 +02:00
parent 927c863e0b
commit f85d73c25c
19 changed files with 69 additions and 83 deletions

View File

@@ -207,7 +207,7 @@ CreateBidiContinuation(nsIFrame* aFrame,
// The list name nsGkAtoms::nextBidi would indicate we don't want reflow // The list name nsGkAtoms::nextBidi would indicate we don't want reflow
// XXXbz this needs higher-level framelist love // XXXbz this needs higher-level framelist love
nsFrameList temp(*aNewFrame); nsFrameList temp(*aNewFrame, *aNewFrame);
rv = parent->InsertFrames(nsGkAtoms::nextBidi, aFrame, temp); rv = parent->InsertFrames(nsGkAtoms::nextBidi, aFrame, temp);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
@@ -229,7 +229,12 @@ IsFrameInCurrentLine(nsBlockInFlowLineIterator* aLineIter,
nsIFrame* endFrame = aLineIter->IsLastLineInList() ? nsnull : nsIFrame* endFrame = aLineIter->IsLastLineInList() ? nsnull :
aLineIter->GetLine().next()->mFirstChild; aLineIter->GetLine().next()->mFirstChild;
nsIFrame* startFrame = aPrevFrame ? aPrevFrame : aLineIter->GetLine()->mFirstChild; nsIFrame* startFrame = aPrevFrame ? aPrevFrame : aLineIter->GetLine()->mFirstChild;
return nsFrameList(startFrame).ContainsFrameBefore(aFrame, endFrame); for (nsIFrame* frame = startFrame; frame && frame != endFrame;
frame = frame->GetNextSibling()) {
if (frame == aFrame)
return PR_TRUE;
}
return PR_FALSE;
} }
static void static void

View File

@@ -614,7 +614,7 @@ inline void
SetInitialSingleChild(nsIFrame* aParent, nsIFrame* aFrame) SetInitialSingleChild(nsIFrame* aParent, nsIFrame* aFrame)
{ {
NS_PRECONDITION(!aFrame->GetNextSibling(), "Should be using a frame list"); NS_PRECONDITION(!aFrame->GetNextSibling(), "Should be using a frame list");
nsFrameList temp(aFrame); nsFrameList temp(aFrame, aFrame);
aParent->SetInitialChildList(nsnull, temp); aParent->SetInitialChildList(nsnull, temp);
} }
@@ -1500,15 +1500,14 @@ GetChildListNameFor(nsIFrame* aChildFrame)
// Verify that the frame is actually in that child list or in the // Verify that the frame is actually in that child list or in the
// corresponding overflow list. // corresponding overflow list.
nsIFrame* parent = aChildFrame->GetParent(); nsIFrame* parent = aChildFrame->GetParent();
PRBool found = nsFrameList(parent->GetFirstChild(listName)) PRBool found = parent->GetChildList(listName).ContainsFrame(aChildFrame);
.ContainsFrame(aChildFrame);
if (!found) { if (!found) {
if (!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { if (!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
found = nsFrameList(parent->GetFirstChild(nsGkAtoms::overflowList)) found = parent->GetChildList(nsGkAtoms::overflowList)
.ContainsFrame(aChildFrame); .ContainsFrame(aChildFrame);
} }
else if (aChildFrame->GetStyleDisplay()->IsFloating()) { else if (aChildFrame->GetStyleDisplay()->IsFloating()) {
found = nsFrameList(parent->GetFirstChild(nsGkAtoms::overflowOutOfFlowList)) found = parent->GetChildList(nsGkAtoms::overflowOutOfFlowList)
.ContainsFrame(aChildFrame); .ContainsFrame(aChildFrame);
} }
// else it's positioned and should have been on the 'listName' child list. // else it's positioned and should have been on the 'listName' child list.
@@ -2944,10 +2943,10 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
mHasRootAbsPosContainingBlock = PR_TRUE; mHasRootAbsPosContainingBlock = PR_TRUE;
} }
nsFrameList newFrameList(newFrame);
if (viewportFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) { if (viewportFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
viewportFrame->SetInitialChildList(nsnull, newFrameList); SetInitialSingleChild(viewportFrame, newFrame);
} else { } else {
nsFrameList newFrameList(newFrame, newFrame);
viewportFrame->AppendFrames(nsnull, newFrameList); viewportFrame->AppendFrames(nsnull, newFrameList);
} }
@@ -4399,7 +4398,7 @@ void
nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIFrame* aScrollFrame, nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIFrame* aScrollFrame,
nsIFrame* aScrolledFrame) nsIFrame* aScrolledFrame)
{ {
nsFrameList scrolled(aScrolledFrame); nsFrameList scrolled(aScrolledFrame, aScrolledFrame);
aScrollFrame->AppendFrames(nsnull, scrolled); aScrollFrame->AppendFrames(nsnull, scrolled);
// force the scrolled frame to have a view. The view will be parented to // force the scrolled frame to have a view. The view will be parented to
@@ -5692,9 +5691,8 @@ static nsIFrame*
FindAppendPrevSibling(nsIFrame* aParentFrame, nsIFrame* aAfterFrame) FindAppendPrevSibling(nsIFrame* aParentFrame, nsIFrame* aAfterFrame)
{ {
if (aAfterFrame) { if (aAfterFrame) {
nsFrameList childList(aParentFrame->GetFirstChild(nsnull));
NS_ASSERTION(aAfterFrame->GetParent() == aParentFrame, "Wrong parent"); NS_ASSERTION(aAfterFrame->GetParent() == aParentFrame, "Wrong parent");
return childList.GetPrevSiblingFor(aAfterFrame); return aParentFrame->GetChildList(nsnull).GetPrevSiblingFor(aAfterFrame);
} }
return aParentFrame->GetLastChild(nsnull); return aParentFrame->GetLastChild(nsnull);
@@ -10346,7 +10344,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// so just doing a linear search for the prevSibling is ok. // so just doing a linear search for the prevSibling is ok.
// 3) Trying to use FindPreviousSibling will fail if the first-letter is in // 3) Trying to use FindPreviousSibling will fail if the first-letter is in
// anonymous content (eg generated content). // anonymous content (eg generated content).
nsFrameList siblingList(parentFrame->GetFirstChild(nsnull)); const nsFrameList& siblingList(parentFrame->GetChildList(nsnull));
NS_ASSERTION(siblingList.ContainsFrame(placeholderFrame), NS_ASSERTION(siblingList.ContainsFrame(placeholderFrame),
"Placeholder not in parent's principal child list?"); "Placeholder not in parent's principal child list?");
nsIFrame* prevSibling = siblingList.GetPrevSiblingFor(placeholderFrame); nsIFrame* prevSibling = siblingList.GetPrevSiblingFor(placeholderFrame);
@@ -10367,7 +10365,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
aFrameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame); aFrameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
// Insert text frame in its place // Insert text frame in its place
nsFrameList textList(newTextFrame); nsFrameList textList(newTextFrame, newTextFrame);
aFrameManager->InsertFrames(parentFrame, nsnull, prevSibling, textList); aFrameManager->InsertFrames(parentFrame, nsnull, prevSibling, textList);
return NS_OK; return NS_OK;
@@ -10413,7 +10411,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
aFrameManager->RemoveFrame(aFrame, nsnull, kid); aFrameManager->RemoveFrame(aFrame, nsnull, kid);
// Insert text frame in its place // Insert text frame in its place
nsFrameList textList(textFrame); nsFrameList textList(textFrame, textFrame);
aFrameManager->InsertFrames(aFrame, nsnull, prevSibling, textList); aFrameManager->InsertFrames(aFrame, nsnull, prevSibling, textList);
*aStopLooking = PR_TRUE; *aStopLooking = PR_TRUE;

View File

@@ -494,11 +494,7 @@ nsFrameIterator::GetFirstChildInner(nsIFrame* aFrame) {
nsIFrame* nsIFrame*
nsFrameIterator::GetLastChildInner(nsIFrame* aFrame) { nsFrameIterator::GetLastChildInner(nsIFrame* aFrame) {
nsIFrame* child = aFrame->GetFirstChild(nsnull); return aFrame->GetChildList(nsnull).LastChild();
if (!child)
return nsnull;
nsFrameList list(child);
return list.LastChild();
} }
nsIFrame* nsIFrame*
@@ -511,8 +507,7 @@ nsFrameIterator::GetPrevSiblingInner(nsIFrame* aFrame) {
nsIFrame* parent = GetParentFrame(aFrame); nsIFrame* parent = GetParentFrame(aFrame);
if (!parent) if (!parent)
return nsnull; return nsnull;
nsFrameList list(parent->GetFirstChild(nsnull)); return parent->GetChildList(nsnull).GetPrevSiblingFor(aFrame);
return list.GetPrevSiblingFor(aFrame);
} }
@@ -545,20 +540,12 @@ nsFrameIterator::IsPopupFrame(nsIFrame* aFrame)
nsIFrame* nsIFrame*
nsVisualIterator::GetFirstChildInner(nsIFrame* aFrame) { nsVisualIterator::GetFirstChildInner(nsIFrame* aFrame) {
nsIFrame* child = aFrame->GetFirstChild(nsnull); return aFrame->GetChildList(nsnull).GetNextVisualFor(nsnull);
if (!child)
return nsnull;
nsFrameList list(child);
return list.GetNextVisualFor(nsnull);
} }
nsIFrame* nsIFrame*
nsVisualIterator::GetLastChildInner(nsIFrame* aFrame) { nsVisualIterator::GetLastChildInner(nsIFrame* aFrame) {
nsIFrame* child = aFrame->GetFirstChild(nsnull); return aFrame->GetChildList(nsnull).GetPrevVisualFor(nsnull);
if (!child)
return nsnull;
nsFrameList list(child);
return list.GetPrevVisualFor(nsnull);
} }
nsIFrame* nsIFrame*
@@ -566,8 +553,7 @@ nsVisualIterator::GetNextSiblingInner(nsIFrame* aFrame) {
nsIFrame* parent = GetParentFrame(aFrame); nsIFrame* parent = GetParentFrame(aFrame);
if (!parent) if (!parent)
return nsnull; return nsnull;
nsFrameList list(parent->GetFirstChild(nsnull)); return parent->GetChildList(nsnull).GetNextVisualFor(aFrame);
return list.GetNextVisualFor(aFrame);
} }
nsIFrame* nsIFrame*
@@ -575,6 +561,5 @@ nsVisualIterator::GetPrevSiblingInner(nsIFrame* aFrame) {
nsIFrame* parent = GetParentFrame(aFrame); nsIFrame* parent = GetParentFrame(aFrame);
if (!parent) if (!parent)
return nsnull; return nsnull;
nsFrameList list(parent->GetFirstChild(nsnull)); return parent->GetChildList(nsnull).GetPrevVisualFor(aFrame);
return list.GetPrevVisualFor(aFrame);
} }

View File

@@ -1197,7 +1197,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
return nsnull; return nsnull;
} }
nsFrameList textList(mTextFrame); nsFrameList textList(mTextFrame, mTextFrame);
mDisplayFrame->SetInitialChildList(nsnull, textList); mDisplayFrame->SetInitialChildList(nsnull, textList);
return mDisplayFrame; return mDisplayFrame;
} }

View File

@@ -529,7 +529,9 @@ nsBlockFrame::GetChildList(nsIAtom* aListName) const
} }
else if (aListName == nsGkAtoms::overflowList) { else if (aListName == nsGkAtoms::overflowList) {
nsLineList* overflowLines = GetOverflowLines(); nsLineList* overflowLines = GetOverflowLines();
return overflowLines ? overflowLines->front()->mFirstChild : nsnull; return overflowLines ? nsFrameList(overflowLines->front()->mFirstChild,
overflowLines->back()->LastChild())
: nsFrameList::EmptyList();
} }
else if (aListName == nsGkAtoms::overflowOutOfFlowList) { else if (aListName == nsGkAtoms::overflowOutOfFlowList) {
return GetOverflowOutOfFlows(); return GetOverflowOutOfFlows();
@@ -538,7 +540,8 @@ nsBlockFrame::GetChildList(nsIAtom* aListName) const
return mFloats; return mFloats;
} }
else if (aListName == nsGkAtoms::bulletList) { else if (aListName == nsGkAtoms::bulletList) {
return (HaveOutsideBullet()) ? mBullet : nsnull; return HaveOutsideBullet() ? nsFrameList(mBullet, mBullet)
: nsFrameList::EmptyList();
} }
return nsContainerFrame::GetChildList(aListName); return nsContainerFrame::GetChildList(aListName);
} }
@@ -3950,7 +3953,8 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState,
if (0 != pushCount) { if (0 != pushCount) {
NS_ABORT_IF_FALSE(aLine->GetChildCount() > pushCount, "bad push"); NS_ABORT_IF_FALSE(aLine->GetChildCount() > pushCount, "bad push");
NS_ABORT_IF_FALSE(nsnull != aFrame, "whoops"); NS_ABORT_IF_FALSE(nsnull != aFrame, "whoops");
NS_ASSERTION(nsFrameList(aFrame).GetLength() >= pushCount, NS_ASSERTION(nsFrameList(aFrame, nsLayoutUtils::GetLastSibling(aFrame))
.GetLength() >= pushCount,
"Not enough frames to push"); "Not enough frames to push");
// Put frames being split out into their own line // Put frames being split out into their own line
@@ -4527,7 +4531,7 @@ nsBlockFrame::GetOverflowOutOfFlows() const
nsIFrame* result = static_cast<nsIFrame*> nsIFrame* result = static_cast<nsIFrame*>
(GetProperty(nsGkAtoms::overflowOutOfFlowsProperty)); (GetProperty(nsGkAtoms::overflowOutOfFlowsProperty));
NS_ASSERTION(result, "value should always be non-empty when state set"); NS_ASSERTION(result, "value should always be non-empty when state set");
return nsFrameList(result); return nsFrameList(result, nsLayoutUtils::GetLastSibling(result));
} }
// This takes ownership of the frames // This takes ownership of the frames
@@ -6331,7 +6335,7 @@ nsBlockFrame::SetInitialChildList(nsIAtom* aListName,
// it to the flow now. // it to the flow now.
if (NS_STYLE_LIST_STYLE_POSITION_INSIDE == if (NS_STYLE_LIST_STYLE_POSITION_INSIDE ==
styleList->mListStylePosition) { styleList->mListStylePosition) {
AddFrames(bullet, nsnull); AddFrames(nsFrameList(bullet, bullet), nsnull);
mState &= ~NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET; mState &= ~NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET;
} }
else { else {

View File

@@ -1330,7 +1330,7 @@ nsContainerFrame::PushChildren(nsPresContext* aPresContext,
} }
else { else {
// Add the frames to our overflow list // Add the frames to our overflow list
SetOverflowFrames(aPresContext, aFromChild); SetOverflowFrames(aPresContext, tail);
} }
} }

View File

@@ -274,16 +274,9 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
} }
// And then push it to our overflow list // And then push it to our overflow list
if (nextInFlow) { const nsFrameList& overflow = mFrames.RemoveFramesAfter(kid);
mFrames.RemoveFramesAfter(kid); if (overflow.NotEmpty()) {
SetOverflowFrames(aPresContext, nextInFlow); SetOverflowFrames(aPresContext, overflow);
}
else {
nsIFrame* nextSib = kid->GetNextSibling();
if (nextSib) {
mFrames.RemoveFramesAfter(kid);
SetOverflowFrames(aPresContext, nextSib);
}
} }
} }

View File

@@ -4769,7 +4769,7 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection)
// Iterate over children and call ourselves recursively // Iterate over children and call ourselves recursively
if (aDirection == eDirPrevious) { if (aDirection == eDirPrevious) {
nsFrameList children(aFrame->GetFirstChild(nsnull)); const nsFrameList& children(aFrame->GetChildList(nsnull));
nsIFrame* child = children.LastChild(); nsIFrame* child = children.LastChild();
while(child && !result.mContent) { while(child && !result.mContent) {
result = FindBlockFrameOrBR(child, aDirection); result = FindBlockFrameOrBR(child, aDirection);
@@ -4806,7 +4806,7 @@ nsIFrame::PeekOffsetParagraph(nsPeekOffsetStruct *aPos)
reachedBlockAncestor = PR_TRUE; reachedBlockAncestor = PR_TRUE;
break; break;
} }
nsFrameList siblings(parent->GetFirstChild(nsnull)); const nsFrameList& siblings(parent->GetChildList(nsnull));
nsIFrame* sibling = siblings.GetPrevSiblingFor(frame); nsIFrame* sibling = siblings.GetPrevSiblingFor(frame);
while (sibling && !blockFrameOrBR.mContent) { while (sibling && !blockFrameOrBR.mContent) {
blockFrameOrBR = FindBlockFrameOrBR(sibling, eDirPrevious); blockFrameOrBR = FindBlockFrameOrBR(sibling, eDirPrevious);

View File

@@ -49,13 +49,6 @@
const nsFrameList* nsFrameList::sEmptyList; const nsFrameList* nsFrameList::sEmptyList;
nsFrameList::nsFrameList(nsIFrame* aFirstFrame)
: mFirstChild(aFirstFrame)
, mLastChild(nsLayoutUtils::GetLastSibling(aFirstFrame))
{
MOZ_COUNT_CTOR(nsFrameList);
}
/* static */ /* static */
nsresult nsresult
nsFrameList::Init() nsFrameList::Init()
@@ -100,6 +93,13 @@ nsFrameList::SetFrames(nsIFrame* aFrameList)
mLastChild = nsLayoutUtils::GetLastSibling(mFirstChild); mLastChild = nsLayoutUtils::GetLastSibling(mFirstChild);
} }
void
nsFrameList::AppendFrames(nsIFrame* aParent, nsIFrame* aFrameList)
{
nsFrameList temp(aFrameList, nsLayoutUtils::GetLastSibling(aFrameList));
AppendFrames(aParent, temp);
}
void void
nsFrameList::RemoveFrame(nsIFrame* aFrame, nsIFrame* aPrevSiblingHint) nsFrameList::RemoveFrame(nsIFrame* aFrame, nsIFrame* aPrevSiblingHint)
{ {
@@ -187,6 +187,15 @@ nsFrameList::DestroyFrameIfPresent(nsIFrame* aFrame)
return PR_FALSE; return PR_FALSE;
} }
void
nsFrameList::InsertFrames(nsIFrame* aParent,
nsIFrame* aPrevSibling,
nsIFrame* aFrameList)
{
nsFrameList temp(aFrameList, nsLayoutUtils::GetLastSibling(aFrameList));
InsertFrames(aParent, aPrevSibling, temp);
}
nsFrameList::Slice nsFrameList::Slice
nsFrameList::InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling, nsFrameList::InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling,
nsFrameList& aFrameList) nsFrameList& aFrameList)

View File

@@ -56,9 +56,6 @@ public:
MOZ_COUNT_CTOR(nsFrameList); MOZ_COUNT_CTOR(nsFrameList);
} }
// XXX We should make this explicit when we can!
nsFrameList(nsIFrame* aFirstFrame);
nsFrameList(nsIFrame* aFirstFrame, nsIFrame* aLastFrame) : nsFrameList(nsIFrame* aFirstFrame, nsIFrame* aLastFrame) :
mFirstChild(aFirstFrame), mLastChild(aLastFrame) mFirstChild(aFirstFrame), mLastChild(aLastFrame)
{ {
@@ -109,10 +106,7 @@ public:
* Append frames from aFrameList to this list. If aParent * Append frames from aFrameList to this list. If aParent
* is not null, reparents the newly-added frames. * is not null, reparents the newly-added frames.
*/ */
void AppendFrames(nsIFrame* aParent, nsIFrame* aFrameList) { void AppendFrames(nsIFrame* aParent, nsIFrame* aFrameList);
nsFrameList temp(aFrameList);
AppendFrames(aParent, temp);
}
/** /**
* Append aFrameList to this list. If aParent is not null, * Append aFrameList to this list. If aParent is not null,
@@ -197,10 +191,7 @@ public:
*/ */
void InsertFrames(nsIFrame* aParent, void InsertFrames(nsIFrame* aParent,
nsIFrame* aPrevSibling, nsIFrame* aPrevSibling,
nsIFrame* aFrameList) { nsIFrame* aFrameList);
nsFrameList temp(aFrameList);
InsertFrames(aParent, aPrevSibling, temp);
}
/** /**
* Inserts aFrameList into this list after aPrevSibling (at the beginning if * Inserts aFrameList into this list after aPrevSibling (at the beginning if

View File

@@ -676,7 +676,7 @@ CanvasFrame::Reflow(nsPresContext* aPresContext,
nsresult rv = aPresContext->PresShell()->FrameConstructor()-> nsresult rv = aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, kidFrame, this, &nextFrame); CreateContinuingFrame(aPresContext, kidFrame, this, &nextFrame);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
SetOverflowFrames(aPresContext, nextFrame); SetOverflowFrames(aPresContext, nsFrameList(nextFrame, nextFrame));
// Root overflow containers will be normal children of // Root overflow containers will be normal children of
// the canvas frame, but that's ok because there // the canvas frame, but that's ok because there
// aren't any other frames we need to isolate them from // aren't any other frames we need to isolate them from

View File

@@ -256,7 +256,7 @@ nsInlineFrame::ReparentFloatsForInlineChild(nsIFrame* aOurLineContainer,
nsBlockFrame* frameBlock = nsLayoutUtils::GetAsBlock(ancestor); nsBlockFrame* frameBlock = nsLayoutUtils::GetAsBlock(ancestor);
NS_ASSERTION(frameBlock, "ancestor not a block"); NS_ASSERTION(frameBlock, "ancestor not a block");
nsFrameList blockChildren(ancestor->GetFirstChild(nsnull)); const nsFrameList& blockChildren(ancestor->GetChildList(nsnull));
PRBool isOverflow = !blockChildren.ContainsFrame(ancestorBlockChild); PRBool isOverflow = !blockChildren.ContainsFrame(ancestorBlockChild);
while (PR_TRUE) { while (PR_TRUE) {

View File

@@ -1342,7 +1342,7 @@ static ForceReflow gForceReflow;
void void
nsMathMLContainerFrame::SetIncrementScriptLevel(PRInt32 aChildIndex, PRBool aIncrement) nsMathMLContainerFrame::SetIncrementScriptLevel(PRInt32 aChildIndex, PRBool aIncrement)
{ {
nsIFrame* child = nsFrameList(GetFirstChild(nsnull)).FrameAt(aChildIndex); nsIFrame* child = GetChildList(nsnull).FrameAt(aChildIndex);
if (!child) if (!child)
return; return;
nsIContent* content = child->GetContent(); nsIContent* content = child->GetContent();

View File

@@ -353,7 +353,7 @@ nsMathMLmoFrame::ProcessOperatorData()
// find the position of our outermost embellished container w.r.t // find the position of our outermost embellished container w.r.t
// its siblings (frames are singly-linked together). // its siblings (frames are singly-linked together).
nsFrameList frameList(parentAncestor->GetFirstChild(nsnull)); const nsFrameList& frameList(parentAncestor->GetChildList(nsnull));
nsIFrame* nextSibling = embellishAncestor->GetNextSibling(); nsIFrame* nextSibling = embellishAncestor->GetNextSibling();
nsIFrame* prevSibling = frameList.GetPrevSiblingFor(embellishAncestor); nsIFrame* prevSibling = frameList.GetPrevSiblingFor(embellishAncestor);

View File

@@ -2050,7 +2050,8 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
if (!child) if (!child)
return; return;
mFrames = nsFrameList(MergeSort(aState, mFrames.FirstChild())); nsIFrame* head = MergeSort(aState, mFrames.FirstChild());
mFrames = nsFrameList(head, nsLayoutUtils::GetLastSibling(head));
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -331,7 +331,7 @@ nsFrameList
nsMenuFrame::GetChildList(nsIAtom* aListName) const nsMenuFrame::GetChildList(nsIAtom* aListName) const
{ {
if (nsGkAtoms::popupList == aListName) { if (nsGkAtoms::popupList == aListName) {
return mPopupFrame; return nsFrameList(mPopupFrame, mPopupFrame);
} }
return nsBoxFrame::GetChildList(aListName); return nsBoxFrame::GetChildList(aListName);
} }

View File

@@ -641,7 +641,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
// get our index // get our index
nsPresContext* outerPresContext = mOuter->PresContext(); nsPresContext* outerPresContext = mOuter->PresContext();
nsFrameList siblingList(mParentBox->GetFirstChild(nsnull)); const nsFrameList& siblingList(mParentBox->GetChildList(nsnull));
PRInt32 childIndex = siblingList.IndexOf(mOuter); PRInt32 childIndex = siblingList.IndexOf(mOuter);
// if it's 0 (or not found) then stop right here. // if it's 0 (or not found) then stop right here.
// It might be not found if we're not in the parent's primary frame list. // It might be not found if we're not in the parent's primary frame list.
@@ -875,7 +875,7 @@ nsSplitterFrameInner::UpdateState()
nsIFrame* splitterSibling; nsIFrame* splitterSibling;
if (newState == CollapsedBefore || mState == CollapsedBefore) { if (newState == CollapsedBefore || mState == CollapsedBefore) {
splitterSibling = splitterSibling =
nsFrameList(mOuter->GetParent()->GetFirstChild(nsnull)).GetPrevSiblingFor(mOuter); mOuter->GetParent()->GetChildList(nsnull).GetPrevSiblingFor(mOuter);
} else { } else {
splitterSibling = mOuter->GetNextSibling(); splitterSibling = mOuter->GetNextSibling();
} }

View File

@@ -1805,7 +1805,7 @@ nsXULPopupManager::GetPreviousMenuItem(nsIFrame* aParent,
if (!immediateParent) if (!immediateParent)
immediateParent = aParent; immediateParent = aParent;
nsFrameList frames(immediateParent->GetFirstChild(nsnull)); const nsFrameList& frames(immediateParent->GetChildList(nsnull));
nsIFrame* currFrame = nsnull; nsIFrame* currFrame = nsnull;
if (aStart) if (aStart)

View File

@@ -127,7 +127,7 @@ nsDisplayXULTreeColSplitterTarget::HitTest(nsDisplayListBuilder* aBuilder,
if (left || right) { if (left || right) {
// We are a header. Look for the correct splitter. // We are a header. Look for the correct splitter.
nsFrameList frames(mFrame->GetParent()->GetFirstChild(nsnull)); const nsFrameList& frames(mFrame->GetParent()->GetChildList(nsnull));
nsIFrame* child; nsIFrame* child;
if (left) if (left)
child = frames.GetPrevSiblingFor(mFrame); child = frames.GetPrevSiblingFor(mFrame);