From 8d229a5a6e9f8a09dc088e933fcb9efa34bd8da7 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Fri, 25 Sep 1998 22:47:00 +0000 Subject: [PATCH] Moved ContentReplaced() handler code to style system git-svn-id: svn://10.0.0.236/trunk@11108 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsStyleSet.cpp | 4 ---- .../html/style/src/nsHTMLStyleSheet.cpp | 19 +++++++++++++++++++ mozilla/layout/base/public/nsIFrame.h | 18 ------------------ .../base/public/nsIStyleFrameConstruction.h | 7 +++++++ mozilla/layout/base/src/nsFrame.cpp | 10 ---------- mozilla/layout/base/src/nsFrame.h | 6 ------ mozilla/layout/base/src/nsPresShell.cpp | 19 ------------------- mozilla/layout/base/src/nsStyleSet.cpp | 4 ---- mozilla/layout/generic/nsIFrame.h | 18 ------------------ mozilla/layout/generic/nsPlaceholderFrame.cpp | 18 ------------------ mozilla/layout/generic/nsPlaceholderFrame.h | 6 ------ .../layout/html/base/src/nsAbsoluteFrame.cpp | 18 ------------------ .../layout/html/base/src/nsAbsoluteFrame.h | 6 ------ .../html/base/src/nsPlaceholderFrame.cpp | 18 ------------------ .../layout/html/base/src/nsPlaceholderFrame.h | 6 ------ .../html/style/src/nsHTMLStyleSheet.cpp | 19 +++++++++++++++++++ mozilla/layout/style/nsHTMLStyleSheet.cpp | 19 +++++++++++++++++++ mozilla/layout/style/nsStyleSet.cpp | 4 ---- 18 files changed, 64 insertions(+), 155 deletions(-) diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index c96e86b6d64..d16c48d80ea 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -774,12 +774,8 @@ NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext, nsIContent* aNewChild, PRInt32 aIndexInContainer) { -#if 0 return mFrameConstructor->ContentReplaced(aPresContext, aDocument, aContainer, aOldChild, aNewChild, aIndexInContainer); -#else - return NS_OK; -#endif } NS_IMETHODIMP StyleSetImpl::ContentRemoved(nsIPresContext* aPresContext, diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index 3e80ca834ca..0a05d2ed436 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -252,6 +252,13 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer); + NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer); + NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, nsIContent* aContainer, @@ -1571,6 +1578,18 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +HTMLStyleSheetImpl::ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) +{ + NS_NOTYETIMPLEMENTED("content replaced"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 281e9e23bff..0b5aae406a0 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -476,24 +476,6 @@ public: NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) = 0; - /** - * This call is invoked when content is replaced in the content - * tree. The container frame that maps that content is asked to deal - * with the replaced content by deleting old frames and then - * creating new frames and updating the index-in-parent values for - * it's affected children. In addition, the call must generate - * reflow commands that will incrementally reflow and repair the - * damaged portion of the frame tree. - * - * @param aIndexInParent the index in the content container where - * the new content was inserted. */ - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) = 0; - /** * This call is invoked when content is changed in the content tree. * The first frame that maps that content is asked to deal with the diff --git a/mozilla/layout/base/public/nsIStyleFrameConstruction.h b/mozilla/layout/base/public/nsIStyleFrameConstruction.h index 8d4a5960889..be7ace9a2a4 100644 --- a/mozilla/layout/base/public/nsIStyleFrameConstruction.h +++ b/mozilla/layout/base/public/nsIStyleFrameConstruction.h @@ -49,6 +49,13 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer) = 0; + NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) = 0; + NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, nsIContent* aContainer, diff --git a/mozilla/layout/base/src/nsFrame.cpp b/mozilla/layout/base/src/nsFrame.cpp index 2c0425e5adb..c82e1bd2bd5 100644 --- a/mozilla/layout/base/src/nsFrame.cpp +++ b/mozilla/layout/base/src/nsFrame.cpp @@ -1141,16 +1141,6 @@ NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -NS_METHOD nsFrame::ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) -{ - return NS_OK; -} - NS_METHOD nsFrame::ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/base/src/nsFrame.h b/mozilla/layout/base/src/nsFrame.h index 8f4cf7cab0d..4eed04580ab 100644 --- a/mozilla/layout/base/src/nsFrame.h +++ b/mozilla/layout/base/src/nsFrame.h @@ -148,12 +148,6 @@ public: const nsReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent); NS_IMETHOD ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/base/src/nsPresShell.cpp b/mozilla/layout/base/src/nsPresShell.cpp index 4349e4518ba..e69231293bc 100644 --- a/mozilla/layout/base/src/nsPresShell.cpp +++ b/mozilla/layout/base/src/nsPresShell.cpp @@ -761,30 +761,11 @@ PresShell::ContentReplaced(nsIDocument* aDocument, nsIContent* aNewChild, PRInt32 aIndexInContainer) { -#ifdef FRAME_CONSTRUCTION EnterReflowLock(); nsresult rv = mPresContext->ContentReplaced(aDocument, aContainer, aOldChild, aNewChild, aIndexInContainer); ExitReflowLock(); return rv; -#else - NS_PRECONDITION(nsnull != mRootFrame, "null root frame"); - - EnterReflowLock(); - - nsIFrame* frame = FindFrameWithContent(aContainer); - NS_PRECONDITION(nsnull != frame, "null frame"); - NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, - ("PresShell::ContentReplaced: container=%p[%s] oldChild=%p[%s][%d] newChild=%p[%s] frame=%p", - aContainer, ContentTag(aContainer, 0), - aOldChild, ContentTag(aOldChild, 1), aIndexInContainer, - aNewChild, ContentTag(aNewChild, 2), frame)); - frame->ContentReplaced(this, mPresContext, aContainer, aOldChild, - aNewChild, aIndexInContainer); - - ExitReflowLock(); - return NS_OK; -#endif } NS_IMETHODIMP diff --git a/mozilla/layout/base/src/nsStyleSet.cpp b/mozilla/layout/base/src/nsStyleSet.cpp index c96e86b6d64..d16c48d80ea 100644 --- a/mozilla/layout/base/src/nsStyleSet.cpp +++ b/mozilla/layout/base/src/nsStyleSet.cpp @@ -774,12 +774,8 @@ NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext, nsIContent* aNewChild, PRInt32 aIndexInContainer) { -#if 0 return mFrameConstructor->ContentReplaced(aPresContext, aDocument, aContainer, aOldChild, aNewChild, aIndexInContainer); -#else - return NS_OK; -#endif } NS_IMETHODIMP StyleSetImpl::ContentRemoved(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 281e9e23bff..0b5aae406a0 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -476,24 +476,6 @@ public: NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus) = 0; - /** - * This call is invoked when content is replaced in the content - * tree. The container frame that maps that content is asked to deal - * with the replaced content by deleting old frames and then - * creating new frames and updating the index-in-parent values for - * it's affected children. In addition, the call must generate - * reflow commands that will incrementally reflow and repair the - * damaged portion of the frame tree. - * - * @param aIndexInParent the index in the content container where - * the new content was inserted. */ - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) = 0; - /** * This call is invoked when content is changed in the content tree. * The first frame that maps that content is asked to deal with the diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index d89c420aeec..2d8b4c6d63c 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -139,24 +139,6 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) -{ - NS_ASSERTION(mContent == aContainer, "bad content-replaced target"); - - // Forward the notification to the floater - if (nsnull != mAnchoredItem) { - return mAnchoredItem->ContentReplaced(aShell, aPresContext, aContainer, - aOldChild, aNewChild, aIndexInParent); - } - - return NS_OK; -} - NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/generic/nsPlaceholderFrame.h b/mozilla/layout/generic/nsPlaceholderFrame.h index 4e44c6a7585..2a0b350e51b 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.h +++ b/mozilla/layout/generic/nsPlaceholderFrame.h @@ -50,12 +50,6 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent); NS_IMETHOD ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp index 0498833a20e..77441c4a81a 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp +++ b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp @@ -97,24 +97,6 @@ NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext, return nsFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } -NS_IMETHODIMP nsAbsoluteFrame::ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) -{ - NS_ASSERTION(mContent == aContainer, "bad content-replaced target"); - - // Forward the notification to the absolutely positioned frame - if (nsnull != mFrame) { - return mFrame->ContentReplaced(aShell, aPresContext, aContainer, - aOldChild, aNewChild, aIndexInParent); - } - - return NS_OK; -} - NS_IMETHODIMP nsAbsoluteFrame::ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/base/src/nsAbsoluteFrame.h b/mozilla/layout/html/base/src/nsAbsoluteFrame.h index 3fe5b0a3f05..90ded94b3ff 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteFrame.h +++ b/mozilla/layout/html/base/src/nsAbsoluteFrame.h @@ -43,12 +43,6 @@ public: const nsReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent); NS_IMETHOD ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index d89c420aeec..2d8b4c6d63c 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -139,24 +139,6 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP nsPlaceholderFrame::ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent) -{ - NS_ASSERTION(mContent == aContainer, "bad content-replaced target"); - - // Forward the notification to the floater - if (nsnull != mAnchoredItem) { - return mAnchoredItem->ContentReplaced(aShell, aPresContext, aContainer, - aOldChild, aNewChild, aIndexInParent); - } - - return NS_OK; -} - NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.h b/mozilla/layout/html/base/src/nsPlaceholderFrame.h index 4e44c6a7585..2a0b350e51b 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.h +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.h @@ -50,12 +50,6 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD ContentReplaced(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInParent); NS_IMETHOD ContentChanged(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index 3e80ca834ca..0a05d2ed436 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -252,6 +252,13 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer); + NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer); + NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, nsIContent* aContainer, @@ -1571,6 +1578,18 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +HTMLStyleSheetImpl::ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) +{ + NS_NOTYETIMPLEMENTED("content replaced"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index 3e80ca834ca..0a05d2ed436 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -252,6 +252,13 @@ public: nsIContent* aChild, PRInt32 aIndexInContainer); + NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer); + NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, nsIContent* aContainer, @@ -1571,6 +1578,18 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +HTMLStyleSheetImpl::ContentReplaced(nsIPresContext* aPresContext, + nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aOldChild, + nsIContent* aNewChild, + PRInt32 aIndexInContainer) +{ + NS_NOTYETIMPLEMENTED("content replaced"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsIDocument* aDocument, diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index c96e86b6d64..d16c48d80ea 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -774,12 +774,8 @@ NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext, nsIContent* aNewChild, PRInt32 aIndexInContainer) { -#if 0 return mFrameConstructor->ContentReplaced(aPresContext, aDocument, aContainer, aOldChild, aNewChild, aIndexInContainer); -#else - return NS_OK; -#endif } NS_IMETHODIMP StyleSetImpl::ContentRemoved(nsIPresContext* aPresContext,