Bug 330934. Set a nsIFrame's stylecontext in its constructor, to ensure that there's always one available for GetPresContext() to use even if Init hasn't been called. Patch by Marc Liddell, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@193022 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2006-03-26 21:30:36 +00:00
parent cbf12a16e3
commit 140fbb3377
228 changed files with 1576 additions and 1768 deletions

View File

@@ -250,7 +250,7 @@ protected:
class nsTextFrame : public nsFrame {
public:
nsTextFrame();
nsTextFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
// nsIFrame
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
@@ -1400,9 +1400,10 @@ nsTextFrame::Destroy(nsPresContext* aPresContext)
class nsContinuingTextFrame : public nsTextFrame {
public:
friend nsIFrame* NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD Destroy(nsPresContext* aPresContext);
@@ -1436,18 +1437,16 @@ public:
virtual nsIFrame* GetFirstContinuation() const;
protected:
nsContinuingTextFrame(nsStyleContext* aContext) : nsTextFrame(aContext) {}
nsIFrame* mPrevContinuation;
};
NS_IMETHODIMP
nsContinuingTextFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow)
{
nsresult rv;
rv = nsTextFrame::Init(aContent, aParent, aContext, aPrevInFlow);
nsresult rv = nsTextFrame::Init(aContent, aParent, aPrevInFlow);
if (aPrevInFlow) {
nsIFrame* nextContinuation = aPrevInFlow->GetNextContinuation();
@@ -1827,19 +1826,15 @@ VerifyNotDirty(state)
#endif
nsIFrame*
NS_NewTextFrame(nsIPresShell* aPresShell)
NS_NewTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsTextFrame;
return new (aPresShell) nsTextFrame(aContext);
}
nsIFrame*
NS_NewContinuingTextFrame(nsIPresShell* aPresShell)
{
return new (aPresShell) nsContinuingTextFrame;
}
nsTextFrame::nsTextFrame()
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsContinuingTextFrame(aContext);
}
nsTextFrame::~nsTextFrame()
@@ -1933,7 +1928,6 @@ nsTextFrame::CharacterDataChanged(nsPresContext* aPresContext,
if (markAllDirty) {
// Mark this frame and all the next-in-flow frames as dirty
nsTextFrame* textFrame = this;
nsPropertyTable *propTable = aPresContext->PropertyTable();
while (textFrame) {
textFrame->mState &= ~TEXT_WHITESPACE_FLAGS;
textFrame->mState |= NS_FRAME_IS_DIRTY;