From 4da6a59fbe1933ad45481b46713c48a362b850e6 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Fri, 16 Jul 2004 21:23:27 +0000 Subject: [PATCH] Backing out half of 236889. --- content/base/src/nsRuleNode.cpp | 4 ++-- content/html/style/src/nsCSSDataBlock.cpp | 5 ++--- content/html/style/src/nsComputedDOMStyle.cpp | 6 +----- content/shared/public/nsStyleStruct.h | 2 +- content/shared/src/nsStyleStruct.cpp | 2 +- layout/generic/nsBulletFrame.cpp | 10 ++-------- layout/html/base/src/nsBulletFrame.cpp | 10 ++-------- layout/style/nsCSSDataBlock.cpp | 5 ++--- layout/style/nsComputedDOMStyle.cpp | 6 +----- layout/style/nsRuleNode.cpp | 4 ++-- layout/style/nsStyleStruct.cpp | 2 +- layout/style/nsStyleStruct.h | 2 +- layout/xul/base/src/nsImageBoxFrame.cpp | 11 ++--------- layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp | 5 +---- 14 files changed, 21 insertions(+), 53 deletions(-) diff --git a/content/base/src/nsRuleNode.cpp b/content/base/src/nsRuleNode.cpp index 16cd3e3b1691..884dafef6de7 100644 --- a/content/base/src/nsRuleNode.cpp +++ b/content/base/src/nsRuleNode.cpp @@ -3504,8 +3504,8 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct, } // list-style-image: url, none, inherit - if (eCSSUnit_Image == listData.mImage.GetUnit()) { - list->mListStyleImage = listData.mImage.GetImageValue(); + if (eCSSUnit_URL == listData.mImage.GetUnit()) { + list->mListStyleImage = listData.mImage.GetURLValue(); } else if (eCSSUnit_None == listData.mImage.GetUnit()) { list->mListStyleImage = nsnull; diff --git a/content/html/style/src/nsCSSDataBlock.cpp b/content/html/style/src/nsCSSDataBlock.cpp index 988eda3bea1d..95b02966ac17 100644 --- a/content/html/style/src/nsCSSDataBlock.cpp +++ b/content/html/style/src/nsCSSDataBlock.cpp @@ -185,10 +185,9 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const if (target->GetUnit() == eCSSUnit_Null) { const nsCSSValue *val = ValueAtCursor(cursor); NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops"); - if ((iProp == eCSSProperty_background_image || - iProp == eCSSProperty_list_style_image) && + if (iProp == eCSSProperty_background_image && val->GetUnit() == eCSSUnit_URL) { - val->StartImageLoad(aRuleData->mPresContext->GetDocument()); + val->StartImageLoad(aRuleData->mPresContext->GetDocument()); } *target = *val; if (iProp == eCSSProperty_font_family) { diff --git a/content/html/style/src/nsComputedDOMStyle.cpp b/content/html/style/src/nsComputedDOMStyle.cpp index 8b738484766b..4bf2bdde06bf 100644 --- a/content/html/style/src/nsComputedDOMStyle.cpp +++ b/content/html/style/src/nsComputedDOMStyle.cpp @@ -1379,11 +1379,7 @@ nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame, if (!list->mListStyleImage) { val->SetIdent(nsLayoutAtoms::none); } else { - nsCOMPtr uri; - if (list->mListStyleImage) { - list->mListStyleImage->GetURI(getter_AddRefs(uri)); - } - val->SetURI(uri); + val->SetURI(list->mListStyleImage); } } diff --git a/content/shared/public/nsStyleStruct.h b/content/shared/public/nsStyleStruct.h index 8e4656367e8e..5308fd7f0e0b 100644 --- a/content/shared/public/nsStyleStruct.h +++ b/content/shared/public/nsStyleStruct.h @@ -578,7 +578,7 @@ struct nsStyleList : public nsStyleStruct { PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h PRUint8 mListStylePosition; // [inherited] - nsCOMPtr mListStyleImage; // [inherited] + nsCOMPtr mListStyleImage; // [inherited] nsRect mImageRegion; // [inherited] the rect to use within an image }; diff --git a/content/shared/src/nsStyleStruct.cpp b/content/shared/src/nsStyleStruct.cpp index fe771a3996da..eed8f52d6b6d 100644 --- a/content/shared/src/nsStyleStruct.cpp +++ b/content/shared/src/nsStyleStruct.cpp @@ -680,7 +680,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource) nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const { if (mListStylePosition == aOther.mListStylePosition && - EqualImages(mListStyleImage, aOther.mListStyleImage) && + EqualURIs(mListStyleImage, aOther.mListStyleImage) && mListStyleType == aOther.mListStyleType) { if (mImageRegion == aOther.mImageRegion) return NS_STYLE_HINT_NONE; diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 4168768c04eb..9db8c2117119 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -124,10 +124,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); - nsCOMPtr imgURI; - imgIRequest *imgReq = GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(imgURI)); + nsIURI *imgURI = GetStyleList()->mListStyleImage; if (imgURI) { nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv)); if (NS_FAILED(rv)) @@ -1590,10 +1587,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, } if (isStyleChange) { - nsCOMPtr newURI; - imgIRequest *imgReq = GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(newURI)); + nsIURI *newURI = GetStyleList()->mListStyleImage; if (newURI) { diff --git a/layout/html/base/src/nsBulletFrame.cpp b/layout/html/base/src/nsBulletFrame.cpp index 4168768c04eb..9db8c2117119 100644 --- a/layout/html/base/src/nsBulletFrame.cpp +++ b/layout/html/base/src/nsBulletFrame.cpp @@ -124,10 +124,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext, nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); - nsCOMPtr imgURI; - imgIRequest *imgReq = GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(imgURI)); + nsIURI *imgURI = GetStyleList()->mListStyleImage; if (imgURI) { nsCOMPtr il(do_GetService("@mozilla.org/image/loader;1", &rv)); if (NS_FAILED(rv)) @@ -1590,10 +1587,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext, } if (isStyleChange) { - nsCOMPtr newURI; - imgIRequest *imgReq = GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(newURI)); + nsIURI *newURI = GetStyleList()->mListStyleImage; if (newURI) { diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 988eda3bea1d..95b02966ac17 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -185,10 +185,9 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const if (target->GetUnit() == eCSSUnit_Null) { const nsCSSValue *val = ValueAtCursor(cursor); NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops"); - if ((iProp == eCSSProperty_background_image || - iProp == eCSSProperty_list_style_image) && + if (iProp == eCSSProperty_background_image && val->GetUnit() == eCSSUnit_URL) { - val->StartImageLoad(aRuleData->mPresContext->GetDocument()); + val->StartImageLoad(aRuleData->mPresContext->GetDocument()); } *target = *val; if (iProp == eCSSProperty_font_family) { diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 8b738484766b..4bf2bdde06bf 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1379,11 +1379,7 @@ nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame, if (!list->mListStyleImage) { val->SetIdent(nsLayoutAtoms::none); } else { - nsCOMPtr uri; - if (list->mListStyleImage) { - list->mListStyleImage->GetURI(getter_AddRefs(uri)); - } - val->SetURI(uri); + val->SetURI(list->mListStyleImage); } } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 16cd3e3b1691..884dafef6de7 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -3504,8 +3504,8 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct, } // list-style-image: url, none, inherit - if (eCSSUnit_Image == listData.mImage.GetUnit()) { - list->mListStyleImage = listData.mImage.GetImageValue(); + if (eCSSUnit_URL == listData.mImage.GetUnit()) { + list->mListStyleImage = listData.mImage.GetURLValue(); } else if (eCSSUnit_None == listData.mImage.GetUnit()) { list->mListStyleImage = nsnull; diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index fe771a3996da..eed8f52d6b6d 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -680,7 +680,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource) nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const { if (mListStylePosition == aOther.mListStylePosition && - EqualImages(mListStyleImage, aOther.mListStyleImage) && + EqualURIs(mListStyleImage, aOther.mListStyleImage) && mListStyleType == aOther.mListStyleType) { if (mImageRegion == aOther.mImageRegion) return NS_STYLE_HINT_NONE; diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 8e4656367e8e..5308fd7f0e0b 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -578,7 +578,7 @@ struct nsStyleList : public nsStyleStruct { PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h PRUint8 mListStylePosition; // [inherited] - nsCOMPtr mListStyleImage; // [inherited] + nsCOMPtr mListStyleImage; // [inherited] nsRect mImageRegion; // [inherited] the rect to use within an image }; diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index 781714ecb0e2..b32444015e6a 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -359,11 +359,7 @@ nsImageBoxFrame::GetImageSource() return; // get the list-style-image - imgIRequest *imgReq = GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(mURI)); - else - mURI = nsnull; + mURI = GetStyleList()->mListStyleImage; } } @@ -551,10 +547,7 @@ nsImageBoxFrame::DidSetStyleContext( nsIPresContext* aPresContext ) return NS_OK; // If list-style-image changes, we have a new image. - imgIRequest *imgReq = myList->mListStyleImage; - nsCOMPtr newURI; - if (imgReq) - imgReq->GetURI(getter_AddRefs(newURI)); + nsIURI *newURI = myList->mListStyleImage; PRBool equal; if (newURI == mURI || // handles null==null (newURI && mURI && NS_SUCCEEDED(newURI->Equals(mURI, &equal)) && equal)) diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 78029a75fb58..77b58a100db7 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -1633,10 +1633,7 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, nsTreeColumn* aCol, PRBool aUseCont else { // Obtain the URL from the style context. aAllowImageRegions = PR_TRUE; - nsCOMPtr uri; - imgIRequest *imgReq = aStyleContext->GetStyleList()->mListStyleImage; - if (imgReq) - imgReq->GetURI(getter_AddRefs(uri)); + nsIURI* uri = aStyleContext->GetStyleList()->mListStyleImage; if (!uri) return NS_OK; nsCAutoString spec;