From 902190112d86c27f3a1e06ef142ffad6dc563b34 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Thu, 11 Feb 1999 15:56:23 +0000 Subject: [PATCH] API changes for nsIPresContext ResolveStyleContextFor and ResolvePseudoStyleContextFor --- layout/forms/nsComboboxControlFrame.cpp | 3 ++- layout/forms/nsFieldSetFrame.cpp | 7 +++--- layout/forms/nsHTMLButtonControlFrame.cpp | 5 ++-- layout/forms/nsLegendFrame.cpp | 5 ++-- layout/forms/nsTextControlFrame.cpp | 6 +++-- layout/generic/nsBlockFrame.cpp | 4 +-- layout/generic/nsBlockReflowState.cpp | 4 +-- layout/generic/nsBlockReflowState.h | 4 +-- layout/generic/nsFrame.cpp | 6 ++--- layout/generic/nsFrameSetFrame.cpp | 18 +++++++------ layout/generic/nsHTMLContainerFrame.cpp | 6 ++--- layout/generic/nsInlineFrame.cpp | 13 ++++------ layout/html/base/src/nsBlockFrame.cpp | 4 +-- layout/html/base/src/nsBlockReflowState.cpp | 4 +-- layout/html/base/src/nsBlockReflowState.h | 4 +-- layout/html/base/src/nsFrame.cpp | 6 ++--- layout/html/base/src/nsHTMLContainerFrame.cpp | 6 ++--- layout/html/base/src/nsInlineFrame.cpp | 13 ++++------ layout/html/document/src/nsFrameSetFrame.cpp | 18 +++++++------ .../html/forms/src/nsComboboxControlFrame.cpp | 3 ++- layout/html/forms/src/nsFieldSetFrame.cpp | 7 +++--- .../forms/src/nsHTMLButtonControlFrame.cpp | 5 ++-- layout/html/forms/src/nsLabelFrame.cpp | 5 ++-- layout/html/forms/src/nsLegendFrame.cpp | 5 ++-- .../html/forms/src/nsSelectControlFrame.cpp | 8 ++++-- layout/html/forms/src/nsTextControlFrame.cpp | 6 +++-- .../html/table/src/nsTableColGroupFrame.cpp | 15 +++++------ layout/html/table/src/nsTableFrame.cpp | 25 +++++++++++-------- layout/tables/nsTableColGroupFrame.cpp | 15 +++++------ layout/tables/nsTableFrame.cpp | 25 +++++++++++-------- 30 files changed, 141 insertions(+), 114 deletions(-) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 2d11ba809d08..5587a8c3329d 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -307,7 +307,8 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte //nsIFrame* childFrame; if (1 == numChildren) { nsIAtom * textBlockContentPseudo = NS_NewAtom(":COMBOBOX-TEXT"); - mBlockTextStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, textBlockContentPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, textBlockContentPseudo, + mStyleContext, &mBlockTextStyle); NS_RELEASE(textBlockContentPseudo); // XXX This code should move to Init(), someday when the frame construction diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index 9a6f52e5087e..e8710410efa5 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -128,9 +128,10 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(mContentFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::fieldsetContentPseudo, - mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::fieldsetContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index ca6bed666385..07aa660b8a1f 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -547,8 +547,9 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(areaFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index 66be43366aed..c5a7dd06fe1a 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -95,8 +95,9 @@ nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(areaFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::legendContentPseudo, mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::legendContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index e17a8c96435e..bdbfd61a485f 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -696,10 +696,12 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, // Scrollbars const nsStyleColor* myColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color); nsIAtom * sbAtom = NS_NewAtom(":SCROLLBAR-LOOK"); - nsIStyleContext* scrollbarStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext); + nsIStyleContext* scrollbarStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext, &scrollbarStyle); NS_RELEASE(sbAtom); sbAtom = NS_NewAtom(":SCROLLBAR-ARROW-LOOK"); - nsIStyleContext* arrowStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext); + nsIStyleContext* arrowStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext, &arrowStyle); NS_RELEASE(sbAtom); nsRect srect(mRect.width-scrollbarScaledWidth-(2*onePixel), 2*onePixel, scrollbarScaledWidth, mRect.height-(onePixel*4)-scrollbarScaledWidth); diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 4ea05d42f9f3..32a6446a4f9f 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -449,11 +449,11 @@ NS_IMETHODIMP nsFrame::ReResolveStyleContext(nsIPresContext* aPresContext, mStyleContext->GetPseudoType(pseudoTag); nsIStyleContext* newContext; if (nsnull != pseudoTag) { - newContext = - aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext); + aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext, + &newContext); } else { - newContext = aPresContext->ResolveStyleContextFor(mContent, aParentContext); + aPresContext->ResolveStyleContextFor(mContent, aParentContext, &newContext); } NS_ASSERTION(nsnull != newContext, "failed to get new style context"); diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index cfcc2bdc3082..3e210d77c1eb 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -934,9 +934,10 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, nsIAtom* tag; child->GetTag(tag); if ((nsHTMLAtoms::frameset == tag) || (nsHTMLAtoms::frame == tag)) { - nsIStyleContext* kidSC = aPresContext.ResolveStyleContextFor(child, mStyleContext); + nsIStyleContext* kidSC; nsresult result; + aPresContext.ResolveStyleContextFor(child, mStyleContext, &kidSC); if (nsHTMLAtoms::frameset == tag) { result = NS_NewHTMLFramesetFrame(frame); frame->Init(aPresContext, child, this, kidSC); @@ -980,8 +981,9 @@ 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 nsHTMLFramesetBlankFrame* blankFrame = new nsHTMLFramesetBlankFrame; - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo, + mStyleContext, &pseudoStyleContext); blankFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); @@ -1018,8 +1020,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, if ((borderWidth > 0) && (eFrameborder_No != frameborder)) { if (firstTime) { // create horizontal border borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo, + mStyleContext, &pseudoStyleContext); borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); @@ -1043,8 +1046,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, if (0 == cellIndex.y) { // in 1st row if (firstTime) { // create vertical border borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo, + mStyleContext, &pseudoStyleContext); borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp index f0aee09e3bbf..4b30f35e67ba 100644 --- a/layout/generic/nsHTMLContainerFrame.cpp +++ b/layout/generic/nsHTMLContainerFrame.cpp @@ -91,9 +91,9 @@ nsHTMLContainerFrame::CreatePlaceholderFrame(nsIPresContext& aPresContext, // The placeholder frame gets a pseudo style context nsIStyleContext* kidSC; aFloatedFrame->GetStyleContext(&kidSC); - nsIStyleContext* placeholderPseudoStyle = - aPresContext.ResolvePseudoStyleContextFor(content, - nsHTMLAtoms::placeholderPseudo, kidSC); + nsIStyleContext* placeholderPseudoStyle; + aPresContext.ResolvePseudoStyleContextFor(content, nsHTMLAtoms::placeholderPseudo, + kidSC, &placeholderPseudoStyle); NS_RELEASE(kidSC); placeholder->Init(aPresContext, content, this, placeholderPseudoStyle); NS_RELEASE(placeholderPseudoStyle); diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index d3506bbb8bea..da73f8f201c0 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -38,9 +38,6 @@ // XXX TODO: // append/insert/remove floater testing -// XXX get rid of this -typedef nsCOMPtr nsIStyleContextPtr; - #define INLINE_FRAME_CID \ { 0xa6cf90e0, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -405,11 +402,11 @@ nsInlineFrame::CreateAnonymousBlock(nsIPresContext& aPresContext, nsIFrame* bf; nsresult rv = NS_NewAnonymousBlockFrame(bf); if (NS_SUCCEEDED(rv)) { - nsIStyleContextPtr newSC; - newSC = aPresContext. - ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::mozAnonymousBlock, - mStyleContext); + nsCOMPtr newSC; + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::mozAnonymousBlock, + mStyleContext, + getter_AddRefs(newSC)); rv = bf->Init(aPresContext, mContent, this, newSC); if (NS_FAILED(rv)) { bf->DeleteFrame(aPresContext); diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index b52e0b1f5369..b7d15c26009f 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -4363,8 +4363,8 @@ nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, (nsnull == mBullet)) { // Resolve style for the bullet frame nsIStyleContext* kidSC; - kidSC = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::bulletPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::bulletPseudo, mStyleContext, &kidSC); // Create bullet frame mBullet = new nsBulletFrame; diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index 4ea05d42f9f3..32a6446a4f9f 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -449,11 +449,11 @@ NS_IMETHODIMP nsFrame::ReResolveStyleContext(nsIPresContext* aPresContext, mStyleContext->GetPseudoType(pseudoTag); nsIStyleContext* newContext; if (nsnull != pseudoTag) { - newContext = - aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext); + aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext, + &newContext); } else { - newContext = aPresContext->ResolveStyleContextFor(mContent, aParentContext); + aPresContext->ResolveStyleContextFor(mContent, aParentContext, &newContext); } NS_ASSERTION(nsnull != newContext, "failed to get new style context"); diff --git a/layout/html/base/src/nsHTMLContainerFrame.cpp b/layout/html/base/src/nsHTMLContainerFrame.cpp index f0aee09e3bbf..4b30f35e67ba 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -91,9 +91,9 @@ nsHTMLContainerFrame::CreatePlaceholderFrame(nsIPresContext& aPresContext, // The placeholder frame gets a pseudo style context nsIStyleContext* kidSC; aFloatedFrame->GetStyleContext(&kidSC); - nsIStyleContext* placeholderPseudoStyle = - aPresContext.ResolvePseudoStyleContextFor(content, - nsHTMLAtoms::placeholderPseudo, kidSC); + nsIStyleContext* placeholderPseudoStyle; + aPresContext.ResolvePseudoStyleContextFor(content, nsHTMLAtoms::placeholderPseudo, + kidSC, &placeholderPseudoStyle); NS_RELEASE(kidSC); placeholder->Init(aPresContext, content, this, placeholderPseudoStyle); NS_RELEASE(placeholderPseudoStyle); diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index d3506bbb8bea..da73f8f201c0 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -38,9 +38,6 @@ // XXX TODO: // append/insert/remove floater testing -// XXX get rid of this -typedef nsCOMPtr nsIStyleContextPtr; - #define INLINE_FRAME_CID \ { 0xa6cf90e0, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} @@ -405,11 +402,11 @@ nsInlineFrame::CreateAnonymousBlock(nsIPresContext& aPresContext, nsIFrame* bf; nsresult rv = NS_NewAnonymousBlockFrame(bf); if (NS_SUCCEEDED(rv)) { - nsIStyleContextPtr newSC; - newSC = aPresContext. - ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::mozAnonymousBlock, - mStyleContext); + nsCOMPtr newSC; + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::mozAnonymousBlock, + mStyleContext, + getter_AddRefs(newSC)); rv = bf->Init(aPresContext, mContent, this, newSC); if (NS_FAILED(rv)) { bf->DeleteFrame(aPresContext); diff --git a/layout/html/document/src/nsFrameSetFrame.cpp b/layout/html/document/src/nsFrameSetFrame.cpp index cfcc2bdc3082..3e210d77c1eb 100644 --- a/layout/html/document/src/nsFrameSetFrame.cpp +++ b/layout/html/document/src/nsFrameSetFrame.cpp @@ -934,9 +934,10 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, nsIAtom* tag; child->GetTag(tag); if ((nsHTMLAtoms::frameset == tag) || (nsHTMLAtoms::frame == tag)) { - nsIStyleContext* kidSC = aPresContext.ResolveStyleContextFor(child, mStyleContext); + nsIStyleContext* kidSC; nsresult result; + aPresContext.ResolveStyleContextFor(child, mStyleContext, &kidSC); if (nsHTMLAtoms::frameset == tag) { result = NS_NewHTMLFramesetFrame(frame); frame->Init(aPresContext, child, this, kidSC); @@ -980,8 +981,9 @@ 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 nsHTMLFramesetBlankFrame* blankFrame = new nsHTMLFramesetBlankFrame; - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::framesetBlankPseudo, + mStyleContext, &pseudoStyleContext); blankFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); @@ -1018,8 +1020,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, if ((borderWidth > 0) && (eFrameborder_No != frameborder)) { if (firstTime) { // create horizontal border borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_FALSE, PR_FALSE); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::horizontalFramesetBorderPseudo, + mStyleContext, &pseudoStyleContext); borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); @@ -1043,8 +1046,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, if (0 == cellIndex.y) { // in 1st row if (firstTime) { // create vertical border borderFrame = new nsHTMLFramesetBorderFrame(borderWidth, PR_TRUE, PR_FALSE); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo, mStyleContext); + nsIStyleContext* pseudoStyleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::verticalFramesetBorderPseudo, + mStyleContext, &pseudoStyleContext); borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext); NS_RELEASE(pseudoStyleContext); diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index 2d11ba809d08..5587a8c3329d 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -307,7 +307,8 @@ NS_IMETHODIMP nsComboboxControlFrame::Reflow(nsIPresContext& aPresConte //nsIFrame* childFrame; if (1 == numChildren) { nsIAtom * textBlockContentPseudo = NS_NewAtom(":COMBOBOX-TEXT"); - mBlockTextStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, textBlockContentPseudo, mStyleContext); + aPresContext.ResolvePseudoStyleContextFor(mContent, textBlockContentPseudo, + mStyleContext, &mBlockTextStyle); NS_RELEASE(textBlockContentPseudo); // XXX This code should move to Init(), someday when the frame construction diff --git a/layout/html/forms/src/nsFieldSetFrame.cpp b/layout/html/forms/src/nsFieldSetFrame.cpp index 9a6f52e5087e..e8710410efa5 100644 --- a/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/layout/html/forms/src/nsFieldSetFrame.cpp @@ -128,9 +128,10 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(mContentFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::fieldsetContentPseudo, - mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, + nsHTMLAtoms::fieldsetContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index ca6bed666385..07aa660b8a1f 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -547,8 +547,9 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(areaFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/html/forms/src/nsLabelFrame.cpp b/layout/html/forms/src/nsLabelFrame.cpp index 72cda4d2f880..19db17153616 100644 --- a/layout/html/forms/src/nsLabelFrame.cpp +++ b/layout/html/forms/src/nsLabelFrame.cpp @@ -361,8 +361,9 @@ nsLabelFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(areaFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::labelContentPseudo, mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::labelContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/html/forms/src/nsLegendFrame.cpp b/layout/html/forms/src/nsLegendFrame.cpp index 66be43366aed..c5a7dd06fe1a 100644 --- a/layout/html/forms/src/nsLegendFrame.cpp +++ b/layout/html/forms/src/nsLegendFrame.cpp @@ -95,8 +95,9 @@ nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, mFrames.SetFrames(areaFrame); // Resolve style and initialize the frame - nsIStyleContext* styleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::legendContentPseudo, mStyleContext); + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::legendContentPseudo, + mStyleContext, &styleContext); mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext); NS_RELEASE(styleContext); diff --git a/layout/html/forms/src/nsSelectControlFrame.cpp b/layout/html/forms/src/nsSelectControlFrame.cpp index bb47f81877e2..d7fa42082ac8 100644 --- a/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/layout/html/forms/src/nsSelectControlFrame.cpp @@ -742,11 +742,15 @@ nsSelectControlFrame::PaintSelectControl(nsIPresContext& aPresContext, * ie: NS_NewAtom(":FIRST-LINE"); */ nsIAtom * sbAtom = NS_NewAtom(":SCROLLBAR-LOOK"); - nsIStyleContext* scrollbarStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, mStyleContext); + nsIStyleContext* scrollbarStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, mStyleContext, + &scrollbarStyle); NS_RELEASE(sbAtom); sbAtom = NS_NewAtom(":SCROLLBAR-ARROW-LOOK"); - nsIStyleContext* arrowStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, mStyleContext); + nsIStyleContext* arrowStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, mStyleContext, + &arrowStyle); NS_RELEASE(sbAtom); diff --git a/layout/html/forms/src/nsTextControlFrame.cpp b/layout/html/forms/src/nsTextControlFrame.cpp index e17a8c96435e..bdbfd61a485f 100644 --- a/layout/html/forms/src/nsTextControlFrame.cpp +++ b/layout/html/forms/src/nsTextControlFrame.cpp @@ -696,10 +696,12 @@ nsTextControlFrame::PaintTextControl(nsIPresContext& aPresContext, // Scrollbars const nsStyleColor* myColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color); nsIAtom * sbAtom = NS_NewAtom(":SCROLLBAR-LOOK"); - nsIStyleContext* scrollbarStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext); + nsIStyleContext* scrollbarStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext, &scrollbarStyle); NS_RELEASE(sbAtom); sbAtom = NS_NewAtom(":SCROLLBAR-ARROW-LOOK"); - nsIStyleContext* arrowStyle = aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext); + nsIStyleContext* arrowStyle; + aPresContext.ResolvePseudoStyleContextFor(mContent, sbAtom, aStyleContext, &arrowStyle); NS_RELEASE(sbAtom); nsRect srect(mRect.width-scrollbarScaledWidth-(2*onePixel), 2*onePixel, scrollbarScaledWidth, mRect.height-(onePixel*4)-scrollbarScaledWidth); diff --git a/layout/html/table/src/nsTableColGroupFrame.cpp b/layout/html/table/src/nsTableColGroupFrame.cpp index 2394597fbfe2..4b43cfd7064a 100644 --- a/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/layout/html/table/src/nsTableColGroupFrame.cpp @@ -28,9 +28,9 @@ #include "nsIPtr.h" #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" +#include "nsCOMPtr.h" NS_DEF_PTR(nsIContent); -NS_DEF_PTR(nsIStyleContext); static NS_DEFINE_IID(kIHTMLTableColElementIID, NS_IHTMLTABLECOLELEMENT_IID); @@ -88,8 +88,9 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi NS_NewTableColFrame(colFrame); // Set its style context - nsIStyleContextPtr colStyleContext = - aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); + nsCOMPtr colStyleContext; + aPresContext.ResolveStyleContextFor(col, mStyleContext, + getter_AddRefs(colStyleContext), PR_TRUE); colFrame->Init(aPresContext, col, this, colStyleContext); colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); @@ -520,9 +521,9 @@ NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext& aPre colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay)); if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) { - nsIStyleContextPtr colStyleContext; + nsCOMPtr colStyleContext; nsStylePosition * colPosition=nsnull; - colFrame->GetStyleContext(colStyleContext.AssignPtr()); + colFrame->GetStyleContext(getter_AddRefs(colStyleContext)); colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position); if (colIndexGetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay)); if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) { - nsIStyleContextPtr colStyleContext; + nsCOMPtr colStyleContext; const nsStylePosition * colPosition=nsnull; colFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)colPosition); // get a read-only version of the style context //XXX: how do I know this is auto because it's defaulted, vs. set explicitly to "auto"? if (eStyleUnit_Auto==colPosition->mWidth.GetUnit()) { // notice how we defer getting a mutable style context until we're sure we really need one - colFrame->GetStyleContext(colStyleContext.AssignPtr()); + colFrame->GetStyleContext(getter_AddRefs(colStyleContext)); nsStylePosition * mutableColPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position); mutableColPosition->mWidth = position->mWidth; colStyleContext->RecalcAutomaticData(&aPresContext); diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index d80d8ac04863..538adbc7ce7b 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -720,10 +720,11 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) parentFrame->GetParent(&parentFrame); } // now we have a ref-counted "lastColGroupElement" content object - nsIStyleContext* colGroupStyleContext = - aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, - nsHTMLAtoms::tableColGroupPseudo, - mStyleContext); // colGroupStyleContext: REFCNT++ + nsIStyleContext* colGroupStyleContext; + aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, + nsHTMLAtoms::tableColGroupPseudo, + mStyleContext, + &colGroupStyleContext); // colGroupStyleContext: REFCNT++ // Create a col group frame nsIFrame* newFrame; NS_NewTableColGroupFrame(newFrame); @@ -753,11 +754,12 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) // Create a new col frame nsIFrame* colFrame; // note we pass in PR_TRUE here to force unique style contexts. - nsIStyleContext* colStyleContext = - aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, - nsHTMLAtoms::tableColPseudo, - lastColGroupStyle, - PR_TRUE); // colStyleContext: REFCNT++ + nsIStyleContext* colStyleContext; + aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, + nsHTMLAtoms::tableColPseudo, + lastColGroupStyle, + &colStyleContext, + PR_TRUE); // colStyleContext: REFCNT++ NS_NewTableColFrame(colFrame); colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame, colStyleContext); @@ -4433,8 +4435,9 @@ nsTableFrame::CreateContinuingFrame(nsIPresContext& aPresContext, { printf("found a head or foot in continuing frame\n"); // Resolve style for the child - nsIStyleContext* kidStyleContext = - aPresContext.ResolveStyleContextFor(content, aStyleContext); // kidStyleContext: REFCNT++ + nsIStyleContext* kidStyleContext; + aPresContext.ResolveStyleContextFor(content, aStyleContext, + &kidStyleContext); // kidStyleContext: REFCNT++ nsIFrame* duplicateFrame; NS_NewTableRowGroupFrame(duplicateFrame); diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index 2394597fbfe2..4b43cfd7064a 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -28,9 +28,9 @@ #include "nsIPtr.h" #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" +#include "nsCOMPtr.h" NS_DEF_PTR(nsIContent); -NS_DEF_PTR(nsIStyleContext); static NS_DEFINE_IID(kIHTMLTableColElementIID, NS_IHTMLTABLECOLELEMENT_IID); @@ -88,8 +88,9 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi NS_NewTableColFrame(colFrame); // Set its style context - nsIStyleContextPtr colStyleContext = - aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); + nsCOMPtr colStyleContext; + aPresContext.ResolveStyleContextFor(col, mStyleContext, + getter_AddRefs(colStyleContext), PR_TRUE); colFrame->Init(aPresContext, col, this, colStyleContext); colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); @@ -520,9 +521,9 @@ NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext& aPre colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay)); if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) { - nsIStyleContextPtr colStyleContext; + nsCOMPtr colStyleContext; nsStylePosition * colPosition=nsnull; - colFrame->GetStyleContext(colStyleContext.AssignPtr()); + colFrame->GetStyleContext(getter_AddRefs(colStyleContext)); colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position); if (colIndexGetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay)); if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) { - nsIStyleContextPtr colStyleContext; + nsCOMPtr colStyleContext; const nsStylePosition * colPosition=nsnull; colFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)colPosition); // get a read-only version of the style context //XXX: how do I know this is auto because it's defaulted, vs. set explicitly to "auto"? if (eStyleUnit_Auto==colPosition->mWidth.GetUnit()) { // notice how we defer getting a mutable style context until we're sure we really need one - colFrame->GetStyleContext(colStyleContext.AssignPtr()); + colFrame->GetStyleContext(getter_AddRefs(colStyleContext)); nsStylePosition * mutableColPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position); mutableColPosition->mWidth = position->mWidth; colStyleContext->RecalcAutomaticData(&aPresContext); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index d80d8ac04863..538adbc7ce7b 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -720,10 +720,11 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) parentFrame->GetParent(&parentFrame); } // now we have a ref-counted "lastColGroupElement" content object - nsIStyleContext* colGroupStyleContext = - aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, - nsHTMLAtoms::tableColGroupPseudo, - mStyleContext); // colGroupStyleContext: REFCNT++ + nsIStyleContext* colGroupStyleContext; + aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, + nsHTMLAtoms::tableColGroupPseudo, + mStyleContext, + &colGroupStyleContext); // colGroupStyleContext: REFCNT++ // Create a col group frame nsIFrame* newFrame; NS_NewTableColGroupFrame(newFrame); @@ -753,11 +754,12 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) // Create a new col frame nsIFrame* colFrame; // note we pass in PR_TRUE here to force unique style contexts. - nsIStyleContext* colStyleContext = - aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, - nsHTMLAtoms::tableColPseudo, - lastColGroupStyle, - PR_TRUE); // colStyleContext: REFCNT++ + nsIStyleContext* colStyleContext; + aPresContext.ResolvePseudoStyleContextFor (lastColGroupElement, + nsHTMLAtoms::tableColPseudo, + lastColGroupStyle, + &colStyleContext, + PR_TRUE); // colStyleContext: REFCNT++ NS_NewTableColFrame(colFrame); colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame, colStyleContext); @@ -4433,8 +4435,9 @@ nsTableFrame::CreateContinuingFrame(nsIPresContext& aPresContext, { printf("found a head or foot in continuing frame\n"); // Resolve style for the child - nsIStyleContext* kidStyleContext = - aPresContext.ResolveStyleContextFor(content, aStyleContext); // kidStyleContext: REFCNT++ + nsIStyleContext* kidStyleContext; + aPresContext.ResolveStyleContextFor(content, aStyleContext, + &kidStyleContext); // kidStyleContext: REFCNT++ nsIFrame* duplicateFrame; NS_NewTableRowGroupFrame(duplicateFrame);