Bug 1310885 - Part 4. (gecko) Allow ImageValue::Intialize be called more then once, but only LoadImage in the first call. r=haycam

MozReview-Commit-ID: IjL2e2LIy0f

--HG--
extra : rebase_source : 7ba6688ca3ca09f30909014ecc45f182b47a3e69
extra : source : 11fbcc3d133ed19e658c297aaf07d9c96280650c
This commit is contained in:
cku 2017-05-04 16:49:30 +08:00
Родитель bbbef1e5fb
Коммит dce4536c2f
2 изменённых файлов: 7 добавлений и 12 удалений

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

@ -3043,7 +3043,6 @@ void
css::ImageValue::Initialize(nsIDocument* aDocument)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mInitialized);
// NB: If aDocument is not the original document, we may not be able to load
// images from aDocument. Instead we do the image load from the original doc
@ -3053,17 +3052,15 @@ css::ImageValue::Initialize(nsIDocument* aDocument)
loadingDoc = aDocument;
}
loadingDoc->StyleImageLoader()->LoadImage(GetURI(),
mExtraData->GetPrincipal(),
mExtraData->GetReferrer(), this);
if (!mLoadedImage) {
loadingDoc->StyleImageLoader()->LoadImage(GetURI(),
mExtraData->GetPrincipal(),
mExtraData->GetReferrer(), this);
if (loadingDoc != aDocument) {
aDocument->StyleImageLoader()->MaybeRegisterCSSImage(this);
mLoadedImage = true;
}
#ifdef DEBUG
mInitialized = true;
#endif
aDocument->StyleImageLoader()->MaybeRegisterCSSImage(this);
}
css::ImageValue::~ImageValue()

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

@ -230,9 +230,7 @@ public:
nsRefPtrHashtable<nsPtrHashKey<nsIDocument>, imgRequestProxy> mRequests;
private:
#ifdef DEBUG
bool mInitialized = false;
#endif
bool mLoadedImage = false;
};
struct GridNamedArea {