Bug 1518795 - Properly track responsive content in a connected ShadowRoot. r=smaug

Took more to write the test than the fix :)

Differential Revision: https://phabricator.services.mozilla.com/D16055
This commit is contained in:
Emilio Cobos Álvarez
2019-01-09 15:59:10 +00:00
parent 04d494ec8e
commit b5a77cad23
3 changed files with 41 additions and 8 deletions

View File

@@ -500,8 +500,9 @@ nsresult HTMLImageElement::BindToTree(Document* aDocument, nsIContent* aParent,
}
if (HaveSrcsetOrInPicture()) {
if (aDocument && !mInDocResponsiveContent) {
aDocument->AddResponsiveContent(this);
Document* doc = GetComposedDoc();
if (doc && !mInDocResponsiveContent) {
doc->AddResponsiveContent(this);
mInDocResponsiveContent = true;
}