Bug 1441136: Cleanup a bit the responsive image content setup. r=smaug

Also, clear it in DestroyElementMaps, as the rest of the code.

MozReview-Commit-ID: A8D3pgQ8MxX
This commit is contained in:
Emilio Cobos Álvarez 2018-03-29 18:46:34 +02:00
Родитель 0c3b21fb32
Коммит 82573e49d6
2 изменённых файлов: 5 добавлений и 11 удалений

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

@ -8638,6 +8638,7 @@ nsIDocument::DestroyElementMaps()
#endif
mStyledLinks.Clear();
mIdentifierMap.Clear();
mResponsiveContent.Clear();
IncrementExpandoGeneration(*this);
}

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

@ -632,12 +632,8 @@ HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
}
if (mInDocResponsiveContent) {
nsIDocument* doc = GetOurOwnerDoc();
MOZ_ASSERT(doc);
if (doc) {
doc->RemoveResponsiveContent(this);
mInDocResponsiveContent = false;
}
OwnerDoc()->RemoveResponsiveContent(this);
mInDocResponsiveContent = false;
}
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
@ -1050,11 +1046,8 @@ HTMLImageElement::PictureSourceSrcsetChanged(nsIContent *aSourceNode,
}
if (!mInDocResponsiveContent && IsInComposedDoc()) {
nsIDocument* doc = GetOurOwnerDoc();
if (doc) {
doc->AddResponsiveContent(this);
mInDocResponsiveContent = true;
}
OwnerDoc()->AddResponsiveContent(this);
mInDocResponsiveContent = true;
}
// This always triggers the image update steps per the spec, even if