зеркало из https://github.com/mozilla/pjs.git
Added ReplaceFrame() member function to nsIFrame
This commit is contained in:
Родитель
908ee043c1
Коммит
ede5a246de
|
@ -238,7 +238,7 @@ public:
|
|||
|
||||
/**
|
||||
* This method is responsible for appending frames to the frame
|
||||
* list. The implementation should append the frames to the appropriate
|
||||
* list. The implementation should append the frames to the specified
|
||||
* child list and then generate a reflow command.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
|
||||
/**
|
||||
* This method is responsible for inserting frames into the frame
|
||||
* list. The implementation should insert the new frames into the appropriate
|
||||
* list. The implementation should insert the new frames into the specified
|
||||
* child list and then generate a reflow command.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
|
@ -293,6 +293,26 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame) = 0;
|
||||
|
||||
/**
|
||||
* This method is responsible for replacing the old frame with the
|
||||
* new frame. The old frame should be destroyed and the new frame inserted
|
||||
* in its place in the specified child list.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
* name means the unnamed principal child list
|
||||
* @param aOldFrame the frame to remove
|
||||
* @param aNewFrame the frame to replace it with
|
||||
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
||||
* name,
|
||||
* NS_ERROR_UNEXPECTED if the frame is an atomic frame
|
||||
* NS_OK otherwise
|
||||
*/
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the content object associated with this frame. Adds a reference to
|
||||
* the content object so the caller must do a release.
|
||||
|
|
|
@ -365,6 +365,32 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContainerFrame::ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame)
|
||||
{
|
||||
nsIFrame* prevFrame;
|
||||
nsIFrame* firstChild;
|
||||
nsresult rv;
|
||||
|
||||
// Get the old frame's previous sibling frame
|
||||
FirstChild(aListName, &firstChild);
|
||||
nsFrameList frames(firstChild);
|
||||
NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame");
|
||||
prevFrame = frames.GetPrevSiblingFor(aOldFrame);
|
||||
|
||||
// Default implementation treats it like two separate operations
|
||||
rv = RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = InsertFrames(aPresContext, aPresShell, aListName, prevFrame, aNewFrame);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Helper member functions
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@ public:
|
|||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange);
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
|
|
|
@ -371,6 +371,16 @@ nsFrame::RemoveFrame(nsIPresContext& aPresContext,
|
|||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::Destroy(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
|
|
@ -130,6 +130,11 @@ public:
|
|||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD GetContent(nsIContent** aContent) const;
|
||||
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const;
|
||||
|
|
|
@ -238,7 +238,7 @@ public:
|
|||
|
||||
/**
|
||||
* This method is responsible for appending frames to the frame
|
||||
* list. The implementation should append the frames to the appropriate
|
||||
* list. The implementation should append the frames to the specified
|
||||
* child list and then generate a reflow command.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
|
||||
/**
|
||||
* This method is responsible for inserting frames into the frame
|
||||
* list. The implementation should insert the new frames into the appropriate
|
||||
* list. The implementation should insert the new frames into the specified
|
||||
* child list and then generate a reflow command.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
|
@ -293,6 +293,26 @@ public:
|
|||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame) = 0;
|
||||
|
||||
/**
|
||||
* This method is responsible for replacing the old frame with the
|
||||
* new frame. The old frame should be destroyed and the new frame inserted
|
||||
* in its place in the specified child list.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
* name means the unnamed principal child list
|
||||
* @param aOldFrame the frame to remove
|
||||
* @param aNewFrame the frame to replace it with
|
||||
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
|
||||
* name,
|
||||
* NS_ERROR_UNEXPECTED if the frame is an atomic frame
|
||||
* NS_OK otherwise
|
||||
*/
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the content object associated with this frame. Adds a reference to
|
||||
* the content object so the caller must do a release.
|
||||
|
|
|
@ -365,6 +365,32 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContainerFrame::ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame)
|
||||
{
|
||||
nsIFrame* prevFrame;
|
||||
nsIFrame* firstChild;
|
||||
nsresult rv;
|
||||
|
||||
// Get the old frame's previous sibling frame
|
||||
FirstChild(aListName, &firstChild);
|
||||
nsFrameList frames(firstChild);
|
||||
NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame");
|
||||
prevFrame = frames.GetPrevSiblingFor(aOldFrame);
|
||||
|
||||
// Default implementation treats it like two separate operations
|
||||
rv = RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = InsertFrames(aPresContext, aPresShell, aListName, prevFrame, aNewFrame);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Helper member functions
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@ public:
|
|||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange);
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
|
|
|
@ -371,6 +371,16 @@ nsFrame::RemoveFrame(nsIPresContext& aPresContext,
|
|||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::Destroy(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
|
|
@ -130,6 +130,11 @@ public:
|
|||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
|
||||
NS_IMETHOD GetContent(nsIContent** aContent) const;
|
||||
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче