зеркало из https://github.com/mozilla/pjs.git
added AddFrame and RemoveFrame as incremental reflow support methods
This commit is contained in:
Родитель
5a8dfade2c
Коммит
bcdbdd90e9
|
@ -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 <b>if and only if</b> a new frame is
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 <b>if and only if</b> a new frame is
|
||||
|
|
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче