From cbaac14adfd437bc795dc6fbe1043ee9d5235472 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Wed, 24 Feb 1999 04:03:50 +0000 Subject: [PATCH] Added CreateContinuingFrame() function to frame construction code git-svn-id: svn://10.0.0.236/trunk@21695 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsStyleSet.cpp | 16 +++++++++ mozilla/layout/base/nsCSSFrameConstructor.cpp | 18 ++++++++++ mozilla/layout/base/nsCSSFrameConstructor.h | 6 ++++ .../base/public/nsIStyleFrameConstruction.h | 6 ++++ mozilla/layout/base/public/nsIStyleSet.h | 6 ++++ mozilla/layout/base/src/nsStyleSet.cpp | 16 +++++++++ .../layout/generic/nsHTMLContainerFrame.cpp | 15 ++++++--- mozilla/layout/generic/nsPageFrame.cpp | 18 ++++++---- .../layout/generic/nsSimplePageSequence.cpp | 18 +++++++--- .../html/base/src/nsHTMLContainerFrame.cpp | 15 ++++++--- mozilla/layout/html/base/src/nsPageFrame.cpp | 18 ++++++---- .../html/base/src/nsSimplePageSequence.cpp | 18 +++++++--- .../html/style/src/nsCSSFrameConstructor.cpp | 18 ++++++++++ .../html/style/src/nsCSSFrameConstructor.h | 6 ++++ .../layout/html/table/src/nsTableFrame.cpp | 33 +++++++++++-------- .../html/table/src/nsTableRowGroupFrame.cpp | 27 +++++++++------ mozilla/layout/style/nsStyleSet.cpp | 16 +++++++++ mozilla/layout/tables/nsTableFrame.cpp | 33 +++++++++++-------- .../layout/tables/nsTableRowGroupFrame.cpp | 27 +++++++++------ 19 files changed, 248 insertions(+), 82 deletions(-) diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index 3fd4358aa2e..48eb0f78e3d 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -136,6 +136,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame); + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame); + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0); private: @@ -818,6 +824,16 @@ StyleSetImpl::CantRenderReplacedElement(nsIPresContext* aPresContext, return mFrameConstructor->CantRenderReplacedElement(aPresContext, aFrame); } +NS_IMETHODIMP +StyleSetImpl::CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) +{ + return mFrameConstructor->CreateContinuingFrame(aPresContext, aFrame, aParentFrame, + aContinuingFrame); +} + void StyleSetImpl::List(FILE* out, PRInt32 aIndent, nsISupportsArray* aSheets) { PRInt32 count = ((nsnull != aSheets) ? aSheets->Count() : 0); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index e646993bf20..05cdf528f5f 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -3551,6 +3551,24 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) +{ + nsresult rv; + nsIFrame* continuingFrame; + + nsIStyleContext* styleContext; + aFrame->GetStyleContext(&styleContext); + rv = aFrame->CreateContinuingFrame(*aPresContext, aParentFrame, styleContext, + continuingFrame); + NS_RELEASE(styleContext); + *aContinuingFrame = continuingFrame; + return rv; +} + nsresult nsCSSFrameConstructor::RecreateFramesOnAttributeChange(nsIPresContext* aPresContext, nsIContent* aContent, diff --git a/mozilla/layout/base/nsCSSFrameConstructor.h b/mozilla/layout/base/nsCSSFrameConstructor.h index 259490738ed..6700036a1a3 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.h +++ b/mozilla/layout/base/nsCSSFrameConstructor.h @@ -99,6 +99,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame); + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame); + protected: nsresult ResolveStyleContext(nsIPresContext* aPresContext, diff --git a/mozilla/layout/base/public/nsIStyleFrameConstruction.h b/mozilla/layout/base/public/nsIStyleFrameConstruction.h index 555ec95d811..a0a4f85945b 100644 --- a/mozilla/layout/base/public/nsIStyleFrameConstruction.h +++ b/mozilla/layout/base/public/nsIStyleFrameConstruction.h @@ -93,6 +93,12 @@ public: // Notification that we were unable to render a replaced element. NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0; + + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) = 0; }; #endif /* nsIStyleFrameConstruction_h___ */ diff --git a/mozilla/layout/base/public/nsIStyleSet.h b/mozilla/layout/base/public/nsIStyleSet.h index a2cf89fe119..a44282a87e5 100644 --- a/mozilla/layout/base/public/nsIStyleSet.h +++ b/mozilla/layout/base/public/nsIStyleSet.h @@ -145,6 +145,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0; + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) = 0; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0; virtual void ListContexts(nsIStyleContext* aRootContext, FILE* out = stdout, PRInt32 aIndent = 0) = 0; }; diff --git a/mozilla/layout/base/src/nsStyleSet.cpp b/mozilla/layout/base/src/nsStyleSet.cpp index 3fd4358aa2e..48eb0f78e3d 100644 --- a/mozilla/layout/base/src/nsStyleSet.cpp +++ b/mozilla/layout/base/src/nsStyleSet.cpp @@ -136,6 +136,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame); + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame); + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0); private: @@ -818,6 +824,16 @@ StyleSetImpl::CantRenderReplacedElement(nsIPresContext* aPresContext, return mFrameConstructor->CantRenderReplacedElement(aPresContext, aFrame); } +NS_IMETHODIMP +StyleSetImpl::CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) +{ + return mFrameConstructor->CreateContinuingFrame(aPresContext, aFrame, aParentFrame, + aContinuingFrame); +} + void StyleSetImpl::List(FILE* out, PRInt32 aIndent, nsISupportsArray* aSheets) { PRInt32 count = ((nsnull != aSheets) ? aSheets->Count() : 0); diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index d589d25058b..9c5b60e82ab 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -42,6 +42,7 @@ #include "nsDOMEvent.h" #include "nsIScrollableView.h" #include "nsWidgetsCID.h" +#include "nsIStyleSet.h" static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID); @@ -160,11 +161,15 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext& aPresContext, // into our lines child list. nsIFrame* nextFrame; aFrame->GetNextSibling(&nextFrame); - nsIStyleContext* kidSC; - aFrame->GetStyleContext(&kidSC); - aFrame->CreateContinuingFrame(aPresContext, aOuterFrame, - kidSC, nextInFlow); - NS_RELEASE(kidSC); + + nsIPresShell* presShell; + nsIStyleSet* styleSet; + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, aFrame, aOuterFrame, &nextInFlow); + NS_RELEASE(styleSet); + if (nsnull == nextInFlow) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 5a71ae14313..79897374fcd 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -25,6 +25,8 @@ #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" #include "nsLayoutAtoms.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" nsPageFrame::nsPageFrame() { @@ -81,14 +83,16 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* prevLastChild = prevPage->mFrames.LastChild(); // Create a continuing child of the previous page's last child - nsIStyleContext* kidSC; - prevLastChild->GetStyleContext(&kidSC); - nsIFrame* newFrame; - nsresult rv = prevLastChild->CreateContinuingFrame(aPresContext, this, - kidSC, - newFrame); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + nsIFrame* newFrame; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, prevLastChild, this, &newFrame); + NS_RELEASE(styleSet); mFrames.SetFrames(newFrame); - NS_RELEASE(kidSC); } // Resize our frame allowing it only to be as big as we are diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 0915cd025bd..14b5db60570 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -26,6 +26,7 @@ #include "nsIDeviceContext.h" #include "nsIViewManager.h" #include "nsIPresShell.h" +#include "nsIStyleSet.h" nsresult nsSimplePageSequenceFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) @@ -151,11 +152,18 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, } else if (nsnull == kidNextInFlow) { // The page isn't complete and it doesn't have a next-in-flow so // create a continuing page - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - nsIFrame* continuingPage; - nsresult rv = kidFrame->CreateContinuingFrame(aPresContext, this, - kidSC, continuingPage); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + nsIFrame* continuingPage; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingPage); + NS_RELEASE(styleSet); + // XXX TROY Should be handled by frame construction code + nsIStyleContext* kidSC; + continuingPage->GetStyleContext(&kidSC); nsHTMLContainerFrame::CreateViewForFrame(aPresContext, continuingPage, kidSC, PR_TRUE); NS_RELEASE(kidSC); diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index d589d25058b..9c5b60e82ab 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -42,6 +42,7 @@ #include "nsDOMEvent.h" #include "nsIScrollableView.h" #include "nsWidgetsCID.h" +#include "nsIStyleSet.h" static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID); @@ -160,11 +161,15 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext& aPresContext, // into our lines child list. nsIFrame* nextFrame; aFrame->GetNextSibling(&nextFrame); - nsIStyleContext* kidSC; - aFrame->GetStyleContext(&kidSC); - aFrame->CreateContinuingFrame(aPresContext, aOuterFrame, - kidSC, nextInFlow); - NS_RELEASE(kidSC); + + nsIPresShell* presShell; + nsIStyleSet* styleSet; + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, aFrame, aOuterFrame, &nextInFlow); + NS_RELEASE(styleSet); + if (nsnull == nextInFlow) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 5a71ae14313..79897374fcd 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -25,6 +25,8 @@ #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" #include "nsLayoutAtoms.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" nsPageFrame::nsPageFrame() { @@ -81,14 +83,16 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* prevLastChild = prevPage->mFrames.LastChild(); // Create a continuing child of the previous page's last child - nsIStyleContext* kidSC; - prevLastChild->GetStyleContext(&kidSC); - nsIFrame* newFrame; - nsresult rv = prevLastChild->CreateContinuingFrame(aPresContext, this, - kidSC, - newFrame); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + nsIFrame* newFrame; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, prevLastChild, this, &newFrame); + NS_RELEASE(styleSet); mFrames.SetFrames(newFrame); - NS_RELEASE(kidSC); } // Resize our frame allowing it only to be as big as we are diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 0915cd025bd..14b5db60570 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -26,6 +26,7 @@ #include "nsIDeviceContext.h" #include "nsIViewManager.h" #include "nsIPresShell.h" +#include "nsIStyleSet.h" nsresult nsSimplePageSequenceFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) @@ -151,11 +152,18 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, } else if (nsnull == kidNextInFlow) { // The page isn't complete and it doesn't have a next-in-flow so // create a continuing page - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - nsIFrame* continuingPage; - nsresult rv = kidFrame->CreateContinuingFrame(aPresContext, this, - kidSC, continuingPage); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + nsIFrame* continuingPage; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingPage); + NS_RELEASE(styleSet); + // XXX TROY Should be handled by frame construction code + nsIStyleContext* kidSC; + continuingPage->GetStyleContext(&kidSC); nsHTMLContainerFrame::CreateViewForFrame(aPresContext, continuingPage, kidSC, PR_TRUE); NS_RELEASE(kidSC); diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index e646993bf20..05cdf528f5f 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -3551,6 +3551,24 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) +{ + nsresult rv; + nsIFrame* continuingFrame; + + nsIStyleContext* styleContext; + aFrame->GetStyleContext(&styleContext); + rv = aFrame->CreateContinuingFrame(*aPresContext, aParentFrame, styleContext, + continuingFrame); + NS_RELEASE(styleContext); + *aContinuingFrame = continuingFrame; + return rv; +} + nsresult nsCSSFrameConstructor::RecreateFramesOnAttributeChange(nsIPresContext* aPresContext, nsIContent* aContent, diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.h b/mozilla/layout/html/style/src/nsCSSFrameConstructor.h index 259490738ed..6700036a1a3 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.h +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.h @@ -99,6 +99,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame); + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame); + protected: nsresult ResolveStyleContext(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 1830c9c1457..b90e7182550 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -44,6 +44,8 @@ #include "nsIReflowCommand.h" #include "nsLayoutAtoms.h" #include "nsIDeviceContext.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -3586,13 +3588,15 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, if (nsnull == kidNextInFlow) { // The child doesn't have a next-in-flow so create a continuing // frame. This hooks the child into the flow - nsIFrame* continuingFrame; - - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - kidFrame->CreateContinuingFrame(aPresContext, this, kidSC, continuingFrame); - NS_RELEASE(kidSC); - NS_ASSERTION(nsnull != continuingFrame, "frame creation failed"); + nsIFrame* continuingFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingFrame); + NS_RELEASE(styleSet); // Add the continuing frame to the sibling list nsIFrame* nextSib; @@ -3738,13 +3742,14 @@ NS_METHOD nsTableFrame::PullUpChildren(nsIPresContext& aPresContext, // The child doesn't have a next-in-flow so create a // continuing frame. The creation appends it to the flow and // prepares it for reflow. - nsIFrame* continuingFrame; - - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - kidFrame->CreateContinuingFrame(aPresContext, this, kidSC, continuingFrame); - NS_RELEASE(kidSC); - NS_ASSERTION(nsnull != continuingFrame, "frame creation failed"); + nsIFrame* continuingFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingFrame); + NS_RELEASE(styleSet); // Add the continuing frame to our sibling list and then push // it to the next-in-flow. This ensures the next-in-flow's diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 6c28ecaba7f..736d7bb1d49 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -31,6 +31,8 @@ #include "nsHTMLIIDs.h" #include "nsIDeviceContext.h" #include "nsHTMLAtoms.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -773,11 +775,14 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // Create a continuing frame, add it to the child list, and then push it // and the frames that follow nsIFrame* contRowFrame; - nsIStyleContext* rowStyle; - - rowFrame->GetStyleContext(&rowStyle); - rowFrame->CreateContinuingFrame(aPresContext, this, rowStyle, contRowFrame); - NS_RELEASE(rowStyle); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, rowFrame, this, &contRowFrame); + NS_RELEASE(styleSet); // Add it to the child list nsIFrame* nextRow; @@ -830,13 +835,15 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, aReflowState, cellFrame, lastRowOrigin.y - firstRowOrigin.y, status); // Create the continuing cell frame - nsIStyleContext* cellStyle; nsIFrame* contCellFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; - cellFrame->GetStyleContext(&cellStyle); - cellFrame->CreateContinuingFrame(aPresContext, rowFrame, cellStyle, - contCellFrame); - NS_RELEASE(cellStyle); + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, cellFrame, rowFrame, &contCellFrame); + NS_RELEASE(styleSet); // Add it to the row's child list ((nsTableRowFrame*)rowFrame)->InsertCellFrame((nsTableCellFrame*)contCellFrame, diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index 3fd4358aa2e..48eb0f78e3d 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -136,6 +136,12 @@ public: NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame); + // Request to create a continuing frame + NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame); + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0); private: @@ -818,6 +824,16 @@ StyleSetImpl::CantRenderReplacedElement(nsIPresContext* aPresContext, return mFrameConstructor->CantRenderReplacedElement(aPresContext, aFrame); } +NS_IMETHODIMP +StyleSetImpl::CreateContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsIFrame* aParentFrame, + nsIFrame** aContinuingFrame) +{ + return mFrameConstructor->CreateContinuingFrame(aPresContext, aFrame, aParentFrame, + aContinuingFrame); +} + void StyleSetImpl::List(FILE* out, PRInt32 aIndent, nsISupportsArray* aSheets) { PRInt32 count = ((nsnull != aSheets) ? aSheets->Count() : 0); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 1830c9c1457..b90e7182550 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -44,6 +44,8 @@ #include "nsIReflowCommand.h" #include "nsLayoutAtoms.h" #include "nsIDeviceContext.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -3586,13 +3588,15 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext, if (nsnull == kidNextInFlow) { // The child doesn't have a next-in-flow so create a continuing // frame. This hooks the child into the flow - nsIFrame* continuingFrame; - - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - kidFrame->CreateContinuingFrame(aPresContext, this, kidSC, continuingFrame); - NS_RELEASE(kidSC); - NS_ASSERTION(nsnull != continuingFrame, "frame creation failed"); + nsIFrame* continuingFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingFrame); + NS_RELEASE(styleSet); // Add the continuing frame to the sibling list nsIFrame* nextSib; @@ -3738,13 +3742,14 @@ NS_METHOD nsTableFrame::PullUpChildren(nsIPresContext& aPresContext, // The child doesn't have a next-in-flow so create a // continuing frame. The creation appends it to the flow and // prepares it for reflow. - nsIFrame* continuingFrame; - - nsIStyleContext* kidSC; - kidFrame->GetStyleContext(&kidSC); - kidFrame->CreateContinuingFrame(aPresContext, this, kidSC, continuingFrame); - NS_RELEASE(kidSC); - NS_ASSERTION(nsnull != continuingFrame, "frame creation failed"); + nsIFrame* continuingFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, kidFrame, this, &continuingFrame); + NS_RELEASE(styleSet); // Add the continuing frame to our sibling list and then push // it to the next-in-flow. This ensures the next-in-flow's diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 6c28ecaba7f..736d7bb1d49 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -31,6 +31,8 @@ #include "nsHTMLIIDs.h" #include "nsIDeviceContext.h" #include "nsHTMLAtoms.h" +#include "nsIStyleSet.h" +#include "nsIPresShell.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -773,11 +775,14 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, // Create a continuing frame, add it to the child list, and then push it // and the frames that follow nsIFrame* contRowFrame; - nsIStyleContext* rowStyle; - - rowFrame->GetStyleContext(&rowStyle); - rowFrame->CreateContinuingFrame(aPresContext, this, rowStyle, contRowFrame); - NS_RELEASE(rowStyle); + nsIPresShell* presShell; + nsIStyleSet* styleSet; + + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, rowFrame, this, &contRowFrame); + NS_RELEASE(styleSet); // Add it to the child list nsIFrame* nextRow; @@ -830,13 +835,15 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext, aReflowState, cellFrame, lastRowOrigin.y - firstRowOrigin.y, status); // Create the continuing cell frame - nsIStyleContext* cellStyle; nsIFrame* contCellFrame; + nsIPresShell* presShell; + nsIStyleSet* styleSet; - cellFrame->GetStyleContext(&cellStyle); - cellFrame->CreateContinuingFrame(aPresContext, rowFrame, cellStyle, - contCellFrame); - NS_RELEASE(cellStyle); + aPresContext.GetShell(&presShell); + presShell->GetStyleSet(&styleSet); + NS_RELEASE(presShell); + styleSet->CreateContinuingFrame(&aPresContext, cellFrame, rowFrame, &contCellFrame); + NS_RELEASE(styleSet); // Add it to the row's child list ((nsTableRowFrame*)rowFrame)->InsertCellFrame((nsTableCellFrame*)contCellFrame,