1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00

[dom] rewrite cache

This commit is contained in:
Witold Filipczyk 2023-09-29 18:51:58 +02:00
parent 3b233ba711
commit 8596d604cc
2 changed files with 18 additions and 5 deletions

View File

@ -349,9 +349,23 @@ dump_xhtml(struct cache_entry *cached, struct document *document, int parse)
dom_node_unref(root);
if (parse) {
free_document(document);
document->dom = NULL;
render_xhtml_document(cached, document, &document->text);
cached->valid = 0;
cached = get_cache_entry(cached->uri);
struct document *doc2;
if (!cached) {
return;
}
add_fragment(cached, 0, document->text.source, document->text.length);
normalize_cache_entry(cached, document->text.length);
doc2 = init_document(cached, &document->options);
if (!doc2) {
return;
}
add_string_to_string(&doc2->text, &document->text);
reset_document(document);
render_xhtml_document(cached, doc2, &doc2->text);
return;
}
render_html_document(cached, document, &document->text);

View File

@ -312,8 +312,7 @@ delayed_reload(void *data)
struct session *ses = rel->ses;
assert(rel);
reset_document(rel->document);
dump_xhtml(rel->cached, rel->document, rel->was_write);
dump_xhtml(rel->cached, rel->document, 1 || rel->was_write);
draw_formatted(ses, 3);
load_common(ses);