Implementing a generalized recycler and arena for all layout frames. Hoping to improve
bug #9489. Should also definitely fix bug #15916. r=troy git-svn-id: svn://10.0.0.236/trunk@55321 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
42c76a9aa9
commit
7e24c61109
@ -335,12 +335,12 @@ nsCommentNode::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
nsresult NS_NewCommentFrame(nsIFrame*& aResult);
|
||||
nsresult NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult);
|
||||
nsresult
|
||||
NS_NewCommentFrame(nsIFrame*& aResult)
|
||||
NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
NS_NewEmptyFrame(&frame);
|
||||
NS_NewEmptyFrame(aPresShell, &frame);
|
||||
if (nsnull == frame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -918,7 +918,9 @@ NS_IMETHODIMP StyleSetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
{
|
||||
return mFrameConstructor->ConstructRootFrame(aPresContext, aDocElement,
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->ConstructRootFrame(shell, aPresContext, aDocElement,
|
||||
aFrameSubTree);
|
||||
}
|
||||
|
||||
@ -1024,7 +1026,9 @@ NS_IMETHODIMP
|
||||
StyleSetImpl::CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
return mFrameConstructor->CantRenderReplacedElement(aPresContext, aFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->CantRenderReplacedElement(shell, aPresContext, aFrame);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1033,7 +1037,9 @@ StyleSetImpl::CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame)
|
||||
{
|
||||
return mFrameConstructor->CreateContinuingFrame(aPresContext, aFrame, aParentFrame,
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->CreateContinuingFrame(shell, aPresContext, aFrame, aParentFrame,
|
||||
aContinuingFrame);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,8 @@ public:
|
||||
NS_IMETHOD Init(nsIDocument* aDocument);
|
||||
|
||||
// nsIStyleFrameConstruction API
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
@ -113,11 +114,13 @@ public:
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
// Notification that we were unable to render a replaced element.
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
// Request to create a continuing frame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame);
|
||||
@ -148,20 +151,23 @@ protected:
|
||||
nsIAtom* aTag,
|
||||
nsIStyleContext** aStyleContext);
|
||||
|
||||
nsresult ConstructFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
nsresult ConstructDocElementFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructDocElementFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIStyleContext* aParentStyleContext,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
nsresult ConstructDocElementTableFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructDocElementTableFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame*& aNewTableFrame);
|
||||
@ -175,7 +181,8 @@ protected:
|
||||
PRUint32 aContentIndex,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
PRBool CreateGeneratedContentFrame(nsIPresContext* aPresContext,
|
||||
PRBool CreateGeneratedContentFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
@ -192,7 +199,8 @@ protected:
|
||||
nsIFrame* aFrameList);
|
||||
|
||||
// BEGIN TABLE SECTION
|
||||
nsresult ConstructTableFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -200,7 +208,8 @@ protected:
|
||||
nsIFrame*& aNewFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructAnonymousTableFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructAnonymousTableFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -209,7 +218,8 @@ protected:
|
||||
nsIFrame*& aInnerFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructTableCaptionFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableCaptionFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -218,7 +228,8 @@ protected:
|
||||
nsIFrame*& aNewCaptionFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructTableGroupFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableGroupFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -229,7 +240,8 @@ protected:
|
||||
nsTableCreator& aTableCreator,
|
||||
nsTableList* aToDo = nsnull);
|
||||
|
||||
nsresult ConstructTableGroupFrameOnly(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableGroupFrameOnly(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -240,7 +252,8 @@ protected:
|
||||
nsTableCreator& aTableCreator,
|
||||
PRBool aProcessChildren = PR_TRUE);
|
||||
|
||||
nsresult ConstructTableRowFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableRowFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -250,7 +263,8 @@ protected:
|
||||
nsTableCreator& aTableCreator,
|
||||
nsTableList* aToDo = nsnull);
|
||||
|
||||
nsresult ConstructTableRowFrameOnly(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableRowFrameOnly(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -259,7 +273,8 @@ protected:
|
||||
nsIFrame*& aNewRowFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructTableColFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableColFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
@ -268,7 +283,8 @@ protected:
|
||||
nsIFrame*& aNewColFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructTableColFrameOnly(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableColFrameOnly(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -276,7 +292,8 @@ protected:
|
||||
nsIFrame*& aNewColFrame,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult ConstructTableCellFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableCellFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -287,7 +304,8 @@ protected:
|
||||
nsTableCreator& aTableCreator,
|
||||
PRBool aProcessChildren = PR_TRUE);
|
||||
|
||||
nsresult ConstructTableCellFrameOnly(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTableCellFrameOnly(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -297,14 +315,16 @@ protected:
|
||||
nsTableCreator& aTableCreator,
|
||||
PRBool aProcessChildren);
|
||||
|
||||
nsresult TableProcessChildren(nsIPresContext* aPresContext,
|
||||
nsresult TableProcessChildren(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsFrameItems& aChildList,
|
||||
nsTableCreator& aTableCreator);
|
||||
|
||||
nsresult TableProcessChild(nsIPresContext* aPresContext,
|
||||
nsresult TableProcessChild(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aChildContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -398,7 +418,8 @@ protected:
|
||||
|
||||
// END TABLE SECTION
|
||||
|
||||
nsresult CreatePlaceholderFrameFor(nsIPresContext* aPresContext,
|
||||
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
@ -406,7 +427,8 @@ protected:
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aPlaceholderFrame);
|
||||
|
||||
nsresult ConstructAlternateImageFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructAlternateImageFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -415,34 +437,41 @@ protected:
|
||||
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
|
||||
nsWidgetType aWidgetType);
|
||||
|
||||
nsresult ConstructRadioControlFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aStyleContext);
|
||||
|
||||
nsresult ConstructCheckboxControlFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsresult ConstructCheckboxControlFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
nsresult ConstructButtonLabelFrame(nsIPresContext *aPresContext,
|
||||
nsresult ConstructButtonLabelFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext *aPresContext,
|
||||
nsIContent *aContent,
|
||||
nsIFrame *&aFrame,
|
||||
nsFrameConstructorState& aState,
|
||||
nsFrameItems& aFrameItems);
|
||||
nsresult ConstructButtonFrames(nsIPresContext *aPresContext,
|
||||
nsresult ConstructButtonFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext *aPresContext,
|
||||
nsIContent *aContent,
|
||||
nsIFrame *&aFrame,
|
||||
nsFrameConstructorState& aState,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
nsresult ConstructButtonControlFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame);
|
||||
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame);
|
||||
|
||||
nsresult ConstructTextControlFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame*& aNewFrame,
|
||||
nsIContent* aContent);
|
||||
|
||||
|
||||
nsresult ConstructSelectFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -455,7 +484,8 @@ protected:
|
||||
PRBool aIsFixedPositioned,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
nsresult ConstructFrameByTag(nsIPresContext* aPresContext,
|
||||
nsresult ConstructFrameByTag(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -463,21 +493,24 @@ protected:
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
nsresult CreateAnonymousFrames(nsIPresContext* aPresContext,
|
||||
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIAtom* aTag,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aParent,
|
||||
nsIFrame* aNewFrame,
|
||||
nsFrameItems& aChildItems);
|
||||
|
||||
nsresult CreateAnonymousFrames(nsIPresContext* aPresContext,
|
||||
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aParent,
|
||||
nsIDocument* aDocument,
|
||||
nsIFrame* aNewFrame,
|
||||
nsFrameItems& aChildItems);
|
||||
|
||||
nsresult CreateAnonymousTreeCellFrames(nsIPresContext* aPresContext,
|
||||
nsresult CreateAnonymousTreeCellFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIAtom* aTag,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aParent,
|
||||
@ -497,7 +530,8 @@ protected:
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
nsresult ConstructXULFrame(nsIPresContext* aPresContext,
|
||||
nsresult ConstructXULFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
@ -508,7 +542,8 @@ protected:
|
||||
|
||||
#endif
|
||||
|
||||
nsresult ConstructFrameByDisplayType(nsIPresContext* aPresContext,
|
||||
nsresult ConstructFrameByDisplayType(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
const nsStyleDisplay* aDisplay,
|
||||
nsIContent* aContent,
|
||||
@ -521,7 +556,8 @@ protected:
|
||||
nsIFrame*& aNewParentFrame);
|
||||
|
||||
|
||||
nsresult ProcessChildren(nsIPresContext* aPresContext,
|
||||
nsresult ProcessChildren(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
@ -529,7 +565,8 @@ protected:
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aParentIsBlock);
|
||||
|
||||
nsresult CreateInputFrame(nsIPresContext *aPresContext,
|
||||
nsresult CreateInputFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext *aPresContext,
|
||||
nsIContent *aContent,
|
||||
nsIFrame *&aFrame,
|
||||
nsIStyleContext *aStyleContext,
|
||||
@ -555,7 +592,8 @@ protected:
|
||||
|
||||
|
||||
nsresult
|
||||
BuildScrollFrame (nsIPresContext* aPresContext,
|
||||
BuildScrollFrame (nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aContentStyle,
|
||||
@ -565,7 +603,7 @@ BuildScrollFrame (nsIPresContext* aPresContext,
|
||||
nsIStyleContext*& aScrolledChildStyle);
|
||||
|
||||
nsresult
|
||||
BeginBuildingScrollFrame (nsIPresContext* aPresContext,
|
||||
BeginBuildingScrollFrame (nsIPresShell* aPresShell, nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aContentStyle,
|
||||
@ -586,7 +624,8 @@ FinishBuildingScrollFrame(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* scrolledPseudoStyle);
|
||||
|
||||
nsresult
|
||||
BuildGfxScrollFrame (nsIPresContext* PresContext,
|
||||
BuildGfxScrollFrame (nsIPresShell* aPresShell,
|
||||
nsIPresContext* PresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIDocument* aDocument,
|
||||
@ -597,7 +636,8 @@ BuildGfxScrollFrame (nsIPresContext* PresContext,
|
||||
|
||||
|
||||
nsresult
|
||||
InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
InitializeSelectFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIFrame* scrollFrame,
|
||||
nsIFrame* scrolledFrame,
|
||||
@ -618,14 +658,16 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute);
|
||||
|
||||
nsresult CreateContinuingOuterTableFrame(nsIPresContext* aPresContext,
|
||||
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame** aContinuingFrame);
|
||||
|
||||
nsresult CreateContinuingTableFrame(nsIPresContext* aPresContext,
|
||||
nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aContent,
|
||||
@ -662,7 +704,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
nsresult ConstructBlock(nsIPresContext* aPresContext,
|
||||
nsresult ConstructBlock(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
const nsStyleDisplay* aDisplay,
|
||||
nsIContent* aContent,
|
||||
@ -670,7 +713,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
nsresult ProcessBlockChildren(nsIPresContext* aPresContext,
|
||||
nsresult ProcessBlockChildren(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
@ -678,7 +722,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aParentIsBlock);
|
||||
|
||||
nsresult ConstructInline(nsIPresContext* aPresContext,
|
||||
nsresult ConstructInline(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
const nsStyleDisplay* aDisplay,
|
||||
nsIContent* aContent,
|
||||
@ -688,7 +733,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame** aNewBlockFrame,
|
||||
nsIFrame** aNextInlineFrame);
|
||||
|
||||
nsresult ProcessInlineChildren(nsIPresContext* aPresContext,
|
||||
nsresult ProcessInlineChildren(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
@ -722,7 +768,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContainer);
|
||||
|
||||
void CreateFloatingLetterFrame(nsIPresContext* aPresContext,
|
||||
void CreateFloatingLetterFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aTextContent,
|
||||
nsIFrame* aTextFrame,
|
||||
@ -731,19 +778,22 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aResult);
|
||||
|
||||
nsresult CreateLetterFrame(nsIPresContext* aPresContext,
|
||||
nsresult CreateLetterFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aTextContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsFrameItems& aResult);
|
||||
|
||||
nsresult WrapFramesInFirstLetterFrame(nsIPresContext* aPresContext,
|
||||
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aBlockContent,
|
||||
nsIFrame* aBlockFrame,
|
||||
nsFrameItems& aBlockFrames);
|
||||
|
||||
nsresult WrapFramesInFirstLetterFrame(nsIPresContext* aPresContext,
|
||||
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame* aParentFrameList,
|
||||
@ -753,7 +803,8 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
nsFrameItems& aLetterFrame,
|
||||
PRBool* aStopLooking);
|
||||
|
||||
nsresult RecoverLetterFrames(nsIPresContext* aPresContext,
|
||||
nsresult RecoverLetterFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIFrame* aBlockFrame);
|
||||
|
||||
@ -781,13 +832,15 @@ InitializeSelectFrame(nsIPresContext* aPresContext,
|
||||
|
||||
// Methods support :first-line style
|
||||
|
||||
nsresult WrapFramesInFirstLineFrame(nsIPresContext* aPresContext,
|
||||
nsresult WrapFramesInFirstLineFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
nsresult AppendFirstLineFrames(nsIPresContext* aPresContext,
|
||||
nsresult AppendFirstLineFrames(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aBlockFrame,
|
||||
|
||||
@ -45,6 +45,7 @@ class nsIStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x76e79c60, 0x944e, 0x11d1, \
|
||||
@ -91,6 +92,12 @@ public:
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
// All frames owned by the shell are allocated from an arena. They are also recycled
|
||||
// using free lists (separate free lists being maintained for each size_t).
|
||||
// Methods for recycling frames.
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0;
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult) = 0;
|
||||
|
||||
@ -19,8 +19,10 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
@ -100,6 +102,9 @@ static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
|
||||
// comment out to hide caret
|
||||
#define SHOW_CARET
|
||||
|
||||
// The size of the presshell's recyclers array
|
||||
#define RECYCLER_SIZE 300
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Class IID's
|
||||
@ -196,6 +201,10 @@ public:
|
||||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet);
|
||||
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult);
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk);
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult);
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
|
||||
@ -378,6 +387,9 @@ protected:
|
||||
PresShellViewEventListener *mViewEventListener;
|
||||
PRBool mPendingReflowEvent;
|
||||
nsCOMPtr<nsIEventQueue> mEventQueue;
|
||||
nsCOMPtr<nsIArena> mArena;
|
||||
|
||||
void* mRecyclers[RECYCLER_SIZE];
|
||||
|
||||
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
|
||||
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
|
||||
@ -615,6 +627,14 @@ PresShell::Init(nsIDocument* aDocument,
|
||||
NS_PRECONDITION(nsnull != aDocument, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aPresContext, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aViewManager, "null ptr");
|
||||
|
||||
// Make the arena that will be used to allocate frames.
|
||||
NS_NewHeapArena(getter_AddRefs(mArena));
|
||||
|
||||
// Zero out the recyclers array.
|
||||
for (PRInt32 i = 0; i < RECYCLER_SIZE; i++)
|
||||
mRecyclers[i] = nsnull;
|
||||
|
||||
if ((nsnull == aDocument) || (nsnull == aPresContext) ||
|
||||
(nsnull == aViewManager)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -692,6 +712,39 @@ PresShell::Init(nsIDocument* aDocument,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::FreeFrame(size_t aSize, void* aPtr)
|
||||
{
|
||||
if (aSize >= RECYCLER_SIZE)
|
||||
return NS_OK;
|
||||
|
||||
void* currentTop = mRecyclers[aSize];
|
||||
mRecyclers[aSize] = aPtr;
|
||||
*((void**)aPtr) = currentTop;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::AllocateFrame(size_t aSize, void** aResult)
|
||||
{
|
||||
void* result = nsnull;
|
||||
if (aSize < RECYCLER_SIZE) {
|
||||
result = mRecyclers[aSize];
|
||||
if (result) {
|
||||
// Need to move to the next object
|
||||
void* next = *((void**)result);
|
||||
mRecyclers[aSize] = next;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
result = mArena->Alloc(PRInt32(aSize));
|
||||
}
|
||||
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::EnterReflowLock()
|
||||
{
|
||||
|
||||
@ -45,6 +45,7 @@ class nsIStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x76e79c60, 0x944e, 0x11d1, \
|
||||
@ -91,6 +92,12 @@ public:
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
// All frames owned by the shell are allocated from an arena. They are also recycled
|
||||
// using free lists (separate free lists being maintained for each size_t).
|
||||
// Methods for recycling frames.
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0;
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult) = 0;
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
@ -42,7 +43,8 @@ public:
|
||||
/**
|
||||
* Create frames for the root content element and its child content.
|
||||
*/
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
@ -100,11 +102,13 @@ public:
|
||||
nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element.
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Request to create a continuing frame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
@ -335,12 +335,12 @@ nsCommentNode::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
nsresult NS_NewCommentFrame(nsIFrame*& aResult);
|
||||
nsresult NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult);
|
||||
nsresult
|
||||
NS_NewCommentFrame(nsIFrame*& aResult)
|
||||
NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
NS_NewEmptyFrame(&frame);
|
||||
NS_NewEmptyFrame(aPresShell, &frame);
|
||||
if (nsnull == frame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -918,7 +918,9 @@ NS_IMETHODIMP StyleSetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree)
|
||||
{
|
||||
return mFrameConstructor->ConstructRootFrame(aPresContext, aDocElement,
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->ConstructRootFrame(shell, aPresContext, aDocElement,
|
||||
aFrameSubTree);
|
||||
}
|
||||
|
||||
@ -1024,7 +1026,9 @@ NS_IMETHODIMP
|
||||
StyleSetImpl::CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
return mFrameConstructor->CantRenderReplacedElement(aPresContext, aFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->CantRenderReplacedElement(shell, aPresContext, aFrame);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1033,7 +1037,9 @@ StyleSetImpl::CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame)
|
||||
{
|
||||
return mFrameConstructor->CreateContinuingFrame(aPresContext, aFrame, aParentFrame,
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
return mFrameConstructor->CreateContinuingFrame(shell, aPresContext, aFrame, aParentFrame,
|
||||
aContinuingFrame);
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
// the dll that are located in the .lib files we link with
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -32,6 +33,8 @@
|
||||
|
||||
void XXXNeverCalled()
|
||||
{
|
||||
nsIPresShell* ps;
|
||||
NS_NewPresShell(&ps);
|
||||
nsIPresContext* cx;
|
||||
NS_NewGalleyContext(&cx);
|
||||
NS_NewPrintPreviewContext(&cx);
|
||||
@ -42,17 +45,17 @@ void XXXNeverCalled()
|
||||
NS_NewHTMLDocument(&doc);
|
||||
NS_NewImageDocument(&doc);
|
||||
nsIFrame* f;
|
||||
NS_NewTextFrame(&f);
|
||||
NS_NewInlineFrame(&f);
|
||||
NS_NewBRFrame(&f);
|
||||
NS_NewWBRFrame(&f);
|
||||
NS_NewHRFrame(&f);
|
||||
NS_NewObjectFrame(&f);
|
||||
NS_NewSpacerFrame(&f);
|
||||
NS_NewHTMLFramesetFrame(&f);
|
||||
NS_NewRootFrame(&f);
|
||||
NS_NewScrollFrame(&f);
|
||||
NS_NewSimplePageSequenceFrame(&f);
|
||||
NS_NewTextFrame(ps, &f);
|
||||
NS_NewInlineFrame(ps, &f);
|
||||
NS_NewBRFrame(ps, &f);
|
||||
NS_NewWBRFrame(ps, &f);
|
||||
NS_NewHRFrame(ps, &f);
|
||||
NS_NewObjectFrame(ps, &f);
|
||||
NS_NewSpacerFrame(ps, &f);
|
||||
NS_NewHTMLFramesetFrame(ps, &f);
|
||||
NS_NewRootFrame(ps, &f);
|
||||
NS_NewScrollFrame(ps, &f);
|
||||
NS_NewSimplePageSequenceFrame(ps, &f);
|
||||
nsINameSpaceManager* nsm;
|
||||
NS_NewNameSpaceManager(&nsm);
|
||||
NS_CreateHTMLElement(nsnull, "");
|
||||
|
||||
@ -78,13 +78,13 @@ static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
const char * kMozDropdownActive = "-moz-dropdown-active";
|
||||
|
||||
nsresult
|
||||
NS_NewComboboxControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsComboboxControlFrame* it = new nsComboboxControlFrame;
|
||||
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -95,13 +95,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewFieldSetFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFieldSetFrame* it = new nsFieldSetFrame;
|
||||
nsFieldSetFrame* it = new (aPresShell) nsFieldSetFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -127,7 +127,10 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
|
||||
|
||||
PRUint8 flags = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay) ? NS_BLOCK_SHRINK_WRAP : 0;
|
||||
NS_NewAreaFrame(&mContentFrame, flags);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
NS_NewAreaFrame(shell, &mContentFrame, flags);
|
||||
mFrames.SetFrames(mContentFrame);
|
||||
|
||||
// Resolve style and initialize the frame
|
||||
|
||||
@ -61,13 +61,13 @@ static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIAnonymousContentCreatorIID, NS_IANONYMOUS_CONTENT_CREATOR_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewFileControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFileControlFrame* it = new nsFileControlFrame();
|
||||
nsFileControlFrame* it = new (aPresShell) nsFileControlFrame();
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -91,13 +91,13 @@ nsGfxButtonControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValu
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewGfxButtonControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxButtonControlFrame* it = new nsGfxButtonControlFrame;
|
||||
nsGfxButtonControlFrame* it = new (aPresShell) nsGfxButtonControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -31,13 +31,13 @@
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
nsresult
|
||||
NS_NewGfxCheckboxControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxCheckboxControlFrame* it = new nsGfxCheckboxControlFrame;
|
||||
nsGfxCheckboxControlFrame* it = new (aPresShell) nsGfxCheckboxControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewGfxRadioControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxRadioControlFrame* it = new nsGfxRadioControlFrame;
|
||||
nsGfxRadioControlFrame* it = new (aPresShell) nsGfxRadioControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -60,13 +60,13 @@ static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
|
||||
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLButtonControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLButtonControlFrame* it = new nsHTMLButtonControlFrame;
|
||||
nsHTMLButtonControlFrame* it = new (aPresShell) nsHTMLButtonControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -110,8 +110,11 @@ nsHTMLButtonControlFrame::Init(nsIPresContext* aPresContext,
|
||||
if (mInline) {
|
||||
flags |= NS_BLOCK_SHRINK_WRAP;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* areaFrame;
|
||||
NS_NewAreaFrame(&areaFrame, flags);
|
||||
NS_NewAreaFrame(shell, &areaFrame, flags);
|
||||
mFrames.SetFrames(areaFrame);
|
||||
|
||||
// Resolve style and initialize the frame
|
||||
|
||||
@ -167,13 +167,13 @@ nsImageControlFrame::~nsImageControlFrame()
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewImageControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsImageControlFrame* it = new nsImageControlFrame;
|
||||
nsImageControlFrame* it = new (aPresShell) nsImageControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -44,13 +44,13 @@ static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLLegendElementIID, NS_IDOMHTMLLEGENDELEMENT_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewLegendFrame(nsIFrame** aNewFrame)
|
||||
NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsLegendFrame* it = new nsLegendFrame;
|
||||
nsLegendFrame* it = new (aPresShell) nsLegendFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -76,13 +76,13 @@ const char * kMozSelected = "-moz-option-selected";
|
||||
|
||||
//---------------------------------------------------------
|
||||
nsresult
|
||||
NS_NewListControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsListControlFrame* it = new nsListControlFrame;
|
||||
nsListControlFrame* it = new (aPresShell) nsListControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class nsListControlFrame : public nsScrollFrame,
|
||||
public nsIStatefulFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewListControlFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -28,13 +28,13 @@
|
||||
static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewSelectsAreaFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSelectsAreaFrame* it = new nsSelectsAreaFrame;
|
||||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class nsIContent;
|
||||
class nsSelectsAreaFrame : public nsAreaFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewSelectsAreaFrame(nsIFrame** aResult, PRUint32 aFlags);
|
||||
friend nsresult NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsIFrame** aResult, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
//NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -40,13 +40,13 @@
|
||||
#undef NOISY_FINAL_SIZE
|
||||
|
||||
nsresult
|
||||
NS_NewAreaFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsAreaFrame* it = new nsAreaFrame;
|
||||
nsAreaFrame* it = new (aPresShell) nsAreaFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ struct nsStylePosition;
|
||||
class nsAreaFrame : public nsBlockFrame, public nsIAreaFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewAreaFrame(nsIFrame** aResult, PRUint32 aFlags);
|
||||
friend nsresult NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -64,13 +64,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewBRFrame(nsIFrame** aNewFrame)
|
||||
NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIFrame* frame = new BRFrame;
|
||||
nsIFrame* frame = new (aPresShell) BRFrame;
|
||||
if (nsnull == frame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -58,7 +58,7 @@ extern const nsIID kBlockFrameCID;
|
||||
class nsBlockFrame : public nsBlockFrameSuper
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags);
|
||||
friend nsresult NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -64,13 +64,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewFirstLetterFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFirstLetterFrame* it = new nsFirstLetterFrame;
|
||||
nsFirstLetterFrame* it = new (aPresShell) nsFirstLetterFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIView.h"
|
||||
@ -174,13 +175,13 @@ nsIFrameDebug::GetLogModuleInfo()
|
||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||
static NS_DEFINE_IID(kIFrameSelection, NS_IFRAMESELECTION_IID);
|
||||
nsresult
|
||||
NS_NewEmptyFrame(nsIFrame** aNewFrame)
|
||||
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFrame* it = new nsFrame;
|
||||
nsFrame* it = new (aPresShell) nsFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -188,10 +189,40 @@ NS_NewEmptyFrame(nsIFrame** aNewFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ZEROING_OPERATOR_NEW(nsFrame)
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsFrame);
|
||||
|
||||
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
|
||||
// (which comes from the presShell) to perform the allocation.
|
||||
void*
|
||||
nsFrame::operator new(size_t sz, nsIPresShell* aPresShell)
|
||||
{
|
||||
// Check the recycle list first.
|
||||
void* result = nsnull;
|
||||
aPresShell->AllocateFrame(sz, &result);
|
||||
|
||||
if (result) {
|
||||
nsCRT::zero(result, sz);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap.
|
||||
void
|
||||
nsFrame::operator delete(void* aPtr, size_t sz)
|
||||
{
|
||||
// Don't let the memory be freed, since it will be recycled
|
||||
// instead. Don't call the global operator delete.
|
||||
|
||||
// Stash the size of the object in the first four bytes of the
|
||||
// freed up memory. The Destroy method can then use this information
|
||||
// to recycle the object.
|
||||
size_t* szPtr = (size_t*)aPtr;
|
||||
*szPtr = sz;
|
||||
}
|
||||
|
||||
|
||||
nsFrame::nsFrame()
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsFrame);
|
||||
@ -371,7 +402,15 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
|
||||
view->Destroy();
|
||||
}
|
||||
|
||||
// Deleting the frame doesn't really free the memory, since we're using an
|
||||
// nsIArena for allocation, but we will get our destructors called.
|
||||
delete this;
|
||||
|
||||
// Now that we're totally cleaned out, we need to add ourselves to the presshell's
|
||||
// recycler.
|
||||
size_t* sz = (size_t*)this;
|
||||
shell->FreeFrame(*sz, (void*)this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
#include "nsIFrameDebug.h"
|
||||
#endif
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
/**
|
||||
* nsFrame logging constants. We redefine the nspr
|
||||
* PRLogModuleInfo.level field to be a bitfield. Each bit controls a
|
||||
@ -109,10 +111,22 @@ public:
|
||||
* Create a new "empty" frame that maps a given piece of content into a
|
||||
* 0,0 area.
|
||||
*/
|
||||
friend nsresult NS_NewEmptyFrame(nsIFrame** aInstancePtrResult);
|
||||
friend nsresult NS_NewEmptyFrame(nsIPresShell* aShell, nsIFrame** aInstancePtrResult);
|
||||
|
||||
// Overloaded new operator. Initializes the memory to 0
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
|
||||
// (which comes from the presShell) to perform the allocation.
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell);
|
||||
|
||||
private:
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap. This is private
|
||||
// to ensure that only the base class Destroy is allowed to delete the frame.
|
||||
void operator delete(void* aPtr, size_t sz);
|
||||
|
||||
// The normal operator new is disallowed on nsFrames.
|
||||
void* operator new(size_t sz) { return nsnull; };
|
||||
|
||||
public:
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -332,7 +332,9 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
nsIFrame* firstChild = mFrames.FirstChild();
|
||||
if (nsnull == firstChild) {
|
||||
firstChild = new nsHTMLFrameInnerFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
firstChild = new (shell.get()) nsHTMLFrameInnerFrame;
|
||||
mFrames.SetFrames(firstChild);
|
||||
// XXX temporary! use style system to get correct style!
|
||||
firstChild->Init(aPresContext, mContent, this, mStyleContext, nsnull);
|
||||
@ -410,13 +412,13 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFrameOuterFrame* it = new nsHTMLFrameOuterFrame;
|
||||
nsHTMLFrameOuterFrame* it = new (aPresShell) nsHTMLFrameOuterFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
@ -932,6 +933,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
||||
// Always get the size so that the caller knows how big we are
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
||||
@ -1030,7 +1034,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
aPresContext->ResolveStyleContextFor(child, mStyleContext,
|
||||
PR_FALSE, &kidSC);
|
||||
if (nsHTMLAtoms::frameset == tag) {
|
||||
result = NS_NewHTMLFramesetFrame(&frame);
|
||||
result = NS_NewHTMLFramesetFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
childTypes[mChildCount] = FRAMESET;
|
||||
@ -1040,7 +1044,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
childFrame->SetParentBorderColor(borderColor);
|
||||
childBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
||||
} else { // frame
|
||||
result = NS_NewHTMLFrameOuterFrame(&frame);
|
||||
result = NS_NewHTMLFrameOuterFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
childTypes[mChildCount] = FRAME;
|
||||
@ -1072,7 +1076,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
for (int blankX = mChildCount; blankX < numCells; blankX++) {
|
||||
// XXX the blank frame is using the content of its parent - at some point it
|
||||
// should just have null content, if we support that
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new nsHTMLFramesetBlankFrame;
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new (shell.get()) nsHTMLFramesetBlankFrame;
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo,
|
||||
mStyleContext, PR_FALSE,
|
||||
@ -1113,7 +1117,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
offset.y += lastSize.height;
|
||||
if ((borderWidth > 0) && (eFrameborder_No != frameborder)) {
|
||||
if (firstTime) { // create horizontal border
|
||||
borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE);
|
||||
borderFrame = new (shell.get()) nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE);
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo,
|
||||
mStyleContext, PR_FALSE,
|
||||
@ -1140,7 +1144,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
if ((cellIndex.x > 0) && (borderWidth > 0)) { // moved to next col in same row
|
||||
if (0 == cellIndex.y) { // in 1st row
|
||||
if (firstTime) { // create vertical border
|
||||
borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE);
|
||||
borderFrame = new (shell.get()) nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE);
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo,
|
||||
mStyleContext,
|
||||
@ -1519,13 +1523,13 @@ nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFramesetFrame* it = new nsHTMLFramesetFrame;
|
||||
nsHTMLFramesetFrame* it = new (aPresShell) nsHTMLFramesetFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -232,13 +232,13 @@ public:
|
||||
NS_IMPL_ISUPPORTS2(nsGfxScrollFrameInner, nsIDocumentObserver, nsIScrollPositionListener)
|
||||
|
||||
nsresult
|
||||
NS_NewGfxScrollFrame(nsIFrame** aNewFrame, nsIDocument* aDocument)
|
||||
NS_NewGfxScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, nsIDocument* aDocument)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxScrollFrame* it = new nsGfxScrollFrame(aDocument);
|
||||
nsGfxScrollFrame* it = new (aPresShell) nsGfxScrollFrame(aDocument);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -42,7 +42,8 @@ class nsGfxScrollFrame : public nsHTMLContainerFrame,
|
||||
public nsIAnonymousContentCreator,
|
||||
public nsIBox {
|
||||
public:
|
||||
friend nsresult NS_NewGfxScrollFrame(nsIFrame** aNewFrame, nsIDocument* aDocument);
|
||||
friend nsresult NS_NewGfxScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
nsIDocument* aDocument);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
||||
@ -110,13 +110,13 @@ private:
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewRootFrame(nsIFrame** aNewFrame)
|
||||
NS_NewRootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
RootFrame* it = new RootFrame;
|
||||
RootFrame* it = new (aPresShell) RootFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ class nsIURI;
|
||||
class nsString;
|
||||
class nsIWebShell;
|
||||
class nsIAttributeContent;
|
||||
class nsIPresShell;
|
||||
|
||||
// Factory methods for creating html content objects
|
||||
// XXX argument order is wrong (out parameter should be last)
|
||||
@ -253,7 +254,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
||||
#define NS_BLOCK_FLAGS_MASK 0x00ff0000
|
||||
|
||||
// Create a frame that supports "display: block" layout behavior
|
||||
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
// Special Generated Content Frame
|
||||
@ -264,102 +265,102 @@ NS_NewAttributeContent(nsIContent ** aResult);
|
||||
// return the option frame
|
||||
// By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
|
||||
|
||||
// Create a basic area frame. By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root, a margin root, and the
|
||||
// initial containing block for absolutely positioned elements
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is a margin root, but does not shrink wrap
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
// doesn't shrink wrap.
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame);
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
extern nsresult NS_NewCommentFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewHRFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewHRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// <frame> and <iframe>
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
// <frameset>
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
extern nsresult NS_NewViewportFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewRootFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewImageFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewInlineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewPositionedInlineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewObjectFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewSpacerFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTextFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewContinuingTextFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewEmptyFrame(nsIFrame** aResult);
|
||||
inline nsresult NS_NewWBRFrame(nsIFrame** aResult) {
|
||||
return NS_NewEmptyFrame(aResult);
|
||||
extern nsresult NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewRootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
inline nsresult NS_NewWBRFrame(nsIPresShell* aPresShell, nsIFrame** aResult) {
|
||||
return NS_NewEmptyFrame(aPresShell, aResult);
|
||||
}
|
||||
extern nsresult NS_NewScrollFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewSimplePageSequenceFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewPageFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFirstLetterFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewFirstLineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewScrollFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// forms
|
||||
extern nsresult NS_NewFormFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewImageControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewHTMLButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxCheckboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeCheckboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFieldSetFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFileControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewLabelFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewLegendFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxAutoTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxRadioControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeRadioControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeSelectControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewListControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewComboboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFormFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewLabelFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// Table frame factories
|
||||
extern nsresult NS_NewTableOuterFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColGroupFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowGroupFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableCellFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// XXX passing aWebShell into this is wrong
|
||||
extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
|
||||
|
||||
@ -78,13 +78,13 @@ static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
#define ALIGN_UNSET PRUint8(-1)
|
||||
|
||||
nsresult
|
||||
NS_NewImageFrame(nsIFrame** aNewFrame)
|
||||
NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsImageFrame* it = new nsImageFrame;
|
||||
nsImageFrame* it = new (aPresShell) nsImageFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -41,13 +41,13 @@ nsIID nsInlineFrame::kInlineFrameCID = NS_INLINE_FRAME_CID;
|
||||
// Basic nsInlineFrame methods
|
||||
|
||||
nsresult
|
||||
NS_NewInlineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsInlineFrame* it = new nsInlineFrame;
|
||||
nsInlineFrame* it = new (aPresShell) nsInlineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -647,13 +647,13 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewFirstLineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aNewFrame, "null ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsInlineFrame* it = new nsFirstLineFrame;
|
||||
nsInlineFrame* it = new (aPresShell) nsFirstLineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -835,13 +835,13 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewPositionedInlineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPositionedInlineFrame* it = new nsPositionedInlineFrame;
|
||||
nsPositionedInlineFrame* it = new (aPresShell) nsPositionedInlineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class nsAnonymousBlockFrame;
|
||||
class nsInlineFrame : public nsInlineFrameSuper
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewInlineFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsISupports overrides
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
@ -129,7 +129,7 @@ protected:
|
||||
*/
|
||||
class nsFirstLineFrame : public nsInlineFrame {
|
||||
public:
|
||||
friend nsresult NS_NewFirstLineFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
||||
|
||||
@ -376,8 +376,10 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
|
||||
if(bImage)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame * aNewFrame = nsnull;
|
||||
rv = NS_NewImageFrame(&aNewFrame);
|
||||
rv = NS_NewImageFrame(shell, &aNewFrame);
|
||||
if(rv != NS_OK)
|
||||
return rv;
|
||||
|
||||
@ -1341,13 +1343,13 @@ nsresult nsObjectFrame::GetPluginInstance(nsIPluginInstance*& aPluginInstance)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewObjectFrame(nsIFrame** aNewFrame)
|
||||
NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsObjectFrame* it = new nsObjectFrame;
|
||||
nsObjectFrame* it = new (aPresShell) nsObjectFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -33,13 +33,13 @@
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
nsresult
|
||||
NS_NewPageFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPageFrame* it = new nsPageFrame;
|
||||
nsPageFrame* it = new (aPresShell) nsPageFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Page frame class used by the simple page sequence frame
|
||||
class nsPageFrame : public nsContainerFrame {
|
||||
public:
|
||||
friend nsresult NS_NewPageFrame(nsIFrame** aResult);
|
||||
friend nsresult NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
||||
@ -29,13 +29,13 @@
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
nsresult
|
||||
NS_NewPlaceholderFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPlaceholderFrame* it = new nsPlaceholderFrame;
|
||||
nsPlaceholderFrame* it = new (aPresShell) nsPlaceholderFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
/**
|
||||
* Create a new placeholder frame
|
||||
*/
|
||||
friend nsresult NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult);
|
||||
friend nsresult NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aInstancePtrResult);
|
||||
|
||||
// Get/Set the associated out of flow frame
|
||||
nsIFrame* GetOutOfFlowFrame() const {return mOutOfFlowFrame;}
|
||||
|
||||
@ -33,13 +33,13 @@
|
||||
#include "nsIStyleSet.h"
|
||||
|
||||
nsresult
|
||||
NS_NewSimplePageSequenceFrame(nsIFrame** aNewFrame)
|
||||
NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSimplePageSequenceFrame* it = new nsSimplePageSequenceFrame;
|
||||
nsSimplePageSequenceFrame* it = new (aPresShell) nsSimplePageSequenceFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
class nsSimplePageSequenceFrame : public nsContainerFrame,
|
||||
public nsIPageSequenceFrame {
|
||||
public:
|
||||
friend nsresult NS_NewSimplePageSequenceFrame(nsIFrame** aResult);
|
||||
friend nsresult NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
class SpacerFrame : public nsFrame {
|
||||
public:
|
||||
friend nsresult NS_NewSpacerFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsIHTMLReflow
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
@ -54,13 +54,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewSpacerFrame(nsIFrame** aNewFrame)
|
||||
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
SpacerFrame* it = new SpacerFrame;
|
||||
SpacerFrame* it = new (aPresShell) SpacerFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -637,13 +637,13 @@ nsContinuingTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) con
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewTextFrame(nsIFrame** aNewFrame)
|
||||
NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTextFrame* it = new nsTextFrame;
|
||||
nsTextFrame* it = new (aPresShell) nsTextFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -652,13 +652,13 @@ NS_NewTextFrame(nsIFrame** aNewFrame)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewContinuingTextFrame(nsIFrame** aNewFrame)
|
||||
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsContinuingTextFrame* it = new nsContinuingTextFrame;
|
||||
nsContinuingTextFrame* it = new (aPresShell) nsContinuingTextFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -116,13 +116,13 @@ private:
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewViewportFrame(nsIFrame** aNewFrame)
|
||||
NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
ViewportFrame* it = new ViewportFrame;
|
||||
ViewportFrame* it = new (aPresShell) ViewportFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -40,13 +40,13 @@
|
||||
#undef NOISY_FINAL_SIZE
|
||||
|
||||
nsresult
|
||||
NS_NewAreaFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsAreaFrame* it = new nsAreaFrame;
|
||||
nsAreaFrame* it = new (aPresShell) nsAreaFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ struct nsStylePosition;
|
||||
class nsAreaFrame : public nsBlockFrame, public nsIAreaFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewAreaFrame(nsIFrame** aResult, PRUint32 aFlags);
|
||||
friend nsresult NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -64,13 +64,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewBRFrame(nsIFrame** aNewFrame)
|
||||
NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIFrame* frame = new BRFrame;
|
||||
nsIFrame* frame = new (aPresShell) BRFrame;
|
||||
if (nsnull == frame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -58,7 +58,7 @@ extern const nsIID kBlockFrameCID;
|
||||
class nsBlockFrame : public nsBlockFrameSuper
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags);
|
||||
friend nsresult NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -1080,13 +1080,13 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
|
||||
|
||||
nsresult
|
||||
NS_NewBlockFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsBlockFrame* it = new nsBlockFrame;
|
||||
nsBlockFrame* it = new (aPresShell) nsBlockFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -5934,7 +5934,10 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
mStyleContext, PR_FALSE, &kidSC);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new nsBulletFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
mBullet = new (shell.get()) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
NS_RELEASE(kidSC);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -64,13 +64,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewFirstLetterFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFirstLetterFrame* it = new nsFirstLetterFrame;
|
||||
nsFirstLetterFrame* it = new (aPresShell) nsFirstLetterFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIView.h"
|
||||
@ -174,13 +175,13 @@ nsIFrameDebug::GetLogModuleInfo()
|
||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||
static NS_DEFINE_IID(kIFrameSelection, NS_IFRAMESELECTION_IID);
|
||||
nsresult
|
||||
NS_NewEmptyFrame(nsIFrame** aNewFrame)
|
||||
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFrame* it = new nsFrame;
|
||||
nsFrame* it = new (aPresShell) nsFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -188,10 +189,40 @@ NS_NewEmptyFrame(nsIFrame** aNewFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ZEROING_OPERATOR_NEW(nsFrame)
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsFrame);
|
||||
|
||||
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
|
||||
// (which comes from the presShell) to perform the allocation.
|
||||
void*
|
||||
nsFrame::operator new(size_t sz, nsIPresShell* aPresShell)
|
||||
{
|
||||
// Check the recycle list first.
|
||||
void* result = nsnull;
|
||||
aPresShell->AllocateFrame(sz, &result);
|
||||
|
||||
if (result) {
|
||||
nsCRT::zero(result, sz);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap.
|
||||
void
|
||||
nsFrame::operator delete(void* aPtr, size_t sz)
|
||||
{
|
||||
// Don't let the memory be freed, since it will be recycled
|
||||
// instead. Don't call the global operator delete.
|
||||
|
||||
// Stash the size of the object in the first four bytes of the
|
||||
// freed up memory. The Destroy method can then use this information
|
||||
// to recycle the object.
|
||||
size_t* szPtr = (size_t*)aPtr;
|
||||
*szPtr = sz;
|
||||
}
|
||||
|
||||
|
||||
nsFrame::nsFrame()
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsFrame);
|
||||
@ -371,7 +402,15 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
|
||||
view->Destroy();
|
||||
}
|
||||
|
||||
// Deleting the frame doesn't really free the memory, since we're using an
|
||||
// nsIArena for allocation, but we will get our destructors called.
|
||||
delete this;
|
||||
|
||||
// Now that we're totally cleaned out, we need to add ourselves to the presshell's
|
||||
// recycler.
|
||||
size_t* sz = (size_t*)this;
|
||||
shell->FreeFrame(*sz, (void*)this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
#include "nsIFrameDebug.h"
|
||||
#endif
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
/**
|
||||
* nsFrame logging constants. We redefine the nspr
|
||||
* PRLogModuleInfo.level field to be a bitfield. Each bit controls a
|
||||
@ -109,10 +111,22 @@ public:
|
||||
* Create a new "empty" frame that maps a given piece of content into a
|
||||
* 0,0 area.
|
||||
*/
|
||||
friend nsresult NS_NewEmptyFrame(nsIFrame** aInstancePtrResult);
|
||||
friend nsresult NS_NewEmptyFrame(nsIPresShell* aShell, nsIFrame** aInstancePtrResult);
|
||||
|
||||
// Overloaded new operator. Initializes the memory to 0
|
||||
NS_DECL_ZEROING_OPERATOR_NEW
|
||||
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
|
||||
// (which comes from the presShell) to perform the allocation.
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell);
|
||||
|
||||
private:
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap. This is private
|
||||
// to ensure that only the base class Destroy is allowed to delete the frame.
|
||||
void operator delete(void* aPtr, size_t sz);
|
||||
|
||||
// The normal operator new is disallowed on nsFrames.
|
||||
void* operator new(size_t sz) { return nsnull; };
|
||||
|
||||
public:
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -232,13 +232,13 @@ public:
|
||||
NS_IMPL_ISUPPORTS2(nsGfxScrollFrameInner, nsIDocumentObserver, nsIScrollPositionListener)
|
||||
|
||||
nsresult
|
||||
NS_NewGfxScrollFrame(nsIFrame** aNewFrame, nsIDocument* aDocument)
|
||||
NS_NewGfxScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, nsIDocument* aDocument)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxScrollFrame* it = new nsGfxScrollFrame(aDocument);
|
||||
nsGfxScrollFrame* it = new (aPresShell) nsGfxScrollFrame(aDocument);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -42,7 +42,8 @@ class nsGfxScrollFrame : public nsHTMLContainerFrame,
|
||||
public nsIAnonymousContentCreator,
|
||||
public nsIBox {
|
||||
public:
|
||||
friend nsresult NS_NewGfxScrollFrame(nsIFrame** aNewFrame, nsIDocument* aDocument);
|
||||
friend nsresult NS_NewGfxScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
nsIDocument* aDocument);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
||||
@ -69,13 +69,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHRFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
HRuleFrame* it = new HRuleFrame;
|
||||
HRuleFrame* it = new (aPresShell) HRuleFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -110,13 +110,13 @@ private:
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewRootFrame(nsIFrame** aNewFrame)
|
||||
NS_NewRootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
RootFrame* it = new RootFrame;
|
||||
RootFrame* it = new (aPresShell) RootFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ class nsIURI;
|
||||
class nsString;
|
||||
class nsIWebShell;
|
||||
class nsIAttributeContent;
|
||||
class nsIPresShell;
|
||||
|
||||
// Factory methods for creating html content objects
|
||||
// XXX argument order is wrong (out parameter should be last)
|
||||
@ -253,7 +254,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
||||
#define NS_BLOCK_FLAGS_MASK 0x00ff0000
|
||||
|
||||
// Create a frame that supports "display: block" layout behavior
|
||||
extern nsresult NS_NewBlockFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
// Special Generated Content Frame
|
||||
@ -264,102 +265,102 @@ NS_NewAttributeContent(nsIContent ** aResult);
|
||||
// return the option frame
|
||||
// By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewSelectsAreaFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewSelectsAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_BLOCK_WRAP_SIZE);
|
||||
|
||||
// Create a basic area frame. By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
||||
extern nsresult NS_NewAreaFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewBlockFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root, a margin root, and the
|
||||
// initial containing block for absolutely positioned elements
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is a margin root, but does not shrink wrap
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
// doesn't shrink wrap.
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame);
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aPresShell, aNewFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
extern nsresult NS_NewCommentFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewHRFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewHRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// <frame> and <iframe>
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
// <frameset>
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
extern nsresult NS_NewViewportFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewRootFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewImageFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewInlineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewPositionedInlineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewObjectFrame(nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewSpacerFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTextFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewContinuingTextFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewEmptyFrame(nsIFrame** aResult);
|
||||
inline nsresult NS_NewWBRFrame(nsIFrame** aResult) {
|
||||
return NS_NewEmptyFrame(aResult);
|
||||
extern nsresult NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewRootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
||||
extern nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
inline nsresult NS_NewWBRFrame(nsIPresShell* aPresShell, nsIFrame** aResult) {
|
||||
return NS_NewEmptyFrame(aPresShell, aResult);
|
||||
}
|
||||
extern nsresult NS_NewScrollFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewSimplePageSequenceFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewPageFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFirstLetterFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewFirstLineFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewScrollFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// forms
|
||||
extern nsresult NS_NewFormFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewImageControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewHTMLButtonControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxCheckboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeCheckboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFieldSetFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFileControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewLabelFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewLegendFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxAutoTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxRadioControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeRadioControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeSelectControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewListControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewComboboxControlFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewFormFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewLabelFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewNativeSelectControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// Table frame factories
|
||||
extern nsresult NS_NewTableOuterFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColGroupFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowGroupFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableCellFrame(nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
extern nsresult NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// XXX passing aWebShell into this is wrong
|
||||
extern nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
|
||||
|
||||
@ -78,13 +78,13 @@ static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
#define ALIGN_UNSET PRUint8(-1)
|
||||
|
||||
nsresult
|
||||
NS_NewImageFrame(nsIFrame** aNewFrame)
|
||||
NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsImageFrame* it = new nsImageFrame;
|
||||
nsImageFrame* it = new (aPresShell) nsImageFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -41,13 +41,13 @@ nsIID nsInlineFrame::kInlineFrameCID = NS_INLINE_FRAME_CID;
|
||||
// Basic nsInlineFrame methods
|
||||
|
||||
nsresult
|
||||
NS_NewInlineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsInlineFrame* it = new nsInlineFrame;
|
||||
nsInlineFrame* it = new (aPresShell) nsInlineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -647,13 +647,13 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewFirstLineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aNewFrame, "null ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsInlineFrame* it = new nsFirstLineFrame;
|
||||
nsInlineFrame* it = new (aPresShell) nsFirstLineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -835,13 +835,13 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewPositionedInlineFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPositionedInlineFrame* it = new nsPositionedInlineFrame;
|
||||
nsPositionedInlineFrame* it = new (aPresShell) nsPositionedInlineFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class nsAnonymousBlockFrame;
|
||||
class nsInlineFrame : public nsInlineFrameSuper
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewInlineFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsISupports overrides
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
@ -129,7 +129,7 @@ protected:
|
||||
*/
|
||||
class nsFirstLineFrame : public nsInlineFrame {
|
||||
public:
|
||||
friend nsresult NS_NewFirstLineFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
||||
|
||||
@ -376,8 +376,10 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
|
||||
if(bImage)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame * aNewFrame = nsnull;
|
||||
rv = NS_NewImageFrame(&aNewFrame);
|
||||
rv = NS_NewImageFrame(shell, &aNewFrame);
|
||||
if(rv != NS_OK)
|
||||
return rv;
|
||||
|
||||
@ -1341,13 +1343,13 @@ nsresult nsObjectFrame::GetPluginInstance(nsIPluginInstance*& aPluginInstance)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewObjectFrame(nsIFrame** aNewFrame)
|
||||
NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsObjectFrame* it = new nsObjectFrame;
|
||||
nsObjectFrame* it = new (aPresShell) nsObjectFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -33,13 +33,13 @@
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
nsresult
|
||||
NS_NewPageFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPageFrame* it = new nsPageFrame;
|
||||
nsPageFrame* it = new (aPresShell) nsPageFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Page frame class used by the simple page sequence frame
|
||||
class nsPageFrame : public nsContainerFrame {
|
||||
public:
|
||||
friend nsresult NS_NewPageFrame(nsIFrame** aResult);
|
||||
friend nsresult NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
||||
@ -29,13 +29,13 @@
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
nsresult
|
||||
NS_NewPlaceholderFrame(nsIFrame** aNewFrame)
|
||||
NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsPlaceholderFrame* it = new nsPlaceholderFrame;
|
||||
nsPlaceholderFrame* it = new (aPresShell) nsPlaceholderFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
/**
|
||||
* Create a new placeholder frame
|
||||
*/
|
||||
friend nsresult NS_NewPlaceholderFrame(nsIFrame** aInstancePtrResult);
|
||||
friend nsresult NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aInstancePtrResult);
|
||||
|
||||
// Get/Set the associated out of flow frame
|
||||
nsIFrame* GetOutOfFlowFrame() const {return mOutOfFlowFrame;}
|
||||
|
||||
@ -19,8 +19,10 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
@ -100,6 +102,9 @@ static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
|
||||
// comment out to hide caret
|
||||
#define SHOW_CARET
|
||||
|
||||
// The size of the presshell's recyclers array
|
||||
#define RECYCLER_SIZE 300
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Class IID's
|
||||
@ -196,6 +201,10 @@ public:
|
||||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet);
|
||||
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult);
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk);
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult);
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
|
||||
@ -378,6 +387,9 @@ protected:
|
||||
PresShellViewEventListener *mViewEventListener;
|
||||
PRBool mPendingReflowEvent;
|
||||
nsCOMPtr<nsIEventQueue> mEventQueue;
|
||||
nsCOMPtr<nsIArena> mArena;
|
||||
|
||||
void* mRecyclers[RECYCLER_SIZE];
|
||||
|
||||
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
|
||||
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
|
||||
@ -615,6 +627,14 @@ PresShell::Init(nsIDocument* aDocument,
|
||||
NS_PRECONDITION(nsnull != aDocument, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aPresContext, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aViewManager, "null ptr");
|
||||
|
||||
// Make the arena that will be used to allocate frames.
|
||||
NS_NewHeapArena(getter_AddRefs(mArena));
|
||||
|
||||
// Zero out the recyclers array.
|
||||
for (PRInt32 i = 0; i < RECYCLER_SIZE; i++)
|
||||
mRecyclers[i] = nsnull;
|
||||
|
||||
if ((nsnull == aDocument) || (nsnull == aPresContext) ||
|
||||
(nsnull == aViewManager)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -692,6 +712,39 @@ PresShell::Init(nsIDocument* aDocument,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::FreeFrame(size_t aSize, void* aPtr)
|
||||
{
|
||||
if (aSize >= RECYCLER_SIZE)
|
||||
return NS_OK;
|
||||
|
||||
void* currentTop = mRecyclers[aSize];
|
||||
mRecyclers[aSize] = aPtr;
|
||||
*((void**)aPtr) = currentTop;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::AllocateFrame(size_t aSize, void** aResult)
|
||||
{
|
||||
void* result = nsnull;
|
||||
if (aSize < RECYCLER_SIZE) {
|
||||
result = mRecyclers[aSize];
|
||||
if (result) {
|
||||
// Need to move to the next object
|
||||
void* next = *((void**)result);
|
||||
mRecyclers[aSize] = next;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
result = mArena->Alloc(PRInt32(aSize));
|
||||
}
|
||||
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::EnterReflowLock()
|
||||
{
|
||||
|
||||
@ -55,13 +55,13 @@ static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewScrollFrame(nsIFrame** aNewFrame)
|
||||
NS_NewScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsScrollFrame* it = new nsScrollFrame;
|
||||
nsScrollFrame* it = new (aPresShell) nsScrollFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
class nsScrollFrame : public nsHTMLContainerFrame {
|
||||
public:
|
||||
friend nsresult NS_NewScrollFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
||||
@ -63,13 +63,13 @@ static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewScrollPortFrame(nsIFrame** aNewFrame)
|
||||
NS_NewScrollPortFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsScrollPortFrame* it = new nsScrollPortFrame;
|
||||
nsScrollPortFrame* it = new (aPresShell) nsScrollPortFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
class nsScrollPortFrame : public nsHTMLContainerFrame, public nsIBox {
|
||||
public:
|
||||
friend nsresult NS_NewScrollPortFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewScrollPortFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
||||
@ -28,13 +28,13 @@
|
||||
static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewSelectsAreaFrame(nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsIFrame** aNewFrame, PRUint32 aFlags)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSelectsAreaFrame* it = new nsSelectsAreaFrame;
|
||||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class nsIContent;
|
||||
class nsSelectsAreaFrame : public nsAreaFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewSelectsAreaFrame(nsIFrame** aResult, PRUint32 aFlags);
|
||||
friend nsresult NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsIFrame** aResult, PRUint32 aFlags);
|
||||
|
||||
// nsISupports
|
||||
//NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -33,13 +33,13 @@
|
||||
#include "nsIStyleSet.h"
|
||||
|
||||
nsresult
|
||||
NS_NewSimplePageSequenceFrame(nsIFrame** aNewFrame)
|
||||
NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsSimplePageSequenceFrame* it = new nsSimplePageSequenceFrame;
|
||||
nsSimplePageSequenceFrame* it = new (aPresShell) nsSimplePageSequenceFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
class nsSimplePageSequenceFrame : public nsContainerFrame,
|
||||
public nsIPageSequenceFrame {
|
||||
public:
|
||||
friend nsresult NS_NewSimplePageSequenceFrame(nsIFrame** aResult);
|
||||
friend nsresult NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
class SpacerFrame : public nsFrame {
|
||||
public:
|
||||
friend nsresult NS_NewSpacerFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsIHTMLReflow
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
@ -54,13 +54,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewSpacerFrame(nsIFrame** aNewFrame)
|
||||
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
SpacerFrame* it = new SpacerFrame;
|
||||
SpacerFrame* it = new (aPresShell) SpacerFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -637,13 +637,13 @@ nsContinuingTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) con
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewTextFrame(nsIFrame** aNewFrame)
|
||||
NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTextFrame* it = new nsTextFrame;
|
||||
nsTextFrame* it = new (aPresShell) nsTextFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -652,13 +652,13 @@ NS_NewTextFrame(nsIFrame** aNewFrame)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewContinuingTextFrame(nsIFrame** aNewFrame)
|
||||
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsContinuingTextFrame* it = new nsContinuingTextFrame;
|
||||
nsContinuingTextFrame* it = new (aPresShell) nsContinuingTextFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -116,13 +116,13 @@ private:
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewViewportFrame(nsIFrame** aNewFrame)
|
||||
NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
ViewportFrame* it = new ViewportFrame;
|
||||
ViewportFrame* it = new (aPresShell) ViewportFrame;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -332,7 +332,9 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
nsIFrame* firstChild = mFrames.FirstChild();
|
||||
if (nsnull == firstChild) {
|
||||
firstChild = new nsHTMLFrameInnerFrame;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
firstChild = new (shell.get()) nsHTMLFrameInnerFrame;
|
||||
mFrames.SetFrames(firstChild);
|
||||
// XXX temporary! use style system to get correct style!
|
||||
firstChild->Init(aPresContext, mContent, this, mStyleContext, nsnull);
|
||||
@ -410,13 +412,13 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFrameOuterFrame* it = new nsHTMLFrameOuterFrame;
|
||||
nsHTMLFrameOuterFrame* it = new (aPresShell) nsHTMLFrameOuterFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
@ -932,6 +933,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
||||
// Always get the size so that the caller knows how big we are
|
||||
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
||||
@ -1030,7 +1034,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
aPresContext->ResolveStyleContextFor(child, mStyleContext,
|
||||
PR_FALSE, &kidSC);
|
||||
if (nsHTMLAtoms::frameset == tag) {
|
||||
result = NS_NewHTMLFramesetFrame(&frame);
|
||||
result = NS_NewHTMLFramesetFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
childTypes[mChildCount] = FRAMESET;
|
||||
@ -1040,7 +1044,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
childFrame->SetParentBorderColor(borderColor);
|
||||
childBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
||||
} else { // frame
|
||||
result = NS_NewHTMLFrameOuterFrame(&frame);
|
||||
result = NS_NewHTMLFrameOuterFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
childTypes[mChildCount] = FRAME;
|
||||
@ -1072,7 +1076,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
for (int blankX = mChildCount; blankX < numCells; blankX++) {
|
||||
// XXX the blank frame is using the content of its parent - at some point it
|
||||
// should just have null content, if we support that
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new nsHTMLFramesetBlankFrame;
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new (shell.get()) nsHTMLFramesetBlankFrame;
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo,
|
||||
mStyleContext, PR_FALSE,
|
||||
@ -1113,7 +1117,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
offset.y += lastSize.height;
|
||||
if ((borderWidth > 0) && (eFrameborder_No != frameborder)) {
|
||||
if (firstTime) { // create horizontal border
|
||||
borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE);
|
||||
borderFrame = new (shell.get()) nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE);
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo,
|
||||
mStyleContext, PR_FALSE,
|
||||
@ -1140,7 +1144,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
||||
if ((cellIndex.x > 0) && (borderWidth > 0)) { // moved to next col in same row
|
||||
if (0 == cellIndex.y) { // in 1st row
|
||||
if (firstTime) { // create vertical border
|
||||
borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE);
|
||||
borderFrame = new (shell.get()) nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE);
|
||||
nsIStyleContext* pseudoStyleContext;
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo,
|
||||
mStyleContext,
|
||||
@ -1519,13 +1523,13 @@ nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIFrame** aNewFrame)
|
||||
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLFramesetFrame* it = new nsHTMLFramesetFrame;
|
||||
nsHTMLFramesetFrame* it = new (aPresShell) nsHTMLFramesetFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -78,13 +78,13 @@ static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
const char * kMozDropdownActive = "-moz-dropdown-active";
|
||||
|
||||
nsresult
|
||||
NS_NewComboboxControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsComboboxControlFrame* it = new nsComboboxControlFrame;
|
||||
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -95,13 +95,13 @@ protected:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewFieldSetFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFieldSetFrame* it = new nsFieldSetFrame;
|
||||
nsFieldSetFrame* it = new (aPresShell) nsFieldSetFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -127,7 +127,10 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
|
||||
|
||||
PRUint8 flags = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay) ? NS_BLOCK_SHRINK_WRAP : 0;
|
||||
NS_NewAreaFrame(&mContentFrame, flags);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
NS_NewAreaFrame(shell, &mContentFrame, flags);
|
||||
mFrames.SetFrames(mContentFrame);
|
||||
|
||||
// Resolve style and initialize the frame
|
||||
|
||||
@ -61,13 +61,13 @@ static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIAnonymousContentCreatorIID, NS_IANONYMOUS_CONTENT_CREATOR_IID);
|
||||
|
||||
nsresult
|
||||
NS_NewFileControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFileControlFrame* it = new nsFileControlFrame();
|
||||
nsFileControlFrame* it = new (aPresShell) nsFileControlFrame();
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -442,13 +442,13 @@ nsFormFrame::OnRadioChecked(nsIPresContext* aPresContext, nsRadioControlFrame& a
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewFormFrame(nsIFrame** aNewFrame)
|
||||
NS_NewFormFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsFormFrame* it = new nsFormFrame;
|
||||
nsFormFrame* it = new (aPresShell) nsFormFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -40,24 +40,25 @@ static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectDataIID, NS_ISCRIPTGLOBALOBJECTDATA_IID);
|
||||
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIFrame** aNewFrame);
|
||||
extern nsresult NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
|
||||
nsresult NS_NewGfxAutoTextControlFrame(nsIFrame** aNewFrame)
|
||||
nsresult NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aNewFrame = new nsGfxAutoTextControlFrame;
|
||||
*aNewFrame = new (aPresShell) nsGfxAutoTextControlFrame;
|
||||
if (nsnull == aNewFrame)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult result = ((nsGfxAutoTextControlFrame*)(*aNewFrame))->CreateEditor();
|
||||
if (NS_FAILED(result))
|
||||
{ // can't properly initialized ender, probably it isn't installed
|
||||
delete *aNewFrame;
|
||||
result = NS_NewNativeTextControlFrame(aNewFrame);
|
||||
//delete *aNewFrame; XXX Very bad. You cannot be deleting frames, since they are recycled.
|
||||
|
||||
result = NS_NewNativeTextControlFrame(aPresShell, aNewFrame);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@ -91,13 +91,13 @@ nsGfxButtonControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValu
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewGfxButtonControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxButtonControlFrame* it = new nsGfxButtonControlFrame;
|
||||
nsGfxButtonControlFrame* it = new (aPresShell) nsGfxButtonControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -31,13 +31,13 @@
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
nsresult
|
||||
NS_NewGfxCheckboxControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxCheckboxControlFrame* it = new nsGfxCheckboxControlFrame;
|
||||
nsGfxCheckboxControlFrame* it = new (aPresShell) nsGfxCheckboxControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -78,13 +78,13 @@ static const char * kMozSelected = "-moz-option-selected";
|
||||
|
||||
//---------------------------------------------------------
|
||||
nsresult
|
||||
NS_NewGfxListControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxListControlFrame* it = new nsGfxListControlFrame();
|
||||
nsGfxListControlFrame* it = new (aPresShell) nsGfxListControlFrame();
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class nsGfxListControlFrame : public nsHTMLContainerFrame,
|
||||
public nsIStatefulFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewGfxListControlFrame(nsIFrame** aNewFrame);
|
||||
friend nsresult NS_NewGfxListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
@ -34,13 +34,13 @@
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewGfxRadioControlFrame(nsIFrame** aNewFrame)
|
||||
NS_NewGfxRadioControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsGfxRadioControlFrame* it = new nsGfxRadioControlFrame;
|
||||
nsGfxRadioControlFrame* it = new (aPresShell) nsGfxRadioControlFrame;
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user