From 4bdfb901109ce6e8753dae91d130f7ef77b388cb Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Wed, 22 Sep 1999 00:58:58 +0000 Subject: [PATCH] Queue up a reflow command when yanking floaters so that cases like bug #11389 work properly git-svn-id: svn://10.0.0.236/trunk@48701 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 48 +++++-------------- mozilla/layout/generic/nsBlockReflowState.cpp | 48 +++++-------------- mozilla/layout/generic/nsBlockReflowState.h | 48 +++++-------------- mozilla/layout/html/base/src/nsBlockFrame.cpp | 48 +++++-------------- .../html/base/src/nsBlockReflowState.cpp | 48 +++++-------------- .../layout/html/base/src/nsBlockReflowState.h | 48 +++++-------------- 6 files changed, 66 insertions(+), 222 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull; diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull; diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull; diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull; diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 9b334624c56..a48ede797aa 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -4368,24 +4368,6 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) } } -static nsISpaceManager* -FindSpaceManager(nsIFrame* aFrame) -{ - nsISpaceManager* spaceManager; - while (aFrame) { - nsIAreaFrame* af; - nsresult rv = aFrame->QueryInterface(kIAreaFrameIID, (void**) &af); - if (NS_SUCCEEDED(rv)) { - af->GetSpaceManager(&spaceManager); - if (spaceManager) { - return spaceManager; - } - } - aFrame->GetParent(&aFrame); - } - return nsnull; -} - NS_IMETHODIMP nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, @@ -4394,18 +4376,17 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, { nsresult rv = NS_OK; +#ifdef NOISY_REFLOW_REASON + ListTag(stdout); + printf(": remove "); + nsFrame::ListTag(stdout, aOldFrame); + printf("\n"); +#endif + if (nsLayoutAtoms::floaterList == aListName) { // Remove floater from the floater list first mFloaters.RemoveFrame(aOldFrame); - // Find nearest space-manager and remove the floater from its - // region list - nsCOMPtr spaceManager = - getter_AddRefs(FindSpaceManager(this)); - if (spaceManager) { - spaceManager->RemoveRegion(aOldFrame); - } - // Find which line contains the floater nsLineBox* line = mLines; while (nsnull != line) { @@ -4427,21 +4408,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext& aPresContext, line->MarkDirty(); line = line->mNext; } - - // We will reflow *after* removing the placeholder (which is done 2nd) - return NS_OK; } else if (nsnull != aListName) { - return NS_ERROR_INVALID_ARG; + rv = NS_ERROR_INVALID_ARG; + } + else { + rv = DoRemoveFrame(&aPresContext, aOldFrame); } -#ifdef NOISY_REFLOW_REASON - ListTag(stdout); - printf(": remove "); - nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); -#endif - rv = DoRemoveFrame(&aPresContext, aOldFrame); if (NS_SUCCEEDED(rv)) { // Generate reflow command to reflow the dirty lines nsIReflowCommand* reflowCmd = nsnull;