mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
Fix bug #3194007: stop emitting duplicate READY/DONE events.
* Make content handlers responsible for setting READY/DONE state & emitting events. * Stop content_convert doing this when there is a registered convert function for the content type. svn path=/trunk/netsurf/; revision=11850
This commit is contained in:
parent
b79dcabd41
commit
86a2e0076d
@ -160,7 +160,8 @@ bool amiga_icon_convert(struct content *c)
|
||||
c->height = height;
|
||||
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
content_set_status(c, "");
|
||||
|
||||
if(dobj) FreeDiskObject(dobj);
|
||||
|
@ -686,19 +686,13 @@ void content_convert(struct content *c)
|
||||
|
||||
LOG(("content %s (%p)", llcache_handle_get_url(c->llcache), c));
|
||||
|
||||
c->locked = true;
|
||||
if (handler_map[c->type].convert) {
|
||||
c->locked = true;
|
||||
if (!handler_map[c->type].convert(c)) {
|
||||
c->status = CONTENT_STATUS_ERROR;
|
||||
}
|
||||
c->locked = false;
|
||||
} else {
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
}
|
||||
c->locked = false;
|
||||
|
||||
if (c->status == CONTENT_STATUS_READY)
|
||||
content_set_ready(c);
|
||||
if (c->status == CONTENT_STATUS_DONE) {
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
}
|
||||
|
27
css/css.c
27
css/css.c
@ -32,6 +32,9 @@
|
||||
#include "utils/log.h"
|
||||
#include "utils/messages.h"
|
||||
|
||||
/* Define to trace import fetches */
|
||||
#undef NSCSS_IMPORT_TRACE
|
||||
|
||||
/**
|
||||
* Context for import fetches
|
||||
*/
|
||||
@ -370,14 +373,8 @@ void nscss_content_done(struct content_css_data *css, void *pw)
|
||||
}
|
||||
|
||||
/* Finally, catch the content's users up with reality */
|
||||
if (css->import_count == 0) {
|
||||
/* No imports? Ok, so we've not returned from nscss_convert yet.
|
||||
* Just set the status, as content_convert will notify users */
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
} else {
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
}
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -447,6 +444,12 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent,
|
||||
return CSS_NOMEM;
|
||||
}
|
||||
|
||||
#ifdef NSCSS_IMPORT_TRACE
|
||||
LOG(("Import %d '%s' -> (handle: %p ctx: %p)",
|
||||
c->import_count, lwc_string_data(url),
|
||||
c->imports[c->import_count].c, ctx));
|
||||
#endif
|
||||
|
||||
c->import_count++;
|
||||
|
||||
return CSS_OK;
|
||||
@ -466,6 +469,10 @@ nserror nscss_import(hlcache_handle *handle,
|
||||
nscss_import_ctx *ctx = pw;
|
||||
css_error error = CSS_OK;
|
||||
|
||||
#ifdef NSCSS_IMPORT_TRACE
|
||||
LOG(("Event %d for %p (%p)", event->type, handle, ctx));
|
||||
#endif
|
||||
|
||||
assert(ctx->css->imports[ctx->index].c == handle);
|
||||
|
||||
switch (event->type) {
|
||||
@ -510,6 +517,10 @@ css_error nscss_import_complete(nscss_import_ctx *ctx)
|
||||
if (ctx->css->next_to_register == ctx->index)
|
||||
error = nscss_register_imports(ctx->css);
|
||||
|
||||
#ifdef NSCSS_IMPORT_TRACE
|
||||
LOG(("Destroying import context %p for %d", ctx, ctx->index));
|
||||
#endif
|
||||
|
||||
/* No longer need import context */
|
||||
free(ctx);
|
||||
|
||||
|
@ -108,7 +108,9 @@ bool nsbmp_convert(struct content *c)
|
||||
/* exit as a success */
|
||||
c->bitmap = bmp->bitmap;
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
|
@ -138,7 +138,8 @@ bool nsgif_convert(struct content *c)
|
||||
|
||||
/* Exit as a success */
|
||||
c->bitmap = gif->frame_image;
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
@ -97,7 +97,9 @@ bool nsico_convert(struct content *c)
|
||||
assert(bmp);
|
||||
c->bitmap = bmp->bitmap;
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
|
@ -167,7 +167,8 @@ bool nsjpeg_convert(struct content *c)
|
||||
width, height, size);
|
||||
content__set_title(c, title);
|
||||
c->size += height * rowstride;
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
@ -330,7 +330,8 @@ bool nsmng_convert(struct content *c)
|
||||
content__set_title(c, title);
|
||||
|
||||
c->size += c->width * c->height * 4;
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
|
||||
|
@ -112,7 +112,9 @@ bool nssprite_convert(struct content *c)
|
||||
c->width = sprite->width;
|
||||
c->height = sprite->height;
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -289,7 +289,8 @@ bool nspng_convert(struct content *c)
|
||||
c->bitmap = c->data.png.bitmap;
|
||||
bitmap_set_opaque(c->bitmap, bitmap_test_opaque(c->bitmap));
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
content_set_status(c, "");
|
||||
|
||||
return true;
|
||||
|
@ -173,7 +173,8 @@ bool rsvg_convert(struct content *c)
|
||||
|
||||
c->bitmap = d->bitmap;
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
|
||||
|
@ -70,7 +70,8 @@ bool svg_convert(struct content *c)
|
||||
snprintf(c->title, 100, messages_get("svgTitle"),
|
||||
width, height, c->source_size);*/
|
||||
//c->size += ?;
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
|
||||
|
@ -107,7 +107,9 @@ bool webp_convert(struct content *c)
|
||||
content__set_title(c, title);
|
||||
|
||||
bitmap_modified(c->bitmap);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
@ -301,7 +301,8 @@ bool textplain_convert(struct content *c)
|
||||
parserutils_inputstream_destroy(stream);
|
||||
c->data.textplain.inputstream = NULL;
|
||||
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
content_set_status(c, messages_get("Done"));
|
||||
|
||||
return true;
|
||||
|
@ -202,7 +202,8 @@ bool artworks_convert(struct content *c)
|
||||
snprintf(title, sizeof(title), messages_get("ArtWorksTitle"),
|
||||
c->width, c->height, source_size);
|
||||
content__set_title(c, title);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
@ -84,7 +84,8 @@ bool draw_convert(struct content *c)
|
||||
c->height, source_size);
|
||||
content__set_title(c, title);
|
||||
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
@ -219,7 +219,9 @@ bool plugin_convert(struct content *c, int width, int height)
|
||||
c->width = width;
|
||||
c->height = height;
|
||||
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,8 @@ bool sprite_convert(struct content *c)
|
||||
snprintf(title, sizeof(title), messages_get("SpriteTitle"), c->width,
|
||||
c->height, source_size);
|
||||
content__set_title(c, title);
|
||||
c->status = CONTENT_STATUS_DONE;
|
||||
content_set_ready(c);
|
||||
content_set_done(c);
|
||||
/* Done: update status bar */
|
||||
content_set_status(c, "");
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user