diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
index 9a58fdca2ea..30156c5fa2c 100644
--- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp
@@ -547,16 +547,6 @@ nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::align)) {
aHint = NS_STYLE_HINT_FRAMECHANGE;
}
- else if (aAttribute == nsHTMLAtoms::src) {
- // If 'src' changed and we don't have a real image frame,
- // we need to cause a reframe.
- nsIImageFrame* imageFrame;
- // cast away |const| because the underlying interfaces don't use it.
- nsHTMLImageElement* mutable_this = NS_CONST_CAST(nsHTMLImageElement*,
- this);
- mutable_this->GetImageFrame(&imageFrame);
- aHint = imageFrame ? NS_STYLE_HINT_CONTENT : NS_STYLE_HINT_FRAMECHANGE;
- }
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
@@ -760,8 +750,9 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL,
{
nsresult result = SetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aSrc,
PR_TRUE);
+ NS_ENSURE_SUCCESS(result, result);
- if (NS_SUCCEEDED(result) && !mDocument) {
+ if (!mDocument) {
nsCOMPtr doc;
mNodeInfo->GetDocument(*getter_AddRefs(doc));
@@ -837,6 +828,18 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL,
nsnull, nsnull, getter_AddRefs(mRequest));
}
}
+ } else {
+ nsIImageFrame* imageFrame;
+ GetImageFrame(&imageFrame);
+ if (!imageFrame) {
+ // If we don't have an image frame, reconstruct the frame
+ // so that the new image can load.
+ nsCOMPtr shell;
+ mDocument->GetShellAt(0, getter_AddRefs(shell));
+ if (shell) {
+ shell->RecreateFramesFor(this);
+ }
+ }
}
return result;