diff --git a/mozilla/content/html/content/src/nsHTMLAtoms.cpp b/mozilla/content/html/content/src/nsHTMLAtoms.cpp
index 6dea38bda1f..b7e8033bd81 100644
--- a/mozilla/content/html/content/src/nsHTMLAtoms.cpp
+++ b/mozilla/content/html/content/src/nsHTMLAtoms.cpp
@@ -19,6 +19,7 @@
// XXX make this be autogenerated. doh!
+nsIAtom* nsHTMLAtoms::mozAnonymousBlock;
nsIAtom* nsHTMLAtoms::_baseHref;
nsIAtom* nsHTMLAtoms::_baseTarget;
nsIAtom* nsHTMLAtoms::a;
@@ -256,6 +257,8 @@ static nsrefcnt gRefCnt;
void nsHTMLAtoms::AddrefAtoms()
{
if (0 == gRefCnt) {
+ mozAnonymousBlock = NS_NewAtom(":MOZ-ANONYMOUS-BLOCK");
+
_baseHref = NS_NewAtom(NS_HTML_BASE_HREF);
_baseTarget = NS_NewAtom(NS_HTML_BASE_TARGET);
a = NS_NewAtom("A");
@@ -493,6 +496,7 @@ void nsHTMLAtoms::ReleaseAtoms()
{
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
if (--gRefCnt == 0) {
+ NS_RELEASE(mozAnonymousBlock);
NS_RELEASE(_baseHref);
NS_RELEASE(_baseTarget);
NS_RELEASE(a);
diff --git a/mozilla/content/html/content/src/nsHTMLAtoms.h b/mozilla/content/html/content/src/nsHTMLAtoms.h
index 8bfc9838700..9a2da18d033 100644
--- a/mozilla/content/html/content/src/nsHTMLAtoms.h
+++ b/mozilla/content/html/content/src/nsHTMLAtoms.h
@@ -35,6 +35,8 @@ public:
static void AddrefAtoms();
static void ReleaseAtoms();
+ static nsIAtom* mozAnonymousBlock;
+
// Special attribute atoms
static nsIAtom* _baseHref;
static nsIAtom* _baseTarget;
diff --git a/mozilla/content/shared/public/nsHTMLAtoms.h b/mozilla/content/shared/public/nsHTMLAtoms.h
index 8bfc9838700..9a2da18d033 100644
--- a/mozilla/content/shared/public/nsHTMLAtoms.h
+++ b/mozilla/content/shared/public/nsHTMLAtoms.h
@@ -35,6 +35,8 @@ public:
static void AddrefAtoms();
static void ReleaseAtoms();
+ static nsIAtom* mozAnonymousBlock;
+
// Special attribute atoms
static nsIAtom* _baseHref;
static nsIAtom* _baseTarget;
diff --git a/mozilla/content/shared/src/nsHTMLAtoms.cpp b/mozilla/content/shared/src/nsHTMLAtoms.cpp
index 6dea38bda1f..b7e8033bd81 100644
--- a/mozilla/content/shared/src/nsHTMLAtoms.cpp
+++ b/mozilla/content/shared/src/nsHTMLAtoms.cpp
@@ -19,6 +19,7 @@
// XXX make this be autogenerated. doh!
+nsIAtom* nsHTMLAtoms::mozAnonymousBlock;
nsIAtom* nsHTMLAtoms::_baseHref;
nsIAtom* nsHTMLAtoms::_baseTarget;
nsIAtom* nsHTMLAtoms::a;
@@ -256,6 +257,8 @@ static nsrefcnt gRefCnt;
void nsHTMLAtoms::AddrefAtoms()
{
if (0 == gRefCnt) {
+ mozAnonymousBlock = NS_NewAtom(":MOZ-ANONYMOUS-BLOCK");
+
_baseHref = NS_NewAtom(NS_HTML_BASE_HREF);
_baseTarget = NS_NewAtom(NS_HTML_BASE_TARGET);
a = NS_NewAtom("A");
@@ -493,6 +496,7 @@ void nsHTMLAtoms::ReleaseAtoms()
{
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
if (--gRefCnt == 0) {
+ NS_RELEASE(mozAnonymousBlock);
NS_RELEASE(_baseHref);
NS_RELEASE(_baseTarget);
NS_RELEASE(a);
diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp
index 64de9d7a233..a6126898cc7 100644
--- a/mozilla/layout/generic/nsAreaFrame.cpp
+++ b/mozilla/layout/generic/nsAreaFrame.cpp
@@ -66,7 +66,7 @@ nsAreaFrame::~nsAreaFrame()
NS_IMETHODIMP
nsAreaFrame::DeleteFrame(nsIPresContext& aPresContext)
{
- DeleteFrameList(aPresContext, &mAbsoluteFrames);
+ mAbsoluteFrames.DeleteFrames(aPresContext);
return nsBlockFrame::DeleteFrame(aPresContext);
}
@@ -78,7 +78,7 @@ nsAreaFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsresult rv;
if (nsLayoutAtoms::absoluteList == aListName) {
- mAbsoluteFrames = aChildList;
+ mAbsoluteFrames.SetFrames(aChildList);
rv = NS_OK;
} else {
rv = nsBlockFrame::SetInitialChildList(aPresContext, aListName, aChildList);
@@ -108,7 +108,7 @@ NS_IMETHODIMP
nsAreaFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
{
if (aListName == nsLayoutAtoms::absoluteList) {
- aFirstChild = mAbsoluteFrames;
+ aFirstChild = mAbsoluteFrames.FirstChild();
return NS_OK;
}
@@ -290,28 +290,8 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
nsIFrame* childFrame;
aReflowState.reflowCommand->GetChildFrame(childFrame);
- // Find the frame in our list of absolutely positioned children
- // and remove it
- if (mAbsoluteFrames == childFrame) {
- childFrame->GetNextSibling(mAbsoluteFrames);
-
- } else {
- nsIFrame* prevSibling = nsnull;
- for (nsIFrame* f = mAbsoluteFrames; nsnull != f; f->GetNextSibling(f)) {
- if (f == childFrame) {
- break;
- }
- prevSibling = f;
- }
-
- NS_ASSERTION(nsnull != prevSibling, "didn't find frame");
- nsIFrame* nextSibling;
- childFrame->GetNextSibling(nextSibling);
- prevSibling->SetNextSibling(nextSibling);
- }
-
- // Now go ahead and delete the child frame
- childFrame->DeleteFrame(aPresContext);
+ PRBool zap = mAbsoluteFrames.DeleteFrame(aPresContext, childFrame);
+ NS_ASSERTION(zap, "didn't find frame");
// XXX We don't need to reflow all the absolutely positioned
// frames. Compute the desired size and exit...
@@ -327,15 +307,7 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
// Insert the frame
- if (nsnull == prevSibling) {
- mAbsoluteFrames = childFrame;
- } else {
- nsIFrame* nextSibling;
-
- prevSibling->GetNextSibling(nextSibling);
- prevSibling->SetNextSibling(childFrame);
- childFrame->SetNextSibling(nextSibling);
- }
+ mAbsoluteFrames.InsertFrame(nsnull, prevSibling, childFrame);
wasHandled = PR_TRUE;
} else {
@@ -380,7 +352,8 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
mStyleContext->GetStyleData(eStyleStruct_Display);
if (NS_STYLE_OVERFLOW_HIDDEN != display->mOverflow) {
- for (nsIFrame* f = mAbsoluteFrames; nsnull != f; f->GetNextSibling(f)) {
+ for (nsIFrame* f = mAbsoluteFrames.FirstChild(); nsnull != f;
+ f->GetNextSibling(f)) {
nsRect rect;
f->GetRect(rect);
@@ -473,14 +446,7 @@ nsAreaFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
// Add the frame to the end of the child list
void nsAreaFrame::AddAbsoluteFrame(nsIFrame* aFrame)
{
- if (nsnull == mAbsoluteFrames) {
- mAbsoluteFrames = aFrame;
- } else {
- nsIFrame* lastChild = LastFrame(mAbsoluteFrames);
-
- lastChild->SetNextSibling(aFrame);
- aFrame->SetNextSibling(nsnull);
- }
+ mAbsoluteFrames.AppendFrames(nsnull, aFrame);
}
// Called at the end of the Reflow() member function so we can process
@@ -489,7 +455,7 @@ void
nsAreaFrame::ReflowAbsoluteItems(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState)
{
- for (nsIFrame* absoluteFrame = mAbsoluteFrames;
+ for (nsIFrame* absoluteFrame = mAbsoluteFrames.FirstChild();
nsnull != absoluteFrame; absoluteFrame->GetNextSibling(absoluteFrame)) {
PRBool placeFrame = PR_FALSE;
@@ -735,17 +701,19 @@ nsAreaFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter* aFilter) const
nsresult rv = nsBlockFrame::List(out, aIndent, aFilter);
// Output absolutely positioned frames
- if (nsnull != mAbsoluteFrames) {
- for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out);
+ if (mAbsoluteFrames.NotEmpty()) {
+ IndentBy(out, aIndent);
fprintf(out, "absolute-items <\n");
+
+ nsIFrame* f = mAbsoluteFrames.FirstChild();
+ while (nsnull != f) {
+ f->List(out, aIndent+1, aFilter);
+ f->GetNextSibling(f);
+ }
+
+ IndentBy(out, aIndent);
+ fputs(">\n", out);
}
- nsIFrame* f = mAbsoluteFrames;
- while (nsnull != f) {
- f->List(out, aIndent+1, aFilter);
- f->GetNextSibling(f);
- }
- for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out);
- fputs(">\n", out);
return rv;
}
diff --git a/mozilla/layout/generic/nsAreaFrame.h b/mozilla/layout/generic/nsAreaFrame.h
index 8d144ac1b05..4ffd090af4b 100644
--- a/mozilla/layout/generic/nsAreaFrame.h
+++ b/mozilla/layout/generic/nsAreaFrame.h
@@ -95,7 +95,7 @@ protected:
private:
nsSpaceManager* mSpaceManager;
- nsIFrame* mAbsoluteFrames; // additional named child list
+ nsFrameList mAbsoluteFrames; // additional named child list
#ifdef NS_DEBUG
struct BandData : public nsBandData {
diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp
index 3328e0cfd94..93034aef62e 100644
--- a/mozilla/layout/generic/nsBlockFrame.cpp
+++ b/mozilla/layout/generic/nsBlockFrame.cpp
@@ -3449,7 +3449,7 @@ nsBaseIBFrame::MarkEmptyLines(nsIPresContext& aPresContext)
}
}
-PRBool
+void
nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aChild)
{
@@ -3470,15 +3470,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
}
-#ifdef NS_DEBUG
- PRInt32 childCount;
- nsIFrame* firstChild;
- nextInFlow->FirstChild(nsnull, firstChild);
- childCount = LengthOf(firstChild);
- NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
- "deleting !empty next-in-flow");
-#endif
-
// Disconnect the next-in-flow from the flow list
nextInFlow->BreakFromPrevFlow();
@@ -3516,7 +3507,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
aChild->GetNextInFlow(nextInFlow);
NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow");
#endif
- return PR_TRUE;
}
PRBool
@@ -4142,7 +4132,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
mBullet = nsnull;
}
- DeleteFrameList(aPresContext, &mFloaters);
+ mFloaters.DeleteFrames(aPresContext);
return nsBlockFrameSuper::DeleteFrame(aPresContext);
}
@@ -4380,12 +4370,12 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
}
// Output floaters next
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
if (outputMe) {
for (i = aIndent; --i >= 0; ) fputs(" ", out);
fprintf(out, "all-floaters <\n");
}
- nsIFrame* floater = mFloaters;
+ nsIFrame* floater = mFloaters.FirstChild();
while (nsnull != floater) {
floater->List(out, aIndent+1, aFilter);
floater->GetNextSibling(floater);
@@ -4447,7 +4437,7 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
- aFirstChild = mFloaters;
+ aFirstChild = mFloaters.FirstChild();
return NS_OK;
}
else if (aListName == nsLayoutAtoms::bulletList) {
@@ -4678,7 +4668,7 @@ nsBlockFrame::BuildFloaterList()
if (nsnull != current) {
current->SetNextSibling(nsnull);
}
- mFloaters = head;
+ mFloaters.SetFrames(head);
}
// XXX keep the text-run data in the first-in-flow of the block
@@ -4946,7 +4936,7 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
return NS_OK;
}
}
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame);
if (NS_OK == rv) {
return NS_OK;
diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h
index c11b5d4a5f1..997bb813ca3 100644
--- a/mozilla/layout/generic/nsBlockFrame.h
+++ b/mozilla/layout/generic/nsBlockFrame.h
@@ -93,8 +93,8 @@ public:
#endif
- virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
- nsIFrame* aNextInFlow);
+ virtual void DeleteChildsNextInFlow(nsIPresContext& aPresContext,
+ nsIFrame* aNextInFlow);
protected:
nsBaseIBFrame();
@@ -380,7 +380,7 @@ protected:
nsTextRun* mTextRuns;
// List of all floaters in this block
- nsIFrame* mFloaters;
+ nsFrameList mFloaters;
// XXX_fix_me: subclass one more time!
// For list-item frames, this is the bullet frame.
diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp
index 3328e0cfd94..93034aef62e 100644
--- a/mozilla/layout/generic/nsBlockReflowState.cpp
+++ b/mozilla/layout/generic/nsBlockReflowState.cpp
@@ -3449,7 +3449,7 @@ nsBaseIBFrame::MarkEmptyLines(nsIPresContext& aPresContext)
}
}
-PRBool
+void
nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aChild)
{
@@ -3470,15 +3470,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
}
-#ifdef NS_DEBUG
- PRInt32 childCount;
- nsIFrame* firstChild;
- nextInFlow->FirstChild(nsnull, firstChild);
- childCount = LengthOf(firstChild);
- NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
- "deleting !empty next-in-flow");
-#endif
-
// Disconnect the next-in-flow from the flow list
nextInFlow->BreakFromPrevFlow();
@@ -3516,7 +3507,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
aChild->GetNextInFlow(nextInFlow);
NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow");
#endif
- return PR_TRUE;
}
PRBool
@@ -4142,7 +4132,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
mBullet = nsnull;
}
- DeleteFrameList(aPresContext, &mFloaters);
+ mFloaters.DeleteFrames(aPresContext);
return nsBlockFrameSuper::DeleteFrame(aPresContext);
}
@@ -4380,12 +4370,12 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
}
// Output floaters next
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
if (outputMe) {
for (i = aIndent; --i >= 0; ) fputs(" ", out);
fprintf(out, "all-floaters <\n");
}
- nsIFrame* floater = mFloaters;
+ nsIFrame* floater = mFloaters.FirstChild();
while (nsnull != floater) {
floater->List(out, aIndent+1, aFilter);
floater->GetNextSibling(floater);
@@ -4447,7 +4437,7 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
- aFirstChild = mFloaters;
+ aFirstChild = mFloaters.FirstChild();
return NS_OK;
}
else if (aListName == nsLayoutAtoms::bulletList) {
@@ -4678,7 +4668,7 @@ nsBlockFrame::BuildFloaterList()
if (nsnull != current) {
current->SetNextSibling(nsnull);
}
- mFloaters = head;
+ mFloaters.SetFrames(head);
}
// XXX keep the text-run data in the first-in-flow of the block
@@ -4946,7 +4936,7 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
return NS_OK;
}
}
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame);
if (NS_OK == rv) {
return NS_OK;
diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h
index 3328e0cfd94..93034aef62e 100644
--- a/mozilla/layout/generic/nsBlockReflowState.h
+++ b/mozilla/layout/generic/nsBlockReflowState.h
@@ -3449,7 +3449,7 @@ nsBaseIBFrame::MarkEmptyLines(nsIPresContext& aPresContext)
}
}
-PRBool
+void
nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aChild)
{
@@ -3470,15 +3470,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
}
-#ifdef NS_DEBUG
- PRInt32 childCount;
- nsIFrame* firstChild;
- nextInFlow->FirstChild(nsnull, firstChild);
- childCount = LengthOf(firstChild);
- NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
- "deleting !empty next-in-flow");
-#endif
-
// Disconnect the next-in-flow from the flow list
nextInFlow->BreakFromPrevFlow();
@@ -3516,7 +3507,6 @@ nsBaseIBFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
aChild->GetNextInFlow(nextInFlow);
NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow");
#endif
- return PR_TRUE;
}
PRBool
@@ -4142,7 +4132,7 @@ nsBlockFrame::DeleteFrame(nsIPresContext& aPresContext)
mBullet = nsnull;
}
- DeleteFrameList(aPresContext, &mFloaters);
+ mFloaters.DeleteFrames(aPresContext);
return nsBlockFrameSuper::DeleteFrame(aPresContext);
}
@@ -4380,12 +4370,12 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
}
// Output floaters next
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
if (outputMe) {
for (i = aIndent; --i >= 0; ) fputs(" ", out);
fprintf(out, "all-floaters <\n");
}
- nsIFrame* floater = mFloaters;
+ nsIFrame* floater = mFloaters.FirstChild();
while (nsnull != floater) {
floater->List(out, aIndent+1, aFilter);
floater->GetNextSibling(floater);
@@ -4447,7 +4437,7 @@ nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
- aFirstChild = mFloaters;
+ aFirstChild = mFloaters.FirstChild();
return NS_OK;
}
else if (aListName == nsLayoutAtoms::bulletList) {
@@ -4678,7 +4668,7 @@ nsBlockFrame::BuildFloaterList()
if (nsnull != current) {
current->SetNextSibling(nsnull);
}
- mFloaters = head;
+ mFloaters.SetFrames(head);
}
// XXX keep the text-run data in the first-in-flow of the block
@@ -4946,7 +4936,7 @@ nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
return NS_OK;
}
}
- if (nsnull != mFloaters) {
+ if (mFloaters.NotEmpty()) {
rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame);
if (NS_OK == rv) {
return NS_OK;
diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp
index 46eea193ec6..b9ab9daa6cc 100644
--- a/mozilla/layout/generic/nsContainerFrame.cpp
+++ b/mozilla/layout/generic/nsContainerFrame.cpp
@@ -28,6 +28,7 @@
#include "nsIView.h"
#include "nsVoidArray.h"
#include "nsISizeOfHandler.h"
+#include "nsIReflowCommand.h"
#include "nsHTMLIIDs.h"
#ifdef NS_DEBUG
@@ -36,12 +37,12 @@
#undef NOISY
#endif
-NS_IMETHODIMP
-nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const
+nsContainerFrame::nsContainerFrame()
+{
+}
+
+nsContainerFrame::~nsContainerFrame()
{
- aHandler->Add(sizeof(*this));
- nsContainerFrame::SizeOfWithoutThis(aHandler);
- return NS_OK;
}
NS_IMETHODIMP
@@ -49,18 +50,17 @@ nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{
- NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
- nsresult result;
+ NS_PRECONDITION(mFrames.IsEmpty(), "already initialized");
- if (nsnull != mFirstChild) {
+ nsresult result;
+ if (nsnull != mFrames.FirstChild()) {
result = NS_ERROR_UNEXPECTED;
} else if (nsnull != aListName) {
result = NS_ERROR_INVALID_ARG;
} else {
- mFirstChild = aChildList;
+ mFrames.SetFrames(aChildList);
result = NS_OK;
}
-
return result;
}
@@ -68,50 +68,19 @@ NS_IMETHODIMP
nsContainerFrame::DeleteFrame(nsIPresContext& aPresContext)
{
// Prevent event dispatch during destruction
- nsIView* view;
+ nsIView* view;
GetView(view);
if (nsnull != view) {
view->SetClientData(nsnull);
}
// Delete the primary child list
- DeleteFrameList(aPresContext, &mFirstChild);
+ mFrames.DeleteFrames(aPresContext);
// Base class will delete the frame
return nsFrame::DeleteFrame(aPresContext);
}
-/**
- * Helper method to delete a frame list and keep the list sane during
- * the deletion.
- */
-void
-nsContainerFrame::DeleteFrameList(nsIPresContext& aPresContext,
- nsIFrame** aListP)
-{
- nsIFrame* first;
- while (nsnull != (first = *aListP)) {
- nsIFrame* nextChild;
-
- first->GetNextSibling(nextChild);
- first->DeleteFrame(aPresContext);
-
- // Once we've deleted the child frame make sure it's no longer in
- // the child list
- *aListP = nextChild;
- }
-}
-
-void
-nsContainerFrame::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
-{
- nsSplittableFrame::SizeOfWithoutThis(aHandler);
- for (nsIFrame* child = mFirstChild; child; ) {
- child->SizeOf(aHandler);
- child->GetNextSibling(child);
- }
-}
-
NS_IMETHODIMP
nsContainerFrame::DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus)
@@ -155,9 +124,8 @@ nsContainerFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
{
// We only know about the unnamed principal child list
if (nsnull == aListName) {
- aFirstChild = mFirstChild;
+ aFirstChild = mFrames.FirstChild();
return NS_OK;
-
} else {
aFirstChild = nsnull;
return NS_ERROR_INVALID_ARG;
@@ -183,7 +151,7 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Update overflow list too
- child = mOverflowList;
+ child = mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext);
child->GetNextSibling(child);
@@ -192,7 +160,7 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// And just to be complete, update our prev-in-flows overflow list
// too (since in theory, those frames will become our frames)
if (nsnull != mPrevInFlow) {
- child = ((nsContainerFrame*)mPrevInFlow)->mOverflowList;
+ child = ((nsContainerFrame*)mPrevInFlow)->mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext);
child->GetNextSibling(child);
@@ -203,7 +171,7 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
/////////////////////////////////////////////////////////////////////////////
-// Painting
+// Painting/Events
NS_IMETHODIMP
nsContainerFrame::Paint(nsIPresContext& aPresContext,
@@ -242,7 +210,7 @@ nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
nsClipCombine_kIntersect, clipState);
}
- nsIFrame* kid = mFirstChild;
+ nsIFrame* kid = mFrames.FirstChild();
while (nsnull != kid) {
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer);
kid->GetNextSibling(kid);
@@ -380,11 +348,11 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
+ NS_PRECONDITION(IsChild(aKidFrame), "not my child");
// Query for the nsIHTMLReflow interface
nsIHTMLReflow* htmlReflow;
nsresult result;
-
result = aKidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow);
if (NS_FAILED(result)) {
return result;
@@ -392,13 +360,13 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
// Send the WillReflow notification, and reflow the child frame
htmlReflow->WillReflow(aPresContext);
- result = htmlReflow->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+ result = htmlReflow->Reflow(aPresContext, aDesiredSize, aReflowState,
+ aStatus);
// If the reflow was successful and the child frame is complete, delete any
// next-in-flows
if (NS_SUCCEEDED(result) && NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
-
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
@@ -406,10 +374,10 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetParent(parent);
- ((nsContainerFrame*)parent)->DeleteChildsNextInFlow(aPresContext, aKidFrame);
+ ((nsContainerFrame*)parent)->DeleteChildsNextInFlow(aPresContext,
+ aKidFrame);
}
}
-
return result;
}
@@ -423,8 +391,9 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
* @param aChild child this child's next-in-flow
* @return PR_TRUE if successful and PR_FALSE otherwise
*/
-PRBool
-nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild)
+void
+nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
+ nsIFrame* aChild)
{
NS_PRECONDITION(IsChild(aChild), "bad geometric parent");
@@ -444,36 +413,14 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame*
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
}
-#ifdef NS_DEBUG
- PRInt32 childCount;
- nsIFrame* firstChild;
-
- nextInFlow->FirstChild(nsnull, firstChild);
- childCount = LengthOf(firstChild);
-
- if ((0 != childCount) || (nsnull != firstChild)) {
- nsIFrame* top = nextInFlow;
- for (;;) {
- nsIFrame* parent;
- top->GetParent(parent);
- if (nsnull == parent) {
- break;
- }
- top = parent;
- }
- top->List(stdout, 0, nsnull);
- }
- NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
- "deleting !empty next-in-flow");
-#endif
-
// Disconnect the next-in-flow from the flow list
nextInFlow->BreakFromPrevFlow();
// Take the next-in-flow out of the parent's child list
- if (parent->mFirstChild == nextInFlow) {
- nextInFlow->GetNextSibling(parent->mFirstChild);
-
+ if (parent->mFrames.FirstChild() == nextInFlow) {
+ nsIFrame* nextFrame;
+ nextInFlow->GetNextSibling(nextFrame);
+ parent->mFrames.SetFrames(nextFrame);
} else {
nsIFrame* nextSibling;
@@ -491,18 +438,12 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame*
}
// Delete the next-in-flow frame
- WillDeleteNextInFlowFrame(nextInFlow);
nextInFlow->DeleteFrame(aPresContext);
#ifdef NS_DEBUG
aChild->GetNextInFlow(nextInFlow);
NS_POSTCONDITION(nsnull == nextInFlow, "non null next-in-flow");
#endif
- return PR_TRUE;
-}
-
-void nsContainerFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
-{
}
/**
@@ -519,13 +460,13 @@ void nsContainerFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
* @param aPrevSibling aFromChild's previous sibling. Must not be null. It's
* an error to push a parent's first child frame
*/
-void nsContainerFrame::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling)
+void
+nsContainerFrame::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling)
{
NS_PRECONDITION(nsnull != aFromChild, "null pointer");
NS_PRECONDITION(nsnull != aPrevSibling, "pushing first child");
#ifdef NS_DEBUG
nsIFrame* prevNextSibling;
-
aPrevSibling->GetNextSibling(prevNextSibling);
NS_PRECONDITION(prevNextSibling == aFromChild, "bad prev sibling");
#endif
@@ -533,38 +474,14 @@ void nsContainerFrame::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling
// Disconnect aFromChild from its previous sibling
aPrevSibling->SetNextSibling(nsnull);
- // Do we have a next-in-flow?
- nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow;
- if (nsnull != nextInFlow) {
- PRInt32 numChildren = 0;
- nsIFrame* lastChild = nsnull;
-
- // Compute the number of children being pushed, and for each child change
- // its geometric parent. Remember the last child
- for (nsIFrame* f = aFromChild; nsnull != f; f->GetNextSibling(f)) {
- numChildren++;
-#ifdef NOISY
- printf(" ");
- ((nsFrame*)f)->ListTag(stdout);
- printf("\n");
-#endif
- lastChild = f;
- f->SetParent(nextInFlow);
- }
- NS_ASSERTION(numChildren > 0, "no children to push");
-
- // Prepend the frames to our next-in-flow's child list
- lastChild->SetNextSibling(nextInFlow->mFirstChild);
- nextInFlow->mFirstChild = aFromChild;
-
- } else {
+ if (nsnull != mNextInFlow) {
+ nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow;
+ nextInFlow->mFrames.InsertFrames(mNextInFlow, nsnull, aFromChild);
+ }
+ else {
// Add the frames to our overflow list
- NS_ASSERTION(nsnull == mOverflowList, "bad overflow list");
-#ifdef NOISY
- ListTag(stdout);
- printf(": pushing kids to my overflow list\n");
-#endif
- mOverflowList = aFromChild;
+ NS_ASSERTION(mOverflowFrames.IsEmpty(), "bad overflow list");
+ mOverflowFrames.SetFrames(aFromChild);
}
}
@@ -576,63 +493,66 @@ void nsContainerFrame::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling
*
* @return PR_TRUE if any frames were moved and PR_FALSE otherwise
*/
-PRBool nsContainerFrame::MoveOverflowToChildList()
+PRBool
+nsContainerFrame::MoveOverflowToChildList()
{
- PRBool result = PR_FALSE;
+ PRBool result = PR_FALSE;
// Check for an overflow list with our prev-in-flow
nsContainerFrame* prevInFlow = (nsContainerFrame*)mPrevInFlow;
if (nsnull != prevInFlow) {
- if (nsnull != prevInFlow->mOverflowList) {
- NS_ASSERTION(nsnull == mFirstChild, "bad overflow list");
- AppendChildren(prevInFlow->mOverflowList);
- prevInFlow->mOverflowList = nsnull;
+ if (prevInFlow->mOverflowFrames.NotEmpty()) {
+ NS_ASSERTION(mFrames.IsEmpty(), "bad overflow list");
+ mFrames.Join(this, prevInFlow->mOverflowFrames);
result = PR_TRUE;
}
}
// It's also possible that we have an overflow list for ourselves
- if (nsnull != mOverflowList) {
- NS_ASSERTION(nsnull != mFirstChild, "overflow list but no mapped children");
- AppendChildren(mOverflowList, PR_FALSE);
- mOverflowList = nsnull;
+ if (mOverflowFrames.NotEmpty()) {
+ NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
+ mFrames.Join(nsnull, mOverflowFrames);
result = PR_TRUE;
}
-
return result;
}
-/**
- * Append child list starting at aChild to this frame's child list. Used for
- * processing of the overflow list.
- *
- * Updates this frame's child count and content mapping.
- *
- * @param aChild the beginning of the child list
- * @param aSetParent if true each child's geometric (and content parent if
- * they're the same) parent is set to this frame.
- */
-void nsContainerFrame::AppendChildren(nsIFrame* aChild, PRBool aSetParent)
+nsresult
+nsContainerFrame::AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame)
{
- // Link the frames into our child frame list
- if (nsnull == mFirstChild) {
- // We have no children so aChild becomes the first child
- mFirstChild = aChild;
- } else {
- nsIFrame* lastChild = LastFrame(mFirstChild);
- lastChild->SetNextSibling(aChild);
+ nsresult rv=NS_OK;
+ nsIReflowCommand::ReflowType type;
+ aReflowState.reflowCommand->GetType(type);
+
+ // we have a generic frame that gets inserted but doesn't effect
+ // reflow hook it up then ignore it
+ if (nsIReflowCommand::FrameAppended == type) {
+ // Append aAddedFrame to the list of frames
+ mFrames.AppendFrame(nsnull, aAddedFrame);
}
-
- // Update our child count and last content offset
- nsIFrame* lastChild;
- for (nsIFrame* f = aChild; nsnull != f; f->GetNextSibling(f)) {
- lastChild = f;
-
- // Reset the geometric parent if requested
- if (aSetParent) {
- f->SetParent(this);
+ else if (nsIReflowCommand::FrameInserted == type) {
+ // Insert aAddedFrame into the list of frames
+ nsIFrame *prevSibling=nsnull;
+ rv = aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
+ if (NS_SUCCEEDED(rv)) {
+ mFrames.InsertFrame(nsnull, prevSibling, aAddedFrame);
}
}
+ else
+ {
+ NS_ASSERTION(PR_FALSE, "bad reflow type");
+ rv = NS_ERROR_UNEXPECTED;
+ }
+ return rv;
+}
+
+nsresult
+nsContainerFrame::RemoveFrame(nsIFrame* aRemovedFrame)
+{
+ PRBool zap = mFrames.RemoveFrame(aRemovedFrame);
+ NS_ASSERTION(zap, "failure to remove a frame");
+ return NS_OK;
}
/////////////////////////////////////////////////////////////////////////////
@@ -680,14 +600,15 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent,
}
// Output the children
- if (nsnull != mFirstChild) {
+ if (mFrames.NotEmpty()) {
if (outputMe) {
if (0 != mState) {
fprintf(out, " [state=%08x]", mState);
}
fputs("<\n", out);
}
- for (nsIFrame* child = mFirstChild; child; child->GetNextSibling(child)) {
+ for (nsIFrame* child = mFrames.FirstChild(); child;
+ child->GetNextSibling(child)) {
child->List(out, aIndent + 1, aFilter);
}
if (outputMe) {
@@ -705,63 +626,3 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent,
return NS_OK;
}
-
-NS_IMETHODIMP
-nsContainerFrame::VerifyTree() const
-{
-#ifdef NS_DEBUG
- NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow");
- NS_ASSERTION(nsnull == mOverflowList, "bad overflow list");
-#endif
- return NS_OK;
-}
-
-PRInt32 nsContainerFrame::LengthOf(nsIFrame* aFrame)
-{
- PRInt32 result = 0;
-
- while (nsnull != aFrame) {
- result++;
- aFrame->GetNextSibling(aFrame);
- }
-
- return result;
-}
-
-nsIFrame* nsContainerFrame::LastFrame(nsIFrame* aFrame)
-{
- nsIFrame* lastChild = nsnull;
-
- while (nsnull != aFrame) {
- lastChild = aFrame;
- aFrame->GetNextSibling(aFrame);
- }
-
- return lastChild;
-}
-
-nsIFrame* nsContainerFrame::FrameAt(nsIFrame* aFrame, PRInt32 aIndex)
-{
- while ((aIndex-- > 0) && (aFrame != nsnull)) {
- aFrame->GetNextSibling(aFrame);
- }
- return aFrame;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef NS_DEBUG
-
-PRBool nsContainerFrame::IsChild(const nsIFrame* aChild) const
-{
- // Check the geometric parent
- nsIFrame* parent;
-
- aChild->GetParent(parent);
- if (parent != (nsIFrame*)this) {
- return PR_FALSE;
- }
-
- return PR_TRUE;
-}
-#endif
diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h
index 944b5012a3e..78d9f6c992f 100644
--- a/mozilla/layout/generic/nsContainerFrame.h
+++ b/mozilla/layout/generic/nsContainerFrame.h
@@ -19,6 +19,7 @@
#define nsContainerFrame_h___
#include "nsSplittableFrame.h"
+#include "nsFrameList.h"
/**
* Implementation of a container frame.
@@ -26,68 +27,45 @@
class nsContainerFrame : public nsSplittableFrame
{
public:
- NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
-
+ // nsIFrame overrides
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
-
+ NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
-
- NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
- nsDidReflowStatus aStatus);
-
- // Painting
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
-
- /**
- * Find the correct child frame.
- */
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
nsIFrame** aFrame);
+ NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
+ nsIStyleContext* aParentContext);
+ NS_IMETHOD List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const;
- // Child frame enumeration.
- NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
+ // nsIHTMLReflow overrides
+ NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
+ nsDidReflowStatus aStatus);
- // re-resolve style context for self and children as necessary
- // Subclasses need to override if they add child lists or
- // if they alter normal style context inheritance
- NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
- nsIStyleContext* aParentContext);
+ // nsContainerFrame methods
+ virtual void DeleteChildsNextInFlow(nsIPresContext& aPresContext,
+ nsIFrame* aChild);
- // Debugging
- NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
- NS_IMETHOD VerifyTree() const;
+ static PRInt32 LengthOf(nsIFrame* aFrameList) {
+ nsFrameList tmp(aFrameList);
+ return tmp.GetLength();
+ }
- /**
- * Return the number of children in the sibling list, starting at aChild.
- * Returns zero if aChild is nsnull.
- */
- static PRInt32 LengthOf(nsIFrame* aChild);
-
- /**
- * Return the last frame in the sibling list.
- * Returns nsnullif aChild is nsnull.
- */
- static nsIFrame* LastFrame(nsIFrame* aChild);
-
- /**
- * Returns the frame at the specified index relative to aFrame
- */
- static nsIFrame* FrameAt(nsIFrame* aFrame, PRInt32 aIndex);
-
- // XXX needs to be virtual so that nsBlockFrame can override it
- virtual PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext,
- nsIFrame* aChild);
+#if XXX
+ static nsIFrame* FrameAt(nsIFrame* aFrameList, PRInt32 aIndex) {
+ nsFrameList tmp(aFrameList);
+ return tmp.FrameAt(aIndex);
+ }
+#endif
protected:
- void DeleteFrameList(nsIPresContext& aPresContext,
- nsIFrame** aListP);
-
- void SizeOfWithoutThis(nsISizeOfHandler* aHandler) const;
+ nsContainerFrame();
+ ~nsContainerFrame();
nsresult GetFrameForPointUsing(const nsPoint& aPoint,
nsIAtom* aList,
@@ -116,56 +94,61 @@ protected:
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
- /**
- * Moves any frames on both the prev-in-flow's overflow list and the receiver's
- * overflow to the receiver's child list.
- *
- * Resets the overlist pointers to nsnull, and updates the receiver's child
- * count and content mapping.
- *
- * @return PR_TRUE if any frames were moved and PR_FALSE otherwise
- */
+ /**
+ * Moves any frames on both the prev-in-flow's overflow list and the
+ * receiver's overflow to the receiver's child list.
+ *
+ * Resets the overlist pointers to nsnull, and updates the receiver's child
+ * count and content mapping.
+ *
+ * @return PR_TRUE if any frames were moved and PR_FALSE otherwise
+ */
PRBool MoveOverflowToChildList();
- /**
- * Push aFromChild and its next siblings to the next-in-flow. Change the
- * geometric parent of each frame that's pushed. If there is no next-in-flow
- * the frames are placed on the overflow list (and the geometric parent is
- * left unchanged).
- *
- * Updates the next-in-flow's child count. Does not update the
- * pusher's child count.
- *
- * @param aFromChild the first child frame to push. It is disconnected from
- * aPrevSibling
- * @param aPrevSibling aFromChild's previous sibling. Must not be null. It's
- * an error to push a parent's first child frame
- */
+ /**
+ * Push aFromChild and its next siblings to the next-in-flow. Change
+ * the geometric parent of each frame that's pushed. If there is no
+ * next-in-flow the frames are placed on the overflow list (and the
+ * geometric parent is left unchanged).
+ *
+ * Updates the next-in-flow's child count. Does not update the
+ * pusher's child count.
+ *
+ * @param aFromChild the first child frame to push. It is disconnected from
+ * aPrevSibling
+ * @param aPrevSibling aFromChild's previous sibling. Must not be null.
+ * It's an error to push a parent's first child frame
+ */
void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling);
/**
- * Append child list starting at aChild to this frame's child list. Used for
- * processing of the overflow list.
- *
- * Updates this frame's child count and content mapping.
+ * Append child list starting at aChild to this frame's child list.
*
* @param aChild the beginning of the child list
- * @param aSetParent if true each child's geometric (and content parent if
- * they're the same) parent is set to this frame.
+ * @param aSetParent if true each child's parent is set to this frame.
*/
- void AppendChildren(nsIFrame* aChild, PRBool aSetParent = PR_TRUE);
+ void AppendChildren(nsIFrame* aChild, PRBool aSetParent) {
+ mFrames.AppendFrames(aSetParent ? this : nsnull, aChild);
+ }
- virtual void WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow);
+ /**
+ */
+ nsresult AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame);
+
+ /**
+ */
+ nsresult RemoveFrame(nsIFrame * aRemovedFrame);
-#ifdef NS_DEBUG
/**
* Returns PR_TRUE if aChild is a child of this frame.
*/
- PRBool IsChild(const nsIFrame* aChild) const;
-#endif
+ PRBool IsChild(const nsIFrame* aChild) const {
+ return mFrames.ContainsFrame(aChild);
+ }
- nsIFrame* mFirstChild;
- nsIFrame* mOverflowList;
+ nsFrameList mFrames;
+ nsFrameList mOverflowFrames;
};
#endif /* nsContainerFrame_h___ */
diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp
index 9031b477968..fb74b673251 100644
--- a/mozilla/layout/generic/nsFrameFrame.cpp
+++ b/mozilla/layout/generic/nsFrameFrame.cpp
@@ -211,8 +211,9 @@ nscoord
nsHTMLFrameOuterFrame::GetBorderWidth(nsIPresContext& aPresContext)
{
if (IsInline()) {
- if (nsnull != mFirstChild) {
- if (eFrameborder_No != ((nsHTMLFrameInnerFrame*)mFirstChild)->GetFrameBorder(eCompatibility_Standard)) {
+ nsIFrame* firstChild = mFrames.FirstChild();
+ if (nsnull != FirstChild) {
+ if (eFrameborder_No != ((nsHTMLFrameInnerFrame*)firstChild)->GetFrameBorder(eCompatibility_Standard)) {
const nsStyleSpacing* spacing =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
nsStyleCoord leftBorder;
@@ -281,9 +282,10 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext& aPresContext,
nsFramePaintLayer aWhichLayer)
{
//printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
- if (nsnull != mFirstChild) {
- mFirstChild->Paint(aPresContext, aRenderingContext, aDirtyRect,
- aWhichLayer);
+ nsIFrame* firstChild = mFrames.FirstChild();
+ if (nsnull != firstChild) {
+ firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect,
+ aWhichLayer);
}
if (IsInline()) {
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
@@ -316,10 +318,12 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.height = aReflowState.availableHeight;
}
- if (nsnull == mFirstChild) {
- mFirstChild = new nsHTMLFrameInnerFrame;
+ nsIFrame* firstChild = mFrames.FirstChild();
+ if (nsnull == firstChild) {
+ firstChild = new nsHTMLFrameInnerFrame;
+ mFrames.SetFrames(firstChild);
// XXX temporary! use style system to get correct style!
- mFirstChild->Init(aPresContext, mContent, this, mStyleContext);
+ firstChild->Init(aPresContext, mContent, this, mStyleContext);
}
// nsContainerFrame::PaintBorder has some problems, kludge it here
@@ -329,17 +333,17 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
// Reflow the child and get its desired size
nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
- nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState,
+ nsHTMLReflowState kidReflowState(aPresContext, firstChild, aReflowState,
innerSize);
nsIHTMLReflow* htmlReflow;
- if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
- ReflowChild(mFirstChild, aPresContext, kidMetrics, kidReflowState, aStatus);
+ if (NS_OK == firstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
+ ReflowChild(firstChild, aPresContext, kidMetrics, kidReflowState, aStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
// Place and size the child
nsRect rect(borderWidth, borderWidth, innerSize.width, innerSize.height);
- mFirstChild->SetRect(rect);
+ firstChild->SetRect(rect);
}
// XXX what should the max-element-size of an iframe be? Shouldn't
@@ -373,8 +377,9 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
{
if (nsHTMLAtoms::src == aAttribute) {
printf("got a request\n");
- if (nsnull != mFirstChild) {
- ((nsHTMLFrameInnerFrame*)mFirstChild)->ReloadURL();
+ nsIFrame* firstChild = mFrames.FirstChild();
+ if (nsnull != firstChild) {
+ ((nsHTMLFrameInnerFrame*)firstChild)->ReloadURL();
}
}
return NS_OK;
diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp
index 2231798136c..43aecdc1221 100644
--- a/mozilla/layout/generic/nsFrameSetFrame.cpp
+++ b/mozilla/layout/generic/nsFrameSetFrame.cpp
@@ -416,7 +416,8 @@ void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
// Reflow only creates children frames for