2012-08-13 15:04:19 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
/* A class that handles style system image loads (other image loads are handled
|
|
|
|
* by the nodes in the content tree).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mozilla/css/ImageLoader.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "nsLayoutUtils.h"
|
2012-08-15 06:52:06 -07:00
|
|
|
#include "nsError.h"
|
2012-11-06 14:04:53 -08:00
|
|
|
#include "nsDisplayList.h"
|
|
|
|
#include "FrameLayerBuilder.h"
|
2013-09-04 04:13:11 -07:00
|
|
|
#include "nsSVGEffects.h"
|
2012-08-13 15:04:19 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
|
|
|
|
|
|
|
/* static */ PLDHashOperator
|
|
|
|
ImageLoader::SetAnimationModeEnumerator(nsISupports* aKey, FrameSet* aValue,
|
|
|
|
void* aClosure)
|
|
|
|
{
|
|
|
|
imgIRequest* request = static_cast<imgIRequest*>(aKey);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t* mode = static_cast<uint16_t*>(aClosure);
|
2012-08-13 15:04:19 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<imgIRequest> debugRequest = do_QueryInterface(aKey);
|
|
|
|
NS_ASSERTION(debugRequest == request, "This is bad");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsCOMPtr<imgIContainer> container;
|
|
|
|
request->GetImage(getter_AddRefs(container));
|
|
|
|
if (!container) {
|
|
|
|
return PL_DHASH_NEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This can fail if the image is in error, and we don't care.
|
|
|
|
container->SetAnimationMode(*mode);
|
|
|
|
|
|
|
|
return PL_DHASH_NEXT;
|
|
|
|
}
|
|
|
|
|
2013-02-23 06:59:43 -08:00
|
|
|
static PLDHashOperator
|
|
|
|
ClearImageHashSet(nsPtrHashKey<ImageLoader::Image>* aKey, void* aClosure)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = static_cast<nsIDocument*>(aClosure);
|
|
|
|
ImageLoader::Image* image = aKey->GetKey();
|
|
|
|
|
|
|
|
imgIRequest* request = image->mRequests.GetWeak(doc);
|
|
|
|
if (request) {
|
|
|
|
request->CancelAndForgetObserver(NS_BINDING_ABORTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
image->mRequests.Remove(doc);
|
|
|
|
|
|
|
|
return PL_DHASH_REMOVE;
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:04:19 -07:00
|
|
|
void
|
|
|
|
ImageLoader::DropDocumentReference()
|
|
|
|
{
|
2013-02-23 06:59:43 -08:00
|
|
|
ClearFrames();
|
|
|
|
mImages.EnumerateEntries(&ClearImageHashSet, mDocument);
|
2012-08-14 13:34:20 -07:00
|
|
|
mDocument = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ImageLoader::AssociateRequestToFrame(imgIRequest* aRequest,
|
|
|
|
nsIFrame* aFrame)
|
|
|
|
{
|
2012-10-12 09:11:22 -07:00
|
|
|
nsCOMPtr<imgINotificationObserver> observer;
|
|
|
|
aRequest->GetNotificationObserver(getter_AddRefs(observer));
|
2012-08-13 15:04:19 -07:00
|
|
|
if (!observer) {
|
|
|
|
// The request has already been canceled, so ignore it. This is ok because
|
|
|
|
// we're not going to get any more notifications from a canceled request.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(observer == this);
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
FrameSet* frameSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
if (mRequestToFrameMap.Get(aRequest, &frameSet)) {
|
|
|
|
NS_ASSERTION(frameSet, "This should never be null!");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!frameSet) {
|
|
|
|
nsAutoPtr<FrameSet> newFrameSet(new FrameSet());
|
|
|
|
|
|
|
|
mRequestToFrameMap.Put(aRequest, newFrameSet);
|
|
|
|
frameSet = newFrameSet.forget();
|
2012-08-21 16:14:06 -07:00
|
|
|
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
if (presContext) {
|
|
|
|
nsLayoutUtils::RegisterImageRequestIfAnimated(presContext,
|
|
|
|
aRequest,
|
|
|
|
nullptr);
|
|
|
|
}
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
RequestSet* requestSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
if (mFrameToRequestMap.Get(aFrame, &requestSet)) {
|
|
|
|
NS_ASSERTION(requestSet, "This should never be null");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!requestSet) {
|
|
|
|
nsAutoPtr<RequestSet> newRequestSet(new RequestSet());
|
|
|
|
|
|
|
|
mFrameToRequestMap.Put(aFrame, newRequestSet);
|
|
|
|
requestSet = newRequestSet.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add these to the sets, but only if they're not already there.
|
2013-02-13 07:11:53 -08:00
|
|
|
uint32_t i = frameSet->IndexOfFirstElementGt(aFrame);
|
|
|
|
if (i == 0 || aFrame != frameSet->ElementAt(i-1)) {
|
2012-08-13 15:04:19 -07:00
|
|
|
frameSet->InsertElementAt(i, aFrame);
|
|
|
|
}
|
2013-02-13 07:11:53 -08:00
|
|
|
i = requestSet->IndexOfFirstElementGt(aRequest);
|
|
|
|
if (i == 0 || aRequest != requestSet->ElementAt(i-1)) {
|
2012-08-13 15:04:19 -07:00
|
|
|
requestSet->InsertElementAt(i, aRequest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-24 10:50:49 -07:00
|
|
|
ImageLoader::MaybeRegisterCSSImage(ImageLoader::Image* aImage)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aImage, "This should never be null!");
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
aImage->mRequests.GetWeak(mDocument, &found);
|
|
|
|
if (found) {
|
|
|
|
// This document already has a request.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:43:01 -07:00
|
|
|
imgRequestProxy* canonicalRequest = aImage->mRequests.GetWeak(nullptr);
|
2012-08-13 15:04:19 -07:00
|
|
|
if (!canonicalRequest) {
|
|
|
|
// The image was blocked or something.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:43:01 -07:00
|
|
|
nsRefPtr<imgRequestProxy> request;
|
2012-08-13 15:04:19 -07:00
|
|
|
|
|
|
|
// Ignore errors here. If cloning fails for some reason we'll put a null
|
|
|
|
// entry in the hash and we won't keep trying to clone.
|
|
|
|
mInClone = true;
|
|
|
|
canonicalRequest->Clone(this, getter_AddRefs(request));
|
|
|
|
mInClone = false;
|
|
|
|
|
|
|
|
aImage->mRequests.Put(mDocument, request);
|
|
|
|
|
|
|
|
AddImage(aImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-24 10:50:49 -07:00
|
|
|
ImageLoader::DeregisterCSSImage(ImageLoader::Image* aImage)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
RemoveImage(aImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ImageLoader::DisassociateRequestFromFrame(imgIRequest* aRequest,
|
|
|
|
nsIFrame* aFrame)
|
|
|
|
{
|
2012-08-14 13:34:20 -07:00
|
|
|
FrameSet* frameSet = nullptr;
|
|
|
|
RequestSet* requestSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
2012-10-12 09:11:22 -07:00
|
|
|
nsCOMPtr<imgINotificationObserver> observer;
|
|
|
|
aRequest->GetNotificationObserver(getter_AddRefs(observer));
|
2012-08-13 15:04:19 -07:00
|
|
|
MOZ_ASSERT(!observer || observer == this);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mRequestToFrameMap.Get(aRequest, &frameSet);
|
|
|
|
mFrameToRequestMap.Get(aFrame, &requestSet);
|
|
|
|
|
|
|
|
if (frameSet) {
|
|
|
|
frameSet->RemoveElementSorted(aFrame);
|
|
|
|
}
|
|
|
|
if (requestSet) {
|
|
|
|
requestSet->RemoveElementSorted(aRequest);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frameSet && !frameSet->Length()) {
|
|
|
|
mRequestToFrameMap.Remove(aRequest);
|
|
|
|
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
if (presContext) {
|
|
|
|
nsLayoutUtils::DeregisterImageRequest(presContext,
|
|
|
|
aRequest,
|
2012-08-14 13:34:20 -07:00
|
|
|
nullptr);
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (requestSet && !requestSet->Length()) {
|
|
|
|
mFrameToRequestMap.Remove(aFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ImageLoader::DropRequestsForFrame(nsIFrame* aFrame)
|
|
|
|
{
|
2012-08-14 13:34:20 -07:00
|
|
|
RequestSet* requestSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
if (!mFrameToRequestMap.Get(aFrame, &requestSet)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(requestSet, "This should never be null");
|
|
|
|
|
|
|
|
RequestSet frozenRequestSet(*requestSet);
|
|
|
|
for (RequestSet::size_type i = frozenRequestSet.Length(); i != 0; --i) {
|
|
|
|
imgIRequest* request = frozenRequestSet.ElementAt(i - 1);
|
|
|
|
|
|
|
|
DisassociateRequestFromFrame(request, aFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
ImageLoader::SetAnimationMode(uint16_t aMode)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aMode == imgIContainer::kNormalAnimMode ||
|
|
|
|
aMode == imgIContainer::kDontAnimMode ||
|
|
|
|
aMode == imgIContainer::kLoopOnceAnimMode,
|
|
|
|
"Wrong Animation Mode is being set!");
|
|
|
|
|
|
|
|
mRequestToFrameMap.EnumerateRead(SetAnimationModeEnumerator, &aMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-23 06:59:43 -08:00
|
|
|
ImageLoader::ClearFrames()
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
mRequestToFrameMap.Clear();
|
|
|
|
mFrameToRequestMap.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ImageLoader::LoadImage(nsIURI* aURI, nsIPrincipal* aOriginPrincipal,
|
2012-08-24 10:50:49 -07:00
|
|
|
nsIURI* aReferrer, ImageLoader::Image* aImage)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aImage->mRequests.Count() == 0, "Huh?");
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
aImage->mRequests.Put(nullptr, nullptr);
|
2012-08-13 15:04:19 -07:00
|
|
|
|
|
|
|
if (!aURI) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nsContentUtils::CanLoadImage(aURI, mDocument, mDocument,
|
|
|
|
aOriginPrincipal)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:43:01 -07:00
|
|
|
nsRefPtr<imgRequestProxy> request;
|
2012-08-13 15:04:19 -07:00
|
|
|
nsContentUtils::LoadImage(aURI, mDocument, aOriginPrincipal, aReferrer,
|
2012-08-14 13:34:20 -07:00
|
|
|
nullptr, nsIRequest::LOAD_NORMAL,
|
2012-08-13 15:04:19 -07:00
|
|
|
getter_AddRefs(request));
|
|
|
|
|
|
|
|
if (!request) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:43:01 -07:00
|
|
|
nsRefPtr<imgRequestProxy> clonedRequest;
|
2012-08-13 15:04:19 -07:00
|
|
|
mInClone = true;
|
|
|
|
nsresult rv = request->Clone(this, getter_AddRefs(clonedRequest));
|
|
|
|
mInClone = false;
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
aImage->mRequests.Put(nullptr, request);
|
2012-08-13 15:04:19 -07:00
|
|
|
aImage->mRequests.Put(mDocument, clonedRequest);
|
|
|
|
|
|
|
|
AddImage(aImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-24 10:50:49 -07:00
|
|
|
ImageLoader::AddImage(ImageLoader::Image* aImage)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(!mImages.Contains(aImage), "Huh?");
|
|
|
|
if (!mImages.PutEntry(aImage)) {
|
|
|
|
NS_RUNTIMEABORT("OOM");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-24 10:50:49 -07:00
|
|
|
ImageLoader::RemoveImage(ImageLoader::Image* aImage)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mImages.Contains(aImage), "Huh?");
|
|
|
|
mImages.RemoveEntry(aImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPresContext*
|
|
|
|
ImageLoader::GetPresContext()
|
|
|
|
{
|
|
|
|
if (!mDocument) {
|
2012-08-14 13:34:20 -07:00
|
|
|
return nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIPresShell* shell = mDocument->GetShell();
|
|
|
|
if (!shell) {
|
2012-08-14 13:34:20 -07:00
|
|
|
return nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return shell->GetPresContext();
|
|
|
|
}
|
|
|
|
|
2012-11-06 14:04:53 -08:00
|
|
|
void InvalidateImagesCallback(nsIFrame* aFrame,
|
|
|
|
FrameLayerBuilder::DisplayItemData* aItem)
|
|
|
|
{
|
|
|
|
nsDisplayItem::Type type = nsDisplayItem::GetDisplayItemTypeFromKey(aItem->GetDisplayItemKey());
|
|
|
|
uint8_t flags = nsDisplayItem::GetDisplayItemFlagsForType(type);
|
|
|
|
|
|
|
|
if (flags & nsDisplayItem::TYPE_RENDERS_NO_IMAGES) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aItem->Invalidate();
|
|
|
|
aFrame->SchedulePaint();
|
2013-09-04 04:13:11 -07:00
|
|
|
|
|
|
|
// Update ancestor rendering observers (-moz-element etc)
|
|
|
|
nsIFrame *f = aFrame;
|
|
|
|
while (f && !f->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
|
|
|
|
nsSVGEffects::InvalidateDirectRenderingObservers(f);
|
|
|
|
f = nsLayoutUtils::GetCrossDocParentFrame(f);
|
|
|
|
}
|
2012-11-06 14:04:53 -08:00
|
|
|
}
|
|
|
|
|
2012-08-13 15:04:19 -07:00
|
|
|
void
|
|
|
|
ImageLoader::DoRedraw(FrameSet* aFrameSet)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aFrameSet, "Must have a frame set");
|
|
|
|
NS_ASSERTION(mDocument, "Should have returned earlier!");
|
|
|
|
|
|
|
|
FrameSet::size_type length = aFrameSet->Length();
|
|
|
|
for (FrameSet::size_type i = 0; i < length; i++) {
|
|
|
|
nsIFrame* frame = aFrameSet->ElementAt(i);
|
|
|
|
|
2013-02-16 13:51:02 -08:00
|
|
|
if (frame->StyleVisibility()->IsVisible()) {
|
2013-03-07 18:18:45 -08:00
|
|
|
if (frame->IsFrameOfType(nsIFrame::eTablePart)) {
|
|
|
|
// Tables don't necessarily build border/background display items
|
|
|
|
// for the individual table part frames, so IterateRetainedDataFor
|
|
|
|
// might not find the right display item.
|
|
|
|
frame->InvalidateFrame();
|
|
|
|
} else {
|
|
|
|
FrameLayerBuilder::IterateRetainedDataFor(frame, InvalidateImagesCallback);
|
|
|
|
}
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(ImageLoader)
|
|
|
|
NS_IMPL_RELEASE(ImageLoader)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(ImageLoader)
|
2012-10-12 09:11:22 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
|
2012-08-13 16:04:17 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(imgIOnloadBlocker)
|
2012-08-13 15:04:19 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-10-12 09:11:22 -07:00
|
|
|
ImageLoader::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
|
|
|
|
{
|
2012-10-12 09:11:23 -07:00
|
|
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
2012-10-12 09:11:22 -07:00
|
|
|
nsCOMPtr<imgIContainer> image;
|
|
|
|
aRequest->GetImage(getter_AddRefs(image));
|
|
|
|
return OnStartContainer(aRequest, image);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aType == imgINotificationObserver::IS_ANIMATED) {
|
|
|
|
return OnImageIsAnimated(aRequest);
|
|
|
|
}
|
|
|
|
|
2012-10-12 09:11:23 -07:00
|
|
|
if (aType == imgINotificationObserver::LOAD_COMPLETE) {
|
2012-10-12 09:11:22 -07:00
|
|
|
return OnStopFrame(aRequest);
|
|
|
|
}
|
|
|
|
|
2012-10-12 09:11:23 -07:00
|
|
|
if (aType == imgINotificationObserver::FRAME_UPDATE) {
|
2012-10-12 09:11:22 -07:00
|
|
|
return FrameChanged(aRequest);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-08-13 15:04:19 -07:00
|
|
|
ImageLoader::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
|
|
|
{
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
if (!presContext) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
aImage->SetAnimationMode(presContext->ImageAnimationMode());
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-12 09:11:22 -07:00
|
|
|
nsresult
|
2012-08-13 15:04:19 -07:00
|
|
|
ImageLoader::OnImageIsAnimated(imgIRequest* aRequest)
|
|
|
|
{
|
|
|
|
if (!mDocument) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-21 16:14:06 -07:00
|
|
|
FrameSet* frameSet = nullptr;
|
|
|
|
if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:04:19 -07:00
|
|
|
// Register with the refresh driver now that we are aware that
|
|
|
|
// we are animated.
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
if (presContext) {
|
|
|
|
nsLayoutUtils::RegisterImageRequest(presContext,
|
|
|
|
aRequest,
|
2012-08-14 13:34:20 -07:00
|
|
|
nullptr);
|
2012-08-13 15:04:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-12 09:11:22 -07:00
|
|
|
nsresult
|
|
|
|
ImageLoader::OnStopFrame(imgIRequest *aRequest)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
2012-08-20 17:14:04 -07:00
|
|
|
if (!mDocument || mInClone) {
|
2012-08-13 15:04:19 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
FrameSet* frameSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(frameSet, "This should never be null!");
|
|
|
|
|
|
|
|
DoRedraw(frameSet);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-12 09:11:22 -07:00
|
|
|
nsresult
|
|
|
|
ImageLoader::FrameChanged(imgIRequest *aRequest)
|
2012-08-13 15:04:19 -07:00
|
|
|
{
|
2012-08-20 17:14:04 -07:00
|
|
|
if (!mDocument || mInClone) {
|
2012-08-13 15:04:19 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-14 13:34:20 -07:00
|
|
|
FrameSet* frameSet = nullptr;
|
2012-08-13 15:04:19 -07:00
|
|
|
if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(frameSet, "This should never be null!");
|
|
|
|
|
|
|
|
DoRedraw(frameSet);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-13 16:04:17 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:04:19 -07:00
|
|
|
} // namespace css
|
|
|
|
} // namespace mozilla
|