From 86a2e0076d0789247a28f370d16583ee4fc87f05 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 27 Feb 2011 20:11:39 +0000 Subject: 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 --- css/css.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'css') diff --git a/css/css.c b/css/css.c index 0964869a2..ffae4db38 100644 --- a/css/css.c +++ b/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); -- cgit v1.2.3