diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index f63c2593..fd8def11 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -20,6 +20,7 @@ #include "dialogs/menu.h" #include "dialogs/status.h" #include "document/html/frames.h" +#include "document/xml/renderer.h" #include "document/document.h" #include "document/forms.h" #include "document/renderer.h" @@ -443,8 +444,7 @@ delayed_reload(void *data) struct delayed_rel *rel = data; assert(rel); - doc_rerender_after_document_update(rel->ses); - free_document(rel->doc); + render_source_document_cxx(rel->cached, rel->document, NULL); mem_free(rel); } @@ -460,29 +460,14 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text) //fprintf(stderr, "%s\n", text); - if (document->dom && f && f->length) { - xmlpp::Document *docu = (xmlpp::Document *)document->dom; - std::string doc1_string = docu->write_to_string_formatted(); - //delete docu; - document->dom = NULL; - - size_t fd_len=f->length; - delete_entry_content(cached); - /* This is very ugly, indeed. And Yes fd_len isn't - * logically correct. But using nu_len will cause - * the document to render improperly. - * TBD: somehow better rerender the document - * now it's places on the session level in doc_loading_callback */ - int ret = add_fragment(cached, 0, doc1_string.c_str(), doc1_string.size()); - normalize_cache_entry(cached, doc1_string.size()); - document->ecmascript_counter++; + if (document->dom) { interpreter->changed = false; struct delayed_rel *rel = mem_calloc(1, sizeof(*rel)); if (rel) { - rel->ses = ses; - rel->doc = docu; + rel->cached = cached; + rel->document = document; register_bottom_half(delayed_reload, rel); } } diff --git a/src/session/session.h b/src/session/session.h index b5dbeb6a..af42870e 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -14,6 +14,8 @@ extern "C" { #endif +struct cache_entry; +struct document; struct document_view; struct link; struct location; @@ -32,8 +34,8 @@ struct delayed_open { }; struct delayed_rel { - struct session *ses; - void *doc; + struct cache_entry *cached; + struct document *document; }; enum remote_session_flags { diff --git a/test/ecmascript/scroll3.html b/test/ecmascript/scroll3.html new file mode 100644 index 00000000..158e47d6 --- /dev/null +++ b/test/ecmascript/scroll3.html @@ -0,0 +1,17 @@ + + + + +
+