API changes for nsIPresContext ResolveStyleContextFor and ResolvePseudoStyleContextFor

This commit is contained in:
troy%netscape.com 1999-02-11 15:56:23 +00:00
parent c553baf851
commit 902190112d
30 changed files with 141 additions and 114 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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);

View File

@ -38,9 +38,6 @@
// XXX TODO:
// append/insert/remove floater testing
// XXX get rid of this
typedef nsCOMPtr<nsIStyleContext> 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<nsIStyleContext> newSC;
aPresContext.ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozAnonymousBlock,
mStyleContext,
getter_AddRefs(newSC));
rv = bf->Init(aPresContext, mContent, this, newSC);
if (NS_FAILED(rv)) {
bf->DeleteFrame(aPresContext);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -38,9 +38,6 @@
// XXX TODO:
// append/insert/remove floater testing
// XXX get rid of this
typedef nsCOMPtr<nsIStyleContext> 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<nsIStyleContext> newSC;
aPresContext.ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozAnonymousBlock,
mStyleContext,
getter_AddRefs(newSC));
rv = bf->Init(aPresContext, mContent, this, newSC);
if (NS_FAILED(rv)) {
bf->DeleteFrame(aPresContext);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<nsIStyleContext> 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<nsIStyleContext> colStyleContext;
nsStylePosition * colPosition=nsnull;
colFrame->GetStyleContext(colStyleContext.AssignPtr());
colFrame->GetStyleContext(getter_AddRefs(colStyleContext));
colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
if (colIndex<numCols)
{
@ -553,14 +554,14 @@ NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext& aPre
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay)
{
nsIStyleContextPtr colStyleContext;
nsCOMPtr<nsIStyleContext> 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);

View File

@ -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);

View File

@ -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<nsIStyleContext> 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<nsIStyleContext> colStyleContext;
nsStylePosition * colPosition=nsnull;
colFrame->GetStyleContext(colStyleContext.AssignPtr());
colFrame->GetStyleContext(getter_AddRefs(colStyleContext));
colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
if (colIndex<numCols)
{
@ -553,14 +554,14 @@ NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext& aPre
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay)
{
nsIStyleContextPtr colStyleContext;
nsCOMPtr<nsIStyleContext> 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);

View File

@ -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);