From 8978d5a35bdd019d96b77dce9cd09950b47fe336 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Wed, 12 Jan 2000 21:52:58 +0000 Subject: [PATCH] r=troy. nsContainerFrame::ReflowDirtyChild() always generates a reflow command targeted at its child. nsInlineFrame::ReflowDirtyChild() always passes up the reflow request to its parent. nsBlockFrame::ReflowDirtyChild() no longer has code for checking whether its parent is an area frame. git-svn-id: svn://10.0.0.236/trunk@57571 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 21 +++++++--------- mozilla/layout/generic/nsBlockReflowState.cpp | 21 +++++++--------- mozilla/layout/generic/nsBlockReflowState.h | 21 +++++++--------- mozilla/layout/generic/nsContainerFrame.cpp | 21 +++++----------- mozilla/layout/generic/nsInlineFrame.cpp | 24 +++++++++++++++++++ mozilla/layout/generic/nsInlineFrame.h | 2 ++ mozilla/layout/html/base/src/nsBlockFrame.cpp | 21 +++++++--------- .../html/base/src/nsBlockReflowState.cpp | 21 +++++++--------- .../layout/html/base/src/nsBlockReflowState.h | 21 +++++++--------- .../layout/html/base/src/nsContainerFrame.cpp | 21 +++++----------- .../layout/html/base/src/nsInlineFrame.cpp | 24 +++++++++++++++++++ mozilla/layout/html/base/src/nsInlineFrame.h | 2 ++ 12 files changed, 112 insertions(+), 108 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 92c0814af39..f0b5e910ea2 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -344,22 +344,13 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext, NS_IMETHODIMP nsContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) { - // The container frame does not handle the reflow - // request. It passes it up to its parent container. + // The container frame always generates a reflow command + // targeted at its child + if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { + mState |= NS_FRAME_HAS_DIRTY_CHILDREN; - // If you don't already have dirty children, - if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { - if (mParent) { - // Record that you are dirty and have dirty children - mState |= NS_FRAME_IS_DIRTY; - mState |= NS_FRAME_HAS_DIRTY_CHILDREN; - - // Pass the reflow request up to the parent - mParent->ReflowDirtyChild(aPresShell, (nsIFrame*) this); - } - else { - NS_ASSERTION(0, "No parent to pass the reflow request up to."); - } + nsFrame::CreateAndPostReflowCommand(aPresShell, aChild, + nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } return NS_OK; diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 032086b513c..6f84a50dc49 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -291,6 +291,30 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout) return NS_OK; } +NS_IMETHODIMP +nsInlineFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) +{ + // The inline container frame does not handle the reflow + // request. It passes it up to its parent container. + + // If you don't already have dirty children, + if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { + if (mParent) { + // Record that you are dirty and have dirty children + mState |= NS_FRAME_IS_DIRTY; + mState |= NS_FRAME_HAS_DIRTY_CHILDREN; + + // Pass the reflow request up to the parent + mParent->ReflowDirtyChild(aPresShell, (nsIFrame*) this); + } + else { + NS_ASSERTION(0, "No parent to pass the reflow request up to."); + } + } + + return NS_OK; +} + void nsInlineFrame::DrainOverflow(nsIPresContext* aPresContext) { diff --git a/mozilla/layout/generic/nsInlineFrame.h b/mozilla/layout/generic/nsInlineFrame.h index ad9cfcf2397..6ed5c0874e0 100644 --- a/mozilla/layout/generic/nsInlineFrame.h +++ b/mozilla/layout/generic/nsInlineFrame.h @@ -66,6 +66,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); + NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild); + #ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; #endif diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 5aff56183fe..cc1a1c27fbf 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -6039,21 +6039,16 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } else { - if (!(mState & NS_FRAME_IS_DIRTY)) { - // If the parent frame is not an area frame - nsCOMPtr frameType; - mParent->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::areaFrame) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; + if (!(mState & NS_FRAME_IS_DIRTY)) { + // Mark yourself as dirty + mState |= NS_FRAME_IS_DIRTY; - // Cancel the dirty children reflow command you posted earlier - nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; - aPresShell->CancelReflowCommand(this, &type); + // Cancel the dirty children reflow command you posted earlier + nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty; + aPresShell->CancelReflowCommand(this, &type); - // Pass up the reflow request to the parent frame. - mParent->ReflowDirtyChild(aPresShell, this); - } + // Pass up the reflow request to the parent frame. + mParent->ReflowDirtyChild(aPresShell, this); } } diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 92c0814af39..f0b5e910ea2 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -344,22 +344,13 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext, NS_IMETHODIMP nsContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) { - // The container frame does not handle the reflow - // request. It passes it up to its parent container. + // The container frame always generates a reflow command + // targeted at its child + if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { + mState |= NS_FRAME_HAS_DIRTY_CHILDREN; - // If you don't already have dirty children, - if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { - if (mParent) { - // Record that you are dirty and have dirty children - mState |= NS_FRAME_IS_DIRTY; - mState |= NS_FRAME_HAS_DIRTY_CHILDREN; - - // Pass the reflow request up to the parent - mParent->ReflowDirtyChild(aPresShell, (nsIFrame*) this); - } - else { - NS_ASSERTION(0, "No parent to pass the reflow request up to."); - } + nsFrame::CreateAndPostReflowCommand(aPresShell, aChild, + nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull); } return NS_OK; diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 032086b513c..6f84a50dc49 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -291,6 +291,30 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout) return NS_OK; } +NS_IMETHODIMP +nsInlineFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) +{ + // The inline container frame does not handle the reflow + // request. It passes it up to its parent container. + + // If you don't already have dirty children, + if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) { + if (mParent) { + // Record that you are dirty and have dirty children + mState |= NS_FRAME_IS_DIRTY; + mState |= NS_FRAME_HAS_DIRTY_CHILDREN; + + // Pass the reflow request up to the parent + mParent->ReflowDirtyChild(aPresShell, (nsIFrame*) this); + } + else { + NS_ASSERTION(0, "No parent to pass the reflow request up to."); + } + } + + return NS_OK; +} + void nsInlineFrame::DrainOverflow(nsIPresContext* aPresContext) { diff --git a/mozilla/layout/html/base/src/nsInlineFrame.h b/mozilla/layout/html/base/src/nsInlineFrame.h index ad9cfcf2397..6ed5c0874e0 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.h +++ b/mozilla/layout/html/base/src/nsInlineFrame.h @@ -66,6 +66,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); + NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild); + #ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; #endif