Bug 1193349 - Part 1: Force a reload only when a source/img is really inserted into a picture; r=jdm

MozReview-Commit-ID: 4FfTwg1nRFO
This commit is contained in:
Edgar Chen
2016-05-04 10:21:45 +08:00
parent e4a9eb4573
commit db0868d04c
4 changed files with 38 additions and 12 deletions

View File

@@ -593,9 +593,10 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
mInDocResponsiveContent = true;
}
bool forceLoadEvent = HTMLPictureElement::IsPictureEnabled() &&
aParent && aParent->IsHTMLElement(nsGkAtoms::picture);
QueueImageLoadTask(forceLoadEvent);
// Run selection algorithm when an img element is inserted into a document
// in order to react to changes in the environment. See note of
// https://html.spec.whatwg.org/multipage/embedded-content.html#img-environment-changes
QueueImageLoadTask(false);
} else if (!InResponsiveMode() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
// We skip loading when our attributes were set from parser land,
@@ -1069,6 +1070,10 @@ HTMLImageElement::PictureSourceAdded(nsIContent *aSourceNode)
return;
}
MOZ_ASSERT(aSourceNode == this ||
IsPreviousSibling(aSourceNode, this),
"Should not be getting notifications for non-previous-siblings");
QueueImageLoadTask(true);
}