diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp
index e2c1702e012..908ca036b1f 100644
--- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp
+++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp
@@ -322,6 +322,75 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
return PR_FALSE;
}
+//XXX handle replace reflow command
+NS_METHOD nsHTMLContainerFrame::AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame)
+{
+ 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)
+ { // frameAppended reflow -- find the last child and make aInsertedFrame its next sibling
+ nsIFrame *lastChild=mFirstChild;
+ nsIFrame *nextChild=mFirstChild;
+ while (nsnull!=nextChild)
+ {
+ lastChild=nextChild;
+ nextChild->GetNextSibling(nextChild);
+ }
+ if (nsnull==lastChild)
+ mFirstChild = aAddedFrame;
+ else
+ lastChild->SetNextSibling(aAddedFrame);
+ }
+ else if (nsIReflowCommand::FrameInserted==type)
+ { // frameInserted reflow -- hook up aInsertedFrame as prevSibling's next sibling,
+ // and be sure to hook in aInsertedFrame's nextSibling (from prevSibling)
+ nsIFrame *prevSibling=nsnull;
+ rv = aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
+ if (NS_SUCCEEDED(rv) && (nsnull!=prevSibling))
+ {
+ nsIFrame *nextSibling=nsnull;
+ prevSibling->GetNextSibling(nextSibling);
+ prevSibling->SetNextSibling(aAddedFrame);
+ aAddedFrame->SetNextSibling(nextSibling);
+ }
+ else
+ {
+ nsIFrame *nextSibling = mFirstChild;
+ mFirstChild = aAddedFrame;
+ aAddedFrame->SetNextSibling(nextSibling);
+ }
+ }
+ else
+ {
+ NS_ASSERTION(PR_FALSE, "bad reflow type");
+ rv = NS_ERROR_UNEXPECTED;
+ }
+ return rv;
+}
+ /** */
+NS_METHOD nsHTMLContainerFrame::RemoveFrame(nsIFrame * aRemovedFrame)
+{
+ nsIFrame *prevChild=nsnull;
+ nsIFrame *nextChild=mFirstChild;
+ while (nextChild!=aRemovedFrame)
+ {
+ prevChild=nextChild;
+ nextChild->GetNextSibling(nextChild);
+ }
+ nextChild=nsnull;
+ aRemovedFrame->GetNextSibling(nextChild);
+ if (nsnull==prevChild) // objectFrame was first child
+ mFirstChild = nextChild;
+ else
+ prevChild->SetNextSibling(nextChild);
+ return NS_OK;;
+}
+
+
/**
* Create a next-in-flow for aFrame. Will return the newly created
* frame in aNextInFlowResult if and only if a new frame is
diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.h b/mozilla/layout/generic/nsHTMLContainerFrame.h
index 9a51d46909b..5c02a275fda 100644
--- a/mozilla/layout/generic/nsHTMLContainerFrame.h
+++ b/mozilla/layout/generic/nsHTMLContainerFrame.h
@@ -63,6 +63,14 @@ public:
const nsStylePosition* aPosition,
nsIFrame*& aPlaceholderFrame);
+ /* helper methods for incremental reflow */
+ /** */
+ NS_IMETHOD AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame);
+ /** */
+ NS_IMETHOD RemoveFrame(nsIFrame * aRemovedFrame);
+
+
// Helper method to create next-in-flows if necessary
static nsresult CreateNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aOuterFrame,
diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp
index e2c1702e012..908ca036b1f 100644
--- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp
+++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp
@@ -322,6 +322,75 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
return PR_FALSE;
}
+//XXX handle replace reflow command
+NS_METHOD nsHTMLContainerFrame::AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame)
+{
+ 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)
+ { // frameAppended reflow -- find the last child and make aInsertedFrame its next sibling
+ nsIFrame *lastChild=mFirstChild;
+ nsIFrame *nextChild=mFirstChild;
+ while (nsnull!=nextChild)
+ {
+ lastChild=nextChild;
+ nextChild->GetNextSibling(nextChild);
+ }
+ if (nsnull==lastChild)
+ mFirstChild = aAddedFrame;
+ else
+ lastChild->SetNextSibling(aAddedFrame);
+ }
+ else if (nsIReflowCommand::FrameInserted==type)
+ { // frameInserted reflow -- hook up aInsertedFrame as prevSibling's next sibling,
+ // and be sure to hook in aInsertedFrame's nextSibling (from prevSibling)
+ nsIFrame *prevSibling=nsnull;
+ rv = aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
+ if (NS_SUCCEEDED(rv) && (nsnull!=prevSibling))
+ {
+ nsIFrame *nextSibling=nsnull;
+ prevSibling->GetNextSibling(nextSibling);
+ prevSibling->SetNextSibling(aAddedFrame);
+ aAddedFrame->SetNextSibling(nextSibling);
+ }
+ else
+ {
+ nsIFrame *nextSibling = mFirstChild;
+ mFirstChild = aAddedFrame;
+ aAddedFrame->SetNextSibling(nextSibling);
+ }
+ }
+ else
+ {
+ NS_ASSERTION(PR_FALSE, "bad reflow type");
+ rv = NS_ERROR_UNEXPECTED;
+ }
+ return rv;
+}
+ /** */
+NS_METHOD nsHTMLContainerFrame::RemoveFrame(nsIFrame * aRemovedFrame)
+{
+ nsIFrame *prevChild=nsnull;
+ nsIFrame *nextChild=mFirstChild;
+ while (nextChild!=aRemovedFrame)
+ {
+ prevChild=nextChild;
+ nextChild->GetNextSibling(nextChild);
+ }
+ nextChild=nsnull;
+ aRemovedFrame->GetNextSibling(nextChild);
+ if (nsnull==prevChild) // objectFrame was first child
+ mFirstChild = nextChild;
+ else
+ prevChild->SetNextSibling(nextChild);
+ return NS_OK;;
+}
+
+
/**
* Create a next-in-flow for aFrame. Will return the newly created
* frame in aNextInFlowResult if and only if a new frame is
diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h
index 9a51d46909b..5c02a275fda 100644
--- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h
+++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h
@@ -63,6 +63,14 @@ public:
const nsStylePosition* aPosition,
nsIFrame*& aPlaceholderFrame);
+ /* helper methods for incremental reflow */
+ /** */
+ NS_IMETHOD AddFrame(const nsHTMLReflowState& aReflowState,
+ nsIFrame * aAddedFrame);
+ /** */
+ NS_IMETHOD RemoveFrame(nsIFrame * aRemovedFrame);
+
+
// Helper method to create next-in-flows if necessary
static nsresult CreateNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aOuterFrame,