Made SetStyleContext take the presentation context as a parameter

Made DidSetStyleContext virtual, since we need to override the behavior in subclasses
This commit is contained in:
kostello 1998-05-01 20:43:42 +00:00
Родитель a5c40d6b25
Коммит 3c9c1ac4e0
19 изменённых файлов: 50 добавлений и 50 удалений

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -573,10 +573,10 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else if (nsnull == kidPrevInFlow) {
nsIContentDelegate* kidDel;
switch (kidDisplay->mDisplay) {
@ -638,7 +638,7 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else {
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
}

Просмотреть файл

@ -46,7 +46,7 @@ void PageFrame::CreateFirstChild(nsIPresContext* aPresContext)
// Resolve style and set the style context
nsIStyleContext* kidStyleContext =
aPresContext->ResolveStyleContextFor(child, this);
mFirstChild->SetStyleContext(kidStyleContext);
mFirstChild->SetStyleContext(aPresContext,kidStyleContext);
NS_RELEASE(kidStyleContext);
}
NS_RELEASE(cd);

Просмотреть файл

@ -78,7 +78,7 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext,
NS_RELEASE(delegate);
// Set the style context for the frame
mAnchoredItem->SetStyleContext(mStyleContext);
mAnchoredItem->SetStyleContext(aPresContext,mStyleContext);
// Resize reflow the anchored item into the available space
// XXX Check for complete?

Просмотреть файл

@ -242,7 +242,7 @@ NS_METHOD AbsoluteFrame::ResizeReflow(nsIPresContext* aPresContext,
// Resolve style for the pseudo-frame. We can't use our style context
nsIStyleContextPtr styleContext = aPresContext->ResolveStyleContextFor(mContent, this);
mFrame->SetStyleContext(styleContext);
mFrame->SetStyleContext(aPresContext,styleContext);
} else {
// Create the absolutely positioned item as a pseudo-frame child. We'll
@ -253,7 +253,7 @@ NS_METHOD AbsoluteFrame::ResizeReflow(nsIPresContext* aPresContext,
NS_RELEASE(delegate);
// Set the style context for the frame
mFrame->SetStyleContext(mStyleContext);
mFrame->SetStyleContext(aPresContext,mStyleContext);
}
// Get the containing block, and its associated view

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -1359,10 +1359,10 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else if (nsnull == kidPrevInFlow) {
// Create initial frame for the child
nsIContentDelegate* kidDel;
@ -1397,7 +1397,7 @@ nsBlockFrame::ReflowAppendedChildren(nsIPresContext* aCX,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
} else {
// Since kid has a prev-in-flow, use that to create the next
// frame.
@ -2099,7 +2099,7 @@ NS_METHOD nsBlockFrame::ContentAppended(nsIPresShell* aShell,
break;
}
}
kidFrame->SetStyleContext(kidSC);
kidFrame->SetStyleContext(aCX,kidSC);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {

Просмотреть файл

@ -90,7 +90,7 @@ void nsBodyFrame::CreateColumnFrame(nsIPresContext* aPresContext)
// Resolve style and set the style context
nsIStyleContext* styleContext =
aPresContext->ResolveStyleContextFor(mContent, this);
mFirstChild->SetStyleContext(styleContext);
mFirstChild->SetStyleContext(aPresContext,styleContext);
NS_RELEASE(styleContext);
} else {
nsBodyFrame* prevBody = (nsBodyFrame*)mPrevInFlow;

Просмотреть файл

@ -688,7 +688,7 @@ ColumnFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
// Create a child frame
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else if (nsnull == kidPrevInFlow) {
// Figure out how to treat the content
nsIContentDelegate* kidDel = nsnull;
@ -718,7 +718,7 @@ ColumnFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
pseudoFrame->SetFirstContentOffset(kidIndex);
break;
}
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else {
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
if (ChildIsPseudoFrame(kidFrame)) {
@ -1232,7 +1232,7 @@ NS_METHOD ColumnFrame::ContentAppended(nsIPresShell* aShell,
case NS_STYLE_DISPLAY_NONE:
// Create place holder frame
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
// Append it to the child list
if (nsnull == prevKidFrame) {
@ -1255,7 +1255,7 @@ NS_METHOD ColumnFrame::ContentAppended(nsIPresShell* aShell,
del = kid->GetDelegate(aPresContext);
kidFrame = del->CreateFrame(aPresContext, kid, kidIndex, this);
NS_RELEASE(del);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
// Append it to the child list
if (nsnull == prevKidFrame) {
@ -1279,7 +1279,7 @@ NS_METHOD ColumnFrame::ContentAppended(nsIPresShell* aShell,
// Resolve style for the pseudo-frame (kid's style won't do)
kidStyleContext = aPresContext->ResolveStyleContextFor(mContent, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
// Append the pseudo frame to the child list
pseudoFrame = (nsBlockFrame*) kidFrame;

Просмотреть файл

@ -214,7 +214,7 @@ nsIFrame* nsHTMLContainer::CreateFrame(nsIPresContext* aPresContext,
break;
}
rv->SetStyleContext(styleContext);
rv->SetStyleContext(aPresContext,styleContext);
NS_RELEASE(styleContext);
return rv;
}

Просмотреть файл

@ -573,10 +573,10 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
// Check whether it wants to floated or absolutely positioned
if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) {
AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) {
PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this);
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else if (nsnull == kidPrevInFlow) {
nsIContentDelegate* kidDel;
switch (kidDisplay->mDisplay) {
@ -638,7 +638,7 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
nsFrame::NewFrame(&kidFrame, kid, kidIndex, this);
break;
}
kidFrame->SetStyleContext(kidStyleContext);
kidFrame->SetStyleContext(aPresContext,kidStyleContext);
} else {
kidPrevInFlow->CreateContinuingFrame(aPresContext, this, kidFrame);
}

Просмотреть файл

@ -437,12 +437,12 @@ nsListItemFrame::~nsListItemFrame()
{
}
nsIFrame* nsListItemFrame::CreateBullet()
nsIFrame* nsListItemFrame::CreateBullet(nsIPresContext *aCX)
{
// Create bullet. The bullet shares the same style context as
// ourselves.
nsIFrame* bullet = new BulletFrame(mContent, mIndexInParent, this);
bullet->SetStyleContext(mStyleContext);
bullet->SetStyleContext(aCX,mStyleContext);
return bullet;
}
@ -578,7 +578,7 @@ NS_METHOD nsListItemFrame::ResizeReflow(nsIPresContext* aCX,
if (nsnull == mFirstChild) {
// Inside bullets get placed on the list immediately so that
// the regular reflow logic can place them.
bullet = CreateBullet();
bullet = CreateBullet(aCX);
mFirstChild = bullet;
mChildCount++;
} else {
@ -588,7 +588,7 @@ NS_METHOD nsListItemFrame::ResizeReflow(nsIPresContext* aCX,
} else {
if (nsnull == mFirstChild) {
// Create outside bullet the first time through
bullet = CreateBullet();
bullet = CreateBullet(aCX);
} else {
// Pull bullet off list (we'll put it back later)
bullet = mFirstChild;

Просмотреть файл

@ -60,7 +60,7 @@ protected:
virtual ~nsListItemFrame();
nsIFrame* CreateBullet();
nsIFrame* CreateBullet(nsIPresContext* aCX);
virtual void PaintChildren(nsIPresContext& aCX,
nsIRenderingContext& aRenderingContext,

Просмотреть файл

@ -46,7 +46,7 @@ void PageFrame::CreateFirstChild(nsIPresContext* aPresContext)
// Resolve style and set the style context
nsIStyleContext* kidStyleContext =
aPresContext->ResolveStyleContextFor(child, this);
mFirstChild->SetStyleContext(kidStyleContext);
mFirstChild->SetStyleContext(aPresContext,kidStyleContext);
NS_RELEASE(kidStyleContext);
}
NS_RELEASE(cd);

Просмотреть файл

@ -78,7 +78,7 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext,
NS_RELEASE(delegate);
// Set the style context for the frame
mAnchoredItem->SetStyleContext(mStyleContext);
mAnchoredItem->SetStyleContext(aPresContext,mStyleContext);
// Resize reflow the anchored item into the available space
// XXX Check for complete?

Просмотреть файл

@ -105,7 +105,7 @@ NS_METHOD RootFrame::ResizeReflow(nsIPresContext* aPresContext,
mFirstChild = new RootContentFrame(mContent, mIndexInParent, this);
mChildCount = 1;
nsIStyleContext* style = aPresContext->ResolveStyleContextFor(mContent, this);
mFirstChild->SetStyleContext(style);
mFirstChild->SetStyleContext(aPresContext,style);
NS_RELEASE(style);
}
@ -277,7 +277,7 @@ void RootContentFrame::CreateFirstChild(nsIPresContext* aPresContext)
// Resolve style and set the style context
nsIStyleContext* kidStyleContext =
aPresContext->ResolveStyleContextFor(child, this);
mFirstChild->SetStyleContext(kidStyleContext);
mFirstChild->SetStyleContext(aPresContext,kidStyleContext);
NS_RELEASE(kidStyleContext);
}
NS_RELEASE(cd);