зеркало из https://github.com/mozilla/pjs.git
Relanding bug bug 212133 (again), since last backout seemed to not affect Tp.
This commit is contained in:
Родитель
9cd77bae71
Коммит
a0ffc4e6d2
|
@ -137,10 +137,14 @@ public:
|
|||
const nsAString& aValue, PRBool aNotify);
|
||||
NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue,
|
||||
PRBool aNotify);
|
||||
|
||||
|
||||
// XXXbz What about UnsetAttr? We don't seem to unload images when
|
||||
// that happens...
|
||||
|
||||
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers);
|
||||
NS_IMETHOD SetParent(nsIContent* aParent);
|
||||
|
||||
protected:
|
||||
void GetImageFrame(nsIImageFrame** aImageFrame);
|
||||
nsresult GetXY(PRInt32* aX, PRInt32* aY);
|
||||
|
@ -618,9 +622,13 @@ NS_IMETHODIMP
|
|||
nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, PRBool aNotify)
|
||||
{
|
||||
// Call ImageURIChanged first so that the image load kicks off
|
||||
// _before_ the reflow triggered by the SetAttr
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::src) {
|
||||
// If we plan to call ImageURIChanged, we want to do it first so that the
|
||||
// image load kicks off _before_ the reflow triggered by the SetAttr. But if
|
||||
// aNotify is false, we are coming from the parser or some such place; we'll
|
||||
// get our parent set after all the attributes have been set, so we'll do the
|
||||
// image load from SetParent. Skip the ImageURIChanged call in that case.
|
||||
if (aNotify &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::src) {
|
||||
ImageURIChanged(aValue);
|
||||
}
|
||||
|
||||
|
@ -635,6 +643,42 @@ nsHTMLImageElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue,
|
|||
return nsGenericHTMLLeafElement::SetAttr(aNodeInfo, aValue, aNotify);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLImageElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||
PRBool aCompileEventHandlers)
|
||||
{
|
||||
PRBool documentChanging = aDocument && (aDocument != mDocument);
|
||||
|
||||
nsresult rv = nsGenericHTMLLeafElement::SetDocument(aDocument, aDeep,
|
||||
aCompileEventHandlers);
|
||||
if (documentChanging && mParent) {
|
||||
// Our base URI may have changed; claim that our URI changed, and the
|
||||
// nsImageLoadingContent will decide whether a new image load is warranted.
|
||||
nsAutoString uri;
|
||||
nsresult result = GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri);
|
||||
if (result == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
ImageURIChanged(uri);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLImageElement::SetParent(nsIContent* aParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLLeafElement::SetParent(aParent);
|
||||
if (aParent && mDocument) {
|
||||
// Our base URI may have changed; claim that our URI changed, and the
|
||||
// nsImageLoadingContent will decide whether a new image load is warranted.
|
||||
nsAutoString uri;
|
||||
nsresult result = GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri);
|
||||
if (result == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
ImageURIChanged(uri);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLImageElement::Initialize(JSContext* aContext, JSObject *aObj,
|
||||
PRUint32 argc, jsval *argv)
|
||||
|
|
Загрузка…
Ссылка в новой задаче