From 997f61bb32a61486cb3966c96725a2aa3d670e23 Mon Sep 17 00:00:00 2001 From: Date: Sat, 28 Jan 2006 12:07:00 +0100 Subject: [PATCH] Use document_view instead of view_state. It is safer probably --- src/document/document.h | 4 ++-- src/document/html/parser/general.c | 13 +++++++------ src/document/renderer.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/document/document.h b/src/document/document.h index 7f357fe04..93608ab67 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -11,12 +11,12 @@ struct cache_entry; struct document_refresh; +struct document_view; struct form_control; struct frame_desc; struct frameset_desc; struct module; struct screen_char; -struct view_state; /* Nodes are used for marking areas of text on the document canvas as * searchable. */ @@ -149,7 +149,7 @@ struct document { * unneeded. */ struct uri_list ecmascript_imports; /* For ecmascript access */ - struct view_state *vs; + struct document_view *doc_view; #endif #ifdef CONFIG_CSS /* FIXME: We should externally maybe using cache_entry store the diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index 43315fa70..3b71aba7b 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -18,6 +18,7 @@ #include "config/options.h" #include "document/css/apply.h" #include "document/document.h" +#include "document/view.h" #include "document/html/frames.h" #include "document/html/parser/general.h" #include "document/html/parser/link.h" @@ -349,14 +350,14 @@ imported: struct string code, ret; struct part *part = html_context->part; struct document *document = part->document; - struct view_state *vs = document->vs; - struct ecmascript_interpreter *interpreter = vs->ecmascript; + struct document_view *doc_view = document->doc_view; + struct view_state *vs = doc_view->vs; + struct ecmascript_interpreter *interpreter; - if (!interpreter) { + if (vs->ecmascript_fragile) ecmascript_reset_state(vs); - interpreter = vs->ecmascript; - } - if (!interpreter) return; + interpreter = vs->ecmascript; + assert(interpreter); if (!init_string(&code)) return; if (!init_string(&ret)) { diff --git a/src/document/renderer.c b/src/document/renderer.c index 379460325..708be1849 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -328,7 +328,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, if (document) { doc_view->document = document; #ifdef CONFIG_ECMASCRIPT - document->vs = vs; + document->doc_view = doc_view; #endif } else { document = init_document(cached, options); @@ -337,7 +337,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, shrink_memory(0); #ifdef CONFIG_ECMASCRIPT - document->vs = vs; + document->doc_view = doc_view; #endif render_encoded_document(cached, document); sort_links(document);