Load list-style-image in the style system rather than from frames. b=236889 r+sr=bzbarsky Reland half of page to test effect on pageload.

This commit is contained in:
dbaron%dbaron.org 2004-07-16 20:26:39 +00:00
Родитель bd8bee85d7
Коммит e4fd9c5b92
14 изменённых файлов: 53 добавлений и 21 удалений

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

@ -3504,8 +3504,8 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
}
// list-style-image: url, none, inherit
if (eCSSUnit_URL == listData.mImage.GetUnit()) {
list->mListStyleImage = listData.mImage.GetURLValue();
if (eCSSUnit_Image == listData.mImage.GetUnit()) {
list->mListStyleImage = listData.mImage.GetImageValue();
}
else if (eCSSUnit_None == listData.mImage.GetUnit()) {
list->mListStyleImage = nsnull;

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

@ -185,7 +185,8 @@ 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 &&
if ((iProp == eCSSProperty_background_image ||
iProp == eCSSProperty_list_style_image) &&
val->GetUnit() == eCSSUnit_URL) {
val->StartImageLoad(aRuleData->mPresContext->GetDocument());
}

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

@ -1379,7 +1379,11 @@ nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame,
if (!list->mListStyleImage) {
val->SetIdent(nsLayoutAtoms::none);
} else {
val->SetURI(list->mListStyleImage);
nsCOMPtr<nsIURI> uri;
if (list->mListStyleImage) {
list->mListStyleImage->GetURI(getter_AddRefs(uri));
}
val->SetURI(uri);
}
}

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

@ -578,7 +578,7 @@ struct nsStyleList : public nsStyleStruct {
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
PRUint8 mListStylePosition; // [inherited]
nsCOMPtr<nsIURI> mListStyleImage; // [inherited]
nsCOMPtr<imgIRequest> mListStyleImage; // [inherited]
nsRect mImageRegion; // [inherited] the rect to use within an image
};

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

@ -680,7 +680,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource)
nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
{
if (mListStylePosition == aOther.mListStylePosition &&
EqualURIs(mListStyleImage, aOther.mListStyleImage) &&
EqualImages(mListStyleImage, aOther.mListStyleImage) &&
mListStyleType == aOther.mListStyleType) {
if (mImageRegion == aOther.mImageRegion)
return NS_STYLE_HINT_NONE;

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

@ -124,7 +124,10 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
nsIURI *imgURI = GetStyleList()->mListStyleImage;
nsCOMPtr<nsIURI> imgURI;
imgIRequest *imgReq = GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(imgURI));
if (imgURI) {
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
if (NS_FAILED(rv))
@ -1587,7 +1590,10 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
}
if (isStyleChange) {
nsIURI *newURI = GetStyleList()->mListStyleImage;
nsCOMPtr<nsIURI> newURI;
imgIRequest *imgReq = GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(newURI));
if (newURI) {

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

@ -124,7 +124,10 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
nsIURI *imgURI = GetStyleList()->mListStyleImage;
nsCOMPtr<nsIURI> imgURI;
imgIRequest *imgReq = GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(imgURI));
if (imgURI) {
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
if (NS_FAILED(rv))
@ -1587,7 +1590,10 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
}
if (isStyleChange) {
nsIURI *newURI = GetStyleList()->mListStyleImage;
nsCOMPtr<nsIURI> newURI;
imgIRequest *imgReq = GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(newURI));
if (newURI) {

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

@ -185,7 +185,8 @@ 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 &&
if ((iProp == eCSSProperty_background_image ||
iProp == eCSSProperty_list_style_image) &&
val->GetUnit() == eCSSUnit_URL) {
val->StartImageLoad(aRuleData->mPresContext->GetDocument());
}

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

@ -1379,7 +1379,11 @@ nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame,
if (!list->mListStyleImage) {
val->SetIdent(nsLayoutAtoms::none);
} else {
val->SetURI(list->mListStyleImage);
nsCOMPtr<nsIURI> uri;
if (list->mListStyleImage) {
list->mListStyleImage->GetURI(getter_AddRefs(uri));
}
val->SetURI(uri);
}
}

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

@ -3504,8 +3504,8 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
}
// list-style-image: url, none, inherit
if (eCSSUnit_URL == listData.mImage.GetUnit()) {
list->mListStyleImage = listData.mImage.GetURLValue();
if (eCSSUnit_Image == listData.mImage.GetUnit()) {
list->mListStyleImage = listData.mImage.GetImageValue();
}
else if (eCSSUnit_None == listData.mImage.GetUnit()) {
list->mListStyleImage = nsnull;

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

@ -680,7 +680,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource)
nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
{
if (mListStylePosition == aOther.mListStylePosition &&
EqualURIs(mListStyleImage, aOther.mListStyleImage) &&
EqualImages(mListStyleImage, aOther.mListStyleImage) &&
mListStyleType == aOther.mListStyleType) {
if (mImageRegion == aOther.mImageRegion)
return NS_STYLE_HINT_NONE;

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

@ -578,7 +578,7 @@ struct nsStyleList : public nsStyleStruct {
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
PRUint8 mListStylePosition; // [inherited]
nsCOMPtr<nsIURI> mListStyleImage; // [inherited]
nsCOMPtr<imgIRequest> mListStyleImage; // [inherited]
nsRect mImageRegion; // [inherited] the rect to use within an image
};

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

@ -359,7 +359,11 @@ nsImageBoxFrame::GetImageSource()
return;
// get the list-style-image
mURI = GetStyleList()->mListStyleImage;
imgIRequest *imgReq = GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(mURI));
else
mURI = nsnull;
}
}
@ -547,7 +551,10 @@ nsImageBoxFrame::DidSetStyleContext( nsIPresContext* aPresContext )
return NS_OK;
// If list-style-image changes, we have a new image.
nsIURI *newURI = myList->mListStyleImage;
imgIRequest *imgReq = myList->mListStyleImage;
nsCOMPtr<nsIURI> newURI;
if (imgReq)
imgReq->GetURI(getter_AddRefs(newURI));
PRBool equal;
if (newURI == mURI || // handles null==null
(newURI && mURI && NS_SUCCEEDED(newURI->Equals(mURI, &equal)) && equal))

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

@ -1633,7 +1633,10 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, nsTreeColumn* aCol, PRBool aUseCont
else {
// Obtain the URL from the style context.
aAllowImageRegions = PR_TRUE;
nsIURI* uri = aStyleContext->GetStyleList()->mListStyleImage;
nsCOMPtr<nsIURI> uri;
imgIRequest *imgReq = aStyleContext->GetStyleList()->mListStyleImage;
if (imgReq)
imgReq->GetURI(getter_AddRefs(uri));
if (!uri)
return NS_OK;
nsCAutoString spec;