From 3be19d2cebab006e1daf8c62583bee59bedbb054 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Fri, 16 Jul 1999 23:25:15 +0000 Subject: [PATCH] Added NotifyDestroyingFrame() function to nsIPresShell git-svn-id: svn://10.0.0.236/trunk@39784 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsIPresShell.h | 26 ++++++++++++++++------- mozilla/layout/base/public/nsIPresShell.h | 26 ++++++++++++++++------- mozilla/layout/generic/nsFrame.cpp | 4 ++-- mozilla/layout/html/base/src/nsFrame.cpp | 4 ++-- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/mozilla/layout/base/nsIPresShell.h b/mozilla/layout/base/nsIPresShell.h index d2d04c7f8bf..ec733351df0 100644 --- a/mozilla/layout/base/nsIPresShell.h +++ b/mozilla/layout/base/nsIPresShell.h @@ -182,26 +182,29 @@ public: nsIFrame* aPlaceholderFrame) = 0; NS_IMETHOD ClearPlaceholderFrameMap() = 0; + /** + * Reflow commands + */ NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0; - NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame) = 0; - NS_IMETHOD ProcessReflowCommands() = 0; NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0; /** - * Given a frame, cough up a rendering context suitable for use with + * Given a frame, create a rendering context suitable for use with * the frame. */ NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame, nsIRenderingContext** aContext) = 0; - // Notification that we were unable to render a replaced element. - // Called when the replaced element can not be rendered, and we should - // instead render the element's contents. - // The content object associated with aFrame should either be a IMG - // element, an OBJECT element, or an APPLET element + /** + * Notification that we were unable to render a replaced element. + * Called when the replaced element can not be rendered, and we should + * instead render the element's contents. + * The content object associated with aFrame should either be a IMG + * element, an OBJECT element, or an APPLET element + */ NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0; @@ -263,6 +266,13 @@ public: PRInt32 aHOffsetPercent, PRUint32 aHFlags) const = 0; + /** + * Notification sent by a frame informing the pres shell that it is about to + * be destroyed. + * This allows any outstanding references to the frame to be cleaned up + */ + NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0; + /** * Notify the Clipboard that we have something to copy. */ diff --git a/mozilla/layout/base/public/nsIPresShell.h b/mozilla/layout/base/public/nsIPresShell.h index d2d04c7f8bf..ec733351df0 100644 --- a/mozilla/layout/base/public/nsIPresShell.h +++ b/mozilla/layout/base/public/nsIPresShell.h @@ -182,26 +182,29 @@ public: nsIFrame* aPlaceholderFrame) = 0; NS_IMETHOD ClearPlaceholderFrameMap() = 0; + /** + * Reflow commands + */ NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0; - NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame) = 0; - NS_IMETHOD ProcessReflowCommands() = 0; NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0; /** - * Given a frame, cough up a rendering context suitable for use with + * Given a frame, create a rendering context suitable for use with * the frame. */ NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame, nsIRenderingContext** aContext) = 0; - // Notification that we were unable to render a replaced element. - // Called when the replaced element can not be rendered, and we should - // instead render the element's contents. - // The content object associated with aFrame should either be a IMG - // element, an OBJECT element, or an APPLET element + /** + * Notification that we were unable to render a replaced element. + * Called when the replaced element can not be rendered, and we should + * instead render the element's contents. + * The content object associated with aFrame should either be a IMG + * element, an OBJECT element, or an APPLET element + */ NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0; @@ -263,6 +266,13 @@ public: PRInt32 aHOffsetPercent, PRUint32 aHFlags) const = 0; + /** + * Notification sent by a frame informing the pres shell that it is about to + * be destroyed. + * This allows any outstanding references to the frame to be cleaned up + */ + NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0; + /** * Notify the Clipboard that we have something to copy. */ diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 6f3fa82fbb9..5d9d66f22c5 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -377,11 +377,11 @@ nsFrame::DeleteFrame(nsIPresContext& aPresContext) nsCOMPtr shell; aPresContext.GetShell(getter_AddRefs(shell)); - // XXX Rather than always do this it would be better if it was part of + // XXX Rather than always doing this it would be better if it was part of // a frame observer mechanism and the pres shell could register as an // observer of the frame while the reflow command is pending... if (shell) { - shell->CancelReflowCommand(this); + shell->NotifyDestroyingFrame(this); } if ((mState & NS_FRAME_EXTERNAL_REFERENCE) || diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 6f3fa82fbb9..5d9d66f22c5 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -377,11 +377,11 @@ nsFrame::DeleteFrame(nsIPresContext& aPresContext) nsCOMPtr shell; aPresContext.GetShell(getter_AddRefs(shell)); - // XXX Rather than always do this it would be better if it was part of + // XXX Rather than always doing this it would be better if it was part of // a frame observer mechanism and the pres shell could register as an // observer of the frame while the reflow command is pending... if (shell) { - shell->CancelReflowCommand(this); + shell->NotifyDestroyingFrame(this); } if ((mState & NS_FRAME_EXTERNAL_REFERENCE) ||