зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1404422 - Part 4. Remove imgIOnloadBlocker and related from tree as redundant. r=tnikkel
This commit is contained in:
Родитель
3e3c2a5bca
Коммит
95ee2e55dc
|
@ -70,8 +70,7 @@ public:
|
|||
NS_IMPL_ISUPPORTS_INHERITED(nsGenConImageContent,
|
||||
nsXMLElement,
|
||||
nsIImageLoadingContent,
|
||||
imgINotificationObserver,
|
||||
imgIOnloadBlocker)
|
||||
imgINotificationObserver)
|
||||
|
||||
nsresult
|
||||
NS_NewGenConImageContent(nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
|
|
|
@ -843,52 +843,6 @@ nsImageLoadingContent::ForceReload(bool aNotify /* = true */,
|
|||
return result.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::BlockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (aRequest == mCurrentRequest) {
|
||||
NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD),
|
||||
"Double BlockOnload!?");
|
||||
mCurrentRequestFlags |= REQUEST_BLOCKS_ONLOAD;
|
||||
} else if (aRequest == mPendingRequest) {
|
||||
NS_ASSERTION(!(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD),
|
||||
"Double BlockOnload!?");
|
||||
mPendingRequestFlags |= REQUEST_BLOCKS_ONLOAD;
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->BlockOnload();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::UnblockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (aRequest == mCurrentRequest) {
|
||||
NS_ASSERTION(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD,
|
||||
"Double UnblockOnload!?");
|
||||
mCurrentRequestFlags &= ~REQUEST_BLOCKS_ONLOAD;
|
||||
} else if (aRequest == mPendingRequest) {
|
||||
NS_ASSERTION(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD,
|
||||
"Double UnblockOnload!?");
|
||||
mPendingRequestFlags &= ~REQUEST_BLOCKS_ONLOAD;
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->UnblockOnload(false);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Non-interface methods
|
||||
*/
|
||||
|
@ -1607,9 +1561,6 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
|
||||
TrackImage(mCurrentRequest);
|
||||
TrackImage(mPendingRequest);
|
||||
|
||||
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
|
||||
aDocument->BlockOnload();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1622,9 +1573,6 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
|
||||
UntrackImage(mCurrentRequest);
|
||||
UntrackImage(mPendingRequest);
|
||||
|
||||
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
|
||||
doc->UnblockOnload(false);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#define nsImageLoadingContent_h__
|
||||
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -41,8 +40,7 @@ class AsyncEventDispatcher;
|
|||
#undef LoadImage
|
||||
#endif
|
||||
|
||||
class nsImageLoadingContent : public nsIImageLoadingContent,
|
||||
public imgIOnloadBlocker
|
||||
class nsImageLoadingContent : public nsIImageLoadingContent
|
||||
{
|
||||
template <typename T> using Maybe = mozilla::Maybe<T>;
|
||||
using Nothing = mozilla::Nothing;
|
||||
|
@ -56,7 +54,6 @@ public:
|
|||
|
||||
NS_DECL_IMGINOTIFICATIONOBSERVER
|
||||
NS_DECL_NSIIMAGELOADINGCONTENT
|
||||
NS_DECL_IMGIONLOADBLOCKER
|
||||
|
||||
// Web IDL binding methods.
|
||||
// Note that the XPCOM SetLoadingEnabled, AddObserver, RemoveObserver,
|
||||
|
@ -421,8 +418,6 @@ protected:
|
|||
enum {
|
||||
// Set if the request needs ResetAnimation called on it.
|
||||
REQUEST_NEEDS_ANIMATION_RESET = 0x00000001U,
|
||||
// Set if the request is blocking onload.
|
||||
REQUEST_BLOCKS_ONLOAD = 0x00000002U,
|
||||
// Set if the request is currently tracked with the document.
|
||||
REQUEST_IS_TRACKED = 0x00000004U,
|
||||
// Set if this is an imageset request, such as from <img srcset> or
|
||||
|
|
|
@ -63,7 +63,6 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLEmbedElement,
|
|||
nsIObjectLoadingContent,
|
||||
imgINotificationObserver,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
nsIChannelEventSink)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLEmbedElement)
|
||||
|
|
|
@ -139,7 +139,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
|
|||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
|
||||
nsGenericHTMLElement,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
imgINotificationObserver)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLImageElement)
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "Units.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
|
|
@ -1253,7 +1253,6 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLInputElement,
|
|||
nsITextControlElement,
|
||||
imgINotificationObserver,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
nsIDOMNSEditableElement,
|
||||
nsIConstraintValidation)
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLObjectElement,
|
|||
nsIFrameLoaderOwner,
|
||||
nsIObjectLoadingContent,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
nsIChannelEventSink,
|
||||
nsIConstraintValidation)
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ nsSVGElement::StringInfo SVGFEImageElement::sStringInfo[3] =
|
|||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(SVGFEImageElement, SVGFEImageElementBase,
|
||||
nsIDOMNode, nsIDOMElement, nsIDOMSVGElement,
|
||||
imgINotificationObserver, nsIImageLoadingContent,
|
||||
imgIOnloadBlocker)
|
||||
imgINotificationObserver, nsIImageLoadingContent)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
|
|
@ -51,7 +51,7 @@ NS_IMPL_ISUPPORTS_INHERITED(SVGImageElement, SVGImageElementBase,
|
|||
nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
imgINotificationObserver,
|
||||
nsIImageLoadingContent, imgIOnloadBlocker)
|
||||
nsIImageLoadingContent)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
|
|
@ -40,10 +40,6 @@ public:
|
|||
virtual void Notify(int32_t aType, const nsIntRect* aRect = nullptr) = 0;
|
||||
virtual void OnLoadComplete(bool aLastPart) = 0;
|
||||
|
||||
// imgIOnloadBlocker methods:
|
||||
virtual void BlockOnload() = 0;
|
||||
virtual void UnblockOnload() = 0;
|
||||
|
||||
// Other, internal-only methods:
|
||||
virtual void SetHasImage() = 0;
|
||||
virtual bool NotificationsDeferred() const = 0;
|
||||
|
|
|
@ -93,8 +93,6 @@ public:
|
|||
}
|
||||
|
||||
// Other notifications are ignored.
|
||||
virtual void BlockOnload() override { }
|
||||
virtual void UnblockOnload() override { }
|
||||
virtual void SetHasImage() override { }
|
||||
virtual bool NotificationsDeferred() const override { return false; }
|
||||
virtual void SetNotificationsDeferred(bool) override { }
|
||||
|
@ -177,7 +175,7 @@ FilterProgress(Progress aProgress)
|
|||
// onload for multipart images.
|
||||
// Filter out errors, since we don't want errors in one part to error out
|
||||
// the whole stream.
|
||||
return aProgress & ~(FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED | FLAG_HAS_ERROR);
|
||||
return aProgress & ~FLAG_HAS_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -61,11 +61,6 @@ public:
|
|||
virtual bool NotificationsDeferred() const override;
|
||||
virtual void SetNotificationsDeferred(bool aDeferNotifications) override;
|
||||
|
||||
// We don't allow multipart images to block onload, so we override these
|
||||
// methods to do nothing.
|
||||
virtual void BlockOnload() override { }
|
||||
virtual void UnblockOnload() override { }
|
||||
|
||||
protected:
|
||||
virtual ~MultipartImage();
|
||||
|
||||
|
|
|
@ -46,13 +46,6 @@ CheckProgressConsistency(Progress aOldProgress, Progress aNewProgress, bool aIsM
|
|||
if (aNewProgress & FLAG_LOAD_COMPLETE) {
|
||||
MOZ_ASSERT(aIsMultipart || aNewProgress & (FLAG_SIZE_AVAILABLE | FLAG_HAS_ERROR));
|
||||
}
|
||||
if (aNewProgress & FLAG_ONLOAD_BLOCKED) {
|
||||
// No preconditions.
|
||||
}
|
||||
if (aNewProgress & FLAG_ONLOAD_UNBLOCKED) {
|
||||
MOZ_ASSERT(aNewProgress & FLAG_ONLOAD_BLOCKED);
|
||||
MOZ_ASSERT(aIsMultipart || aNewProgress & (FLAG_SIZE_AVAILABLE | FLAG_HAS_ERROR));
|
||||
}
|
||||
if (aNewProgress & FLAG_IS_ANIMATED) {
|
||||
// No preconditions; like FLAG_HAS_TRANSPARENCY, we should normally never
|
||||
// discover this *after* FLAG_SIZE_AVAILABLE, but unfortunately some corrupt
|
||||
|
@ -376,23 +369,9 @@ ProgressTracker::SyncNotifyProgress(Progress aProgress,
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only");
|
||||
|
||||
// Don't unblock onload if we're not blocked.
|
||||
Progress progress = Difference(aProgress);
|
||||
if (!((mProgress | progress) & FLAG_ONLOAD_BLOCKED)) {
|
||||
progress &= ~FLAG_ONLOAD_UNBLOCKED;
|
||||
}
|
||||
|
||||
CheckProgressConsistency(mProgress, mProgress | progress, mIsMultipart);
|
||||
|
||||
// XXX(seth): Hack to work around the fact that some observers have bugs and
|
||||
// need to get onload blocking notifications multiple times. We should fix
|
||||
// those observers and remove this.
|
||||
if ((aProgress & FLAG_DECODE_COMPLETE) &&
|
||||
(mProgress & FLAG_ONLOAD_BLOCKED) &&
|
||||
(mProgress & FLAG_ONLOAD_UNBLOCKED)) {
|
||||
progress |= FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED;
|
||||
}
|
||||
|
||||
// Apply the changes.
|
||||
mProgress |= progress;
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ enum {
|
|||
FLAG_DECODE_COMPLETE = 1u << 1, // STATUS_DECODE_COMPLETE
|
||||
FLAG_FRAME_COMPLETE = 1u << 2, // STATUS_FRAME_COMPLETE
|
||||
FLAG_LOAD_COMPLETE = 1u << 3, // STATUS_LOAD_COMPLETE
|
||||
FLAG_ONLOAD_BLOCKED = 1u << 4,
|
||||
FLAG_ONLOAD_UNBLOCKED = 1u << 5,
|
||||
FLAG_IS_ANIMATED = 1u << 6, // STATUS_IS_ANIMATED
|
||||
FLAG_HAS_TRANSPARENCY = 1u << 7, // STATUS_HAS_TRANSPARENCY
|
||||
FLAG_LAST_PART_COMPLETE = 1u << 8,
|
||||
|
|
|
@ -1008,7 +1008,6 @@ RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*, nsresult aStatus,
|
|||
// We don't have our size yet, so we'll fire the load event in SetSize().
|
||||
MOZ_ASSERT(!canSyncDecodeMetadata,
|
||||
"Firing load async after metadata sync decode?");
|
||||
NotifyProgress(FLAG_ONLOAD_BLOCKED);
|
||||
mLoadProgress = Some(loadProgress);
|
||||
return finalStatus;
|
||||
}
|
||||
|
@ -1843,7 +1842,6 @@ RasterImage::NotifyDecodeComplete(const DecoderFinalStatus& aStatus,
|
|||
if (mLoadProgress) {
|
||||
NotifyForLoadEvent(*mLoadProgress);
|
||||
mLoadProgress = Nothing();
|
||||
NotifyProgress(FLAG_ONLOAD_UNBLOCKED);
|
||||
}
|
||||
|
||||
// If we were a metadata decode and a full decode was requested, do it.
|
||||
|
|
|
@ -1197,16 +1197,6 @@ VectorImage::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// ProgressTracker::SyncNotifyProgress may release us, so ensure we
|
||||
// stick around long enough to complete our work.
|
||||
RefPtr<VectorImage> kungFuDeathGrip(this);
|
||||
|
||||
// Block page load until the document's ready. (We unblock it in
|
||||
// OnSVGDocumentLoaded or OnSVGDocumentError.)
|
||||
if (mProgressTracker) {
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_ONLOAD_BLOCKED);
|
||||
}
|
||||
|
||||
// Create a listener to wait until the SVG document is fully loaded, which
|
||||
// will signal that this image is ready to render. Certain error conditions
|
||||
// will prevent us from ever getting this notification, so we also create a
|
||||
|
@ -1290,8 +1280,7 @@ VectorImage::OnSVGDocumentLoaded()
|
|||
Progress progress = FLAG_SIZE_AVAILABLE |
|
||||
FLAG_HAS_TRANSPARENCY |
|
||||
FLAG_FRAME_COMPLETE |
|
||||
FLAG_DECODE_COMPLETE |
|
||||
FLAG_ONLOAD_UNBLOCKED;
|
||||
FLAG_DECODE_COMPLETE;
|
||||
|
||||
if (mHaveAnimations) {
|
||||
progress |= FLAG_IS_ANIMATED;
|
||||
|
@ -1318,7 +1307,7 @@ VectorImage::OnSVGDocumentError()
|
|||
|
||||
if (mProgressTracker) {
|
||||
// Notify observers about the error and unblock page load.
|
||||
Progress progress = FLAG_ONLOAD_UNBLOCKED | FLAG_HAS_ERROR;
|
||||
Progress progress = FLAG_HAS_ERROR;
|
||||
|
||||
// Merge in any saved progress from OnImageDataComplete.
|
||||
if (mLoadProgress) {
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface imgIRequest;
|
||||
|
||||
[uuid(dc126d90-0ee0-4683-b942-2fa66e443abc)]
|
||||
interface imgIOnloadBlocker : nsISupports
|
||||
{
|
||||
/**
|
||||
* blockOnload
|
||||
* Called when it is appropriate to block onload for the given imgIRequest.
|
||||
*
|
||||
* @param aRequest
|
||||
* The request that should block onload.
|
||||
*/
|
||||
void blockOnload(in imgIRequest aRequest);
|
||||
|
||||
/**
|
||||
* unblockOnload
|
||||
* Called when it is appropriate to unblock onload for the given
|
||||
* imgIRequest.
|
||||
*
|
||||
* @param aRequest
|
||||
* The request that should unblock onload.
|
||||
*/
|
||||
void unblockOnload(in imgIRequest aRequest);
|
||||
};
|
|
@ -354,7 +354,7 @@ imgRequest::ContinueCancel(nsresult aStatus)
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
RefPtr<ProgressTracker> progressTracker = GetProgressTracker();
|
||||
progressTracker->SyncNotifyProgress(FLAG_HAS_ERROR | FLAG_ONLOAD_UNBLOCKED);
|
||||
progressTracker->SyncNotifyProgress(FLAG_HAS_ERROR);
|
||||
|
||||
RemoveFromCache();
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "ImageLogging.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
#include "imgLoader.h"
|
||||
#include "Image.h"
|
||||
#include "ImageOps.h"
|
||||
|
@ -1104,60 +1103,6 @@ imgRequestProxy::OnLoadComplete(bool aLastPart)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
imgRequestProxy::BlockOnload()
|
||||
{
|
||||
if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
|
||||
nsAutoCString name;
|
||||
GetName(name);
|
||||
LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::BlockOnload",
|
||||
"name", name.get());
|
||||
}
|
||||
|
||||
nsCOMPtr<imgIOnloadBlocker> blocker = do_QueryInterface(mListener);
|
||||
if (!blocker) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsOnEventTarget()) {
|
||||
RefPtr<imgRequestProxy> self(this);
|
||||
DispatchWithTarget(NS_NewRunnableFunction("imgRequestProxy::BlockOnload",
|
||||
[self]() -> void {
|
||||
self->BlockOnload();
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
blocker->BlockOnload(this);
|
||||
}
|
||||
|
||||
void
|
||||
imgRequestProxy::UnblockOnload()
|
||||
{
|
||||
if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
|
||||
nsAutoCString name;
|
||||
GetName(name);
|
||||
LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::UnblockOnload",
|
||||
"name", name.get());
|
||||
}
|
||||
|
||||
nsCOMPtr<imgIOnloadBlocker> blocker = do_QueryInterface(mListener);
|
||||
if (!blocker) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsOnEventTarget()) {
|
||||
RefPtr<imgRequestProxy> self(this);
|
||||
DispatchWithTarget(NS_NewRunnableFunction("imgRequestProxy::UnblockOnload",
|
||||
[self]() -> void {
|
||||
self->UnblockOnload();
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
blocker->UnblockOnload(this);
|
||||
}
|
||||
|
||||
void
|
||||
imgRequestProxy::NullOutListener()
|
||||
{
|
||||
|
|
|
@ -107,10 +107,6 @@ public:
|
|||
const mozilla::gfx::IntRect* aRect = nullptr) override;
|
||||
virtual void OnLoadComplete(bool aLastPart) override;
|
||||
|
||||
// imgIOnloadBlocker methods:
|
||||
virtual void BlockOnload() override;
|
||||
virtual void UnblockOnload() override;
|
||||
|
||||
// Other, internal-only methods:
|
||||
virtual void SetHasImage() override;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ XPIDL_SOURCES += [
|
|||
'imgIEncoder.idl',
|
||||
'imgILoader.idl',
|
||||
'imgINotificationObserver.idl',
|
||||
'imgIOnloadBlocker.idl',
|
||||
'imgIRequest.idl',
|
||||
'imgIScriptedNotificationObserver.idl',
|
||||
'imgITools.idl',
|
||||
|
|
|
@ -63,7 +63,6 @@ NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
|
|||
|
||||
nsBulletFrame::~nsBulletFrame()
|
||||
{
|
||||
NS_ASSERTION(!mBlockingOnload, "Still blocking onload in destructor?");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1228,42 +1227,6 @@ nsBulletFrame::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aDa
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBulletFrame::BlockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (aRequest != mImageRequest) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!mBlockingOnload, "Double BlockOnload for an nsBulletFrame?");
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
mBlockingOnload = true;
|
||||
doc->BlockOnload();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBulletFrame::UnblockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (aRequest != mImageRequest) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!mBlockingOnload, "Double UnblockOnload for an nsBulletFrame?");
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->UnblockOnload(false);
|
||||
}
|
||||
mBlockingOnload = false;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsBulletFrame::GetOurCurrentDoc() const
|
||||
{
|
||||
|
@ -1470,15 +1433,6 @@ nsBulletFrame::DeregisterAndCancelImageRequest()
|
|||
|
||||
isRequestRegistered = mRequestRegistered;
|
||||
|
||||
// Unblock onload if we blocked it.
|
||||
if (mBlockingOnload) {
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc) {
|
||||
doc->UnblockOnload(false);
|
||||
}
|
||||
mBlockingOnload = false;
|
||||
}
|
||||
|
||||
// Cancel the image request and forget about it.
|
||||
mImageRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
|
||||
mImageRequest = nullptr;
|
||||
|
@ -1509,21 +1463,3 @@ nsBulletListener::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect*
|
|||
}
|
||||
return mFrame->Notify(aRequest, aType, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBulletListener::BlockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (!mFrame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mFrame->BlockOnload(aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBulletListener::UnblockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (!mFrame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mFrame->UnblockOnload(aRequest);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "imgIContainer.h"
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
|
||||
class imgIContainer;
|
||||
class imgRequestProxy;
|
||||
|
@ -22,15 +21,13 @@ class imgRequestProxy;
|
|||
class nsBulletFrame;
|
||||
class BulletRenderer;
|
||||
|
||||
class nsBulletListener final : public imgINotificationObserver,
|
||||
public imgIOnloadBlocker
|
||||
class nsBulletListener final : public imgINotificationObserver
|
||||
{
|
||||
public:
|
||||
nsBulletListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IMGINOTIFICATIONOBSERVER
|
||||
NS_DECL_IMGIONLOADBLOCKER
|
||||
|
||||
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
|
||||
|
||||
|
@ -59,14 +56,11 @@ public:
|
|||
, mIntrinsicSize(GetWritingMode())
|
||||
, mOrdinal(0)
|
||||
, mRequestRegistered(false)
|
||||
, mBlockingOnload(false)
|
||||
{}
|
||||
|
||||
virtual ~nsBulletFrame();
|
||||
|
||||
NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
|
||||
NS_IMETHOD BlockOnload(imgIRequest* aRequest);
|
||||
NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
|
||||
|
||||
// nsIFrame
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
||||
|
@ -153,9 +147,6 @@ private:
|
|||
// This is a boolean flag indicating whether or not the current image request
|
||||
// has been registered with the refresh driver.
|
||||
bool mRequestRegistered : 1;
|
||||
|
||||
// Whether we're currently blocking onload.
|
||||
bool mBlockingOnload : 1;
|
||||
};
|
||||
|
||||
#endif /* nsBulletFrame_h___ */
|
||||
|
|
|
@ -381,7 +381,6 @@ NS_IMPL_RELEASE(ImageLoader)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN(ImageLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(imgIOnloadBlocker)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -494,30 +493,6 @@ ImageLoader::OnFrameUpdate(imgIRequest* aRequest)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageLoader::BlockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (!mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mDocument->BlockOnload();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageLoader::UnblockOnload(imgIRequest* aRequest)
|
||||
{
|
||||
if (!mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mDocument->UnblockOnload(false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ImageLoader::FlushUseCounters()
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsHashKeys.h"
|
||||
#include "nsTArray.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
|
@ -30,8 +29,7 @@ namespace css {
|
|||
|
||||
struct ImageValue;
|
||||
|
||||
class ImageLoader final : public imgINotificationObserver,
|
||||
public imgIOnloadBlocker
|
||||
class ImageLoader final : public imgINotificationObserver
|
||||
{
|
||||
public:
|
||||
typedef mozilla::css::ImageValue Image;
|
||||
|
@ -44,7 +42,6 @@ public:
|
|||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IMGIONLOADBLOCKER
|
||||
NS_DECL_IMGINOTIFICATIONOBSERVER
|
||||
|
||||
void DropDocumentReference();
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsCSSPropertyIDSet.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "imgRequestProxy.h"
|
||||
|
||||
struct nsRuleData;
|
||||
class nsCSSExpandedDataBlock;
|
||||
|
|
|
@ -915,7 +915,7 @@ nsImageBoxFrame::OnFrameUpdate(imgIRequest* aRequest)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsImageBoxListener, imgINotificationObserver, imgIOnloadBlocker)
|
||||
NS_IMPL_ISUPPORTS(nsImageBoxListener, imgINotificationObserver)
|
||||
|
||||
nsImageBoxListener::nsImageBoxListener()
|
||||
{
|
||||
|
@ -933,23 +933,3 @@ nsImageBoxListener::Notify(imgIRequest *request, int32_t aType, const nsIntRect*
|
|||
|
||||
return mFrame->Notify(request, aType, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxListener::BlockOnload(imgIRequest *aRequest)
|
||||
{
|
||||
if (mFrame && mFrame->GetContent() && mFrame->GetContent()->GetUncomposedDoc()) {
|
||||
mFrame->GetContent()->GetUncomposedDoc()->BlockOnload();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxListener::UnblockOnload(imgIRequest *aRequest)
|
||||
{
|
||||
if (mFrame && mFrame->GetContent() && mFrame->GetContent()->GetUncomposedDoc()) {
|
||||
mFrame->GetContent()->GetUncomposedDoc()->UnblockOnload(false);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -12,23 +12,19 @@
|
|||
#include "imgILoader.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "imgIOnloadBlocker.h"
|
||||
|
||||
class imgRequestProxy;
|
||||
class nsImageBoxFrame;
|
||||
|
||||
class nsDisplayXULImage;
|
||||
|
||||
class nsImageBoxListener final : public imgINotificationObserver,
|
||||
public imgIOnloadBlocker
|
||||
class nsImageBoxListener final : public imgINotificationObserver
|
||||
{
|
||||
public:
|
||||
nsImageBoxListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IMGINOTIFICATIONOBSERVER
|
||||
NS_DECL_IMGIONLOADBLOCKER
|
||||
|
||||
void SetFrame(nsImageBoxFrame *frame) { mFrame = frame; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче