This commit is contained in:
kipp%netscape.com 1999-02-25 16:42:47 +00:00
Родитель 2e0453b45b
Коммит 91144abd41
2 изменённых файлов: 0 добавлений и 973 удалений

Просмотреть файл

@ -1,562 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* This is a dummy Net Context which the Image Library uses for network
operations in lieu of an MWContext. It will be replaced by a true
Net Context when the Network Library is modularized. */
#include "dummy_nc.h"
#include "il_strm.h"
#include "if.h"
#ifdef NU_CACHE
#include "nsCacheManager.h"
#endif
PR_BEGIN_EXTERN_C
extern int MK_OUT_OF_MEMORY;
PR_END_EXTERN_C
/*
* XXX Temporary inclusion of this prototype. It was originally in
* libimg.h but needed to be removed since it required C++ compilation.
* It should eventually return to libimg.h and may be remove when
* a modularized netlib comes around.
*/
extern ilIURL *
IL_CreateIURL(URL_Struct *urls);
typedef struct dum_TitleObsClosure {
MWContext *context;
XP_ObserverList obs_list;
} dum_TitleObsClosure;
static NS_DEFINE_IID(kINetContextIID, IL_INETCONTEXT_IID);
static NS_DEFINE_IID(kIURLIID, IL_IURL_IID);
class NetContextImpl : public ilINetContext
{
public:
NetContextImpl(MWContext *aContext, NET_ReloadMethod aReloadMethod);
~NetContextImpl();
int operator==(NetContextImpl& aNetContext) const;
NS_DECL_ISUPPORTS
virtual ilINetContext* Clone();
virtual NET_ReloadMethod GetReloadPolicy();
virtual void AddReferer(ilIURL *aUrl);
virtual void Interrupt();
virtual ilIURL* CreateURL(const char *aUrl,
NET_ReloadMethod aReloadMethod);
virtual PRBool IsLocalFileURL(char *aAddress);
#ifdef NU_CACHE
virtual PRBool IsURLInCache(ilIURL* iUrl);
#else
virtual PRBool IsURLInMemCache(ilIURL *aUrl);
virtual PRBool IsURLInDiskCache(ilIURL *aUrl);
#endif
virtual int GetURL (ilIURL * aUrl, NET_ReloadMethod aLoadMethod,
ilINetReader *aReader);
private:
MWContext *mContext;
NET_ReloadMethod mReloadPolicy;
};
class URLImpl : public ilIURL {
public:
URLImpl();
URLImpl(URL_Struct *urls);
~URLImpl();
nsresult Init(const char *aURL, NET_ReloadMethod aReloadMethod);
NS_DECL_ISUPPORTS
virtual void SetReader(ilINetReader *aReader);
virtual ilINetReader *GetReader();
virtual int GetContentLength();
virtual const char* GetAddress();
virtual time_t GetExpires();
virtual void SetBackgroundLoad(PRBool aBgload);
virtual int GetOwnerId();
virtual void SetOwnerId(int aOwnerId);
URL_Struct *GetURLStruct() { return mURLS; }
private:
ilINetReader *mReader;
URL_Struct *mURLS;
};
PR_BEGIN_EXTERN_C
extern void
lo_view_title( MWContext *context, char *title_str );
PR_END_EXTERN_C
extern PRBool
il_load_image(MWContext *cx, char *image_url, NET_ReloadMethod cache_reload_policy);
NetContextImpl::NetContextImpl(MWContext *aContext,
NET_ReloadMethod aReloadPolicy)
{
NS_INIT_REFCNT();
mContext = aContext;
mReloadPolicy = aReloadPolicy;
}
NetContextImpl::~NetContextImpl()
{
}
IL_NetContext *
IL_NewDummyNetContext(MWContext *context, NET_ReloadMethod cache_reload_policy)
{
ilINetContext *cx = new NetContextImpl(context, cache_reload_policy);
if (cx != NULL) {
NS_ADDREF(cx);
}
return (IL_NetContext *)cx;
}
void
IL_DestroyDummyNetContext(IL_NetContext *net_cx)
{
ilINetContext *cx = (ilINetContext *)net_cx;
if (cx != NULL) {
NS_RELEASE(cx);
}
}
NS_IMPL_ISUPPORTS(NetContextImpl, kINetContextIID)
int
NetContextImpl::operator==(NetContextImpl& aNetContext) const
{
return ((mContext == aNetContext.mContext) &&
(mReloadPolicy == aNetContext.mReloadPolicy));
}
ilINetContext *
NetContextImpl::Clone()
{
return (ilINetContext *)IL_NewDummyNetContext(mContext, mReloadPolicy);
}
NET_ReloadMethod
NetContextImpl::GetReloadPolicy()
{
return mReloadPolicy;
}
#include "shist.h" /* For use with IL_AddReferer */
#include "structs.h" /* For use with IL_AddReferer */
void
NetContextImpl::AddReferer(ilIURL *url)
{
History_entry *he = SHIST_GetCurrent (&mContext->hist);
URL_Struct *urls = ((URLImpl *)url)->GetURLStruct();
PR_FREEIF (urls->referer);
if (he && he->address)
urls->referer = PL_strdup (he->origin_url
? he->origin_url
: he->address);
else
urls->referer = 0;
}
void
dum_TitleObserver(XP_Observable observerable, XP_ObservableMsg msg,
void *message_data, void *closure){
IL_MessageData *data = (IL_MessageData*)message_data;
MWContext *context;
dum_TitleObsClosure *title_obs_closure = (dum_TitleObsClosure *)closure;
context = (MWContext *)title_obs_closure->context;
switch(msg){
case IL_DESCRIPTION:
#ifdef MOZ_NGLAYOUT
XP_ASSERT(0);
#else
lo_view_title(context, data->description);
#endif /* MOZ_NGLAYOUT */
break;
case IL_IMAGE_DESTROYED:
/* Remove ourself from the observer callback list. */
XP_RemoveObserver(title_obs_closure->obs_list, dum_TitleObserver,
title_obs_closure);
PR_FREEIF(title_obs_closure);
break;
default:
break;
}
return;
}
XP_ObserverList
dum_NewTitleObserverList(MWContext *context)
{
XP_ObserverList title_obs_list; /* List of observer callbacks. */
dum_TitleObsClosure *title_obs_closure; /* Closure data to be passed back
to lo_ImageObserver. */
NS_Error status;
/* Create an XP_ObserverList for the title */
status = XP_NewObserverList(NULL, &title_obs_list);
if (status < 0) {
return NULL;
}
/* Closure data for the image observer. */
title_obs_closure = PR_NEWZAP(dum_TitleObsClosure);
if (!title_obs_closure) {
XP_DisposeObserverList(title_obs_list);
return NULL;
}
title_obs_closure->context = context;
title_obs_closure->obs_list = title_obs_list;
/* Add the layout image observer to the observer list. */
status = XP_AddObserver(title_obs_list, dum_TitleObserver, title_obs_closure);
if (status < 0) {
XP_DisposeObserverList(title_obs_list);
XP_RemoveObserver(title_obs_closure->obs_list, dum_TitleObserver,
title_obs_closure );
PR_FREEIF(title_obs_closure);
return NULL;
}
return title_obs_list;
}
/* This function only handles view_images. Note that the title observer
created is only used to set the image dimensions and type in the
title bar. */
PRBool
il_load_image(MWContext *cx, char *image_url, NET_ReloadMethod cache_reload_policy)
{
PRBool ret_val = PR_TRUE;
XP_ObserverList obs_list;
IL_NetContext *net_cx;
IL_IRGB *trans_pixel;
IL_ImageReq *image_req;
/* Create a new observer list for the image's title. The destruction of this
list is managed by the image library once we call IL_GetImage. */
obs_list = dum_NewTitleObserverList(cx);
if (!obs_list)
return PR_FALSE;
net_cx = IL_NewDummyNetContext(cx, cache_reload_policy);
if (!net_cx) {
XP_DisposeObserverList(obs_list);
return PR_FALSE;
}
/* Determine whether to request a mask if this is a transparent image.
In the case of a document backdrop, we ask the image library to fill
in the transparent area with a solid color. For all other transparent
images, we force the creation of a mask by passing in NULL. */
if (cx->type == MWContextPostScript) {
trans_pixel = PR_NEWZAP(IL_IRGB);
if (trans_pixel)
trans_pixel->red = trans_pixel->green = trans_pixel->blue = 0xff;
}
else if (cx->type == MWContextPrint) {
trans_pixel = cx->transparent_pixel;
}
else {
trans_pixel = NULL;
}
/* Fetch the image. */
image_req = IL_GetImage(image_url, cx->img_cx, obs_list, trans_pixel, 0, 0, 0, (ilINetContext *)net_cx);
if (!image_req) {
ret_val = PR_FALSE;
}
/* Destroy the transparent pixel if this is a PostScript context. */
if ((cx->type == MWContextPostScript) && trans_pixel)
PR_FREEIF(trans_pixel);
/* The Image Library clones the dummy Net Context, so it safe to destroy
it. */
IL_DestroyDummyNetContext(net_cx);
return ret_val;
}
ilIURL *
NetContextImpl::CreateURL(const char *url, NET_ReloadMethod reload_method)
{
URLImpl *iurl;
iurl = new URLImpl();
if (iurl == NULL) {
return NULL;
}
if (iurl->Init(url, reload_method) != NS_OK) {
delete iurl;
return NULL;
}
NS_ADDREF(iurl);
return (ilIURL *)iurl;
}
void
NetContextImpl::Interrupt()
{
if (mContext != NULL) {
NET_InterruptWindow(mContext);
}
}
PRBool
NetContextImpl::IsLocalFileURL(char *address)
{
return (PRBool)NET_IsLocalFileURL(address);
}
#ifdef NU_CACHE
PRBool
NetContextImpl::IsURLInCache(ilIURL *iURL)
{
return iURL ?
nsCacheManager::GetInstance()->Contains(((URLImpl *)iURL)->GetURLStruct()->address) : PR_FALSE;
}
#else
PRBool
NetContextImpl::IsURLInMemCache(ilIURL *aURL)
{
if (aURL != NULL) {
return (PRBool)NET_IsURLInMemCache(((URLImpl *)aURL)->GetURLStruct());
}
else {
return PR_FALSE;
}
}
PRBool
NetContextImpl::IsURLInDiskCache(ilIURL *aURL)
{
if (aURL != NULL) {
return (PRBool)NET_IsURLInDiskCache(((URLImpl *)aURL)->GetURLStruct());
}
else {
return PR_FALSE;
}
}
#endif /* NU_CACHE */
static void
il_netgeturldone(URL_Struct *URL_s, int status, OPAQUE_CONTEXT *cx)
{
ilIURL *iurl = (ilIURL *)URL_s->fe_data;
ilINetReader *reader;
if (iurl != NULL) {
reader = iurl->GetReader();
if (reader != NULL) {
reader->NetRequestDone(iurl, status);
NS_RELEASE(reader);
}
}
/* for mac */
if (status == MK_OUT_OF_MEMORY)
NET_InterruptWindow((MWContext *)cx);
}
int
NetContextImpl::GetURL (ilIURL *aURL,
NET_ReloadMethod aLoadMethod,
ilINetReader *aReader)
{
URL_Struct *urls = ((URLImpl *)aURL)->GetURLStruct();
FO_Present_Types type = (aLoadMethod == NET_CACHE_ONLY_RELOAD) ?
FO_ONLY_FROM_CACHE_AND_INTERNAL_IMAGE :
FO_CACHE_AND_INTERNAL_IMAGE;
aURL->SetReader(aReader);
return NET_GetURL (urls, type, mContext,
(Net_GetUrlExitFunc*)&il_netgeturldone);
}
URLImpl::URLImpl()
{
NS_INIT_REFCNT();
mReader = NULL;
mURLS = NULL;
}
URLImpl::URLImpl(URL_Struct *urls)
{
NS_INIT_REFCNT();
mReader = NULL;
mURLS = urls;
urls->fe_data = this;
}
URLImpl::~URLImpl()
{
if (mURLS != NULL) {
NET_FreeURLStruct(mURLS);
}
if (mReader != NULL) {
NS_RELEASE(mReader);
}
}
/* This is only used for the UNIX icon hack in
cmd/xfe/mkicons.cpp */
ilIURL *
IL_CreateIURL(URL_Struct *urls)
{
ilIURL *iurl = new URLImpl(urls);
NS_ADDREF(iurl);
return iurl;
}
NS_IMPL_ISUPPORTS(URLImpl, kIURLIID)
nsresult
URLImpl::Init(const char *url, NET_ReloadMethod reload_method)
{
mURLS = NET_CreateURLStruct(url, reload_method);
if (mURLS == NULL) {
return NS_ERROR_OUT_OF_MEMORY;
}
mURLS->fe_data = this;
return NS_OK;
}
void
URLImpl::SetReader(ilINetReader *aReader)
{
NS_ADDREF(aReader);
mReader = aReader;
}
ilINetReader *
URLImpl::GetReader()
{
NS_ADDREF(mReader);
return mReader;
}
int
URLImpl::GetContentLength()
{
if (mURLS) {
return mURLS->content_length;
}
else {
return 0;
}
}
const char *
URLImpl::GetAddress()
{
if (mURLS) {
return (const char *)mURLS->address;
}
else {
return NULL;
}
}
time_t
URLImpl::GetExpires()
{
if (mURLS) {
return mURLS->expires;
}
else {
return 0;
}
}
void
URLImpl::SetBackgroundLoad(PRBool bgload)
{
if (mURLS) {
mURLS->load_background = bgload;
}
}
int
URLImpl::GetOwnerId()
{
if (mURLS) {
return mURLS->owner_id;
}
else {
return 0;
}
}
void
URLImpl::SetOwnerId(int ownerId)
{
if (mURLS) {
mURLS->owner_id = ownerId;
}
}

Просмотреть файл

@ -1,411 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "if.h"
#include "dummy_nc.h"
extern PRBool
il_load_image(MWContext *cx, char *image_url, NET_ReloadMethod cache_reload_policy);
#include "merrors.h"
#ifdef STANDALONE_IMAGE_LIB
#include "xpcompat.h"
#else
/* for XP_GetString() */
#include "xpgetstr.h"
#endif
#include "il_strm.h" /* Stream converters. */
static unsigned int
il_view_write_ready(NET_StreamClass *stream)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
/* For some reason, the imagelib can't deliver the image.
Trigger il_view_write(), which will abort the stream. */
/* This originally returned (ic!=0) to trigger il_view_write()
which would set the read_size to something reasonable. But in mkmailbox.c
ReadMessageSock() uses the return value of one as the read_size and does not
call il_view_write() until it has filled up the buffer one byte
at a time. This should be addressed correctly in later versions. */
return (reader != 0) * MAX_WRITE_READY;
}
/* Abort the stream if we get this far */
static int
il_view_write(NET_StreamClass *stream, const unsigned char *str, int32 len)
{
void *dobj=stream->data_object;
/* If this assert fires, chances are that the provided URL was malformed.*/
PR_ASSERT(dobj == (void*)1);
/* Should be MK_DATA_LOADED, but netlib ignores that. */
return MK_INTERRUPTED;
}
static void
il_view_complete(NET_StreamClass *stream)
{
}
static void
il_view_abort(NET_StreamClass *stream, int status)
{
}
void
il_stream_complete(NET_StreamClass *stream)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
reader->StreamComplete((PRBool)stream->is_multipart);
}
void
il_abort(NET_StreamClass *stream, int status)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
reader->StreamAbort(status);
stream->data_object = 0;
}
/* Only for internal-external-reconnect. */
void
il_stream_reconnect_complete(NET_StreamClass *stream)
{
/* Get reader before calling il_stream_complete because it
may set stream->data_object to NULL. */
ilINetReader *reader = (ilINetReader *)stream->data_object;
PR_ASSERT(reader);
il_stream_complete(stream);
NS_RELEASE(reader);
stream->data_object = NULL;
}
/* Only for internal-external-reconnect. */
void
il_reconnect_abort(NET_StreamClass *stream, int status)
{
/* Get reader before calling il_abort because it
may set stream->data_object to NULL. */
ilINetReader *reader = (ilINetReader *)stream->data_object;
PR_ASSERT(reader);
il_abort(stream,status);
NS_RELEASE(reader);
stream->data_object = NULL;
}
unsigned int
il_write_ready(NET_StreamClass *stream)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
return reader->WriteReady();
}
int
il_write(NET_StreamClass *stream, const unsigned char *str, int32 len)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
return reader->Write(str, len);
}
int
il_first_write(NET_StreamClass *stream, const unsigned char *str, int32 len)
{
ilINetReader *reader = (ilINetReader *)stream->data_object;
int ret_val;
ret_val = reader->FirstWrite(str, len);
if (ret_val != 0) {
return ret_val;
}
stream->put_block = (MKStreamWriteFunc)il_write;
/* do first write */
return stream->put_block(stream, (const char*) str, len);
}
/* there can be only one, highlander */
static NET_StreamClass *unconnected_stream = 0;
static URL_Struct *unconnected_urls = 0;
void
il_reconnect(il_container *ic)
{
if (unconnected_stream)
{
/* Will be freed in il_stream_reconnect_complete or il_reconnect_abort */
ilINetReader *reader = IL_NewNetReader(ic);
if (reader != NULL) {
unconnected_stream->complete = il_stream_reconnect_complete;
unconnected_stream->abort = il_reconnect_abort;
unconnected_stream->is_write_ready = il_write_ready;
unconnected_stream->data_object = (void *)reader;
unconnected_stream->put_block = (MKStreamWriteFunc)il_first_write;
ic->type = IL_UNKNOWN;
ic->state = IC_STREAM;
/* unconnected_urls->fe_data no longer has a ponter to an ilIURL,
it wasn't used anyway. */
ic->content_length = unconnected_urls->content_length;
}
unconnected_stream = 0;
unconnected_urls = 0;
}
}
/* We aren't going to reconnect after all. Cause the stream to abort */
void
il_abort_reconnect()
{
if (unconnected_stream) {
unconnected_stream->data_object = (void *)1;
unconnected_stream = 0;
unconnected_urls = 0;
}
}
static char fakehtml[] = "<IMG SRC=\"%s\">";
NET_StreamClass *
IL_ViewStream(FO_Present_Types format_out, void *newshack, URL_Struct *urls,
OPAQUE_CONTEXT *cx)
{
NET_StreamClass *stream = nil,
*viewstream = nil;
il_container *ic = nil;
ilINetReader *reader = nil;
ilIURL *iurl;
char *org_content_type;
char *image_url;
/* multi-part reconnect hack */
iurl = (ilIURL *)urls->fe_data;
if (iurl) {
reader = iurl->GetReader();
if(reader)
{
if( reader->IsMulti() ) {
NS_RELEASE(reader);
return IL_NewStream(format_out, IL_UNKNOWN, urls, cx);
}
NS_RELEASE(reader);
}
}
/* Create stream object */
if (!(stream = PR_NEWZAP(NET_StreamClass))) {
ILTRACE(1,("il: IL_ViewStream memory lossage"));
return 0;
}
stream->name = "image view";
stream->complete = il_view_complete;
stream->abort = il_view_abort;
stream->is_write_ready = il_view_write_ready;
stream->data_object = NULL;
stream->window_id = (MWContext *)cx;
stream->put_block = (MKStreamWriteFunc)il_view_write;
ILTRACE(0,("il: new view stream, %s", urls->address));
PR_ASSERT(!unconnected_stream);
/* Note that this URL_Struct does not have a iURL wrapper around
it anymore. It doesn't need it and we wouldn't have any good place
to free it anyway. */
unconnected_stream = stream;
unconnected_urls = urls;
if(!newshack)
{
char *buffer;
org_content_type = urls->content_type;
urls->content_type = 0;
StrAllocCopy(urls->content_type, TEXT_HTML);
urls->is_binary = 1; /* secret flag for mail-to save as */
/* Force layout to discard the old document and start a new one.
We do this so that the pre-fetched image request won't be
destroyed by a layout call to IL_DestroyImageGroup. */
viewstream = NET_StreamBuilder(format_out, urls, (MWContext *)cx);
if (!viewstream) {
PR_FREEIF(stream);
return NULL;
}
buffer = PL_strdup("<HTML>");
if (!buffer) {
PR_FREEIF(stream);
PR_FREEIF(viewstream);
return NULL;
}
(*viewstream->put_block)(viewstream, buffer,
PL_strlen(buffer)+1);
PR_FREEIF(buffer);
} /* !newshack */
/* Prefetch the image. We do this so that the image library can
process image data even if the parser is blocked on the fake IMG
tag that we send. Note that this image request will persist until
the document is destroyed (when IL_DestroyImageGroup will be called.) */
image_url = (char*) PR_MALLOC(PL_strlen(urls->address) + 29);
if (!image_url) {
PR_FREEIF(stream);
PR_FREEIF(viewstream);
return NULL;
}
XP_SPRINTF(image_url, "internal-external-reconnect:%s", urls->address);
if (!il_load_image((MWContext *)cx, image_url, urls->force_reload)) {
PR_FREEIF(stream);
PR_FREEIF(viewstream);
return NULL;
}
PR_FREEIF(image_url);
if (!newshack) {
if (viewstream) {
char *buffer = (char*)
PR_MALLOC(PL_strlen(fakehtml) + PL_strlen(urls->address) + 1);
if (buffer)
{
XP_SPRINTF(buffer, fakehtml, urls->address);
(*viewstream->put_block)(viewstream,
buffer, PL_strlen(buffer));
PR_FREEIF(buffer);
}
(*viewstream->complete)(viewstream);
}
/* this has to be set back for abort to work correctly */
PR_FREEIF(urls->content_type);
urls->content_type = org_content_type;
} /* !newshack */
return stream;
}
NET_StreamClass *
IL_NewStream (FO_Present_Types format_out,
void *type,
URL_Struct *urls,
OPAQUE_CONTEXT *cx)
{
NET_StreamClass *stream = nil;
il_container *ic = nil;
ilINetReader *reader = nil;
ilIURL *iurl = nil;
/* recover the container */
iurl = (ilIURL *)urls->fe_data;
reader = iurl->GetReader();
PR_ASSERT(reader);
if (reader->StreamCreated(iurl, (int)type) == PR_FALSE) {
NS_RELEASE(reader);
return NULL;
}
/* Create stream object */
if (!(stream = PR_NEWZAP(NET_StreamClass)))
{
ILTRACE(0,("il: MEM il_newstream"));
NS_RELEASE(reader);
return 0;
}
stream->name = "image decode";
stream->complete = il_stream_complete;
stream->abort = il_abort;
stream->is_write_ready = il_write_ready;
stream->data_object = (void *)reader;
stream->window_id = (MWContext *)cx;
stream->put_block = (MKStreamWriteFunc) il_first_write;
// Careful not to call NS_RELEASE until the end, because it sets reader=NULL.
NS_RELEASE(reader);
return stream;
}
IL_IMPLEMENT(PRBool)
IL_PreferredStream(URL_Struct *urls)
{
il_container *ic = 0;
IL_ImageReq *image_req;
ilIURL *iurl;
ilINetReader *reader;
PR_ASSERT(urls);
if (urls) {
/* xxx this MUST be an image stream */
iurl = (ilIURL *)urls->fe_data;
reader = iurl->GetReader();
ic = IL_GetNetReaderContainer(reader);
NS_RELEASE(reader);
PR_ASSERT(ic);
if (ic) {
/*
* It could be that layout aborted image loading by
* calling IL_FreeImage before the netlib finished
* transferring data. Don't do anything.
*/
if (ic->state == IC_ABORT_PENDING)
return PR_FALSE;
/* discover if layout is blocked on this image */
for (image_req = ic->clients; image_req;
image_req = image_req->next) {
#ifdef MOZ_NGLAYOUT
XP_ASSERT(0);
#else
#ifndef M12N /* XXXM12N Fixme. Observer for layout?
Query mechanism for FE? */
if ((LO_BlockedOnImage(c->cx,
(LO_ImageStruct*)c->client) == TRUE) ||
FE_ImageOnScreen(c->cx, (LO_ImageStruct*)c->client) )
#endif /* M12N */
#endif /* MOZ_NGLAYOUT */
return PR_TRUE;
}
}
}
return PR_FALSE;
}