mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1098202 (Part 1) - Rename imgINotificationObserver handlers to be consistent with the notifications they handle. r=tn
--HG-- extra : rebase_source : 991d277afba4826ed403b74bbcbb9408b3dac0cc
This commit is contained in:
parent
9fdcdbbc7e
commit
8272e602b4
@ -182,7 +182,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
|
|||||||
}
|
}
|
||||||
nsresult status =
|
nsresult status =
|
||||||
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
||||||
return OnStopRequest(aRequest, status);
|
return OnLoadComplete(aRequest, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
||||||
@ -205,8 +205,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
|
nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||||
nsresult aStatus)
|
|
||||||
{
|
{
|
||||||
uint32_t oldStatus;
|
uint32_t oldStatus;
|
||||||
aRequest->GetImageStatus(&oldStatus);
|
aRequest->GetImageStatus(&oldStatus);
|
||||||
|
@ -209,7 +209,7 @@ protected:
|
|||||||
nsIContent* aBindingParent, bool aCompileEventHandlers);
|
nsIContent* aBindingParent, bool aCompileEventHandlers);
|
||||||
void UnbindFromTree(bool aDeep, bool aNullParent);
|
void UnbindFromTree(bool aDeep, bool aNullParent);
|
||||||
|
|
||||||
nsresult OnStopRequest(imgIRequest* aRequest, nsresult aStatus);
|
nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
|
||||||
void OnUnlockedDraw();
|
void OnUnlockedDraw();
|
||||||
nsresult OnImageIsAnimated(imgIRequest *aRequest);
|
nsresult OnImageIsAnimated(imgIRequest *aRequest);
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
|
|||||||
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
aRequest->GetImage(getter_AddRefs(image));
|
aRequest->GetImage(getter_AddRefs(image));
|
||||||
return OnStartContainer(aRequest, image);
|
return OnSizeAvailable(aRequest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run this using a script runner because HAS_TRANSPARENCY notifications can
|
// Run this using a script runner because HAS_TRANSPARENCY notifications can
|
||||||
@ -475,7 +475,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
|
|||||||
aRequest->GetImageStatus(&reqStatus);
|
aRequest->GetImageStatus(&reqStatus);
|
||||||
nsresult status =
|
nsresult status =
|
||||||
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
||||||
return OnStopRequest(aRequest, status);
|
return OnLoadComplete(aRequest, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -513,7 +513,7 @@ ImageDocument::SetModeClass(eModeClasses mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||||
{
|
{
|
||||||
// Styles have not yet been applied, so we don't know the final size. For now,
|
// Styles have not yet been applied, so we don't know the final size. For now,
|
||||||
// default to the image's intrinsic size.
|
// default to the image's intrinsic size.
|
||||||
@ -529,8 +529,7 @@ ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ImageDocument::OnStopRequest(imgIRequest *aRequest,
|
ImageDocument::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||||
nsresult aStatus)
|
|
||||||
{
|
{
|
||||||
UpdateTitleAndCharset();
|
UpdateTitleAndCharset();
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ protected:
|
|||||||
};
|
};
|
||||||
void SetModeClass(eModeClasses mode);
|
void SetModeClass(eModeClasses mode);
|
||||||
|
|
||||||
nsresult OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage);
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||||
nsresult OnStopRequest(imgIRequest *aRequest, nsresult aStatus);
|
nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
|
||||||
void OnHasTransparency();
|
void OnHasTransparency();
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> mImageContent;
|
nsCOMPtr<nsIContent> mImageContent;
|
||||||
|
@ -306,15 +306,12 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
// OnStartContainer
|
|
||||||
if (aProgress & FLAG_HAS_SIZE)
|
if (aProgress & FLAG_HAS_SIZE)
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStartContainer());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnSizeAvailable());
|
||||||
|
|
||||||
// OnStartDecode
|
|
||||||
if (aProgress & FLAG_DECODE_STARTED)
|
if (aProgress & FLAG_DECODE_STARTED)
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStartDecode());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStartDecode());
|
||||||
|
|
||||||
// BlockOnload
|
|
||||||
if (aProgress & FLAG_ONLOAD_BLOCKED)
|
if (aProgress & FLAG_ONLOAD_BLOCKED)
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, BlockOnload());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, BlockOnload());
|
||||||
|
|
||||||
@ -327,7 +324,7 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
|||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameUpdate(&aDirtyRect));
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameUpdate(&aDirtyRect));
|
||||||
|
|
||||||
if (aProgress & FLAG_FRAME_STOPPED)
|
if (aProgress & FLAG_FRAME_STOPPED)
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStopFrame());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameComplete());
|
||||||
|
|
||||||
if (aProgress & FLAG_HAS_TRANSPARENCY)
|
if (aProgress & FLAG_HAS_TRANSPARENCY)
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageHasTransparency());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageHasTransparency());
|
||||||
@ -345,12 +342,12 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
|||||||
|
|
||||||
if (aProgress & FLAG_DECODE_STOPPED) {
|
if (aProgress & FLAG_DECODE_STOPPED) {
|
||||||
MOZ_ASSERT(aHasImage, "Stopped decoding without ever having an image?");
|
MOZ_ASSERT(aHasImage, "Stopped decoding without ever having an image?");
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStopDecode());
|
NOTIFY_IMAGE_OBSERVERS(aProxies, OnDecodeComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProgress & FLAG_REQUEST_STOPPED) {
|
if (aProgress & FLAG_REQUEST_STOPPED) {
|
||||||
NOTIFY_IMAGE_OBSERVERS(aProxies,
|
NOTIFY_IMAGE_OBSERVERS(aProxies,
|
||||||
OnStopRequest(aProgress & FLAG_MULTIPART_STOPPED));
|
OnLoadComplete(aProgress & FLAG_MULTIPART_STOPPED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +413,7 @@ ProgressTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(mProgress & FLAG_REQUEST_STOPPED)) {
|
if (!(mProgress & FLAG_REQUEST_STOPPED)) {
|
||||||
aProxy->OnStopRequest(true);
|
aProxy->OnLoadComplete(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ void imgRequestProxy::OnStartDecode()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imgRequestProxy::OnStartContainer()
|
void imgRequestProxy::OnSizeAvailable()
|
||||||
{
|
{
|
||||||
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnStartContainer");
|
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnStartContainer");
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ void imgRequestProxy::OnStartContainer()
|
|||||||
|
|
||||||
void imgRequestProxy::OnFrameUpdate(const nsIntRect * rect)
|
void imgRequestProxy::OnFrameUpdate(const nsIntRect * rect)
|
||||||
{
|
{
|
||||||
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnDataAvailable");
|
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnFrameUpdate");
|
||||||
|
|
||||||
if (mListener && !mCanceled) {
|
if (mListener && !mCanceled) {
|
||||||
// Hold a ref to the listener while we call it, just in case.
|
// Hold a ref to the listener while we call it, just in case.
|
||||||
@ -756,9 +756,9 @@ void imgRequestProxy::OnFrameUpdate(const nsIntRect * rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imgRequestProxy::OnStopFrame()
|
void imgRequestProxy::OnFrameComplete()
|
||||||
{
|
{
|
||||||
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnStopFrame");
|
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnFrameComplete");
|
||||||
|
|
||||||
if (mListener && !mCanceled) {
|
if (mListener && !mCanceled) {
|
||||||
// Hold a ref to the listener while we call it, just in case.
|
// Hold a ref to the listener while we call it, just in case.
|
||||||
@ -767,9 +767,9 @@ void imgRequestProxy::OnStopFrame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imgRequestProxy::OnStopDecode()
|
void imgRequestProxy::OnDecodeComplete()
|
||||||
{
|
{
|
||||||
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnStopDecode");
|
LOG_FUNC(GetImgLog(), "imgRequestProxy::OnDecodeComplete");
|
||||||
|
|
||||||
if (mListener && !mCanceled) {
|
if (mListener && !mCanceled) {
|
||||||
// Hold a ref to the listener while we call it, just in case.
|
// Hold a ref to the listener while we call it, just in case.
|
||||||
@ -830,7 +830,7 @@ void imgRequestProxy::OnImageIsAnimated()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imgRequestProxy::OnStopRequest(bool lastPart)
|
void imgRequestProxy::OnLoadComplete(bool aLastPart)
|
||||||
{
|
{
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
nsAutoCString name;
|
nsAutoCString name;
|
||||||
@ -852,17 +852,17 @@ void imgRequestProxy::OnStopRequest(bool lastPart)
|
|||||||
// to the loadgroup so that the document doesn't lose track of the load.
|
// to the loadgroup so that the document doesn't lose track of the load.
|
||||||
// If the request is already a background request and there's more data
|
// If the request is already a background request and there's more data
|
||||||
// coming, we can just leave the request in the loadgroup as-is.
|
// coming, we can just leave the request in the loadgroup as-is.
|
||||||
if (lastPart || (mLoadFlags & nsIRequest::LOAD_BACKGROUND) == 0) {
|
if (aLastPart || (mLoadFlags & nsIRequest::LOAD_BACKGROUND) == 0) {
|
||||||
RemoveFromLoadGroup(lastPart);
|
RemoveFromLoadGroup(aLastPart);
|
||||||
// More data is coming, so change the request to be a background request
|
// More data is coming, so change the request to be a background request
|
||||||
// and put it back in the loadgroup.
|
// and put it back in the loadgroup.
|
||||||
if (!lastPart) {
|
if (!aLastPart) {
|
||||||
mLoadFlags |= nsIRequest::LOAD_BACKGROUND;
|
mLoadFlags |= nsIRequest::LOAD_BACKGROUND;
|
||||||
AddToLoadGroup();
|
AddToLoadGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mListenerIsStrongRef && lastPart) {
|
if (mListenerIsStrongRef && aLastPart) {
|
||||||
NS_PRECONDITION(mListener, "How did that happen?");
|
NS_PRECONDITION(mListener, "How did that happen?");
|
||||||
// Drop our strong ref to the listener now that we're done with
|
// Drop our strong ref to the listener now that we're done with
|
||||||
// everything. Note that this can cancel us and other fun things
|
// everything. Note that this can cancel us and other fun things
|
||||||
|
@ -150,17 +150,17 @@ protected:
|
|||||||
// notifications.
|
// notifications.
|
||||||
|
|
||||||
void OnStartDecode();
|
void OnStartDecode();
|
||||||
void OnStartContainer();
|
void OnSizeAvailable();
|
||||||
void OnFrameUpdate(const nsIntRect* aRect);
|
void OnFrameUpdate(const nsIntRect* aRect);
|
||||||
void OnStopFrame();
|
void OnFrameComplete();
|
||||||
void OnStopDecode();
|
void OnDecodeComplete();
|
||||||
void OnDiscard();
|
void OnDiscard();
|
||||||
void OnUnlockedDraw();
|
void OnUnlockedDraw();
|
||||||
void OnImageHasTransparency();
|
void OnImageHasTransparency();
|
||||||
void OnImageIsAnimated();
|
void OnImageIsAnimated();
|
||||||
|
|
||||||
/* non-virtual sort-of-nsIRequestObserver methods */
|
/* non-virtual sort-of-nsIRequestObserver methods */
|
||||||
void OnStopRequest(bool aLastPart);
|
void OnLoadComplete(bool aLastPart);
|
||||||
|
|
||||||
/* non-virtual imgIOnloadBlocker methods */
|
/* non-virtual imgIOnloadBlocker methods */
|
||||||
void BlockOnload();
|
void BlockOnload();
|
||||||
|
@ -659,7 +659,7 @@ nsBulletFrame::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aDa
|
|||||||
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
aRequest->GetImage(getter_AddRefs(image));
|
aRequest->GetImage(getter_AddRefs(image));
|
||||||
return OnStartContainer(aRequest, image);
|
return OnSizeAvailable(aRequest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
||||||
@ -734,8 +734,8 @@ nsBulletFrame::GetOurCurrentDoc() const
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
|
nsresult
|
||||||
imgIContainer *aImage)
|
nsBulletFrame::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||||
{
|
{
|
||||||
if (!aImage) return NS_ERROR_INVALID_ARG;
|
if (!aImage) return NS_ERROR_INVALID_ARG;
|
||||||
if (!aRequest) return NS_ERROR_INVALID_ARG;
|
if (!aRequest) return NS_ERROR_INVALID_ARG;
|
||||||
|
@ -108,7 +108,7 @@ public:
|
|||||||
already_AddRefed<imgIContainer> GetImage() const;
|
already_AddRefed<imgIContainer> GetImage() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||||
|
|
||||||
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics);
|
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics);
|
||||||
void GetDesiredSize(nsPresContext* aPresContext,
|
void GetDesiredSize(nsPresContext* aPresContext,
|
||||||
|
@ -289,11 +289,11 @@ nsImageFrame::Init(nsIContent* aContent,
|
|||||||
if (p)
|
if (p)
|
||||||
p->AdjustPriority(-1);
|
p->AdjustPriority(-1);
|
||||||
|
|
||||||
// If we already have an image container, OnStartContainer won't be called
|
// If we already have an image container, OnSizeAvailable won't be called.
|
||||||
if (currentRequest) {
|
if (currentRequest) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
currentRequest->GetImage(getter_AddRefs(image));
|
currentRequest->GetImage(getter_AddRefs(image));
|
||||||
OnStartContainer(currentRequest, image);
|
OnSizeAvailable(currentRequest, image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,16 +535,18 @@ nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageFrame::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
|
nsImageFrame::Notify(imgIRequest* aRequest,
|
||||||
|
int32_t aType,
|
||||||
|
const nsIntRect* aRect)
|
||||||
{
|
{
|
||||||
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
aRequest->GetImage(getter_AddRefs(image));
|
aRequest->GetImage(getter_AddRefs(image));
|
||||||
return OnStartContainer(aRequest, image);
|
return OnSizeAvailable(aRequest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
||||||
return OnDataAvailable(aRequest, aData);
|
return OnFrameUpdate(aRequest, aRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
||||||
@ -556,7 +558,7 @@ nsImageFrame::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDat
|
|||||||
aRequest->GetImageStatus(&imgStatus);
|
aRequest->GetImageStatus(&imgStatus);
|
||||||
nsresult status =
|
nsresult status =
|
||||||
imgStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
imgStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
||||||
return OnStopRequest(aRequest, status);
|
return OnLoadComplete(aRequest, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -575,7 +577,7 @@ SizeIsAvailable(imgIRequest* aRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
|
nsImageFrame::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||||
{
|
{
|
||||||
if (!aImage) return NS_ERROR_INVALID_ARG;
|
if (!aImage) return NS_ERROR_INVALID_ARG;
|
||||||
|
|
||||||
@ -628,8 +630,7 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
|
nsImageFrame::OnFrameUpdate(imgIRequest* aRequest, const nsIntRect* aRect)
|
||||||
const nsIntRect *aRect)
|
|
||||||
{
|
{
|
||||||
if (mFirstFrameComplete) {
|
if (mFirstFrameComplete) {
|
||||||
nsCOMPtr<imgIContainer> container;
|
nsCOMPtr<imgIContainer> container;
|
||||||
@ -637,9 +638,8 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
|
|||||||
return FrameChanged(aRequest, container);
|
return FrameChanged(aRequest, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX do we need to make sure that the reflow from the
|
// XXX do we need to make sure that the reflow from the OnSizeAvailable has
|
||||||
// OnStartContainer has been processed before we start calling
|
// been processed before we start calling invalidate?
|
||||||
// invalidate?
|
|
||||||
|
|
||||||
NS_ENSURE_ARG_POINTER(aRect);
|
NS_ENSURE_ARG_POINTER(aRect);
|
||||||
|
|
||||||
@ -674,8 +674,7 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageFrame::OnStopRequest(imgIRequest *aRequest,
|
nsImageFrame::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||||
nsresult aStatus)
|
|
||||||
{
|
{
|
||||||
// Check what request type we're dealing with
|
// Check what request type we're dealing with
|
||||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
||||||
|
@ -221,10 +221,10 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
friend class nsImageListener;
|
friend class nsImageListener;
|
||||||
friend class nsImageLoadingContent;
|
friend class nsImageLoadingContent;
|
||||||
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
|
|
||||||
nsresult OnDataAvailable(imgIRequest *aRequest, const nsIntRect *rect);
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||||
nsresult OnStopRequest(imgIRequest *aRequest,
|
nsresult OnFrameUpdate(imgIRequest* aRequest, const nsIntRect* aRect);
|
||||||
nsresult aStatus);
|
nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
|
||||||
nsresult FrameChanged(imgIRequest *aRequest,
|
nsresult FrameChanged(imgIRequest *aRequest,
|
||||||
imgIContainer *aContainer);
|
imgIContainer *aContainer);
|
||||||
/**
|
/**
|
||||||
|
@ -395,12 +395,12 @@ NS_INTERFACE_MAP_BEGIN(ImageLoader)
|
|||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ImageLoader::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
ImageLoader::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
|
||||||
{
|
{
|
||||||
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
aRequest->GetImage(getter_AddRefs(image));
|
aRequest->GetImage(getter_AddRefs(image));
|
||||||
return OnStartContainer(aRequest, image);
|
return OnSizeAvailable(aRequest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::IS_ANIMATED) {
|
if (aType == imgINotificationObserver::IS_ANIMATED) {
|
||||||
@ -408,18 +408,18 @@ ImageLoader::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
||||||
return OnStopFrame(aRequest);
|
return OnFrameComplete(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
||||||
return FrameChanged(aRequest);
|
return OnFrameUpdate(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ImageLoader::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
ImageLoader::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||||
{
|
{
|
||||||
nsPresContext* presContext = GetPresContext();
|
nsPresContext* presContext = GetPresContext();
|
||||||
if (!presContext) {
|
if (!presContext) {
|
||||||
@ -456,7 +456,7 @@ ImageLoader::OnImageIsAnimated(imgIRequest* aRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ImageLoader::OnStopFrame(imgIRequest *aRequest)
|
ImageLoader::OnFrameComplete(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
if (!mDocument || mInClone) {
|
if (!mDocument || mInClone) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -478,7 +478,7 @@ ImageLoader::OnStopFrame(imgIRequest *aRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ImageLoader::FrameChanged(imgIRequest *aRequest)
|
ImageLoader::OnFrameUpdate(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
if (!mDocument || mInClone) {
|
if (!mDocument || mInClone) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -100,13 +100,10 @@ private:
|
|||||||
DeregisterRequestEnumerator(nsISupports* aKey, FrameSet* aValue,
|
DeregisterRequestEnumerator(nsISupports* aKey, FrameSet* aValue,
|
||||||
void* aClosure);
|
void* aClosure);
|
||||||
|
|
||||||
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer* aImage);
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||||
nsresult OnStopFrame(imgIRequest *aRequest);
|
nsresult OnFrameComplete(imgIRequest* aRequest);
|
||||||
nsresult OnImageIsAnimated(imgIRequest *aRequest);
|
nsresult OnImageIsAnimated(imgIRequest* aRequest);
|
||||||
nsresult FrameChanged(imgIRequest* aRequest);
|
nsresult OnFrameUpdate(imgIRequest* aRequest);
|
||||||
// Do not override OnDataAvailable since background images are not
|
|
||||||
// displayed incrementally; they are displayed after the entire image
|
|
||||||
// has been loaded.
|
|
||||||
|
|
||||||
// A map of imgIRequests to the nsIFrames that are using them.
|
// A map of imgIRequests to the nsIFrames that are using them.
|
||||||
RequestToFrameMap mRequestToFrameMap;
|
RequestToFrameMap mRequestToFrameMap;
|
||||||
|
@ -602,16 +602,18 @@ nsImageBoxFrame::GetFrameName(nsAString& aResult) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsImageBoxFrame::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
nsImageBoxFrame::Notify(imgIRequest* aRequest,
|
||||||
|
int32_t aType,
|
||||||
|
const nsIntRect* aData)
|
||||||
{
|
{
|
||||||
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||||
nsCOMPtr<imgIContainer> image;
|
nsCOMPtr<imgIContainer> image;
|
||||||
aRequest->GetImage(getter_AddRefs(image));
|
aRequest->GetImage(getter_AddRefs(image));
|
||||||
return OnStartContainer(aRequest, image);
|
return OnSizeAvailable(aRequest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
||||||
return OnStopDecode(aRequest);
|
return OnDecodeComplete(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
||||||
@ -619,7 +621,7 @@ nsImageBoxFrame::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* a
|
|||||||
aRequest->GetImageStatus(&imgStatus);
|
aRequest->GetImageStatus(&imgStatus);
|
||||||
nsresult status =
|
nsresult status =
|
||||||
imgStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
imgStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
|
||||||
return OnStopRequest(aRequest, status);
|
return OnLoadComplete(aRequest, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::IS_ANIMATED) {
|
if (aType == imgINotificationObserver::IS_ANIMATED) {
|
||||||
@ -627,25 +629,25 @@ nsImageBoxFrame::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* a
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
||||||
return FrameChanged(aRequest);
|
return OnFrameUpdate(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImageBoxFrame::OnStartContainer(imgIRequest *request,
|
nsresult
|
||||||
imgIContainer *image)
|
nsImageBoxFrame::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(image);
|
NS_ENSURE_ARG_POINTER(aImage);
|
||||||
|
|
||||||
// Ensure the animation (if any) is started. Note: There is no
|
// Ensure the animation (if any) is started. Note: There is no
|
||||||
// corresponding call to Decrement for this. This Increment will be
|
// corresponding call to Decrement for this. This Increment will be
|
||||||
// 'cleaned up' by the Request when it is destroyed, but only then.
|
// 'cleaned up' by the Request when it is destroyed, but only then.
|
||||||
request->IncrementAnimationConsumers();
|
aRequest->IncrementAnimationConsumers();
|
||||||
|
|
||||||
nscoord w, h;
|
nscoord w, h;
|
||||||
image->GetWidth(&w);
|
aImage->GetWidth(&w);
|
||||||
image->GetHeight(&h);
|
aImage->GetHeight(&h);
|
||||||
|
|
||||||
mIntrinsicSize.SizeTo(nsPresContext::CSSPixelsToAppUnits(w),
|
mIntrinsicSize.SizeTo(nsPresContext::CSSPixelsToAppUnits(w),
|
||||||
nsPresContext::CSSPixelsToAppUnits(h));
|
nsPresContext::CSSPixelsToAppUnits(h));
|
||||||
@ -658,13 +660,14 @@ nsresult nsImageBoxFrame::OnStartContainer(imgIRequest *request,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImageBoxFrame::OnStopDecode(imgIRequest *request)
|
nsresult
|
||||||
|
nsImageBoxFrame::OnDecodeComplete(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
if (mFireEventOnDecode) {
|
if (mFireEventOnDecode) {
|
||||||
mFireEventOnDecode = false;
|
mFireEventOnDecode = false;
|
||||||
|
|
||||||
uint32_t reqStatus;
|
uint32_t reqStatus;
|
||||||
request->GetImageStatus(&reqStatus);
|
aRequest->GetImageStatus(&reqStatus);
|
||||||
if (!(reqStatus & imgIRequest::STATUS_ERROR)) {
|
if (!(reqStatus & imgIRequest::STATUS_ERROR)) {
|
||||||
FireImageDOMEvent(mContent, NS_LOAD);
|
FireImageDOMEvent(mContent, NS_LOAD);
|
||||||
} else {
|
} else {
|
||||||
@ -682,11 +685,11 @@ nsresult nsImageBoxFrame::OnStopDecode(imgIRequest *request)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImageBoxFrame::OnStopRequest(imgIRequest *request,
|
nsresult
|
||||||
nsresult aStatus)
|
nsImageBoxFrame::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||||
{
|
{
|
||||||
uint32_t reqStatus;
|
uint32_t reqStatus;
|
||||||
request->GetImageStatus(&reqStatus);
|
aRequest->GetImageStatus(&reqStatus);
|
||||||
|
|
||||||
// We want to give the decoder a chance to find errors. If we haven't found
|
// We want to give the decoder a chance to find errors. If we haven't found
|
||||||
// an error yet and we've already started decoding, we must only fire these
|
// an error yet and we've already started decoding, we must only fire these
|
||||||
@ -711,7 +714,8 @@ nsresult nsImageBoxFrame::OnStopRequest(imgIRequest *request,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImageBoxFrame::OnImageIsAnimated(imgIRequest *aRequest)
|
nsresult
|
||||||
|
nsImageBoxFrame::OnImageIsAnimated(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
// Register with our refresh driver, if we're animated.
|
// Register with our refresh driver, if we're animated.
|
||||||
nsLayoutUtils::RegisterImageRequest(PresContext(), aRequest,
|
nsLayoutUtils::RegisterImageRequest(PresContext(), aRequest,
|
||||||
@ -720,7 +724,8 @@ nsresult nsImageBoxFrame::OnImageIsAnimated(imgIRequest *aRequest)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImageBoxFrame::FrameChanged(imgIRequest *aRequest)
|
nsresult
|
||||||
|
nsImageBoxFrame::OnFrameUpdate(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
if ((0 == mRect.width) || (0 == mRect.height)) {
|
if ((0 == mRect.width) || (0 == mRect.height)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -101,11 +101,11 @@ protected:
|
|||||||
virtual void GetImageSize();
|
virtual void GetImageSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsresult OnStartContainer(imgIRequest *request, imgIContainer *image);
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||||
nsresult OnStopDecode(imgIRequest *request);
|
nsresult OnDecodeComplete(imgIRequest* aRequest);
|
||||||
nsresult OnStopRequest(imgIRequest *request, nsresult status);
|
nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
|
||||||
nsresult OnImageIsAnimated(imgIRequest* aRequest);
|
nsresult OnImageIsAnimated(imgIRequest* aRequest);
|
||||||
nsresult FrameChanged(imgIRequest *aRequest);
|
nsresult OnFrameUpdate(imgIRequest* aRequest);
|
||||||
|
|
||||||
nsRect mSubRect; ///< If set, indicates that only the portion of the image specified by the rect should be used.
|
nsRect mSubRect; ///< If set, indicates that only the portion of the image specified by the rect should be used.
|
||||||
nsSize mIntrinsicSize;
|
nsSize mIntrinsicSize;
|
||||||
|
@ -108,18 +108,18 @@ NS_IMETHODIMP
|
|||||||
nsAlertsIconListener::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
nsAlertsIconListener::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
||||||
{
|
{
|
||||||
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
||||||
return OnStopRequest(aRequest);
|
return OnLoadComplete(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
||||||
return OnStopFrame(aRequest);
|
return OnFrameComplete(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest)
|
nsAlertsIconListener::OnLoadComplete(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
|
NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsAlertsIconListener::OnStopFrame(imgIRequest* aRequest)
|
nsAlertsIconListener::OnFrameComplete(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
|
NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual ~nsAlertsIconListener();
|
virtual ~nsAlertsIconListener();
|
||||||
|
|
||||||
nsresult OnStopRequest(imgIRequest* aRequest);
|
nsresult OnLoadComplete(imgIRequest* aRequest);
|
||||||
nsresult OnStopFrame(imgIRequest* aRequest);
|
nsresult OnFrameComplete(imgIRequest* aRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The only difference between libnotify.so.4 and libnotify.so.1 for these symbols
|
* The only difference between libnotify.so.4 and libnotify.so.1 for these symbols
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult OnStopFrame(imgIRequest* aRequest);
|
nsresult OnFrameComplete(imgIRequest* aRequest);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> mContent;
|
nsCOMPtr<nsIContent> mContent;
|
||||||
nsRefPtr<imgRequestProxy> mIconRequest;
|
nsRefPtr<imgRequestProxy> mIconRequest;
|
||||||
|
@ -325,10 +325,12 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
|
|||||||
//
|
//
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMenuItemIconX::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
nsMenuItemIconX::Notify(imgIRequest* aRequest,
|
||||||
|
int32_t aType,
|
||||||
|
const nsIntRect* aData)
|
||||||
{
|
{
|
||||||
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
if (aType == imgINotificationObserver::FRAME_COMPLETE) {
|
||||||
return OnStopFrame(aRequest);
|
return OnFrameComplete(aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
||||||
@ -342,7 +344,7 @@ nsMenuItemIconX::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* a
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsMenuItemIconX::OnStopFrame(imgIRequest* aRequest)
|
nsMenuItemIconX::OnFrameComplete(imgIRequest* aRequest)
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user