Bug 697230: Part 3 - Make style images block onload. r=bz

This commit is contained in:
Kyle Huey 2012-08-13 16:04:17 -07:00
parent 2fc3f31d0c
commit 4dcafaedea
8 changed files with 35 additions and 7 deletions

View File

@ -83,7 +83,6 @@ nsImageLoadingContent::nsImageLoadingContent()
mBroken(true),
mUserDisabled(false),
mSuppressed(false),
mBlockingOnload(false),
mNewRequestsWillNeedAnimationReset(false),
mStateChangerDepth(0),
mCurrentRequestRegistered(false),

View File

@ -368,11 +368,6 @@ private:
bool mUserDisabled : 1;
bool mSuppressed : 1;
/**
* Whether we're currently blocking document load.
*/
bool mBlockingOnload : 1;
protected:
/**
* A hack to get animations to reset, see bug 594771. On requests

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<img src="really-big-background.png" style="width: 1600px; height: 1200px; position: absolute;">

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<img style="background-image: url(really-big-background.png); width: 1600px; height: 1200px; position: absolute;"></img>

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View File

@ -127,4 +127,6 @@ random-if(bug685516) == fixed-bg-with-transform-outside-viewport-1.html fixed-bg
HTTP == root-background-1.html root-background-ref.html
HTTP != root-background-1.html about:blank
== really-big-background.html really-big-background-ref.html
== background-repeat-1-ref.html background-repeat-1.html

View File

@ -347,6 +347,7 @@ NS_IMPL_RELEASE(ImageLoader)
NS_INTERFACE_MAP_BEGIN(ImageLoader)
NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver)
NS_INTERFACE_MAP_ENTRY(imgIContainerObserver)
NS_INTERFACE_MAP_ENTRY(imgIOnloadBlocker)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
@ -423,5 +424,29 @@ ImageLoader::FrameChanged(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;
}
} // namespace css
} // namespace mozilla

View File

@ -11,6 +11,7 @@
#include "nsInterfaceHashtable.h"
#include "nsCSSValue.h"
#include "imgIRequest.h"
#include "imgIOnloadBlocker.h"
#include "nsStubImageDecoderObserver.h"
class nsIFrame;
@ -22,7 +23,8 @@ class nsIPrincipal;
namespace mozilla {
namespace css {
class ImageLoader : public nsStubImageDecoderObserver {
class ImageLoader : public nsStubImageDecoderObserver,
public imgIOnloadBlocker {
public:
ImageLoader(nsIDocument* aDocument)
: mDocument(aDocument),
@ -37,6 +39,7 @@ public:
}
NS_DECL_ISUPPORTS
NS_DECL_IMGIONLOADBLOCKER
// imgIDecoderObserver (override nsStubImageDecoderObserver)
NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);