Bug 1184647. Cloning an image should ensure that the clone tries to load the src, if any. r=smaug
This commit is contained in:
@@ -800,10 +800,30 @@ HTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
||||
nsresult
|
||||
HTMLImageElement::CopyInnerTo(Element* aDest)
|
||||
{
|
||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||
CreateStaticImageClone(static_cast<HTMLImageElement*>(aDest));
|
||||
bool destIsStatic = aDest->OwnerDoc()->IsStaticDocument();
|
||||
auto dest = static_cast<HTMLImageElement*>(aDest);
|
||||
if (destIsStatic) {
|
||||
CreateStaticImageClone(dest);
|
||||
}
|
||||
return nsGenericHTMLElement::CopyInnerTo(aDest);
|
||||
|
||||
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!destIsStatic) {
|
||||
// In SetAttr (called from nsGenericHTMLElement::CopyInnerTo), dest skipped
|
||||
// doing the image load because we passed in false for aNotify. But we
|
||||
// really do want it to do the load, so set it up to happen once the cloning
|
||||
// reaches a stable state.
|
||||
if (!dest->InResponsiveMode() &&
|
||||
dest->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
CORSMode
|
||||
|
||||
Reference in New Issue
Block a user