summaryrefslogtreecommitdiff
path: root/css/css.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-04-04 12:41:19 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-04-04 12:41:19 +0000
commit79ce683b4e6d34fe327b00f1e427e476016cfab0 (patch)
tree2ed3ba800e8f570000f97588ce668eb47168565a /css/css.c
parent3daffe3d6b07be7bbeedbcb2586f11edd872cbd6 (diff)
downloadnetsurf-79ce683b4e6d34fe327b00f1e427e476016cfab0.tar.gz
netsurf-79ce683b4e6d34fe327b00f1e427e476016cfab0.tar.bz2
Most of a stop implementation.
Remaining work: 1) Clone content_html_data 2) Cloning content_css_data requires the charset of the old content 3) Calling hlcache_handle_abort() before a content has been created must clean up the retrieval context. svn path=/trunk/netsurf/; revision=10236
Diffstat (limited to 'css/css.c')
-rw-r--r--css/css.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/css/css.c b/css/css.c
index b0a3cd472..ef38d76aa 100644
--- a/css/css.c
+++ b/css/css.c
@@ -326,6 +326,33 @@ void nscss_destroy_css_data(struct content_css_data *c)
}
}
+bool nscss_clone(const struct content *old, struct content *new_content)
+{
+ const char *data;
+ unsigned long size;
+
+ /* Simply replay create/process/convert */
+ /** \todo We need the charset of the old sheet */
+ if (nscss_create_css_data(&new_content->data.css,
+ content__get_url(new_content),
+ NULL, new_content->quirks) != NSERROR_OK)
+ return false;
+
+ data = content__get_source_data(new_content, &size);
+ if (size > 0) {
+ if (nscss_process_data(new_content, data, size) == false)
+ return false;
+ }
+
+ if (old->status == CONTENT_STATUS_READY ||
+ old->status == CONTENT_STATUS_DONE) {
+ if (nscss_convert(new_content) == false)
+ return false;
+ }
+
+ return true;
+}
+
/**
* Retrieve imported stylesheets
*