1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05: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); dom_node_unref(root);
if (parse) { if (parse) {
free_document(document); cached->valid = 0;
document->dom = NULL; cached = get_cache_entry(cached->uri);
render_xhtml_document(cached, document, &document->text); 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; return;
} }
render_html_document(cached, document, &document->text); render_html_document(cached, document, &document->text);

View File

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