Bug 653649 - New way of getting child lists from frames. (part 3/5) r=roc

Update GetAdditionalChildListName consumers to use the new
child list iterator instead.
This commit is contained in:
Mats Palmgren 2011-08-24 22:54:29 +02:00
parent 90d0315f85
commit f06792a6ef
14 changed files with 226 additions and 331 deletions

View File

@ -1903,25 +1903,27 @@ InternalInvalidateThebesLayersInSubtree(nsIFrame* aFrame)
foundContainerLayer = PR_TRUE;
}
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame* child = aFrame->GetFirstChild(childList);
if (!child && !childList) {
nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(aFrame);
nsIFrame* frame = aFrame;
while (frame) {
nsIFrame::ChildListIterator lists(frame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
if (InternalInvalidateThebesLayersInSubtree(childFrames.get())) {
foundContainerLayer = PR_TRUE;
}
}
}
if (frame == aFrame && !frame->GetFirstPrincipalChild()) {
nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(frame);
if (subdocumentFrame) {
// Descend into the subdocument
child = subdocumentFrame->GetSubdocumentRootFrame();
frame = subdocumentFrame->GetSubdocumentRootFrame();
continue;
}
}
while (child) {
if (InternalInvalidateThebesLayersInSubtree(child)) {
foundContainerLayer = PR_TRUE;
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
break;
}
if (!foundContainerLayer) {
aFrame->RemoveStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);

View File

@ -7595,13 +7595,11 @@ UpdateViewsForTree(nsIFrame* aFrame, nsIViewManager* aViewManager,
}
}
// now do children of frame
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame* child = aFrame->GetFirstChild(childList);
while (child) {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that don't have placeholders
if (nsGkAtoms::placeholderFrame == child->GetType()) {
@ -7612,7 +7610,7 @@ UpdateViewsForTree(nsIFrame* aFrame, nsIViewManager* aViewManager,
DoApplyRenderingChangeToTree(outOfFlowFrame, aViewManager,
aFrameManager, aChange);
} while ((outOfFlowFrame = outOfFlowFrame->GetNextContinuation()));
} else if (childList == nsGkAtoms::popupList) {
} else if (lists.CurrentID() == nsIFrame::kPopupList) {
DoApplyRenderingChangeToTree(child, aViewManager,
aFrameManager, aChange);
} else { // regular frame
@ -7624,10 +7622,8 @@ UpdateViewsForTree(nsIFrame* aFrame, nsIViewManager* aViewManager,
UpdateViewsForTree(child, aViewManager, aFrameManager, aChange);
}
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
}
static void

View File

@ -649,13 +649,11 @@ VerifyStyleTree(nsPresContext* aPresContext, nsIFrame* aFrame,
nsStyleContext* context = aFrame->GetStyleContext();
VerifyContextParent(aPresContext, aFrame, context, nsnull);
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
nsIFrame* child;
do {
child = aFrame->GetFirstChild(childList);
while (child) {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
|| (child->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
// only do frames that don't have placeholders
@ -676,11 +674,8 @@ VerifyStyleTree(nsPresContext* aPresContext, nsIFrame* aFrame,
VerifyStyleTree(aPresContext, child, nsnull);
}
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
// do additional contexts
PRInt32 contextIndex = -1;
@ -908,15 +903,13 @@ nsFrameManager::ReparentStyleContext(nsIFrame* aFrame)
NS_ASSERTION(!(styleChange & nsChangeHint_ReconstructFrame),
"Our frame tree is likely to be bogus!");
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
nsIFrame* child;
aFrame->SetStyleContext(newContext);
do {
child = aFrame->GetFirstChild(childList);
while (child) {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
// only do frames that don't have placeholders
if ((!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW) ||
(child->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) &&
@ -931,15 +924,10 @@ nsFrameManager::ReparentStyleContext(nsIFrame* aFrame)
"Out of flow provider?");
}
#endif
ReparentStyleContext(child);
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
// If this frame is part of an IB split, then the style context of
// the next part of the split might be a child of our style context.
@ -1526,12 +1514,11 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// style contexts that we're just going to throw away anyway. - dwh
// now do children
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame* child = aFrame->GetFirstChild(childList);
while (child) {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
|| (child->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
// only do frames that don't have placeholders
@ -1592,11 +1579,8 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
}
}
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
// XXX need to do overflow frames???
#ifdef ACCESSIBILITY
@ -1754,17 +1738,13 @@ nsFrameManager::CaptureFrameState(nsIFrame* aFrame,
CaptureFrameStateFor(aFrame, aState);
// Now capture state recursively for the frame hierarchy rooted at aFrame
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
while (childFrame) {
CaptureFrameState(childFrame, aState);
// Get the next sibling child frame
childFrame = childFrame->GetNextSibling();
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
CaptureFrameState(childFrames.get(), aState);
}
childListName = aFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName);
}
}
// Restore state for a given frame.
@ -1827,17 +1807,13 @@ nsFrameManager::RestoreFrameState(nsIFrame* aFrame,
RestoreFrameStateFor(aFrame, aState);
// Now restore state recursively for the frame hierarchy rooted at aFrame
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
while (childFrame) {
RestoreFrameState(childFrame, aState);
// Get the next sibling child frame
childFrame = childFrame->GetNextSibling();
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
RestoreFrameState(childFrames.get(), aState);
}
childListName = aFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName);
}
}
//----------------------------------------------------------------------

View File

@ -3179,31 +3179,28 @@ nsLayoutUtils::CalculateContentBottom(nsIFrame* aFrame)
// We want scrollable overflow rather than visual because this
// calculation is intended to affect layout.
if (aFrame->GetScrollableOverflowRect().height > contentBottom) {
nsIFrame::ChildListIDs skip(nsIFrame::kOverflowList |
nsIFrame::kExcessOverflowContainersList |
nsIFrame::kOverflowOutOfFlowList);
nsBlockFrame* blockFrame = GetAsBlock(aFrame);
nsIAtom* childList = nsnull;
PRIntn nextListID = 0;
do {
if (childList == nsnull && blockFrame) {
contentBottom = NS_MAX(contentBottom, CalculateBlockContentBottom(blockFrame));
}
else if (childList != nsGkAtoms::overflowList &&
childList != nsGkAtoms::excessOverflowContainersList &&
childList != nsGkAtoms::overflowOutOfFlowList)
{
for (nsIFrame* child = aFrame->GetFirstChild(childList);
child; child = child->GetNextSibling())
{
if (blockFrame) {
contentBottom =
NS_MAX(contentBottom, CalculateBlockContentBottom(blockFrame));
skip |= nsIFrame::kPrincipalList;
}
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
if (!skip.Contains(lists.CurrentID())) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
nscoord offset = child->GetRect().y - child->GetRelativeOffset().y;
contentBottom = NS_MAX(contentBottom,
CalculateContentBottom(child) + offset);
}
}
childList = aFrame->GetAdditionalChildListName(nextListID);
nextListID++;
} while (childList);
}
}
return contentBottom;
}
@ -4214,15 +4211,13 @@ nsLayoutUtils::AssertTreeOnlyEmptyNextInFlows(nsIFrame *aSubtreeRoot)
NS_ASSERTION(start == end || IsInLetterFrame(aSubtreeRoot),
"frame tree not empty, but caller reported complete status");
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
for (nsIFrame* child = aSubtreeRoot->GetFirstChild(childList); child;
child = child->GetNextSibling()) {
nsLayoutUtils::AssertTreeOnlyEmptyNextInFlows(child);
nsIFrame::ChildListIterator lists(aSubtreeRoot);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsLayoutUtils::AssertTreeOnlyEmptyNextInFlows(childFrames.get());
}
childList = aSubtreeRoot->GetAdditionalChildListName(listIndex++);
} while (childList);
}
}
#endif
@ -4239,7 +4234,8 @@ nsLayoutUtils::GetFontFacesForFrames(nsIFrame* aFrame,
}
while (aFrame) {
nsIAtom* childLists[] = { nsnull, nsGkAtoms::popupList };
nsIFrame::ChildListID childLists[] = { nsIFrame::kPrincipalList,
nsIFrame::kPopupList };
for (int i = 0; i < NS_ARRAY_LENGTH(childLists); ++i) {
nsFrameList children(aFrame->GetChildList(childLists[i]));
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {

View File

@ -3599,16 +3599,15 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
}
}
PRInt32 childListIndex = 0;
nsIAtom *childListName;
do {
childListName = f->GetAdditionalChildListName(childListIndex++);
for (nsIFrame *kid = f->GetFirstChild(childListName); kid;
kid = kid->GetNextSibling()) {
nsIFrame::ChildListIterator lists(f);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
kid->MarkIntrinsicWidthsDirty();
stack.AppendElement(kid);
}
} while (childListName);
}
} while (stack.Length() != 0);
}
@ -8139,12 +8138,11 @@ WalkFramesThroughPlaceholders(nsPresContext *aPresContext, nsIFrame *aFrame,
if (!walkChildren)
return;
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame *child = aFrame->GetFirstChild(childList);
while (child) {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that are in flow, and recur through the
// out-of-flows of placeholders.
@ -8152,11 +8150,8 @@ WalkFramesThroughPlaceholders(nsPresContext *aPresContext, nsIFrame *aFrame,
nsPlaceholderFrame::GetRealFrameFor(child),
aFunc, aClosure);
}
child = child->GetNextSibling();
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
}
#endif
@ -8347,11 +8342,11 @@ CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
//if (aFirstFrame->GetType() == nsGkAtoms::scrollbarFrame)
// return PR_TRUE;
PRBool ok = PR_TRUE;
nsIAtom* listName = nsnull;
PRInt32 listIndex = 0;
nsIFrame::ChildListIterator lists1(aFirstFrame);
nsIFrame::ChildListIterator lists2(aSecondFrame);
do {
const nsFrameList& kids1 = aFirstFrame->GetChildList(listName);
const nsFrameList& kids2 = aSecondFrame->GetChildList(listName);
const nsFrameList& kids1 = !lists1.IsDone() ? lists1.CurrentList() : nsFrameList();
const nsFrameList& kids2 = !lists2.IsDone() ? lists2.CurrentList() : nsFrameList();
PRInt32 l1 = kids1.GetLength();
PRInt32 l2 = kids2.GetLength();;
if (l1 != l2) {
@ -8437,34 +8432,21 @@ CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
break;
}
nsIAtom* listName1 = aFirstFrame->GetAdditionalChildListName(listIndex);
nsIAtom* listName2 = aSecondFrame->GetAdditionalChildListName(listIndex);
listIndex++;
if (listName1 != listName2) {
lists1.Next();
lists2.Next();
if (lists1.IsDone() != lists2.IsDone() ||
(!lists1.IsDone() && lists1.CurrentID() != lists2.CurrentID())) {
if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) {
ok = PR_FALSE;
}
LogVerifyMessage(kids1.FirstChild(), kids2.FirstChild(),
"child list names are not matched: ");
nsAutoString tmp;
if (nsnull != listName1) {
listName1->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), stdout);
}
else
fputs("(null)", stdout);
printf(" != ");
if (nsnull != listName2) {
listName2->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), stdout);
}
else
fputs("(null)", stdout);
printf("\n");
fprintf(stdout, "%s != %s\n",
!lists1.IsDone() ? mozilla::layout::ChildListName(lists1.CurrentID()) : "(null)",
!lists2.IsDone() ? mozilla::layout::ChildListName(lists2.CurrentID()) : "(null)");
break;
}
listName = listName1;
} while (ok && (listName != nsnull));
} while (ok && !lists1.IsDone());
return ok;
}

View File

@ -467,32 +467,23 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const
fputs(">\n", out);
}
nsIAtom* listName = nsnull;
PRInt32 listIndex = 0;
for (;;) {
listName = GetAdditionalChildListName(listIndex++);
if (nsGkAtoms::overflowList == listName) {
continue; // skip the overflow list - we printed the overflow lines above
// skip the principal list - we printed the lines above
// skip the overflow list - we printed the overflow lines above
ChildListIterator lists(this);
ChildListIDs skip(kPrincipalList | kOverflowList);
for (; !lists.IsDone(); lists.Next()) {
if (skip.Contains(lists.CurrentID())) {
continue;
}
if (nsnull == listName) {
break;
}
nsIFrame* kid = GetFirstChild(listName);
if (kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
if (nsnull != listName) {
listName->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
}
fputs("<\n", out);
while (kid) {
kid->List(out, aIndent + 1);
kid = kid->GetNextSibling();
}
IndentBy(out, aIndent);
fputs(">\n", out);
IndentBy(out, aIndent);
fprintf(out, "%s<\n", mozilla::layout::ChildListName(lists.CurrentID()));
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
kid->List(out, aIndent + 1);
}
IndentBy(out, aIndent);
fputs(">\n", out);
}
aIndent--;

View File

@ -440,20 +440,16 @@ ReparentFrameViewTo(nsIFrame* aFrame,
nsIView* insertBefore = nsLayoutUtils::FindSiblingViewFor(aNewParentView, aFrame);
aViewManager->InsertChild(aNewParentView, view, insertBefore, insertBefore != nsnull);
} else {
PRInt32 listIndex = 0;
nsIAtom* listName = nsnull;
// This loop iterates through every child list name, and also
// executes once with listName == nsnull.
do {
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
// Iterate the child frames, and check each child frame to see if it has
// a view
nsIFrame* childFrame = aFrame->GetFirstChild(listName);
for (; childFrame; childFrame = childFrame->GetNextSibling()) {
ReparentFrameViewTo(childFrame, aViewManager,
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
ReparentFrameViewTo(childFrames.get(), aViewManager,
aNewParentView, aOldParentView);
}
listName = aFrame->GetAdditionalChildListName(listIndex++);
} while (listName);
}
}
return NS_OK;
@ -991,32 +987,27 @@ nsContainerFrame::PositionChildViews(nsIFrame* aFrame)
return;
}
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
// Recursively walk aFrame's child frames
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
while (childFrame) {
// Recursively walk aFrame's child frames.
// Process the additional child lists, but skip the popup list as the
// view for popups is managed by the parent. Currently only nsMenuFrame
// has a popupList and during layout will call nsMenuPopupFrame::AdjustView.
ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
if (lists.CurrentID() == kPopupList) {
continue;
}
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
// Position the frame's view (if it has one) otherwise recursively
// process its children
nsIFrame* childFrame = childFrames.get();
if (childFrame->HasView()) {
PositionFrameView(childFrame);
} else {
PositionChildViews(childFrame);
}
// Get the next sibling child frame
childFrame = childFrame->GetNextSibling();
}
// also process the additional child lists, but skip the popup list as the
// view for popups is managed by the parent. Currently only nsMenuFrame
// has a popupList and during layout will call nsMenuPopupFrame::AdjustView.
do {
childListName = aFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName == nsGkAtoms::popupList);
} while (childListName);
}
}
/**
@ -1791,35 +1782,27 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
}
// Output the children
nsIAtom* listName = nsnull;
PRInt32 listIndex = 0;
PRBool outputOneList = PR_FALSE;
do {
nsIFrame* kid = GetFirstChild(listName);
if (nsnull != kid) {
if (outputOneList) {
IndentBy(out, aIndent);
}
outputOneList = PR_TRUE;
nsAutoString tmp;
if (nsnull != listName) {
listName->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
}
fputs("<\n", out);
while (nsnull != kid) {
// Verify the child frame's parent frame pointer is correct
NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer");
// Have the child frame list
kid->List(out, aIndent + 1);
kid = kid->GetNextSibling();
}
ChildListIterator lists(this);
for (; !lists.IsDone(); lists.Next()) {
if (outputOneList) {
IndentBy(out, aIndent);
fputs(">\n", out);
}
listName = GetAdditionalChildListName(listIndex++);
} while(nsnull != listName);
outputOneList = PR_TRUE;
fputs(mozilla::layout::ChildListName(lists.CurrentID()), out);
fputs("<\n", out);
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
// Verify the child frame's parent frame pointer is correct
NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");
// Have the child frame list
kid->List(out, aIndent + 1);
}
IndentBy(out, aIndent);
fputs(">\n", out);
}
if (!outputOneList) {
fputs("<>\n", out);

View File

@ -3481,16 +3481,14 @@ nsFrame::ComputeSimpleTightBounds(gfxContext* aContext) const
}
nsRect r(0, 0, 0, 0);
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame* child = GetFirstChild(childList);
while (child) {
r.UnionRect(r, child->ComputeTightBounds(aContext) + child->GetPosition());
child = child->GetNextSibling();
ChildListIterator lists(this);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
r.UnionRect(r, child->ComputeTightBounds(aContext) + child->GetPosition());
}
childList = GetAdditionalChildListName(listIndex++);
} while (childList);
}
return r;
}
@ -4942,35 +4940,25 @@ nsFrame::DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32
mRect.x, mRect.y, mRect.width, mRect.height);
// Now dump all of the children on all of the child lists
nsIFrame* kid;
nsIAtom* list = nsnull;
PRInt32 listIndex = 0;
do {
kid = GetFirstChild(list);
if (kid) {
IndentBy(out, aIndent);
if (nsnull != list) {
nsAutoString listName;
list->ToString(listName);
fprintf(out, "<child-list name=\"");
XMLQuote(listName);
fputs(NS_LossyConvertUTF16toASCII(listName).get(), out);
fprintf(out, "\">\n");
}
else {
fprintf(out, "<child-list>\n");
}
aIndent++;
while (kid) {
kid->DumpRegressionData(aPresContext, out, aIndent);
kid = kid->GetNextSibling();
}
aIndent--;
IndentBy(out, aIndent);
fprintf(out, "</child-list>\n");
ChildListIterator lists(this);
for (; !lists.IsDone(); lists.Next()) {
IndentBy(out, aIndent);
if (lists.CurrentID() != kPrincipalList) {
fprintf(out, "<child-list name=\"%s\">\n", mozilla::layout::ChildListName(lists.CurrentID()));
}
list = GetAdditionalChildListName(listIndex++);
} while (nsnull != list);
else {
fprintf(out, "<child-list>\n");
}
aIndent++;
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
kid->DumpRegressionData(aPresContext, out, aIndent);
}
aIndent--;
IndentBy(out, aIndent);
fprintf(out, "</child-list>\n");
}
}
#endif

View File

@ -1604,24 +1604,18 @@ static void AdjustViews(nsIFrame* aFrame)
return;
}
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
// Recursively walk aFrame's child frames
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
while (childFrame) {
AdjustViews(childFrame);
// Get the next sibling child frame
childFrame = childFrame->GetNextSibling();
// Call AdjustViews recursively for all child frames except the popup list as
// the views for popups are not scrolled.
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
if (lists.CurrentID() == nsIFrame::kPopupList) {
continue;
}
// also process the additional child lists, but skip the popup list as the
// views for popups are not scrolled.
do {
childListName = aFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName == nsGkAtoms::popupList);
} while (childListName);
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
AdjustViews(childFrames.get());
}
}
}
static PRBool

View File

@ -863,16 +863,13 @@ DestroyDisplayItemDataForFrames(nsIFrame* aFrame)
{
FrameLayerBuilder::DestroyDisplayItemDataFor(aFrame);
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
do {
nsIFrame* child = aFrame->GetFirstChild(childList);
while (child) {
DestroyDisplayItemDataForFrames(child);
child = child->GetNextSibling();
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
DestroyDisplayItemDataForFrames(childFrames.get());
}
childList = aFrame->GetAdditionalChildListName(listIndex++);
} while (childList);
}
}
static PRBool

View File

@ -2532,7 +2532,7 @@ nsPrintEngine::PrintPage(nsPrintObject* aPO,
nsresult
nsPrintEngine::FindSelectionBoundsWithList(nsPresContext* aPresContext,
nsRenderingContext& aRC,
nsIAtom* aList,
nsFrameList::Enumerator& aChildFrames,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
@ -2543,9 +2543,9 @@ nsPrintEngine::FindSelectionBoundsWithList(nsPresContext* aPresContext,
NS_ASSERTION(aPresContext, "Pointer is null!");
NS_ASSERTION(aParentFrame, "Pointer is null!");
nsIFrame* child = aParentFrame->GetFirstChild(aList);
aRect += aParentFrame->GetPosition();
while (child) {
for (; !aChildFrames.AtEnd(); aChildFrames.Next()) {
nsIFrame* child = aChildFrames.get();
// only leaf frames have this bit flipped
// then check the hard way
PRBool isSelected = (child->GetStateBits() & NS_FRAME_SELECTED_CONTENT)
@ -2587,13 +2587,12 @@ nsPrintEngine::FindSelectionBounds(nsPresContext* aPresContext,
NS_ASSERTION(aParentFrame, "Pointer is null!");
// loop through named child lists
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childListName, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect);
nsIFrame::ChildListIterator lists(aParentFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childFrames, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect);
NS_ENSURE_SUCCESS(rv, rv);
childListName = aParentFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName);
}
return NS_OK;
}

View File

@ -41,6 +41,7 @@
#include "nsPrintObject.h"
#include "nsPrintData.h"
#include "nsFrameList.h"
// Interfaces
#include "nsIDocument.h"
@ -239,7 +240,7 @@ protected:
static nsresult FindSelectionBoundsWithList(nsPresContext* aPresContext,
nsRenderingContext& aRC,
nsIAtom* aList,
nsFrameList::Enumerator& aChildFrames,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
@ -257,8 +258,8 @@ protected:
nsRect& aEndRect);
static nsresult GetPageRangeForSelection(nsIPresShell * aPresShell,
nsPresContext* aPresContext,
nsRenderingContext& aRC,
nsPresContext* aPresContext,
nsRenderingContext& aRC,
nsISelection* aSelection,
nsIPageSequenceFrame* aPageSeqFrame,
nsIFrame** aStartFrame,

View File

@ -1067,6 +1067,7 @@ nsTableFrame::InsertRowGroups(const nsFrameList::Slice& aRowGroups)
/////////////////////////////////////////////////////////////////////////////
// Child frame enumeration
nsFrameList
nsTableFrame::GetChildList(ChildListID aListID) const
{
if (aListID == kColGroupList) {

View File

@ -231,35 +231,26 @@ nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const
}
// Output the children
nsIAtom* listName = nsnull;
PRInt32 listIndex = 0;
PRBool outputOneList = PR_FALSE;
do {
nsIFrame* kid = GetFirstChild(listName);
if (nsnull != kid) {
if (outputOneList) {
IndentBy(out, aIndent);
}
outputOneList = PR_TRUE;
nsAutoString tmp;
if (nsnull != listName) {
listName->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
}
fputs("<\n", out);
while (nsnull != kid) {
// Verify the child frame's parent frame pointer is correct
NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer");
// Have the child frame list
kid->List(out, aIndent + 1);
kid = kid->GetNextSibling();
}
ChildListIterator lists(this);
for (; !lists.IsDone(); lists.Next()) {
if (outputOneList) {
IndentBy(out, aIndent);
fputs(">\n", out);
}
listName = GetAdditionalChildListName(listIndex++);
} while(nsnull != listName);
outputOneList = PR_TRUE;
fprintf(out, "%s<\n", mozilla::layout::ChildListName(lists.CurrentID()));
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
// Verify the child frame's parent frame pointer is correct
NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");
// Have the child frame list
kid->List(out, aIndent + 1);
}
IndentBy(out, aIndent);
fputs(">\n", out);
}
// XXXmats the above is copy-pasted from nsContainerFrame::List which is lame,
// clean this up after bug 399111 is implemented.
@ -268,9 +259,7 @@ nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const
fputs("<\n", out);
++aIndent;
IndentBy(out, aIndent);
nsAutoString tmp;
nsGkAtoms::popupList->ToString(tmp);
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
fputs(mozilla::layout::ChildListName(kPopupList), out);
fputs(" for ", out);
ListTag(out);
fputs(" <\n", out);