зеркало из https://github.com/mozilla/pjs.git
bug 314453 Rename ImageURIChanged and ObjectURIChanged to LoadImage and
LoadObject, respectively, in order to make it clear what they do rather than prescribing when they should be called. r+sr=bz
This commit is contained in:
Родитель
eec5573f68
Коммит
e372451268
|
@ -419,7 +419,7 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
|
|||
*/
|
||||
|
||||
nsresult
|
||||
nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
|
||||
nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
|
||||
PRBool aForce,
|
||||
PRBool aNotify)
|
||||
{
|
||||
|
@ -440,11 +440,11 @@ nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// XXXbiesi fire onerror if that failed?
|
||||
|
||||
return ImageURIChanged(imageURI, aForce, aNotify, doc);
|
||||
return LoadImage(imageURI, aForce, aNotify, doc);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsImageLoadingContent::ImageURIChanged(nsIURI* aNewURI,
|
||||
nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
|
||||
PRBool aForce,
|
||||
PRBool aNotify,
|
||||
nsIDocument* aDocument)
|
||||
|
@ -555,7 +555,7 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify)
|
|||
// Ignore this call; we'll update our state when the state changer is
|
||||
// destroyed. Need this to work around the fact that some libpr0n stuff is
|
||||
// actually sync and hence we can get OnStopDecode called while we're still
|
||||
// under ImageURIChanged, and OnStopDecode doesn't know anything about
|
||||
// under LoadImage, and OnStopDecode doesn't know anything about
|
||||
// aNotify
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* ImageURIChanged is called by subclasses when the appropriate
|
||||
* LoadImage is called by subclasses when the appropriate
|
||||
* attributes (eg 'src' for <img> tags) change. The string passed
|
||||
* in is the new uri string; this consolidates the code for getting
|
||||
* the charset, constructing URI objects, and any other incidentals
|
||||
|
@ -80,7 +80,7 @@ protected:
|
|||
* @param aNotify If true, nsIDocumentObserver state change notifications
|
||||
* will be sent as needed.
|
||||
*/
|
||||
nsresult ImageURIChanged(const nsAString& aNewURI, PRBool aForce,
|
||||
nsresult LoadImage(const nsAString& aNewURI, PRBool aForce,
|
||||
PRBool aNotify);
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ protected:
|
|||
PRInt32 ImageState() const;
|
||||
|
||||
/**
|
||||
* ImageURIChanged is called by subclasses when the appropriate
|
||||
* LoadImage is called by subclasses when the appropriate
|
||||
* attributes (eg 'src' for <img> tags) change. If callers have an
|
||||
* URI object already available, they should use this method.
|
||||
*
|
||||
|
@ -108,7 +108,7 @@ protected:
|
|||
* @param aDocument Optional parameter giving the document this node is in.
|
||||
* This is purely a performance optimization.
|
||||
*/
|
||||
nsresult ImageURIChanged(nsIURI* aNewURI, PRBool aForce, PRBool aNotify,
|
||||
nsresult LoadImage(nsIURI* aNewURI, PRBool aForce, PRBool aNotify,
|
||||
nsIDocument* aDocument = nsnull);
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ protected:
|
|||
/**
|
||||
* UseAsPrimaryRequest is called by subclasses when they have an existing
|
||||
* imgIRequest that they want this nsImageLoadingContent to use. This may
|
||||
* effectively be called instead of ImageURIChanged or LoadImageWithChannel.
|
||||
* effectively be called instead of LoadImage or LoadImageWithChannel.
|
||||
* If aNotify is true, this method will notify on state changes.
|
||||
*/
|
||||
nsresult UseAsPrimaryRequest(imgIRequest* aRequest, PRBool aNotify);
|
||||
|
|
|
@ -699,7 +699,7 @@ nsObjectLoadingContent::ObjectState() const
|
|||
|
||||
// <protected>
|
||||
nsresult
|
||||
nsObjectLoadingContent::ObjectURIChanged(const nsAString& aURI,
|
||||
nsObjectLoadingContent::LoadObject(const nsAString& aURI,
|
||||
PRBool aNotify,
|
||||
const nsCString& aTypeHint,
|
||||
PRBool aForceType,
|
||||
|
@ -730,11 +730,11 @@ nsObjectLoadingContent::ObjectURIChanged(const nsAString& aURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return ObjectURIChanged(uri, aNotify, aTypeHint, aForceType, aForceLoad);
|
||||
return LoadObject(uri, aNotify, aTypeHint, aForceType, aForceLoad);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectLoadingContent::ObjectURIChanged(nsIURI* aURI,
|
||||
nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
||||
PRBool aNotify,
|
||||
const nsCString& aTypeHint,
|
||||
PRBool aForceType,
|
||||
|
@ -881,7 +881,7 @@ nsObjectLoadingContent::ObjectURIChanged(nsIURI* aURI,
|
|||
switch (newType) {
|
||||
case eType_Image:
|
||||
// Don't notify, because we will take care of that ourselves.
|
||||
rv = ImageURIChanged(aURI, aForceLoad, PR_FALSE);
|
||||
rv = LoadImage(aURI, aForceLoad, PR_FALSE);
|
||||
break;
|
||||
case eType_Plugin:
|
||||
rv = Instantiate(aTypeHint, aURI);
|
||||
|
@ -1034,7 +1034,7 @@ nsObjectLoadingContent::RemovedFromDocument()
|
|||
mFrameLoader->Destroy();
|
||||
mFrameLoader = nsnull;
|
||||
|
||||
// Clear the current URI, so that ObjectURIChanged doesn't think that we
|
||||
// Clear the current URI, so that LoadObject doesn't think that we
|
||||
// have already loaded the content.
|
||||
mURI = nsnull;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
* @see the URI-taking version of this function for a detailed description
|
||||
* of how a plugin will be found.
|
||||
*/
|
||||
nsresult ObjectURIChanged(const nsAString& aURI,
|
||||
nsresult LoadObject(const nsAString& aURI,
|
||||
PRBool aNotify,
|
||||
const nsCString& aTypeHint = EmptyCString(),
|
||||
PRBool aForceType = PR_FALSE,
|
||||
|
@ -171,7 +171,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
* @param aForceLoad If true, the object will be refetched even if the URI
|
||||
* is the same as the currently-loaded object.
|
||||
*/
|
||||
nsresult ObjectURIChanged(nsIURI* aURI,
|
||||
nsresult LoadObject(nsIURI* aURI,
|
||||
PRBool aNotify,
|
||||
const nsCString& aTypeHint = EmptyCString(),
|
||||
PRBool aForceType = PR_FALSE,
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
virtual PRUint32 GetCapabilities() const;
|
||||
protected:
|
||||
/**
|
||||
* Calls ObjectURIChanged with the correct arguments to start the plugin
|
||||
* Calls LoadObject with the correct arguments to start the plugin
|
||||
* load.
|
||||
*/
|
||||
NS_HIDDEN_(void) StartAppletLoad(PRBool aNotify);
|
||||
|
@ -278,15 +278,15 @@ nsHTMLAppletElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
PRBool aNotify)
|
||||
{
|
||||
// If we plan to call ObjectURIChanged, we want to do it first so that the
|
||||
// If we plan to call LoadObject, we want to do it first so that the
|
||||
// object 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 bound after all the attributes have been set, so we'll do the
|
||||
// object load from BindToTree/DoneAddingChildren.
|
||||
// Skip the ObjectURIChanged call in that case.
|
||||
// Skip the LoadObject call in that case.
|
||||
if (aNotify &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::code) {
|
||||
ObjectURIChanged(aValue, aNotify,
|
||||
LoadObject(aValue, aNotify,
|
||||
NS_LITERAL_CSTRING("application/x-java-vm"),
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
@ -301,10 +301,10 @@ nsHTMLAppletElement::StartAppletLoad(PRBool aNotify)
|
|||
{
|
||||
nsAutoString uri;
|
||||
if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, uri)) {
|
||||
ObjectURIChanged(uri, aNotify,
|
||||
LoadObject(uri, aNotify,
|
||||
NS_LITERAL_CSTRING("application/x-java-vm"), PR_TRUE);
|
||||
} else {
|
||||
// The constructor set the type to eType_Plugin; but if we have no code
|
||||
// The constructor set the type to eType_Loading; but if we have no code
|
||||
// attribute, then we aren't really a plugin
|
||||
Fallback(aNotify);
|
||||
}
|
||||
|
|
|
@ -550,11 +550,11 @@ nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
PRBool aNotify)
|
||||
{
|
||||
// If we plan to call ImageURIChanged, we want to do it first so that the
|
||||
// If we plan to call LoadImage, 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 bound after all the attributes have been set, so we'll do the
|
||||
// image load from BindToTree. Skip the ImageURIChanged call in that case.
|
||||
// image load from BindToTree. Skip the LoadImage call in that case.
|
||||
if (aNotify &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::src) {
|
||||
|
||||
|
@ -569,7 +569,7 @@ nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
// Force image loading here, so that we'll try to load the image from
|
||||
// network if it's set to be not cacheable...
|
||||
ImageURIChanged(aValue, PR_TRUE, aNotify);
|
||||
LoadImage(aValue, PR_TRUE, aNotify);
|
||||
|
||||
if (mCurrentRequest && !mPendingRequest &&
|
||||
oldCurrentRequest != mCurrentRequest) {
|
||||
|
@ -604,7 +604,7 @@ nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri)) {
|
||||
// Note: no need to notify here; since we're just now being bound
|
||||
// we don't have any frames or anything yet.
|
||||
ImageURIChanged(uri, PR_FALSE, PR_FALSE);
|
||||
LoadImage(uri, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -431,7 +431,7 @@ nsHTMLInputElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
} else if (aNotify && aName == nsHTMLAtoms::src &&
|
||||
aValue && mType == NS_FORM_INPUT_IMAGE) {
|
||||
// Null value means the attr got unset; don't trigger on that
|
||||
ImageURIChanged(*aValue, PR_TRUE, aNotify);
|
||||
LoadImage(*aValue, PR_TRUE, aNotify);
|
||||
} else if (aNotify && aName == nsHTMLAtoms::disabled) {
|
||||
SET_BOOLBIT(mBitField, BF_DISABLED_CHANGED, PR_TRUE);
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
// whether we have an image to load;
|
||||
nsAutoString src;
|
||||
if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, src)) {
|
||||
ImageURIChanged(src, PR_FALSE, aNotify);
|
||||
LoadImage(src, PR_FALSE, aNotify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1685,7 +1685,7 @@ nsHTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri)) {
|
||||
// Note: no need to notify here; since we're just now being bound
|
||||
// we don't have any frames or anything yet.
|
||||
ImageURIChanged(uri, PR_FALSE, PR_FALSE);
|
||||
LoadImage(uri, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calls ObjectURIChanged with the correct arguments to start the plugin
|
||||
* Calls LoadObject with the correct arguments to start the plugin
|
||||
* load.
|
||||
*/
|
||||
NS_HIDDEN_(void) StartObjectLoad(PRBool aNotify);
|
||||
|
@ -223,17 +223,17 @@ nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
PRBool aNotify)
|
||||
{
|
||||
// If we plan to call ObjectURIChanged, we want to do it first so that the
|
||||
// If we plan to call LoadObject, we want to do it first so that the
|
||||
// object 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 bound after all the attributes have been set, so we'll do the
|
||||
// object load from BindToTree/DoneAddingChildren.
|
||||
// Skip the ObjectURIChanged call in that case.
|
||||
// Skip the LoadObject call in that case.
|
||||
if (aNotify &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::data) {
|
||||
nsAutoString type;
|
||||
GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type);
|
||||
ObjectURIChanged(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_FALSE, PR_TRUE);
|
||||
LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_FALSE, PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -426,9 +426,9 @@ nsHTMLObjectElement::StartObjectLoad(PRBool aNotify)
|
|||
// That handles the case where no URI is specified. An empty string would get
|
||||
// interpreted as the page itself, instead of absence of URI.
|
||||
if (!GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, uri)) {
|
||||
ObjectURIChanged(nsnull, aNotify, ctype);
|
||||
LoadObject(nsnull, aNotify, ctype);
|
||||
} else {
|
||||
ObjectURIChanged(uri, aNotify, ctype);
|
||||
LoadObject(uri, aNotify, ctype);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -532,11 +532,11 @@ nsHTMLSharedElement::BindToTree(nsIDocument* aDocument,
|
|||
nsAutoString uri;
|
||||
if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri)) {
|
||||
// Don't notify: We aren't in a document yet, so we have no frames
|
||||
ObjectURIChanged(uri, PR_FALSE, NS_ConvertUTF16toUTF8(type), PR_TRUE);
|
||||
LoadObject(uri, PR_FALSE, NS_ConvertUTF16toUTF8(type), PR_TRUE);
|
||||
} else {
|
||||
// Sometimes, code uses <embed> with no src attributes, for example using
|
||||
// code="...". Handle that case.
|
||||
ObjectURIChanged(nsnull, PR_FALSE, NS_ConvertUTF16toUTF8(type), PR_TRUE);
|
||||
LoadObject(nsnull, PR_FALSE, NS_ConvertUTF16toUTF8(type), PR_TRUE);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -560,16 +560,16 @@ nsHTMLSharedElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
PRBool aNotify)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
// If we plan to call ObjectURIChanged, we want to do it first so that the
|
||||
// If we plan to call LoadObject, 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 bound after all the attributes have been set, so we'll do the
|
||||
// object load from BindToTree. Skip the ObjectURIChanged call in that case.
|
||||
// object load from BindToTree. Skip the LoadObject call in that case.
|
||||
if (aNotify &&
|
||||
aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::src) {
|
||||
nsAutoString type;
|
||||
GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type);
|
||||
ObjectURIChanged(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE, PR_TRUE);
|
||||
LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ nsSVGImageElement::DidModifySVGObservable(nsISVGValue* aObservable,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
ImageURIChanged(href, PR_TRUE, PR_TRUE);
|
||||
LoadImage(href, PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
return nsSVGImageElementBase::DidModifySVGObservable(aObservable, aModType);
|
||||
|
|
Загрузка…
Ссылка в новой задаче