From 9c723a5924ef5ef05d56b1addba42dafb3ca5c37 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 24 Mar 2004 00:07:21 +0000 Subject: [project @ 2004-03-24 00:07:21 by jmb] Add URL rewriting for most URLs. Still TODO: 1) rewriting of @import rules 2) Objects used by embedded html pages NB. This change means that the XML parse tree is kept in memory until the content is freed. svn path=/import/netsurf/; revision=659 --- render/html.c | 8 ++++++-- render/html.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index e028e523d..7e3fb834c 100644 --- a/render/html.c +++ b/render/html.c @@ -69,6 +69,7 @@ void html_create(struct content *c, const char *params[]) } html->parser = htmlCreatePushParserCtxt(0, 0, "", 0, 0, html->encoding); + html->document = 0; html->base_url = xstrdup(c->url); html->layout = 0; html->background_colour = TRANSPARENT; @@ -139,7 +140,7 @@ int html_convert(struct content *c, unsigned int width, unsigned int height) /* finish parsing */ htmlParseChunk(c->data.html.parser, "", 0, 1); - document = c->data.html.parser->myDoc; + document = c->data.html.document = c->data.html.parser->myDoc; /*xmlDebugDumpDocument(stderr, c->data.html.parser->myDoc);*/ htmlFreeParserCtxt(c->data.html.parser); c->data.html.parser = 0; @@ -181,7 +182,7 @@ int html_convert(struct content *c, unsigned int width, unsigned int height) /*box_dump(c->data.html.layout->children, 0);*/ /* XML tree not required past this point */ - xmlFreeDoc(document); + //xmlFreeDoc(document); /* layout the box tree */ sprintf(c->status_message, messages_get("Formatting")); @@ -755,6 +756,9 @@ void html_destroy(struct content *c) if (c->data.html.parser) htmlFreeParserCtxt(c->data.html.parser); + if (c->data.html.document) + xmlFreeDoc(c->data.html.document); + free(c->data.html.base_url); if (c->data.html.layout) diff --git a/render/html.h b/render/html.h index d029a7554..673e57317 100644 --- a/render/html.h +++ b/render/html.h @@ -36,6 +36,7 @@ struct box_position { /** Data specific to CONTENT_HTML. */ struct content_html_data { htmlParserCtxt *parser; /**< HTML parser context. */ + xmlDoc *document; /**< the XML document tree */ xmlCharEncoding encoding; /**< Encoding of source. */ bool getenc; /**< Need to get the encoding from the document, as server is broken. */ -- cgit v1.2.3